Commit 07816a76 authored by Administrator's avatar Administrator
Browse files

refined the cube with customized png

parent 3d3d5e78
...@@ -66,14 +66,75 @@ struct Vertex ...@@ -66,14 +66,75 @@ struct Vertex
// create vertex buffer (8 vertices for one cube) // create vertex buffer (8 vertices for one cube)
const Vertex vertices[] = const Vertex vertices[] =
{ {
// back surface
// left bottom back // left bottom back
{ -1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f }, { -1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f },
// right bottom back // right bottom back
{ 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f }, { 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 0.0f },
// left top back // left top back
{ -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f }, { -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f },
// right top back // right top back
{ 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f },
// left surface
// left bottom front
{ -1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f },
// left bottom back
{ -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 0.0f },
// left top front
{ -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f },
// left top back
{ -1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f },
// right surface
// right bottom back
{ 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f },
// right bottom front
{ 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f },
// right top back
{ 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f },
// right top front
{ 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
// top surface
// left top back
{ -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 1.0f },
// right top back
{ 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f }, { 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 0.0f },
// left top front
{ -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f },
// right top front
{ 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
// back surface
// right bottom front
{ 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f },
// left bottom front
{ -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f },
// right top front
{ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f },
// left top front
{ -1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f },
// bottom surface
// left bottom front
{ -1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f },
// right bottom front
{ 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f },
// left bottom back
{ -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f },
// right bottom back
{ 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f },
// right bottom back
{ 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 0.0f },
// left top back
{ -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f },
// right top back
{ 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f },
// left bottom front // left bottom front
{ -1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 1.0f }, { -1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 1.0f },
...@@ -95,16 +156,16 @@ const unsigned short indices[] = ...@@ -95,16 +156,16 @@ const unsigned short indices[] =
{ {
// back surface // back surface
0, 2, 1, 2, 3, 1, 0, 2, 1, 2, 3, 1,
// left surface
4, 6, 5, 6, 7, 5,
// right surface // right surface
1, 3, 5, 3, 7, 5, 8, 10, 9, 10, 11, 9,
// top surface // top surface
2, 6, 3, 3, 6, 7, 12, 14, 13, 14, 15, 13,
// front surface // back surface
4, 5, 7, 4, 7, 6, 16, 18, 17, 18, 19, 17,
// left surface
0, 4, 2, 2, 4, 6,
// bottom surface // bottom surface
0, 1, 4, 1, 5, 4, 20, 22, 21, 22, 23, 21,
}; };
/************************************ /************************************
...@@ -993,7 +1054,7 @@ int WINAPI WinMain(HINSTANCE hInstance, ...@@ -993,7 +1054,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
InitD3D(hWnd); InitD3D(hWnd);
// test texture load // test texture load
std::string imageFile = "oasis.ico"; std::string imageFile = "Ethan.png";
std::wstring wsImageFile = std::wstring(imageFile.begin(), imageFile.end()); std::wstring wsImageFile = std::wstring(imageFile.begin(), imageFile.end());
BYTE* imageData; BYTE* imageData;
int bytesPerRow = 8; int bytesPerRow = 8;
......
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