RenderablePicoSurface.h

Go to the documentation of this file.
00001 #ifndef RENDERABLEPICOSURFACE_H_
00002 #define RENDERABLEPICOSURFACE_H_
00003 
00004 #include "picomodel.h"
00005 #include "irender.h"
00006 #include "render.h"
00007 #include <string>
00008 #include "math/aabb.h"
00009 
00010 /* FORWARD DECLS */
00011 
00012 namespace model
00013 {
00014     /* Renderable class containing a series of polygons textured with the same
00015      * material. RenderablePicoSurface objects are composited into a RenderablePicoModel
00016      * object to create a renderable static mesh.
00017      */
00018     class RenderablePicoSurface: public OpenGLRenderable
00019     {
00020             // Name of the material this surface is using, both originally and after a skin
00021             // remap.
00022             std::string _originalShaderName;
00023             std::string _mappedShaderName;
00024 
00025             // Shader object containing the material shader for this surface
00026             Shader* _shader;
00027 
00028             // Vector of ArbitraryMeshVertex structures, containing the coordinates,
00029             // normals, tangents and texture coordinates of the component vertices
00030             std::vector<ArbitraryMeshVertex> _vertices;
00031 
00032             // Vector of render indices, representing the groups of vertices to be
00033             // used to create triangles
00034             std::vector<unsigned int> _indices;
00035 
00036             // Keep track of the number of indices to iterate over, since vector::size()
00037             // may not be fast
00038             unsigned int _nIndices;
00039 
00040             // The AABB containing this surface, in local object space.
00041             AABB _localAABB;
00042 
00043         public:
00047             RenderablePicoSurface (picoSurface_t* surf);
00048 
00051             RenderablePicoSurface (RenderablePicoSurface const& other);
00052 
00056             ~RenderablePicoSurface ();
00057 
00060             void render (RenderStateFlags flags) const;
00061 
00064             int getVertexCount () const
00065             {
00066                 return _vertices.size();
00067             }
00068 
00071             int getPolyCount () const
00072             {
00073                 return _indices.size() / 3; // 3 indices per triangle
00074             }
00075 
00078             Shader* getShader () const
00079             {
00080                 return _shader;
00081             }
00082 
00085             const AABB& localAABB () const
00086             {
00087                 return _localAABB;
00088             }
00089 
00097             void applySkin (const std::string& skin);
00098     };
00099 }
00100 
00101 #endif /*RENDERABLEPICOSURFACE_H_*/

Generated by  doxygen 1.6.2