Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Plus symbols added to increase readability.
- // This defines the position of each vertex.
- float vertexPosDat[8][3]=
- {
- {-3.5, +3.5, +3.5}, //left,top,front
- {+3.5, +3.5, +3.5}, //right,top,front
- {+3.5, +3.5, -3.5}, //right,top,back
- {-3.5, +3.5, -3.5}, //left, top,back
- {-3.5, -3.5, +3.5}, //left,bottom,front
- {+3.5, -3.5, +3.5}, //right,bottom,front
- {+3.5, -3.5, -3.5}, //right,bottom,back
- {-3.5, -3.5, -3.5} //left,bottom,back
- };
- // This defines the colour of each vertex.
- float vertexColDat[8][4]=
- {
- {0.5, 0.0, 0.0, 1.0}, //dark red
- {0.3, 0.3, 0.6, 1.0}, //dark blue
- {1.0, 0.0, 0.0, 1.0}, //red
- {0.3, 0.3, 0.6, 1.0}, //dark blue
- {0.3, 0.3, 0.6, 1.0}, //dark blue
- {0.5, 0.0, 0.0, 1.0}, //dark red
- {0.3, 0.3, 0.6, 1.0}, //dark blue
- {1.0, 0.0, 0.0, 1.0}, //red
- };
- // This defines the vertexes of each quad in anti-clockwise order.
- unsigned int quadVerDat[6][4]=
- {
- {0,1,2,3}, //top
- {0,3,7,4}, //left
- {3,2,6,7}, //back
- {2,1,5,6}, //right
- {0,4,5,1}, //front
- {4,7,6,5}, //bottom
- };
- int a,b;
- // Put the vertex data into the cube.ver[] struct.
- for (a=0;a<8;++a)
- {
- for (b=0;b<3;++b)
- {
- cube.ver[a].pos[b]=vertexPosDat[a][b];
- cube.ver[a].col[b]=vertexColDat[a][b];
- }
- }
- // Put the quad data into the cube.quad[] struct.
- for (a=0;a<6;++a)
- {
- for (b=0;b<4;++b)
- {
- cube.quad[a].ver[b]=quadVerDat[a][b];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement