Changeset 54 for trunk/VUT/OcclusionCullingSceneManager/src
- Timestamp:
- 04/21/05 14:04:02 (20 years ago)
- Location:
- trunk/VUT/OcclusionCullingSceneManager/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneTraverser.cpp
r52 r54 28 28 { 29 29 Octree *nextChild = octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]; 30 31 /*char msg[100];32 sprintf(msg, "node number: %d %d %d\n", (i & 4) >> 2, (i & 2) >> 1, i & 1);33 OutputDebugString(msg);*/34 30 35 31 if(nextChild) … … 59 55 } 60 56 57 mRenderSystem->_setRasterisationMode(SDL_WIREFRAME); 58 renderBoundingBox(&box); 59 mRenderSystem->_setRasterisationMode(SDL_SOLID); 61 60 // update node's visited flag 62 61 octant->setLastVisited(mFrameId); … … 86 85 bool intersects = false; 87 86 88 /*char msg2[100];89 Vector3 min = box.getMinimum();90 Vector3 max = box.getMaximum();91 92 sprintf(msg2, "culling box: %3.3f %3.3f %3.3f %3.3f %3.3f %3.3f\n", min.x, min.y, min.z, max.x, max.y, max.z);93 OutputDebugString(msg2);*/94 95 87 if(!cam->isVisible(box, intersects)) 96 88 { … … 102 94 { 103 95 octant->setOctreeVisible(true); 104 // char msg[100]; sprintf(msg, "intersecting\n");105 // OutputDebugString(msg);106 96 traverseOctant(cam, octant); 107 97 continue; … … 114 104 query->pullOcclusionQuery(&visiblePixels); 115 105 116 char msg[100]; sprintf(msg, "visible pixels: %d\n", visiblePixels, intersects);117 OutputDebugString(msg);106 //char msg[100]; sprintf(msg, "visible pixels: %d\n", visiblePixels); 107 //OutputDebugString(msg); 118 108 119 109 // node visible … … 124 114 else 125 115 { 116 /* 117 char msg2[100]; 118 Vector3 min = box.getMinimum(); 119 Vector3 max = box.getMaximum(); 120 121 sprintf(msg2, "culling box: %3.3f %3.3f %3.3f %3.3f %3.3f %3.3f\n", min.x, min.y, min.z, max.x, max.y, max.z); 122 OutputDebugString(msg2); 123 */ 124 126 125 mNumQueryCulledNodes ++; 127 126 } … … 192 191 bool wasVisible = octant->isOctreeVisible() && (octant->lastVisited() == mFrameId - 1); 193 192 194 /*195 char msg[100];196 if(wasVisible) sprintf(msg, "yes, was visible, %d\n", mFrameId);197 else sprintf(msg, "no was invisible, %d\n", mFrameId);198 OutputDebugString(msg);199 */200 201 193 // identify nodes that we cannot skip queries for 202 194 bool mustQuery = !wasVisible || (octant->numNodes() > 0) || isLeaf(octant); … … 242 234 243 235 //TODO: does nothing useful 244 setRenderingMode(MODE_RENDER);236 //setRenderingMode(MODE_RENDER); 245 237 246 238 ((OctreeSceneManager *)mSceneManager)->_renderOctant(cam, octant); -
trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneTraverser.cpp
r52 r54 44 44 45 45 initDistanceQueue(cam); 46 47 //deleteQueries();48 //char *msg = "deleting queries\n"; OutputDebugString(msg);49 //for(unsigned int i=0; i < 1000; i++)50 //mOcclusionQueries.push_back(mRenderSystem->createHardwareOcclusionQuery());51 52 //mCurrentAlgorithm = RENDER_CULL_FRUSTUM;53 46 54 47 switch(mCurrentAlgorithm) … … 235 228 // TODO: in rendervisibleobjects, the rendermode is changed by ogre itself => change this!! 236 229 237 setRenderingMode(MODE_QUERY);238 //mRenderSystem->_setRasterisationMode(SDL_SOLID); setRenderingMode(MODE_RENDER);230 //setRenderingMode(MODE_QUERY); 231 //mRenderSystem->_setRasterisationMode(SDL_SOLID); setRenderingMode(MODE_RENDER); 239 232 240 233 // get next available test id … … 247 240 248 241 query->endOcclusionQuery(); 249 250 251 //mRenderSystem->_setRasterisationMode(SDL_WIREFRAME); 242 243 /*mRenderSystem->_setRasterisationMode(SDL_WIREFRAME); 252 244 setRenderingMode(MODE_RENDER); 253 245 renderBoundingBox(box); 254 //mRenderSystem->_setRasterisationMode(SDL_SOLID);246 mRenderSystem->_setRasterisationMode(SDL_SOLID);*/ 255 247 256 248 return query; … … 278 270 mRenderSystem->_setColourBufferWriteEnabled(enabled, enabled, enabled, enabled); 279 271 mRenderSystem->_setDepthBufferWriteEnabled(enabled); 280 mRenderSystem->setLightingEnabled(enabled);272 //mRenderSystem->setLightingEnabled(enabled); 281 273 } 282 274 } … … 304 296 { 305 297 //TODO: does not do any changes 306 setRenderingMode(MODE_RENDER);298 //setRenderingMode(MODE_RENDER); 307 299 308 300 if(node->lastRendered() != node->lastVisited()) … … 383 375 halfbox->setupBoundingBox(*box); 384 376 385 mRenderSystem->_setWorldMatrix(Matrix4::IDENTITY); 386 387 // Set world transformation 388 /*halfbox->getWorldTransforms(xform); 377 /*mRenderSystem->_setWorldMatrix(Matrix4::IDENTITY); 378 379 halfbox->getWorldTransforms(xform); 389 380 390 381 int numMatrices = halfbox->getNumWorldTransforms(); … … 397 388 mRenderSystem->_setWorldMatrix(*xform); 398 389 } 399 mRenderSystem->setClipPlanes(halfbox->getClipPlanes()); */390 mRenderSystem->setClipPlanes(halfbox->getClipPlanes()); 400 391 401 392 static RenderOperation ro; … … 404 395 halfbox->getRenderOperation(ro); 405 396 ro.srcRenderable = halfbox; 406 mRenderSystem->_render(ro); 407 408 //mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half), getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true); 397 mRenderSystem->_render(ro);*/ 398 399 mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half), 400 getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true); 409 401 } 410 402 } … … 444 436 { 445 437 mOcclusionQueries.push_back(mRenderSystem->createHardwareOcclusionQuery()); 446 //char *msg = "creating query!!\n"; OutputDebugString(msg);447 438 } 448 439 -
trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingTerrainSceneManager.cpp
r52 r54 18 18 mShowBoxes = true; 19 19 //mDisplayNodes = true; 20 //mShowBoundingBoxes = true;21 //mMaxDepth = 20;20 mShowBoundingBoxes = true; 21 mMaxDepth = 20; 22 22 } 23 23 //----------------------------------------------------------------------- -
trunk/VUT/OcclusionCullingSceneManager/src/OgreSolidHalfBoundingBox.cpp
r51 r54 5 5 #include "OgreHardwareBufferManager.h" 6 6 #include "OgreCamera.h" 7 #include "OgreMaterialManager.h" 7 8 //#include <windows.h> 8 9 … … 13 14 :WireBoundingBox(), mIsFirstHalf(isFirstHalf) 14 15 { 16 setOcclusionQueryMaterial(); 17 15 18 mRenderOp.vertexData->vertexCount = 8; 16 19 mRenderOp.operationType = RenderOperation::OT_TRIANGLE_FAN; … … 95 98 *xform = Matrix4::IDENTITY; 96 99 } 100 101 void SolidHalfBoundingBox::setOcclusionQueryMaterial( void ) 102 { 103 m_pMaterial = MaterialManager::getSingleton().getByName("OcclusionQuery"); 104 105 if(m_pMaterial.isNull()) 106 { 107 m_pMaterial = MaterialManager::getSingleton(). 108 create("OcclusionQuery", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 109 } 110 111 m_pMaterial->setColourWriteEnabled(false); 112 m_pMaterial->setDepthWriteEnabled(false); 113 m_pMaterial->setLightingEnabled(false); 114 115 setMaterial("OcclusionQuery"); 116 } 97 117 } 98 118
Note: See TracChangeset
for help on using the changeset viewer.