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

refined the cube with customized png

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