add texture

This commit is contained in:
2025-09-24 12:19:00 +02:00
parent c9e9dcf572
commit b235ef4d3a
10 changed files with 793 additions and 17 deletions
+22 -9
View File
@@ -131,18 +131,31 @@ UINT Mesh::createVertexBuffer(IDirect3DDevice9* pD3DDevice)
//pVertices[2] = Vertex(0.5f, -0.5f, 0.0f);
//pVertices[3] = Vertex(-0.5f, -0.5f, 0.0f);
// cube
//// cube with color
//// front
//pVertices[0] = Vertex(-0.5f, 0.5f, -0.5f, 255, 0, 0);
//pVertices[1] = Vertex(0.5f, 0.5f, -0.5f, 0, 255, 0);
//pVertices[2] = Vertex(0.5f, -0.5f, -0.5f, 0, 0, 255);
//pVertices[3] = Vertex(-0.5f, -0.5f, -0.5f, 255, 0, 255);
//// back
//pVertices[4] = Vertex(0.5f, 0.5f, 0.5f, 255, 255, 0);
//pVertices[5] = Vertex(-0.5f, 0.5f, 0.5f, 0, 255, 255);
//pVertices[6] = Vertex(-0.5f, -0.5f, 0.5f, 0, 0, 0);
//pVertices[7] = Vertex(0.5f, -0.5f, 0.5f, 200, 200, 200);
// cube with uv
// front
pVertices[0] = Vertex(-0.5f, 0.5f, -0.5f, 255, 0, 0);
pVertices[1] = Vertex(0.5f, 0.5f, -0.5f, 0, 255, 0);
pVertices[2] = Vertex(0.5f, -0.5f, -0.5f, 0, 0, 255);
pVertices[3] = Vertex(-0.5f, -0.5f, -0.5f, 255, 0, 255);
pVertices[0] = Vertex(-0.5f, 0.5f, -0.5f, 0.0f, 0.0f);
pVertices[1] = Vertex(0.5f, 0.5f, -0.5f, 1.0f, 0.0f);
pVertices[2] = Vertex(0.5f, -0.5f, -0.5f, 1.0f, 1.0f);
pVertices[3] = Vertex(-0.5f, -0.5f, -0.5f, 0.0f, 1.0f);
// back
pVertices[4] = Vertex(0.5f, 0.5f, 0.5f, 255, 255, 0);
pVertices[5] = Vertex(-0.5f, 0.5f, 0.5f, 0, 255, 255);
pVertices[6] = Vertex(-0.5f, -0.5f, 0.5f, 0, 0, 0);
pVertices[7] = Vertex(0.5f, -0.5f, 0.5f, 200, 200, 200);
pVertices[4] = Vertex(0.5f, 0.5f, 0.5f, 0.0f, 0.0f);
pVertices[5] = Vertex(-0.5f, 0.5f, 0.5f, 1.0f, 0.0f);
pVertices[6] = Vertex(-0.5f, -0.5f, 0.5f, 1.0f, 1.0f);
pVertices[7] = Vertex(0.5f, -0.5f, 0.5f, 0.0f, 1.0f);
hr = _pVertexBuffer->Unlock(); // transfer vertex buffer back from cpu memory to video memory
CheckFailed(hr, 320);