00001 #ifndef RENDERABLEPICOMODEL_H_ 00002 #define RENDERABLEPICOMODEL_H_ 00003 00004 #include <string> 00005 #include <vector> 00006 #include "RenderablePicoSurface.h" 00007 #include "imodel.h" 00008 #include "picomodel.h" 00009 #include "math/aabb.h" 00010 #include "igl.h" 00011 00012 namespace model 00013 { 00014 /* Renderable class containing a model loaded via the picomodel library. A 00015 * RenderablePicoModel is made up of one or more RenderablePicoSurface objects, 00016 * each of which contains a number of polygons with the same texture. Rendering 00017 * a RenderablePicoModel involves rendering all of its surfaces, each of which 00018 * binds its texture(s) and submits its geometry via OpenGL calls. 00019 */ 00020 class RenderablePicoModel: public IModel 00021 { 00022 // Vector of renderable surfaces for this model 00023 typedef std::vector<RenderablePicoSurface> SurfaceList; 00024 SurfaceList _surfVec; 00025 00026 // Local AABB for this model 00027 AABB _localAABB; 00028 00029 // The list of skins that are available for this model 00030 ModelSkinList modelSkinList; 00031 00032 std::string polyCountStr; 00033 std::string surfaceCountStr; 00034 std::string vertexCountStr; 00035 00038 int getSurfaceCountInt () const 00039 { 00040 return _surfVec.size(); 00041 } 00042 00046 int getVertexCountInt () const 00047 { 00048 int sum = 0; 00049 for (SurfaceList::const_iterator i = _surfVec.begin(); i != _surfVec.end(); ++i) { 00050 sum += i->getVertexCount(); 00051 } 00052 return sum; 00053 } 00054 00058 int getPolyCountInt () const 00059 { 00060 int sum = 0; 00061 for (SurfaceList::const_iterator i = _surfVec.begin(); i != _surfVec.end(); ++i) { 00062 sum += i->getPolyCount(); 00063 } 00064 return sum; 00065 } 00066 00067 public: 00068 00072 RenderablePicoModel (picoModel_t* mod); 00073 00076 void render (RenderStateFlags flags) const; 00077 00080 const AABB& localAABB () const 00081 { 00082 return _localAABB; 00083 } 00084 00087 const std::string& getSurfaceCount () const 00088 { 00089 return surfaceCountStr; 00090 } 00091 00095 const std::string& getVertexCount () const 00096 { 00097 return vertexCountStr; 00098 } 00099 00103 const std::string& getPolyCount () const 00104 { 00105 return polyCountStr; 00106 } 00107 00115 const ModelSkinList& getSkinsForModel () const; 00116 00119 void applySkin (const std::string& skin); 00120 }; 00121 } 00122 00123 #endif /*RENDERABLEPICOMODEL_H_*/