Changeset 94 for trunk/VUT/Ogre
- Timestamp:
- 05/12/05 18:55:25 (20 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r92 r94 34 34 GtpVisibility::OcclusionQuery *GetNextOcclusionQuery(); 35 35 36 /** Sets the current camera .36 /** Sets the current camera used for the rendering. 37 37 @param cam the current camera 38 38 */ 39 39 void SetCamera(Camera *cam); 40 40 /** Sets the current camera used for culling. 41 @param cam the current camera 42 @remark the default is the camera used for rendering 43 */ 44 void SetCullCamera(Camera *cullCam); 41 45 /** Initialises this scene traverser for the current frame. 42 46 @param root root of the hierarchy 43 47 @param cam current camera 48 @param cullCam the camera used for culling. If null, the current camera is used 44 49 @remark convenience method wich calls VisibilitySceneTraverser::initFrame, 45 50 sets the current camera, and initialises the distance queue. 46 51 */ 47 void InitFrame(GtpVisibility::HierarchyNode *root, Ogre::Camera *cam);52 void InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam = NULL); 48 53 /** Checks if the node is visible from the current view frustum. 49 54 @param node the current node … … 95 100 96 101 Camera *mCamera; 102 Camera *mCullCamera; 103 97 104 AxisAlignedBox mBox; 98 105 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r93 r94 2 2 #include "OgreVisibilityOctreeSceneManager.h" 3 3 #include <OgreOctree.h> 4 #include <OgreLogManager.h> 5 4 6 #include <windows.h> 5 7 6 8 namespace Ogre { 7 //namespace GtpVisibility { 9 8 10 //----------------------------------------------------------------------- 9 11 OctreeHierarchyInterface::OctreeHierarchyInterface(SceneManager *sm, RenderSystem *rsys): … … 25 27 26 28 // if not all subtrees are empty 27 if (octree->numNodes() > (int)octree->mNodes.size()) 29 //if (octree->numNodes() > (int)octree->mNodes.size()) 30 if (!IsLeaf(node)) 28 31 { 29 32 for(int i=0; i<8; ++i) … … 42 45 bool OctreeHierarchyInterface::IsLeaf(GtpVisibility::HierarchyNode *node) const 43 46 { 44 Octree *octant = static_cast<Octree *>(node); 45 46 for(int i=0; i<8; i++) 47 { 48 if (octant->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]) 49 return false; 50 } 51 52 return true; 47 Octree *octree = static_cast<Octree *>(node); 48 // HACK: if there are subtrees, they are empty => we are not interested in them 49 return octree->numNodes() == (int)octree->mNodes.size(); 53 50 } 54 51 //----------------------------------------------------------------------- … … 68 65 Vector3 mid = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 69 66 70 return (mC amera->getDerivedPosition() - mid).squaredLength();67 return (mCullCamera->getDerivedPosition() - mid).squaredLength(); 71 68 } 72 69 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r93 r94 1 1 #include <OgreCamera.h> 2 2 #include <OgreLogManager.h> 3 3 //#include "OgreSolidHalfBoundingBox.h" 4 4 #include "OgreSolidBoundingBox.h" … … 11 11 //----------------------------------------------------------------------- 12 12 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 13 mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL)/*, mSolidHalfBoundingBox(NULL)*/ 13 mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL), 14 mCamera(NULL), mCullCamera(NULL) 14 15 { 15 16 } … … 64 65 } 65 66 //----------------------------------------------------------------------- 67 void PlatformHierarchyInterface::SetCullCamera(Ogre::Camera *cullCam) 68 { 69 mCullCamera = cullCam; 70 } 71 //----------------------------------------------------------------------- 66 72 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::GetNextOcclusionQuery() 67 73 { … … 74 80 } 75 81 //----------------------------------------------------------------------- 76 void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam )82 void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam) 77 83 { 78 84 GtpVisibility::HierarchyInterface::InitFrame(root); … … 80 86 81 87 SetCamera(cam); 88 89 if(cullCam) 90 SetCullCamera(cullCam); 91 else 92 SetCullCamera(cam); 82 93 } 83 94 //----------------------------------------------------------------------- … … 96 107 { 97 108 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 98 return mC amera->isVisible(*GetBoundingBox(node), intersects);109 return mCullCamera->isVisible(*GetBoundingBox(node), intersects); 99 110 #else 100 111 return true; … … 113 124 // if node is leaf and was visible => will be rendered anyway. 114 125 // In this case we can also test with the real geometry. 115 if(mUseOptimization && wasVisible && IsLeaf(node)) 126 // if camera for culling is different from camera for rendering => cannot optimize 127 if (mUseOptimization && wasVisible && IsLeaf(node) && (mCamera == mCullCamera)) 116 128 { 129 //LogManager::getSingleton().logMessage("render node\n"); 117 130 RenderNode(node); 118 131 } 119 132 else 120 133 { 134 //LogManager::getSingleton().logMessage("render box\n"); 121 135 RenderBoundingBox(GetBoundingBox(node)); 122 136 } -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r87 r94 3 3 #include <OgreCamera.h> 4 4 #include <OgreSceneNode.h> 5 6 //#include <windows.h>7 5 8 6 namespace Ogre { -
trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp
r92 r94 6 6 #include "OgreCamera.h" 7 7 #include "OgreMaterialManager.h" 8 //#include <windows.h> 8 9 9 10 10 namespace Ogre { -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r93 r94 6 6 #include <OgreCamera.h> 7 7 #include <OgreLogManager.h> 8 9 #include <windows.h>10 8 11 9 namespace Ogre { … … 18 16 mHierarchyInterface = 19 17 new OctreeHierarchyInterface(this, mDestRenderSystem); 20 //visManager->SetCullingManager(GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING); 21 18 22 19 //mDisplayNodes = true; 23 20 //mShowBoundingBoxes = true; … … 34 31 void VisibilityOctreeSceneManager::_renderVisibleObjects() 35 32 { 36 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress); 33 Camera *cullCam = NULL; 34 35 if(mCullCamera) cullCam = getCamera("CullCamera"); 36 37 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, cullCam); 37 38 mVisibilityManager->GetCullingManager()->InitFrame(); 38 39 -
trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
r87 r94 7 7 #include "OgreVisibilityOptionsManager.h" 8 8 9 //#include <windows.h>10 9 11 10 namespace Ogre { -
trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp
r74 r94 34 34 #include <OgreRoot.h> 35 35 36 //#include <windows.h>37 36 GtpVisibility::VisibilityEnvironment *visEnv; 38 37 GtpVisibility::VisibilityManager *visManager; -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r93 r94 32 32 void VisibilityTerrainSceneManager::_renderVisibleObjects() 33 33 { 34 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress); 34 Camera *cullCam = NULL; 35 36 // if two cameras (one for culling, one for visualization) 37 if(mCullCamera) 38 cullCam = getCamera("CullCamera"); 39 40 if(cullCam && (mCameraInProgress != cullCam)) 41 OutputDebugString("using cullcam\n"); 42 else 43 OutputDebugString("not using cullcam\n"); 44 45 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, cullCam); 35 46 mVisibilityManager->GetCullingManager()->InitFrame(); 36 47
Note: See TracChangeset
for help on using the changeset viewer.