Changeset 3258 for GTP/trunk/App
- Timestamp:
- 01/08/09 01:10:53 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter.vcproj
r3235 r3258 18 18 <Configuration 19 19 Name="Debug|Win32" 20 OutputDirectory="$(SolutionDir) $(ConfigurationName)"21 IntermediateDirectory="$(ConfigurationName) "20 OutputDirectory="$(SolutionDir)\$(ProjectName)\$(ConfigurationName)" 21 IntermediateDirectory="$(ConfigurationName)\$(ProjectName)" 22 22 ConfigurationType="1" 23 23 CharacterSet="1" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r3243 r3258 335 335 </File> 336 336 <File 337 RelativePath=".\src\PvsCollectionRenderer.h" 338 > 339 </File> 340 <File 337 341 RelativePath=".\src\RenderTraverser.h" 338 342 > … … 411 415 /> 412 416 </FileConfiguration> 417 </File> 418 <File 419 RelativePath=".\src\PvsCollectionRenderer.cpp" 420 > 413 421 </File> 414 422 <File -
GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
r3246 r3258 66 66 LinkIncremental="2" 67 67 AdditionalLibraryDirectories=""lib/$(ConfigurationName)";libs;"$(CG_LIB_PATH)";libs/GL;libs/Devil/lib;libs/Zlib/lib" 68 IgnoreDefaultLibraryNames="LIBCMT" 68 69 GenerateDebugInformation="true" 69 70 SubSystem="1" 71 LargeAddressAware="2" 70 72 TargetMachine="1" 71 73 /> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter.vcproj
r3248 r3258 42 42 AdditionalOptions=" /D "_CRT_SECURE_NO_WARNINGS"" 43 43 Optimization="0" 44 AdditionalIncludeDirectories="libs\Zlib\include "44 AdditionalIncludeDirectories="libs\Zlib\include; src" 45 45 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" 46 46 MinimalRebuild="true" … … 63 63 <Tool 64 64 Name="VCLinkerTool" 65 AdditionalDependencies="zlib.lib "65 AdditionalDependencies="zlib.lib DemoEngine.lib" 66 66 LinkIncremental="2" 67 AdditionalLibraryDirectories="libs\Zlib\lib "67 AdditionalLibraryDirectories="libs\Zlib\lib; lib\$(ConfigurationName)" 68 68 IgnoreDefaultLibraryNames="libCMT" 69 69 GenerateDebugInformation="true" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3257 r3258 115 115 ## powerplant options 116 116 117 filename=PowerPlantM117 #filename=PowerPlantM 118 118 119 keyForwardMotion=500.0f120 mouseMotion=3.0f121 visibilitySolution=power-plant-2c-xx-1000b-pgv2122 camPosition=-1320.57 -6306.34 3603123 camDirection=0.292156 0.9556 0.0383878124 viewCellsScaleFactor=0.05f119 #keyForwardMotion=500.0f 120 #mouseMotion=3.0f 121 #visibilitySolution=power-plant-2c-xx-1000b-pgv2 122 #camPosition=-1320.57 -6306.34 3603 123 #camDirection=0.292156 0.9556 0.0383878 124 #viewCellsScaleFactor=0.05f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp
r3251 r3258 119 119 mDistanceQueue.pop(); 120 120 121 if (1 && !IsNode Visible(node, 10))121 if (1 && !IsNodeGeometryVisible(node, 10)) 122 122 { 123 123 node->SetVisible(false); … … 261 261 newPBatch = 0; 262 262 else 263 newPBatch *= mVisibilityPredictor.GetProbability(node);263 newPBatch *= mVisibilityPredictor.GetProbability(node); 264 264 265 265 if (query->GetNodes().empty()) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp
r3251 r3258 1 1 #include "FrustumCullingTraverser.h" 2 #include "SceneEntity.h"3 2 4 3 … … 18 17 mDistanceQueue.pop(); 19 18 20 if (1 && !IsNode Visible(node, 10))19 if (1 && !IsNodeGeometryVisible(node, 10)) 21 20 { 22 21 node->SetVisible(false); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/OcclusionQuery.h
r2782 r3258 24 24 25 25 virtual ~OcclusionQuery(); 26 26 /** Returns true if the query result is available. 27 */ 27 28 bool ResultAvailable() const; 28 29 /** Returns number of visible pixels. 30 */ 29 31 unsigned int GetQueryResult() const; 30 32 /** Starts the query. Everything drawn inbetween start and end is 33 queried. 34 */ 31 35 void BeginQuery() const; 32 36 /** Ends the query. 37 */ 33 38 void EndQuery() const; 34 39 /** Returns id of this query. 40 */ 35 41 unsigned int GetQueryId() const; 36 42 /** Returns the first node of the multiquery 37 43 */ 38 44 inline BvhNode *GetFrontNode() const { return mNodes[0]; } 45 /** Returns nodes by reference 46 */ 39 47 inline const BvhNodeContainer &GetNodes() const { return mNodes; } 40 41 48 /** Reset the list of nodes associated with this query. 42 49 */ … … 47 54 /** Returns the size of the multiquery. 48 55 */ 49 inline int GetSize() const { return (int)mNodes.size();} 50 56 inline int GetSize() const { return (int)mNodes.size(); } 57 58 inline bool IsEmpty() const { return GetSize() == 0; } 59 51 60 52 61 protected: 53 62 /** Constructor taking an already allocated query id. 63 */ 54 64 OcclusionQuery(unsigned int id): mQueryId(id) { } 55 65 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
r3251 r3258 5 5 #include "RenderState.h" 6 6 #include "Geometry.h" 7 #include "RenderQueue.h" 7 8 #include "Timer/PerfTimer.h" 8 9 … … 292 293 293 294 294 bool RenderTraverser::IsNode Visible(BvhNode *node, int maxSize)295 bool RenderTraverser::IsNodeGeometryVisible(BvhNode *node, int maxSize) 295 296 { 296 297 // no invisible objects … … 300 301 SceneEntity **entities = mBvh->GetGeometry(node, geometrySize); 301 302 302 if ( geometrySize > maxSize) return true;303 if ((maxSize != -1) && (geometrySize > maxSize)) return true; 303 304 304 305 for (int i = 0; i < geometrySize; ++ i) … … 311 312 312 313 313 } 314 void RenderTraverser::SetCamera(Camera *cam) 315 { 316 mCamera = cam; 317 } 318 319 320 void RenderTraverser::SetRenderQueue(RenderQueue *rq) 321 { 322 mRenderQueue = rq; 323 } 324 325 326 const TraversalStatistics &RenderTraverser::GetStats() const 327 { 328 return mStats; 329 } 330 331 332 const SceneEntityContainer &RenderTraverser::GetVisibleObjects() const 333 { 334 return mVisibleObjects; 335 } 336 337 338 float RenderTraverser::GetMaxVisibleDistance() const 339 { 340 return mMaxVisibleDistance; 341 } 342 343 344 Camera *RenderTraverser::GetCamera() const 345 { 346 return mCamera; 347 } 348 349 350 351 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h
r3251 r3258 2 2 #define __RENDERTRAVERSER_H 3 3 4 #include <queue> 4 5 5 #include "Bvh.h" 6 6 #include "OcclusionQuery.h" 7 #include "Camera.h" 8 #include "RenderQueue.h" 9 #include "Timer/PerfTimer.h" 10 7 //#include "Timer/PerfTimer.h" 8 #include <queue> 11 9 12 10 … … 14 12 { 15 13 14 16 15 class Camera; 17 class Matrix4x4; 18 16 class RenderQueue; 19 17 20 18 … … 53 51 54 52 /// types of traversers 55 enum {CULL_FRUSTUM, STOP_AND_WAIT, CHC, CHCPLUSPLUS, NUM_TRAVERSAL_TYPES}; 53 enum {CULL_FRUSTUM, 54 STOP_AND_WAIT, 55 CHC, CHCPLUSPLUS, 56 CULL_COLLECTOR, 57 NUM_TRAVERSAL_TYPES}; 56 58 57 59 /** Default constructor. 58 60 */ 59 61 RenderTraverser(); 60 /** Virtual constructor, has to be redefined in subclasses 62 /** Virtual constructor, has to be redefined in subclasses. 61 63 */ 62 64 virtual ~RenderTraverser(); 63 /** Abstract method that traverses and renders the scene65 /** Maim method that traverses and renders the scene. 64 66 */ 65 67 void RenderScene(); … … 78 80 /** Sets the camera. 79 81 */ 80 void SetCamera(Camera *cam) { mCamera = cam;}82 void SetCamera(Camera *cam); 81 83 /** Sets the render queue. 82 84 */ 83 void SetRenderQueue(RenderQueue *rq) {mRenderQueue =rq;}84 /** Sets the current render state 85 void SetRenderQueue(RenderQueue *rq); 86 /** Sets the current render state. 85 87 */ 86 88 void SetRenderState(RenderState *state); 87 89 /** The traversal statistics 88 90 */ 89 const TraversalStatistics &GetStats() const { return mStats; }91 const TraversalStatistics &GetStats() const; 90 92 /** The current frame id 91 93 */ 92 in t GetCurrentFrameId() const { return mFrameId; }94 inline int GetCurrentFrameId() const; 93 95 96 97 94 98 ////////////////// 95 //-- options for the differentrendering algorithms99 //-- methods that concern one or more of the implemented rendering algorithms 96 100 97 101 /** If a render queue should be used to batch up and sort scene entities before … … 107 111 void SetVisibilityThreshold(int threshold); 108 112 113 109 114 /////////////////// 110 115 //-- CHC / CHC ++ related options 116 //-- note: could be implemented more cleanly in a CoherentOcclusionCullingTraverser parent class! 111 117 112 118 /** CHC optimization to query the geometry itself instead of the bounding box. … … 131 137 (only if StoreVisibleObjects is set) 132 138 */ 133 const SceneEntityContainer &GetVisibleObjects() const { return mVisibleObjects; }139 const SceneEntityContainer &GetVisibleObjects() const; 134 140 /** Returns the current camera. 135 141 */ 136 Camera *GetCamera() const { return mCamera; }142 Camera *GetCamera() const; 137 143 /** Returns the maximal visible distance encountered in the scene. 138 144 Useful for e.g., shadow map focussing 139 145 */ 140 float GetMaxVisibleDistance() const { return mMaxVisibleDistance; }141 /** Render also dynamic objects.146 float GetMaxVisibleDistance() const; 147 /** Render objects declared as dynamic (non-static) 142 148 */ 143 149 void SetRenderDynamicObjects(bool dynamic); … … 168 174 */ 169 175 void ApplyRenderQueue(); 170 171 bool IsNodeVisible(BvhNode *node, int maxSize); 176 /** Returns true if at least one of the objects in this node are 177 marked as visible. maxSize describes the maximum sized node 178 (in # of objects) that is tested. if maxSize is -1, all nodes are tested. 179 */ 180 bool IsNodeGeometryVisible(BvhNode *node, int maxSize); 172 181 173 182 … … 189 198 /// the statisitcs 190 199 TraversalStatistics mStats; 191 200 /// the render queue 192 201 RenderQueue *mRenderQueue; 193 194 202 /// the objects found visible in current frame 195 203 SceneEntityContainer mVisibleObjects; … … 197 205 float mMaxVisibleDistance; 198 206 207 199 208 ///////////////// 200 209 //-- algorithm parameters … … 222 231 223 232 233 inline int RenderTraverser::GetCurrentFrameId() const 234 { 235 return mFrameId; 224 236 } 225 237 226 238 239 } 240 241 227 242 228 243 #endif // RENDERTRAVERSER_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r3233 r3258 7 7 #include "Polyhedron.h" 8 8 #include "ResourceManager.h" 9 #include "Camera.h" 9 10 10 11 #include <IL/il.h> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp
r3257 r3258 155 155 entities = bvh->GetGeometry(node, geometrySize); 156 156 157 //if (node->IsLeaf() && (geometrySize != 1))158 //if (geometrySize != 1) cout << "Error!! " << geometrySize << endl;159 157 for (int k = 0; k < geometrySize; ++ k) 160 158 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3257 r3258 60 60 #include "VisibilitySolutionLoader.h" 61 61 #include "ViewCellsTree.h" 62 #include "PvsCollectionRenderer.h" 62 63 63 64 … … 894 895 tr = new CHCPlusPlusTraverser(); 895 896 break; 896 897 case RenderTraverser::CULL_COLLECTOR: 898 tr = new PvsCollectionRenderer(); 899 break; 897 900 default: 898 901 tr = new FrustumCullingTraverser(); … … 1278 1281 else 1279 1282 { 1283 if (traverser->GetType() == RenderTraverser::CULL_COLLECTOR) 1284 ((PvsCollectionRenderer *)traverser)->SetViewCell(usePvs ? viewCell : NULL); 1285 1280 1286 // actually render the scene geometry using the specified algorithm 1281 1287 traverser->RenderScene(); … … 1423 1429 case 32: // space 1424 1430 renderMode = (renderMode + 1) % RenderTraverser::NUM_TRAVERSAL_TYPES; 1431 //renderMode = (renderMode + 1) % 4; 1425 1432 1426 1433 DEL_PTR(traverser); … … 2312 2319 2313 2320 glColor3f(1.0f, 1.0f, 1.0f); 2314 static char *alg_str[] = {"Frustum Cull", "Stop and Wait", "CHC", "CHC ++"}; 2321 static char *alg_str[] = { 2322 "Frustum Cull" 2323 , "Stop and Wait" 2324 , "CHC" 2325 , "CHC ++" 2326 , "Collector" 2327 }; 2315 2328 2316 2329 if (!showAlgorithmTime) … … 2393 2406 renderQueue->Enqueue(*sit); 2394 2407 } 2408 2395 2409 /// now render out everything in one giant pass 2396 2410 renderQueue->Apply(); … … 2407 2421 { 2408 2422 if (!sceneQuery) 2423 { 2409 2424 sceneQuery = new SceneQuery(bvh->GetBox(), traverser, &renderState); 2425 } 2410 2426 2411 2427 return sceneQuery;
Note: See TracChangeset
for help on using the changeset viewer.