00001 //============================================================================= 00016 #ifndef __MODEL_H_INCLUDED__ 00017 #define __MODEL_H_INCLUDED__ 00018 00019 #include <QtCore/QString> 00020 #include "vector.h" 00021 00022 // forward declarations 00023 class VertexAttribLocations; 00024 00025 00026 //============================================================================= 00027 // IModel - stores geometry for rendering. 00028 //============================================================================= 00029 00037 class IModel 00038 { 00039 public: 00040 // factory 00041 static IModel* createPoint( void ); // a single point located in the origin. 00042 static IModel* createPlane( void ); 00043 static IModel* createCube ( void ); 00044 static IModel* createSphere( int numRings, int numSegments, float radius ); 00045 static IModel* createTorus ( int numRings, int numSegments, float radius1, float radius2 ); 00046 virtual ~IModel( void ) {} 00047 00049 virtual QString getName( void ) = 0; 00050 00064 virtual void render( const VertexAttribLocations * attribs = NULL, 00065 const vec4_t * overrideColor = NULL ) = 0; 00066 00074 virtual void renderNormals( void ) = 0; 00075 00082 virtual void renderTangents( void ) = 0; 00083 00088 virtual int getPrimitiveType( void ) = 0; 00089 00094 virtual QString getPrimitiveTypeName( void ) = 0; 00095 00099 virtual float getBoundingRadius( void ) = 0; 00100 00106 virtual void getBoundingBox( vec3_t & mins, vec3_t & maxs ) = 0; 00107 00113 static QString primitiveTypeName( int primitiveType ); 00114 }; 00115 00116 00117 //============================================================================= 00118 // IMeshModel 00119 //============================================================================= 00120 00134 class IMeshModel : public IModel 00135 { 00136 public: 00137 static IMeshModel* createMeshModel( void ); 00138 00145 virtual bool loadObjModel( const QString & fileName ) = 0; 00146 }; 00147 00148 00149 #endif // __MODEL_H_INCLUDED__ 00150