Commit 61f3e9ba authored by chili's avatar chili
Browse files

vertex struct organization

parent 301baa20
...@@ -103,22 +103,29 @@ void Graphics::DrawTestTriangle() ...@@ -103,22 +103,29 @@ void Graphics::DrawTestTriangle()
HRESULT hr; HRESULT hr;
struct Vertex struct Vertex
{
struct
{ {
float x; float x;
float y; float y;
} pos;
struct
{
unsigned char r; unsigned char r;
unsigned char g; unsigned char g;
unsigned char b; unsigned char b;
unsigned char a; unsigned char a;
} color;
}; };
// create vertex buffer (1 2d triangle at center of screen) // create vertex buffer (1 2d triangle at center of screen)
const Vertex vertices[] = Vertex vertices[] =
{ {
{ 0.0f,0.5f,255,0,0,0 }, { 0.0f,0.5f,255,0,0,0 },
{ 0.5f,-0.5f,0,255,0,0 }, { 0.5f,-0.5f,0,255,0,0 },
{ -0.5f,-0.5f,0,0,255,0 }, { -0.5f,-0.5f,0,0,255,0 },
}; };
vertices[0].color.g = 255;
wrl::ComPtr<ID3D11Buffer> pVertexBuffer; wrl::ComPtr<ID3D11Buffer> pVertexBuffer;
D3D11_BUFFER_DESC bd = {}; D3D11_BUFFER_DESC bd = {};
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment