AnimaL |
Tutorial |
Documentation |
00001 00002 #ifndef _CG_RENDERING_MACHINE_H 00003 #define _CG_RENDERING_MACHINE_H 00004 00005 #include "octree_instanciation.h" 00006 #include "ConstrainedVertex.h" 00007 00008 #include <map> 00009 #include <vector> 00010 00011 namespace animal 00012 { 00013 namespace octree 00014 { 00015 class CGRenderingMachine; 00016 00017 typedef struct 00018 { 00019 // Have a unique ID for each octree vertex 00020 std::map< ConstrainedVertex*, unsigned int> verticesIDs; 00021 00022 // Get the ID of the cells for each meshPoint it belongs to 00023 std::vector< unsigned int > meshPointsCell; 00024 00025 // Remember the associated SFVec3fCellConstrained for each meshPoint 00026 std::vector<SFVec3fCellConstrained*> meshPointsSFVCC; 00027 00028 // Now for each cell, get the 8 vertices' corresponding vertex id 00029 std::vector< std::vector<unsigned int> > cellsVertexIDs; 00030 // The associated float array 00031 float *cellsVertexIDsArray; 00032 00033 } CGData; 00034 00035 } 00036 } 00037 00038 #include "Octree.h" 00039 #include "SFVec3fCellConstrained.h" 00040 #include <X3DTK/private/X3D_IndexedFaceSet.h> 00041 00042 namespace animal 00043 { 00044 namespace octree 00045 { 00046 00047 class CGRenderingMachine 00048 { 00049 public: 00050 CGRenderingMachine( Octree *octree, X3DTK::X3D::IndexedFaceSet *ifs ); 00051 00052 void initializeCg( int method ); 00053 bool cgIsInitialized() const; 00054 00058 void structureUpdated( int method ); 00059 00063 void render( int method ); 00064 00065 00066 private: 00067 Octree *_octree; 00068 X3DTK::X3D::IndexedFaceSet *_ifs; 00069 00070 bool _cgInitiliazed; 00071 00072 CGData _cgData; 00073 00074 00075 00076 void drawMethodLinear(); 00077 00082 CGData& computeCGData( int method ); 00083 00087 void loadCGParameters( int method ) const; 00088 00089 }; 00090 00091 } 00092 } 00093 00094 #endif