Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Cubemap.cpp

Go to the documentation of this file.
00001 
00007 #include "Cubemap.h"
00008 
00009 Cubemap::Cubemap(float size) {
00010         m_pBoxVertices = NULL;
00011 
00027         short indices[] = {
00028                 3, 7, 6,
00029                 2, 3, 6,
00030                 5, 1, 0,
00031                 4, 5, 0,
00032                 0, 2, 6,
00033                 4, 0, 6,
00034                 4, 6, 7,
00035                 5, 4, 7,
00036                 5, 7, 3,
00037                 1, 5, 3,
00038                 1, 3, 2,
00039                 0, 1, 2
00040         };
00041 
00042         float vertices[] = {
00043                 -1, 1, 1,
00044                  1, 1, 1,
00045                 -1,-1, 1,
00046                  1,-1, 1,
00047                 -1, 1,-1,
00048                  1, 1,-1,
00049                 -1,-1,-1,
00050                  1,-1,-1
00051         };
00052 
00053         m_pBoxVertices = (float *)malloc(sizeof(float)*24);
00054         memcpy(m_pBoxVertices, vertices, sizeof(float)*24);
00055 
00056         m_pBoxIndices = (short *)malloc(sizeof(short)*36);
00057         memcpy(m_pBoxIndices, indices, sizeof(short)*36);
00058 
00059 
00060         addFormat(ATT_VERTEX, ATT_FLOAT, 3, 0);
00061         addFormat(ATT_TEX, ATT_FLOAT, 3, 0);
00062 
00063         setPrimitive(PRIM_TRIANGLES);
00064         setVertices(m_pBoxVertices, 24, sizeof(float)*3);
00065         setIndices(m_pBoxIndices, 36, sizeof(short)*3);
00066 
00067 
00068         LOG_SUCCESS(("Object cubemap loaded"));
00069 }
00070 
00071 Cubemap::~Cubemap() {
00072         m_pBoxVertices = NULL;          // deletion handled by Object.cpp
00073 }

Generated on Sun Jun 5 15:47:03 2005 for Defacto by  doxygen 1.4.3