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

vertex struct organization

parent 301baa20
...@@ -104,21 +104,28 @@ void Graphics::DrawTestTriangle() ...@@ -104,21 +104,28 @@ void Graphics::DrawTestTriangle()
struct Vertex struct Vertex
{ {
float x; struct
float y; {
unsigned char r; float x;
unsigned char g; float y;
unsigned char b; } pos;
unsigned char a; struct
{
unsigned char r;
unsigned char g;
unsigned char b;
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