- Timestamp:
- 10/18/05 14:21:26 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Intersectable.h
r308 r339 8 8 class Intersectable { 9 9 public: 10 static int mailID; 11 int mailbox; 10 // last mail id -> warning not thread safe! 11 // both mailId and mailbox should be unique for each thread!!! 12 static int sMailId; 13 int mMailbox; 14 15 // unique object Id 16 int mId; 12 17 13 KdPvs mKdPvs; 18 // object based pvs 19 KdPvs mKdPvs; 14 20 15 21 enum { MESH_INSTANCE, TRANSFORMED_MESH_INSTANCE, SPHERE, VIEW_CELL }; 16 22 17 Intersectable():mailbox(0) {} 18 19 void Mail() { mailbox = mailID; } 20 static void NewMail() { mailID++; } 21 bool Mailed() const { return mailbox == mailID; } 22 int IncMail() { return ++mailbox - mailID; } 23 Intersectable():mMailbox(0) {} 24 25 void SetId(const int id) { mId = id; } 26 int GetId() { return mId; } 27 28 void Mail() { mMailbox = sMailId; } 29 static void NewMail() { sMailId++; } 30 bool Mailed() const { return mMailbox == sMailId; } 31 int IncMail() { return ++mMailbox - sMailId; } 23 32 24 33 virtual AxisAlignedBox3 GetBox() = 0; -
trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
r333 r339 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (1.07a) (Qt 3.3.2) on: Tue Sep 06 13:46:0020053 # Generated by qmake (1.07a) (Qt 3.3.2) on: Tue Oct 18 11:00:55 2005 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 13 13 LEX = flex 14 14 YACC = byacc 15 CFLAGS = -nologo -Zm200 -W0 -MD -O2 -GX -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG16 CXXFLAGS = -nologo -Zm200 -W0 -MD -O2 -GX -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG15 CFLAGS = -nologo -Zm200 -W0 -MDd -Zi -Gm -GX -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT 16 CXXFLAGS = -nologo -Zm200 -W0 -MDd -Zi -Gm -GX -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT 17 17 LEXFLAGS = 18 18 YACCFLAGS =-d 19 INCPATH = -I"..\src" -I"..\support\xerces\include" -I"..\support\zlib\include" -I"..\support\boost" -I"..\support\devil\include" -I"$(QTDIR)\include" -I"d:\gametools\svn\trunk\VUT\GtpVisibilityPreprocessor\src" -I"C:\Qt\3.3.2\mkspecs\win32-msvc "20 LINK = link21 LFLAGS = /NOLOGO delayimp.lib /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /SUBSYSTEM:console/LIBPATH:"../support/xerces/lib" /LIBPATH:"../support/devil/lib" /LIBPATH:"$(QTDIR)\lib"22 LIBS = "qt-mt332.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" " xerces-c_2.lib" "devil.lib" "ilu.lib" "ilut.lib" "opengl32.lib" "glu32.lib" "delayimp.lib"19 INCPATH = -I"..\src" -I"..\support\xerces\include" -I"..\support\zlib\include" -I"..\support\boost" -I"..\support\devil\include" -I"$(QTDIR)\include" -I"d:\gametools\svn\trunk\VUT\GtpVisibilityPreprocessor\src" -I"C:\Qt\3.3.2\mkspecs\win32-msvc.net" 20 LINK = "c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe" 21 LFLAGS = /NOLOGO /DEBUG /SUBSYSTEM:CONSOLE /LIBPATH:"../support/xerces/lib" /LIBPATH:"../support/devil/lib" /LIBPATH:"$(QTDIR)\lib" 22 LIBS = "qt-mt332.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" "delayimp.lib" "xerces-c_2.lib" "devil.lib" "ilu.lib" "ilut.lib" "opengl32.lib" "glu32.lib" 23 23 MOC = $(QTDIR)\bin\moc.exe 24 24 UIC = $(QTDIR)\bin\uic.exe … … 148 148 uicables: $(UICIMPLS) $(UICDECLS) 149 149 150 Makefile: preprocessor.pro C:\Qt\3.3.2\mkspecs\win32-msvc \qmake.conf C:\Qt\3.3.2\lib\qtmain.prl150 Makefile: preprocessor.pro C:\Qt\3.3.2\mkspecs\win32-msvc.net\qmake.conf C:\Qt\3.3.2\lib\qtmain.prl 151 151 $(QMAKE) -o Makefile preprocessor.pro 152 152 qmake: … … 188 188 -$(DEL_FILE) ViewCell.obj 189 189 -$(DEL_FILE) ViewCellBsp.obj 190 -$(DEL_FILE) preprocessor.pdb 191 -$(DEL_FILE) preprocessor.ilk 192 -$(DEL_FILE) vc*.pdb 193 -$(DEL_FILE) vc*.idb 194 190 195 191 196 … … 231 236 MutualVisibility.h \ 232 237 Polygon3.h \ 238 ViewCell.h \ 233 239 Containers.h \ 234 240 AxisAlignedBox3.h \ … … 255 261 KdTree.h \ 256 262 ViewCellBsp.h \ 263 ViewCell.h \ 257 264 Intersectable.h \ 258 265 Plane3.h \ … … 373 380 AxisAlignedBox3.h \ 374 381 Ray.h \ 375 Rectangle3.h \ 376 Matrix4x4.h \ 377 Vector3.h \ 378 Plane3.h \ 379 common.h \ 382 Polygon3.h \ 383 Rectangle3.h \ 384 Matrix4x4.h \ 385 Vector3.h \ 386 Plane3.h \ 387 common.h \ 388 Containers.h \ 389 Mesh.h \ 390 Intersectable.h \ 391 Material.h \ 392 Pvs.h \ 380 393 381 394 382 395 Ray.obj: Ray.cpp \ 383 396 Ray.h \ 397 Plane3.h \ 384 398 Matrix4x4.h \ 385 399 Vector3.h \ … … 396 410 Camera.h \ 397 411 MeshKdTree.h \ 412 Exporter.h \ 413 X3dExporter.h \ 414 ViewCell.h \ 415 SceneGraph.h \ 398 416 Preprocessor.h \ 399 417 Containers.h \ … … 433 451 X3dExporter.h \ 434 452 Exporter.h \ 453 Containers.h \ 435 454 Material.h \ 436 455 … … 459 478 Mesh.h \ 460 479 SceneGraph.h \ 480 Triangle3.h \ 481 ViewCell.h \ 461 482 Parser.h \ 462 Intersectable.h \ 463 Plane3.h \ 464 Matrix4x4.h \ 465 AxisAlignedBox3.h \ 466 Material.h \ 467 Pvs.h \ 468 Rectangle3.h \ 469 Vector3.h \ 470 common.h \ 471 Containers.h \ 483 Containers.h \ 484 Intersectable.h \ 485 Plane3.h \ 486 Matrix4x4.h \ 487 AxisAlignedBox3.h \ 488 Material.h \ 489 Pvs.h \ 490 Rectangle3.h \ 491 Vector3.h \ 492 common.h \ 493 Ray.h \ 472 494 473 495 … … 535 557 Polygon3.h \ 536 558 Mesh.h \ 537 Containers.h \ 538 Intersectable.h \ 539 Plane3.h \ 540 Matrix4x4.h \ 541 AxisAlignedBox3.h \ 559 ViewCellBsp.h \ 560 AxisAlignedBox3.h \ 561 Ray.h \ 562 Containers.h \ 563 Intersectable.h \ 564 Plane3.h \ 565 Matrix4x4.h \ 542 566 Material.h \ 543 567 Pvs.h \ … … 550 574 ViewCell.h \ 551 575 Mesh.h \ 576 Intersectable.h \ 552 577 MeshKdTree.h \ 553 578 Triangle3.h \ 554 Intersectable.h \ 555 Containers.h \ 556 AxisAlignedBox3.h \ 557 Pvs.h \ 558 Rectangle3.h \ 559 Matrix4x4.h \ 560 Vector3.h \ 561 Plane3.h \ 562 common.h \ 563 Material.h \ 564 Ray.h \ 579 Containers.h \ 580 Ray.h \ 581 Plane3.h \ 582 Matrix4x4.h \ 583 AxisAlignedBox3.h \ 584 Material.h \ 585 Pvs.h \ 586 Rectangle3.h \ 587 Vector3.h \ 588 common.h \ 565 589 566 590 … … 575 599 Ray.h \ 576 600 AxisAlignedBox3.h \ 601 Exporter.h \ 577 602 Vector3.h \ 578 603 Containers.h \ -
trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp
r333 r339 4 4 #include "Triangle3.h" 5 5 6 int MeshInstance::mailID= 21843194198;6 int Intersectable::sMailId = 21843194198; 7 7 8 8 void -
trunk/VUT/GtpVisibilityPreprocessor/src/Parser.h
r261 r339 13 13 public: 14 14 Parser() {} 15 virtual bool ParseFile(const string filename, SceneGraphNode **root) = 0; 15 16 virtual bool ParseFile(const string filename, SceneGraphNode **root) = 0; 17 16 18 }; 17 19 -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r331 r339 13 13 { 14 14 } 15 15 16 16 17 Preprocessor::~Preprocessor() … … 44 45 } 45 46 46 bool Preprocessor::ParseViewCellsOptions() 47 bool 48 Preprocessor::ParseViewCellsOptions() 47 49 { 48 50 // parse type of view cells … … 114 116 115 117 bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); 116 118 119 120 117 121 delete parser; 118 122 123 if (result) 124 mSceneGraph->AssignObjectIds(); 125 119 126 return result; 120 127 } … … 152 159 bool 153 160 Preprocessor::Export( const string filename, 154 155 156 157 161 const bool scene, 162 const bool kdtree, 163 const bool bsptree 164 ) 158 165 { 159 166 Exporter *exporter = Exporter::GetExporter(filename); 160 167 161 168 if (exporter) { 162 169 if (scene) -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r335 r339 27 27 void 28 28 SamplingPreprocessor::SetupRay(Ray &ray, 29 30 31 29 const Vector3 &point, 30 const Vector3 &direction, 31 const int type) 32 32 { 33 33 ray.intersections.clear(); … … 148 148 149 149 int 150 SamplingPreprocessor::CastRay(Intersectable *object, Ray &ray) 150 SamplingPreprocessor::CastRay(Intersectable *object, 151 Ray &ray) 151 152 { 152 153 int sampleContributions = 0; 153 154 155 long t1 = GetTime(); 154 156 // cast ray to KD tree to find intersection with other objects 155 157 mKdTree->CastRay(ray); 156 158 long t2 = GetTime(); 159 160 cout<<object->GetId()<<" "<<TimeDiff(t1, t2); 161 157 162 if (mViewCellsType == BSP_VIEW_CELLS) 158 {159 // cast ray to BSP tree to get intersection with view cells160 if (mBspTree)161 163 { 162 mBspTree->CastRay(ray); 163 164 sampleContributions += AddObjectSamples(object, ray); 164 // cast ray to BSP tree to get intersection with view cells 165 if (mBspTree) 166 { 167 mBspTree->CastRay(ray); 168 169 sampleContributions += AddObjectSamples(object, ray); 165 170 166 if (!ray.intersections.empty()) // second intersection found 167 { 168 sampleContributions += 169 AddObjectSamples(ray.intersections[0].mObject, ray); 170 } 171 if (!ray.intersections.empty()) // second intersection found 172 { 173 sampleContributions += 174 AddObjectSamples(ray.intersections[0].mObject, ray); 175 } 176 } 171 177 } 172 }173 178 else 174 {175 if (ray.leaves.size()) {176 sampleContributions += AddNodeSamples(object, ray);177 178 if (ray.intersections.size()) {179 sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray);180 }181 }182 }179 { 180 if (ray.leaves.size()) { 181 sampleContributions += AddNodeSamples(object, ray); 182 183 if (ray.intersections.size()) { 184 sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray); 185 } 186 } 187 } 183 188 184 189 return sampleContributions; -
trunk/VUT/GtpVisibilityPreprocessor/src/SceneGraph.cpp
r260 r339 4 4 #include "SceneGraph.h" 5 5 #include "X3dExporter.h" 6 #include "Intersectable.h" 6 7 7 8 … … 50 51 return number; 51 52 } 53 54 55 int 56 SceneGraph::AssignObjectIds() 57 { 58 int id = 1; 59 stack<SceneGraphNode *> nodeStack; 60 61 nodeStack.push(mRoot); 62 63 while (!nodeStack.empty()) { 64 SceneGraphNode *node = nodeStack.top(); 65 nodeStack.pop(); 66 67 ObjectContainer::const_iterator mi = node->mGeometry.begin(); 68 for (; mi != node->mGeometry.end(); mi++) 69 (*mi)->SetId(id++); 70 71 SceneGraphNodeContainer::iterator ni = node->mChildren.begin(); 72 for (; ni != node->mChildren.end(); ni++) { 73 nodeStack.push(*ni); 74 } 75 } 76 // return max id 77 return id; 78 } -
trunk/VUT/GtpVisibilityPreprocessor/src/SceneGraph.h
r176 r339 27 27 28 28 int CollectObjects(ObjectContainer *instances); 29 29 30 int 31 AssignObjectIds(); 32 30 33 protected: 31 34 }; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r338 r339 1101 1101 // needed for balanced view cells criterium 1102 1102 ViewCell::NewMail(); 1103 int backId = ViewCell:: mailID;1103 int backId = ViewCell::sMailId; 1104 1104 ViewCell::NewMail(); 1105 int frontId = ViewCell:: mailID;1105 int frontId = ViewCell::sMailId; 1106 1106 ViewCell::NewMail(); 1107 int frontAndBackId = ViewCell:: mailID;1107 int frontAndBackId = ViewCell::sMailId; 1108 1108 1109 1109 PolygonContainer::const_iterator it, it_end = polys.end(); … … 1145 1145 if (classification == Plane3::FRONT_SIDE) 1146 1146 { 1147 if ((viewCell->m ailbox != frontId) &&1148 (viewCell->m ailbox != frontAndBackId))1147 if ((viewCell->mMailbox != frontId) && 1148 (viewCell->mMailbox != frontAndBackId)) 1149 1149 { 1150 1150 sumBalancedViewCells += 1.0; 1151 1151 1152 if (viewCell->m ailbox != backId)1153 viewCell->m ailbox = frontId;1152 if (viewCell->mMailbox != backId) 1153 viewCell->mMailbox = frontId; 1154 1154 else 1155 viewCell->m ailbox = frontAndBackId;1155 viewCell->mMailbox = frontAndBackId; 1156 1156 1157 1157 ++ totalViewCells; … … 1160 1160 else if (classification == Plane3::BACK_SIDE) 1161 1161 { 1162 if ((viewCell->m ailbox != backId) &&1163 (viewCell->m ailbox != frontAndBackId))1162 if ((viewCell->mMailbox != backId) && 1163 (viewCell->mMailbox != frontAndBackId)) 1164 1164 { 1165 1165 sumBalancedViewCells -= 1.0; 1166 1166 1167 if (viewCell->m ailbox != frontId)1168 viewCell->m ailbox = backId;1167 if (viewCell->mMailbox != frontId) 1168 viewCell->mMailbox = backId; 1169 1169 else 1170 viewCell->m ailbox = frontAndBackId;1170 viewCell->mMailbox = frontAndBackId; 1171 1171 1172 1172 ++ totalViewCells; -
trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro
r333 r339 13 13 14 14 # debuc config 15 CONFIG += console warn_off thread release15 CONFIG += console warn_off thread debug 16 16 17 17 # RELEASE CONFIG
Note: See TracChangeset
for help on using the changeset viewer.