00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef TEDDY__MODELS__GEOMETRY__H
00026 #define TEDDY__MODELS__GEOMETRY__H
00027
00028
00029 #if defined( TEDDY_INCLUDE_COLDET )
00030 # include "Teddy/ColDet/ColDet.h"
00031 #endif
00032 #include "Teddy/Maths/Vector.h"
00033 #include "Teddy/SysSupport/StdList.h"
00034 #if 0
00035 # include "Teddy/Bsp/CSG_BooleanOps.h"
00036 #endif
00037
00038
00039
00040 namespace Teddy {
00041 namespace Maths { class Matrix; };
00042 namespace PhysicalComponents { class Projection; };
00043 };
00044 using namespace Teddy::Maths;
00045 using namespace Teddy::PhysicalComponents;
00046
00047
00048 namespace Teddy {
00049 namespace Models {
00050
00051
00052 class Element;
00053 class Vertex;
00054
00055
00056 #define TEXTURE_AXIS_X 0
00057 #define TEXTURE_AXIS_Y 1
00058 #define TEXTURE_AXIS_Z 2
00059
00060
00062 class Geometry {
00063 public:
00064 Geometry();
00065 virtual ~Geometry();
00066
00067 void insert ( Element *e );
00068 virtual void beginElements ( Projection *p );
00069 virtual void drawElements ( Projection *p );
00070 virtual void endElements ( Projection *p );
00071 virtual void transformVertices( const Matrix &m, const Matrix &normal_matrix, const bool reverse );
00072 void clearTraversal ();
00073
00074
00075 double getMaxVector ();
00076 void smooth ( float max_smoothing_angle );
00077 void makePlanarTextureCoordinates ( Vector center, Vector size, int axis );
00078 void makeCylindricalTextureCoordinates( Vector center, Vector size, int axis );
00079 void makeSphericalTextureCoordinates ( Vector center, Vector size, int axis );
00080 void makeCubicTextureCoordinates ( Vector center, Vector size );
00081 void setTextureCoordinate ( Element *e, list<Vertex*>::iterator v_it, float u, float v );
00082
00083 #if defined( TEDDY_INCLUDE_COLDET )
00084 int addToCollisionModel ( Teddy::ColDet::CollisionModel3D *collision_model );
00085 #endif
00086
00087 public:
00088 list<Element*> elements;
00089
00090
00091 public:
00092 void draw ( Projection *p );
00093 void beginUpdate( Projection *p );
00094 void endUpdate ( Projection *p );
00095
00096 protected:
00097 unsigned int gl_list_id;
00098 bool dirty;
00099
00100 public:
00101 static int draw_count;
00102 };
00103
00104
00105 };
00106 };
00107
00108
00109 #endif // TEDDY__MODELS__GEOMETRY__H
00110