00001 #pragma once
00002 #include "Model3D.h"
00003
00004 #include <string>
00005
00006 #ifdef __APPLE__
00007 #include <OpenGL/gl.h>
00008 #else
00009 #ifdef _WIN32
00010 #include <windows.h>
00011 #endif
00012 #include <GL/gl.h>
00013 #endif
00014
00015 using namespace std;
00016
00019 class OpenGLModel :
00020 public Model3D
00021 {
00022 public:
00036 OpenGLModel(const char* strPath, bool bTexturesEnabledByDefault = true, bool bColorMaterialEnabledByDefault = true, bool bIgnoreTexturePath = false, char* strTextureBasePath = 0);
00037 virtual ~OpenGLModel(void);
00038
00041 GLint generateDisplayList();
00042
00043 protected:
00044 virtual void preProcess();
00045 virtual void applyTransformation(float* fMatrix4Data);
00046 virtual void unApplyLastTransformation();
00047 virtual void processMesh(const struct aiMaterial *pMtl, const struct aiFace* pFaces, unsigned int nNumFaces, aiVector3D* aVertices, aiColor4D* aColorsByVertexIndex, aiVector3D* aNormalsByVertexIndex, aiVector3D* aTextureCoordsByVertexIndex);
00048 virtual void postProcess();
00049 virtual void applyMaterial(const struct aiMaterial *mtl);
00050
00051 protected:
00052 bool bTexturesEnabledByDefault;
00053 bool bTexturesEnabled;
00054 bool bColorMaterialEnabledByDefault;
00055 bool bColorMaterialEnabled;
00056 bool bIgnoreTexturePath;
00057 GLuint nActualTexture;
00058 float cDif[4];
00059 float cAmb[4];
00060 float cSpe[4];
00061 float cEmi[4];
00062 float oldShi;
00063 float oldColor[4];
00064 string strTextureBasePath;
00065 float fScaleFactor;
00066 Vector3 oCenterVector;
00067
00068 };