- Timestamp:
- 09/08/05 18:45:51 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/data/atlanta/atlanta_viewcells_large.x3d
r257 r261 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd"> 3 <X3D profile="Full"> 4 <head> 5 <meta name="filename" content="atlanta_viewcells_large.x3d"/> 6 <meta name="description" content="*enter description here, short-sentence summaries preferred*"/> 7 <meta name="author" content="*enter name of original author here*"/> 8 <meta name="translator" content="*if manually translating VRML-to-X3D, enter name of person translating here*"/> 9 <meta name="created" content="*enter date of initial version here*"/> 10 <meta name="translated" content="06 September 2005"/> 11 <meta name="revised" content="06 September 2005"/> 12 <meta name="version" content="*enter version here*"/> 13 <meta name="reference" content="*enter reference citation or relative/online url here*"/> 14 <meta name="reference" content="*enter additional url/bibliographic reference information here*"/> 15 <meta name="copyright" content="*enter copyright information here* Example: Copyright (c) Web3D Consortium Inc. 2002"/> 16 <meta name="drawing" content="*enter drawing filename/url here*"/> 17 <meta name="image" content="*enter image filename/url here*"/> 18 <meta name="movie" content="*enter movie filename/url here*"/> 19 <meta name="photo" content="*enter photo filename/url here*"/> 20 <meta name="keywords" content="*enter keywords here*"/> 21 <meta name="url" content="*enter online url address for this file here*"/> 22 <meta name="generator" content="Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html"/> 23 </head> 24 <Scene> 25 <Shape > 26 <IndexedFaceSet coordIndex=" 0 1 2 -1 3 4 5 -1 6 7 8 -1 9 10 11 -1 12 13 14 -1 15 16 17 -1 18 19 20 -1 21 22 23 -1 24 25 26 -1 27 28 29 -1"> 27 <Coordinate point="3588.0 0.0 -2541.0, 3568.0 0.0 -2541.0, 3588.0 0.0 -2561.0, 3558.0 0.0 -2540.0, 3578.0 0.0 -2540.0, 3558.0 0.0 -2560.0, 3552.0 0.0 -2921.0, 3572.0 0.0 -2921.0, 3552.0 0.0 -2941.0, 3484.0 0.0 -3315.0, 3504.0 0.0 -3315.0, 3484.0 0.0 -3335.0, 3175.0 0.0 -3323.0, 3195.0 0.0 -3323.0, 3175.0 0.0 -3343.0, 4034.0 0.0 -3655.0, 4054.0 0.0 -3655.0, 4034.0 0.0 -3675.0, 3407.0 0.0 -4380.0, 3427.0 0.0 -4380.0, 3407.0 0.0 -4400.0, 3005.0 0.0 -4968.0, 3025.0 0.0 -4968.0, 3005.0 0.0 -4988.0, 5143.0 0.0 -4990.0, 5163.0 0.0 -4990.0, 5143.0 0.0 -5010.0, 5355.0 0.0 -4195.0, 5375.0 0.0 -4195.0, 5355.0 0.0 -4205.0, "/> 28 </IndexedFaceSet> 29 </Shape> 30 </Scene> 31 32 </X3D> 2 <X3D> 3 <Scene> 4 <Shape> 5 <Appearance> 6 <Material diffuseColor="0.500626 0.781793 0.596652" specularColor="0.0 0.0 0.0"/> 7 </Appearance> 8 <IndexedFaceSet ccw="TRUE" coordIndex=" 9 0 1 2 -1 10 5 4 3 -1 11 0 3 4 1 -1 12 1 4 5 2 -1 13 0 2 5 3 -1 14 " > 15 <Coordinate point=" 16 3588 0 -2541, 17 3568 0 -2541, 18 3588 0 -2561, 19 3568 -10 -2541, 20 3568 -10 -2541, 21 3568 -10 -2541, 22 " > 23 </Coordinate> 24 </IndexedFaceSet> 25 </Shape> 26 <Shape> 27 <Appearance> 28 <Material diffuseColor="0.90437 0.792505 0.739937" specularColor="0.0 0.0 0.0"/> 29 </Appearance> 30 <IndexedFaceSet ccw="TRUE" coordIndex=" 31 0 1 2 -1 32 5 4 3 -1 33 0 3 4 1 -1 34 1 4 5 2 -1 35 0 2 5 3 -1 36 " > 37 <Coordinate point=" 38 3558 0 -2540, 39 3578 0 -2540, 40 3558 0 -2560, 41 3578 10 -2540, 42 3578 10 -2540, 43 3578 10 -2540, 44 " > 45 </Coordinate> 46 </IndexedFaceSet> 47 </Shape> 48 <Shape> 49 <Appearance> 50 <Material diffuseColor="0.675146 0.947981 0.91142" specularColor="0.0 0.0 0.0"/> 51 </Appearance> 52 <IndexedFaceSet ccw="TRUE" coordIndex=" 53 0 1 2 -1 54 5 4 3 -1 55 0 3 4 1 -1 56 1 4 5 2 -1 57 0 2 5 3 -1 58 " > 59 <Coordinate point=" 60 3552 0 -2921, 61 3572 0 -2921, 62 3552 0 -2941, 63 3572 10 -2921, 64 3572 10 -2921, 65 3572 10 -2921, 66 " > 67 </Coordinate> 68 </IndexedFaceSet> 69 </Shape> 70 <Shape> 71 <Appearance> 72 <Material diffuseColor="0.873302 0.587054 0.929472" specularColor="0.0 0.0 0.0"/> 73 </Appearance> 74 <IndexedFaceSet ccw="TRUE" coordIndex=" 75 0 1 2 -1 76 5 4 3 -1 77 0 3 4 1 -1 78 1 4 5 2 -1 79 0 2 5 3 -1 80 " > 81 <Coordinate point=" 82 3484 0 -3315, 83 3504 0 -3315, 84 3484 0 -3335, 85 3504 10 -3315, 86 3504 10 -3315, 87 3504 10 -3315, 88 " > 89 </Coordinate> 90 </IndexedFaceSet> 91 </Shape> 92 <Shape> 93 <Appearance> 94 <Material diffuseColor="0.855251 0.756767 0.651997" specularColor="0.0 0.0 0.0"/> 95 </Appearance> 96 <IndexedFaceSet ccw="TRUE" coordIndex=" 97 0 1 2 -1 98 5 4 3 -1 99 0 3 4 1 -1 100 1 4 5 2 -1 101 0 2 5 3 -1 102 " > 103 <Coordinate point=" 104 3175 0 -3323, 105 3195 0 -3323, 106 3175 0 -3343, 107 3195 10 -3323, 108 3195 10 -3323, 109 3195 10 -3323, 110 " > 111 </Coordinate> 112 </IndexedFaceSet> 113 </Shape> 114 <Shape> 115 <Appearance> 116 <Material diffuseColor="0.507492 0.545701 0.682226" specularColor="0.0 0.0 0.0"/> 117 </Appearance> 118 <IndexedFaceSet ccw="TRUE" coordIndex=" 119 0 1 2 -1 120 5 4 3 -1 121 0 3 4 1 -1 122 1 4 5 2 -1 123 0 2 5 3 -1 124 " > 125 <Coordinate point=" 126 4034 0 -3655, 127 4054 0 -3655, 128 4034 0 -3675, 129 4054 10 -3655, 130 4054 10 -3655, 131 4054 10 -3655, 132 " > 133 </Coordinate> 134 </IndexedFaceSet> 135 </Shape> 136 <Shape> 137 <Appearance> 138 <Material diffuseColor="0.573656 0.582949 0.994263" specularColor="0.0 0.0 0.0"/> 139 </Appearance> 140 <IndexedFaceSet ccw="TRUE" coordIndex=" 141 0 1 2 -1 142 5 4 3 -1 143 0 3 4 1 -1 144 1 4 5 2 -1 145 0 2 5 3 -1 146 " > 147 <Coordinate point=" 148 3407 0 -4380, 149 3427 0 -4380, 150 3407 0 -4400, 151 3427 10 -4380, 152 3427 10 -4380, 153 3427 10 -4380, 154 " > 155 </Coordinate> 156 </IndexedFaceSet> 157 </Shape> 158 <Shape> 159 <Appearance> 160 <Material diffuseColor="0.722846 0.559542 0.502335" specularColor="0.0 0.0 0.0"/> 161 </Appearance> 162 <IndexedFaceSet ccw="TRUE" coordIndex=" 163 0 1 2 -1 164 5 4 3 -1 165 0 3 4 1 -1 166 1 4 5 2 -1 167 0 2 5 3 -1 168 " > 169 <Coordinate point=" 170 3005 0 -4968, 171 3025 0 -4968, 172 3005 0 -4988, 173 3025 10 -4968, 174 3025 10 -4968, 175 3025 10 -4968, 176 " > 177 </Coordinate> 178 </IndexedFaceSet> 179 </Shape> 180 <Shape> 181 <Appearance> 182 <Material diffuseColor="0.504456 0.68894 0.765831" specularColor="0.0 0.0 0.0"/> 183 </Appearance> 184 <IndexedFaceSet ccw="TRUE" coordIndex=" 185 0 1 2 -1 186 5 4 3 -1 187 0 3 4 1 -1 188 1 4 5 2 -1 189 0 2 5 3 -1 190 " > 191 <Coordinate point=" 192 5143 0 -4990, 193 5163 0 -4990, 194 5143 0 -5010, 195 5163 10 -4990, 196 5163 10 -4990, 197 5163 10 -4990, 198 " > 199 </Coordinate> 200 </IndexedFaceSet> 201 </Shape> 202 <Shape> 203 <Appearance> 204 <Material diffuseColor="0.785592 0.800882 0.803583" specularColor="0.0 0.0 0.0"/> 205 </Appearance> 206 <IndexedFaceSet ccw="TRUE" coordIndex=" 207 0 1 2 -1 208 5 4 3 -1 209 0 3 4 1 -1 210 1 4 5 2 -1 211 0 2 5 3 -1 212 " > 213 <Coordinate point=" 214 5355 0 -4195, 215 5375 0 -4195, 216 5355 0 -4205, 217 5375 10 -4195, 218 5375 10 -4195, 219 5375 10 -4195, 220 " > 221 </Coordinate> 222 </IndexedFaceSet> 223 </Shape> -
trunk/VUT/GtpVisibilityPreprocessor/include/Preprocessor.h
r221 r261 34 34 @return true on success 35 35 */ 36 virtual bool LoadView cells(const string filename);36 virtual bool LoadViewCells(const string filename); 37 37 38 38 /** Generate the viewCells automatically. The particular algorithm to be used depends … … 42 42 @return true on successful viewcell generation. 43 43 */ 44 virtual bool GenerateView cells();44 virtual bool GenerateViewCells(); 45 45 46 46 /** Export all preprocessed data in a XML format understandable by the -
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r260 r261 11 11 # filename ../data/soda/soda.dat 12 12 # filename ../data/soda/soda5.dat 13 viewcells ../data/at alanta/atlanta_viewcells_large.x3d13 viewcells ../data/atlanta/atlanta_viewcells_large.x3d 14 14 } 15 15 … … 66 66 # constructionMethod sceneGeometry 67 67 maxCandidates 20 68 maxViewCells 1068 maxViewCells 999 69 69 Termination { 70 70 maxPolygons 4 -
trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h
r242 r261 7 7 8 8 #include "Material.h" 9 #include "Containers.h" 9 10 10 11 class KdTree; … … 53 54 54 55 56 virtual void 57 ExportViewCells(ViewCellContainer *viewCells) = 0; 58 55 59 virtual void 56 60 ExportIntersectable(Intersectable *object) = 0; -
trunk/VUT/GtpVisibilityPreprocessor/src/Parser.h
r162 r261 14 14 Parser() {} 15 15 virtual bool ParseFile(const string filename, SceneGraphNode **root) = 0; 16 17 16 }; 18 17 -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r260 r261 2 2 #include "Mesh.h" 3 3 4 #define SIDE_TOLERANCE 0.002 // TODO: Test different values4 #define SIDE_TOLERANCE 0.002f // TODO: Test different values 5 5 6 6 Polygon3::Polygon3(): mMaterial(NULL) -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r260 r261 7 7 #include "Environment.h" 8 8 9 10 bool 11 Preprocessor::LoadViewcells(const string filename) 9 10 Preprocessor::~Preprocessor() 12 11 { 13 14 return true; 12 // delete view cells 13 while (!mViewCells.empty()) 14 { 15 DEL_PTR(mViewCells.back()); 16 mViewCells.pop_back(); 17 } 18 19 // delete psp tree 20 DEL_PTR(mBspTree); 15 21 } 16 22 17 23 bool 18 Preprocessor::GenerateViewcells() 24 Preprocessor::LoadViewCells(const string filename) 25 { 26 X3dParser *parser = new X3dParser; 27 28 delete parser; 29 30 bool result = parser->ParseFile(filename, mViewCells); 31 32 if (result) 33 { 34 Exporter *exporter = Exporter::GetExporter(filename); 35 36 if (exporter) 37 exporter->ExportViewCells(&mViewCells); 38 39 GenerateViewCells(); 40 } 41 return result; 42 } 43 44 bool 45 Preprocessor::GenerateViewCells() 19 46 { 20 47 return BuildBspTree(); … … 38 65 bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); 39 66 67 delete parser; 68 40 69 return result; 41 70 } … … 90 119 { 91 120 case BspTree::VIEWCELLS: 92 93 mViewcells.clear();121 // derive view cells from the scene objects 122 //ViewCell::DeriveViewCells(objects, mViewCells, maxViewCells); 94 123 95 // derive viewcells from the scene objects 96 ViewCell::DeriveViewCells(objects, mViewcells, maxViewCells); 97 98 mBspTree->Construct(mViewcells); 124 mBspTree->Construct(mViewCells); 99 125 break; 100 126 case BspTree::SCENE_GEOMETRY: 101 mBspTree->Construct(objects); 127 CLEAR_CONTAINER(mViewCells); 128 mBspTree->Construct(objects, &mViewCells); 129 break; 130 case BspTree::RAYS: 131 CLEAR_CONTAINER(mViewCells); 132 mBspTree->Construct(objects, &mViewCells); 102 133 break; 103 134 default: -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
r242 r261 25 25 class Preprocessor { 26 26 public: 27 ~Preprocessor(); 28 27 29 /** Load the input scene. 28 30 @param filename file to load … … 37 39 @return true on success 38 40 */ 39 virtual bool LoadView cells(const string filename);41 virtual bool LoadViewCells(const string filename); 40 42 41 43 /** Generate the viewCells automatically. The particular algorithm to be used depends … … 45 47 @return true on successful viewcell generation. 46 48 */ 47 virtual bool GenerateView cells();49 virtual bool GenerateViewCells(); 48 50 49 51 /** Export all preprocessed data in a XML format understandable by the … … 96 98 ObjectContainer mOccludees; 97 99 /// list of all loaded/generated viewcells 98 ViewCellContainer mView cells;100 ViewCellContainer mViewCells; 99 101 100 102 BspTree * mBspTree; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r260 r261 7 7 ViewCell::ViewCell(Mesh *mesh): mMesh(mesh), mPvs(NULL) 8 8 { 9 } 10 11 ViewCell::~ViewCell() 12 { 13 // NOTE: should I really do this here? 14 DEL_PTR(mMesh); 9 15 } 10 16 … … 77 83 } 78 84 79 ViewCell *ViewCell:: Convert2ViewCell(Face *face, float scale)85 ViewCell *ViewCell::ExtrudeViewCell(const Triangle3 &baseTri, const float height) 80 86 { 81 // TODO: delete mesh87 // one mesh per view cell 82 88 Mesh *mesh = new Mesh(); 83 mesh->mFaces.push_back(face);84 89 90 //-- construct prism 85 91 92 // bottom 93 mesh->mFaces.push_back(new Face(0,1,2)); 94 // top 95 mesh->mFaces.push_back(new Face(5,4,3)); 96 // sides 97 mesh->mFaces.push_back(new Face(0, 3, 4, 1)); 98 mesh->mFaces.push_back(new Face(1, 4, 5, 2)); 99 mesh->mFaces.push_back(new Face(0, 2, 5, 3)); 100 101 102 //--- extrude new vertices for top of prism 103 Vector3 triNorm = baseTri.GetNormal(); 104 105 Triangle3 topTri; 106 107 // add base vertices and calculate top vertices 108 for (int i = 0; i < 3; ++i) 109 { 110 mesh->mVertices.push_back(baseTri.mVertices[i]); 111 topTri.mVertices[i] = baseTri.mVertices[i] + height * triNorm; 112 } 113 114 // add top vertices 115 for (int i = 0; i < 3; ++i) 116 mesh->mVertices.push_back(topTri.mVertices[1]); 117 86 118 return new ViewCell(mesh); 87 119 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
r260 r261 11 11 class BspInterior; 12 12 class BspPvs; 13 struct Triangle3; 13 14 /** 14 15 View cell represented as a mesh … … 52 53 const int maxViewCells); 53 54 54 static ViewCell *Convert2ViewCell(Face *face); 55 /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. 56 @param the base triangle 57 @param the height of the newly created view cell 58 */ 59 static ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height); 60 55 61 protected: 56 62 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r260 r261 463 463 464 464 465 ViewCellContainer *BspTree::Construct(const ObjectContainer &objects)465 void BspTree::Construct(const ObjectContainer &objects, ViewCellContainer *viewCells) 466 466 { 467 467 #ifdef _DEBUG … … 479 479 Construct(polys); 480 480 481 return NULL;// TODO482 } 483 484 ViewCellContainer *BspTree::Construct(const RayContainer &rays)481 // TODO: generate view cells 482 } 483 484 void BspTree::Construct(const RayContainer &rays, ViewCellContainer *viewCells) 485 485 { 486 486 // TODO 487 return NULL;488 487 } 489 488 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r260 r261 262 262 @returns list of view cells. 263 263 */ 264 ViewCellContainer *Construct(const ObjectContainer &objects);264 void Construct(const ObjectContainer &objects, ViewCellContainer *viewCells); 265 265 266 266 /** Constructs tree using the given number of rays … … 268 268 @returns list of view cells. 269 269 */ 270 ViewCellContainer *Construct(const RayContainer &rays);270 void Construct(const RayContainer &rays, ViewCellContainer *viewCells); 271 271 272 272 int CollectLeafPvs(); -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r260 r261 120 120 } 121 121 122 void X3dExporter::ExportViewCells(ViewCellContainer *viewCells) 123 { 124 ViewCellContainer::iterator it, it_end = viewCells->end(); 125 126 for (it = viewCells->begin(); it != it_end; ++it) 127 ExportViewCell(*it); 128 } 122 129 void 123 X3dExporter::ExportViewCell(ViewCell * object)124 { 125 if ( object->GetMesh())126 ExportMesh( object->GetMesh());130 X3dExporter::ExportViewCell(ViewCell *viewCell) 131 { 132 if (viewCell->GetMesh()) 133 ExportMesh(viewCell->GetMesh()); 127 134 } 128 135 -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h
r260 r261 9 9 10 10 #include "Exporter.h" 11 #include "Containers.h" 11 12 12 13 class SceneGraphNode; … … 64 65 ExportViewCell(ViewCell *viewCell); 65 66 67 virtual void 68 ExportViewCells(ViewCellContainer *viewCells); 69 66 70 protected: 67 71 virtual void -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dParser.cpp
r260 r261 27 27 #include "Mesh.h" 28 28 #include "SceneGraph.h" 29 #include "Triangle3.h" 30 #include "ViewCell.h" 29 31 30 32 // --------------------------------------------------------------------------- … … 376 378 377 379 /*********************************************************** 378 * class X3dViewCellsParse rimplemenation *380 * class X3dViewCellsParseHandlers implemenation * 379 381 ***********************************************************/ 380 382 … … 383 385 // StdInParseHandlers: Constructors and Destructor 384 386 // --------------------------------------------------------------------------- 385 X3dViewCellsParse r::X3dViewCellsParser(ViewCellContainer *viewCells) :387 X3dViewCellsParseHandlers::X3dViewCellsParseHandlers(ViewCellContainer *viewCells) : 386 388 mElementCount(0) 387 389 , mAttrCount(0) … … 392 394 } 393 395 394 X3dViewCellsParse r::~X3dViewCellsParser()396 X3dViewCellsParseHandlers::~X3dViewCellsParseHandlers() 395 397 { 396 398 } … … 400 402 // StdInParseHandlers: Implementation of the SAX DocumentHandler interface 401 403 // --------------------------------------------------------------------------- 402 void X3dViewCellsParse r::endElement(const XMLCh* const name)404 void X3dViewCellsParseHandlers::endElement(const XMLCh* const name) 403 405 { 404 406 StrX lname(name); … … 409 411 410 412 void 411 X3dViewCellsParse r::EndShape()412 { 413 } 414 415 void 416 X3dViewCellsParse r::StartIndexedFaceSet(413 X3dViewCellsParseHandlers::EndShape() 414 { 415 } 416 417 void 418 X3dViewCellsParseHandlers::StartIndexedFaceSet( 417 419 AttributeList& attributes) 418 420 { 419 421 int len = attributes.getLength(); 420 422 int i; 421 VertexIndexContainer vertices; 422 423 423 424 for (i=0; i < len; i++) 424 425 { … … 430 431 431 432 // handle coordIndex 432 vertices.clear();433 433 const char *ptr = attrValue.LocalForm(); 434 434 char *endptr; 435 435 436 while (1)436 while (1) 437 437 { 438 438 int index = strtol(ptr, &endptr, 10); 439 439 440 if (ptr == endptr || index == -1) 440 if (ptr == endptr) 441 break; 442 443 if (index != -1) 441 444 { 442 if (vertices.size() > 2) 443 { 444 // the base of all view cells is a triangle. 445 Face *face = new Face(vertices); 446 447 mViewCells->push_back(ViewCell::Convert2ViewCell(face)); 448 } 449 vertices.clear(); 450 451 if (ptr == endptr) 452 break; 453 } 454 else 455 { 456 vertices.push_back(index); 445 mCurrentVertexIndices.push_back(index); 457 446 } 458 447 … … 465 454 466 455 void 467 X3dViewCellsParse r::StartCoordinate(456 X3dViewCellsParseHandlers::StartCoordinate( 468 457 AttributeList& attributes) 469 458 { … … 511 500 vertices.push_back(v); 512 501 } 513 mCurrentMesh->mVertices = vertices;514 502 } 515 503 } 516 } 517 518 519 void 520 X3dViewCellsParser::startElement(const XMLCh* const name, 504 505 506 507 for (int i = 0; i < mCurrentVertexIndices.size(); i+=3) 508 { 509 Triangle3 baseTri(vertices[mCurrentVertexIndices[i]], 510 vertices[mCurrentVertexIndices[i+1]], 511 vertices[mCurrentVertexIndices[i+2]]); 512 513 // create view cell from base triangle 514 const float height = 10; 515 mViewCells->push_back(ViewCell::ExtrudeViewCell(baseTri, height)); 516 } 517 } 518 519 520 void 521 X3dViewCellsParseHandlers::startElement(const XMLCh* const name, 521 522 AttributeList& attributes) 522 523 { … … 525 526 526 527 if (element == "IndexedFaceSet") { 527 // create a new mesh node in the scene graph528 // create the viewcells from individual triangles 528 529 StartIndexedFaceSet(attributes); 529 530 } 530 531 if (element == "Shape") { 532 cout<<"+"; 533 mCurrentMesh = new Mesh; 534 } 531 532 // do nothing 533 //if (element == "Shape") {} 535 534 536 535 if (element == "Coordinate") { 537 if (mCurrentMesh) 536 // add coordinates to the triangles 538 537 StartCoordinate(attributes); 539 538 } 540 541 if (element == "Material") { 542 StartMaterial(attributes); 543 } 539 // ignore material 540 //if (element == "Material") {} 544 541 545 542 mElementCount++; … … 548 545 549 546 void 550 X3dViewCellsParse r::characters(const XMLCh* const chars,547 X3dViewCellsParseHandlers::characters(const XMLCh* const chars, 551 548 const unsigned int length) 552 549 { … … 555 552 556 553 void 557 X3dViewCellsParse r::ignorableWhitespace(const XMLCh* const chars,554 X3dViewCellsParseHandlers::ignorableWhitespace(const XMLCh* const chars, 558 555 const unsigned int length) 559 556 { … … 562 559 563 560 void 564 X3dViewCellsParse r::resetDocument()561 X3dViewCellsParseHandlers::resetDocument() 565 562 { 566 563 mAttrCount = 0; … … 576 573 // --------------------------------------------------------------------------- 577 574 void 578 X3dViewCellsParse r::error(const SAXParseException& e)575 X3dViewCellsParseHandlers::error(const SAXParseException& e) 579 576 { 580 577 XERCES_STD_QUALIFIER cerr << "\nError at (file " << StrX(e.getSystemId()) … … 585 582 586 583 void 587 X3dViewCellsParse r::fatalError(const SAXParseException& e)584 X3dViewCellsParseHandlers::fatalError(const SAXParseException& e) 588 585 { 589 586 XERCES_STD_QUALIFIER cerr << "\nFatal Error at (file " << StrX(e.getSystemId()) … … 594 591 595 592 void 596 X3dViewCellsParse r::warning(const SAXParseException& e)593 X3dViewCellsParseHandlers::warning(const SAXParseException& e) 597 594 { 598 595 XERCES_STD_QUALIFIER cerr << "\nWarning at (file " << StrX(e.getSystemId()) … … 604 601 605 602 bool 606 X3dParser::ParseFile(const string filename, 607 SceneGraphNode **root) 603 X3dParser::ParseFile(const string filename, ViewCellContainer &viewCells) 608 604 { 609 605 // Initialize the XML4C system … … 637 633 // to do. 638 634 // 639 *root = new SceneGraphNode; 640 X3dViewCellsParser handler(*root); 635 X3dViewCellsParseHandlers handler(&viewCells); 641 636 parser->setDocumentHandler(&handler); 642 637 parser->setErrorHandler(&handler); -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dParser.h
r260 r261 3 3 4 4 #include "Parser.h" 5 #include "ViewCells.h" 5 #include "Containers.h" 6 7 class ViewCell; 6 8 7 9 class X3dParser : public Parser … … 11 13 12 14 bool ParseFile(const string filename, SceneGraphNode **root); 13 bool Parse ViewCells(const string filename, ViewCellContainer *viewCells);15 bool ParseFile(const string filename, ViewCellContainer &viewCells); 14 16 }; 15 17 -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dParserXerces.h
r260 r261 6 6 // --------------------------------------------------------------------------- 7 7 #include <xercesc/sax/HandlerBase.hpp> 8 #include "Mesh.h" 8 9 9 10 XERCES_CPP_NAMESPACE_USE … … 113 114 // Constructors and Destructor 114 115 // ----------------------------------------------------------------------- 115 X3dViewCellsParseHandlers(ViewCellContainer *mViewCells ;);116 X3dViewCellsParseHandlers(ViewCellContainer *mViewCells); 116 117 ~X3dViewCellsParseHandlers(); 117 118 … … 151 152 152 153 ViewCellContainer *mViewCells; 153 154 VertexIndexContainer mCurrentVertexIndices; 155 154 156 // Handlers for X3D 155 157 void -
trunk/VUT/GtpVisibilityPreprocessor/src/common.h
r235 r261 131 131 #endif 132 132 133 #ifndef CLEAR_CONTAINER 134 #define CLEAR_CONTAINER(co) while (!co.empty()) {delete co.back(); co.pop_back();} 135 #endif 136 133 137 inline 134 138 int signum(const Real a, const Real thresh = TRASH) -
trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
r260 r261 35 35 environment->GetStringValue("Scene.viewcells", buff); 36 36 37 p->GenerateViewcells(); 37 string viewCellsFile(buff); 38 p->LoadViewCells(viewCellsFile); 39 38 40 p->BspTreeStatistics(Debug); 39 41 #endif … … 45 47 } 46 48 47 // p->LoadViewcells("viewcells.wrl");49 48 50 if (1) { 49 51 p->ComputeVisibility(); … … 64 66 } 65 67 66 68 // clean up 69 DEL_PTR(p); 70 DEL_PTR(environment); 71 67 72 return 0; 68 73 }
Note: See TracChangeset
for help on using the changeset viewer.