Add texture loading
Add uv mapping
This commit is contained in:
+12
-6
@@ -39,8 +39,8 @@ void Mesh::update(FLOAT dt)
|
||||
if (GetAsyncKeyState(VK_RIGHT) & 0x8000) x += move;
|
||||
if (GetAsyncKeyState(VK_DOWN) & 0x8000) y -= move;
|
||||
if (GetAsyncKeyState(VK_UP) & 0x8000) y += move;
|
||||
if (GetAsyncKeyState(VK_SUBTRACT) & 0x8000) z -= move;
|
||||
if (GetAsyncKeyState(VK_ADD) & 0x8000) z += move;
|
||||
if ((GetAsyncKeyState(VK_SUBTRACT) & 0x8000) || (GetAsyncKeyState('Q') & 0x8000)) z -= move;
|
||||
if ((GetAsyncKeyState(VK_ADD) & 0x8000) || (GetAsyncKeyState('E') & 0x8000)) z += move;
|
||||
|
||||
XMMATRIX translation = XMMatrixTranslation(x, y, z);
|
||||
XMMATRIX rotation = XMMatrixRotationRollPitchYaw(0.0f, 0.0f, rotZ);
|
||||
@@ -114,10 +114,16 @@ UINT Mesh::createVertexBuffer(IDirect3DDevice9* pD3DDevice)
|
||||
//pVertices[3] = Vertex(-0.5f, -0.5f, 0.0f);
|
||||
|
||||
// quad with colors
|
||||
pVertices[0] = Vertex(-0.5f, 0.5f, 0.0f, 255, 0, 0);
|
||||
pVertices[1] = Vertex(0.5f, 0.5f, 0.0f, 0, 255, 0);
|
||||
pVertices[2] = Vertex(0.5f, -0.5f, 0.0f, 0, 0, 255);
|
||||
pVertices[3] = Vertex(-0.5f, -0.5f, 0.0f, 255, 255, 0);
|
||||
//pVertices[0] = Vertex(-0.5f, 0.5f, 0.0f, 255, 0, 0);
|
||||
//pVertices[1] = Vertex(0.5f, 0.5f, 0.0f, 0, 255, 0);
|
||||
//pVertices[2] = Vertex(0.5f, -0.5f, 0.0f, 0, 0, 255);
|
||||
//pVertices[3] = Vertex(-0.5f, -0.5f, 0.0f, 255, 255, 0);
|
||||
|
||||
// quad with uvs
|
||||
pVertices[0] = Vertex(-0.5f, 0.5f, 0.0f, 0.0f, 0.0f);
|
||||
pVertices[1] = Vertex(0.5f, 0.5f, 0.0f, 1.0f, 0.0f);
|
||||
pVertices[2] = Vertex(0.5f, -0.5f, 0.0f, 1.0f, 1.0f);
|
||||
pVertices[3] = Vertex(-0.5f, -0.5f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
hr = _pVertexBuffer->Unlock();
|
||||
CheckFailed(hr, 320);
|
||||
|
||||
Reference in New Issue
Block a user