Changeset 85 for trunk/VUT/Ogre
- Timestamp:
- 05/04/05 17:58:13 (20 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r71 r85 77 77 */ 78 78 void RenderBoundingBox(AxisAlignedBox *box); 79 /** Returns one half of the bounding box. 80 @param half the half index of the bouding box (0 or 1) 79 /** Returns pointer to current renderable half bounding box geometry 81 80 */ 82 SolidHalfBoundingBox *GetSolidHalfBoundingBox( int half);81 SolidHalfBoundingBox *GetSolidHalfBoundingBox(); 83 82 84 /** two halfesof an aabb.83 /** one renderable half of an aabb. 85 84 */ 86 SolidHalfBoundingBox *m HalfBoundingBox[2];85 SolidHalfBoundingBox *mSolidHalfBoundingBox; 87 86 88 87 SceneManager *mSceneManager; … … 91 90 Camera *mCamera; 92 91 AxisAlignedBox mBox; 93 92 94 93 std::vector<PlatformOcclusionQuery *> mOcclusionQueries; 95 94 }; -
trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h
r74 r85 36 36 37 37 AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 38 39 protected:40 41 42 38 }; 43 39 -
trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h
r59 r85 15 15 public: 16 16 17 SolidHalfBoundingBox(bool isFirstHalf); 18 void setupBoundingBox(const AxisAlignedBox& aabb); 19 /** Override this method to prevent parent transforms (rotation,translation,scale) 20 and to make it public. 17 SolidHalfBoundingBox(); 18 /** Sets up the first or second half of a solid bounding box. 19 @param aab the axis aligned bounding box 20 @param isFirstHalf if it is the first or the second half 21 */ 22 void SetupBoundingBox(const AxisAlignedBox& aabb, const bool isFirstHalf); 23 24 protected: 25 /** Builds the wireframe line list. 26 @param aab the axis aligned bounding box for setting up the vertices 27 @param first or second half of the box 21 28 */ 22 void getWorldTransforms(Matrix4* xform) const; 23 24 protected: 25 26 /** Builds the wireframe line list. 27 @param aab the axis aligned bounding box for setting up the list. 28 */ 29 void setupBoundingBoxVertices(const AxisAlignedBox& aab); 29 void SetupBoundingBoxVertices(const AxisAlignedBox& aab, const bool isFirstHalf); 30 30 /** 31 31 Sets the material used for occlusion queries. … … 33 33 uses no lighting, no depth write, and no colours 34 34 */ 35 void setOcclusionQueryMaterial();35 void SetOcclusionQueryMaterial(); 36 36 /** Whether this half box is the first or the second half of the bounding box. 37 37 */ -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r74 r85 140 140 AxisAlignedBox *OctreeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 141 141 { 142 static_cast<Octree *>(node)->_getCullBounds(&mBox); 142 if(node != mPreviousNode) 143 { 144 mPreviousNode = node; 145 static_cast<Octree *>(node)->_getCullBounds(&mBox); 146 } 143 147 144 148 return &mBox; -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r74 r85 11 11 //----------------------------------------------------------------------- 12 12 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 13 mSceneManager(sm), mRenderSystem(rsys) 14 { 15 mHalfBoundingBox[0] = mHalfBoundingBox[1] = NULL; 13 mSceneManager(sm), mRenderSystem(rsys), mSolidHalfBoundingBox(NULL) 14 { 16 15 } 17 16 //----------------------------------------------------------------------- … … 19 18 { 20 19 DeleteQueries(); 21 22 if (mHalfBoundingBox[0])23 delete mHalfBoundingBox[0];24 20 25 if (mHalfBoundingBox[1])26 delete m HalfBoundingBox[1];21 if(mSolidHalfBoundingBox) 22 delete mSolidHalfBoundingBox; 27 23 } 28 24 //----------------------------------------------------------------------- … … 38 34 { 39 35 // Render two halfes of the bounding box (using triangle fans) 40 for(int half = 0; half < 2; half ++)36 for(int halfIdx = 0; halfIdx < 2; ++halfIdx) 41 37 { 42 static Matrix4 xform[256]; 43 //TODO: this should be full bounding box 44 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(half); 45 halfbox->setupBoundingBox(*box); 46 38 //TODO: this should be the full bounding box 39 SolidHalfBoundingBox *halfbox = GetSolidHalfBoundingBox(); 40 halfbox->SetupBoundingBox(*box, halfIdx == 1); 41 47 42 mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 48 43 … … 50 45 51 46 mSceneManager->useRenderableViewProjMode(halfbox); 52 mSceneManager->setPass( halfbox->getTechnique()->getPass(0));47 mSceneManager->setPass(GetSolidHalfBoundingBox()->getTechnique()->getPass(0)); 53 48 halfbox->getRenderOperation(ro); 54 ro.srcRenderable = halfbox; 49 ro.srcRenderable = halfbox; 55 50 mRenderSystem->_render(ro); 56 57 // matt: change this58 // mSceneManager->myrenderSingleObject(getSolidHalfBoundingBox(half),59 // getSolidHalfBoundingBox(half)->getTechnique()->getPass(0), true);60 51 } 61 }62 //-----------------------------------------------------------------------63 SolidHalfBoundingBox *PlatformHierarchyInterface::GetSolidHalfBoundingBox(int half)64 {65 if(!mHalfBoundingBox[half])66 mHalfBoundingBox[half] = new Ogre::SolidHalfBoundingBox(half == 1);67 68 return mHalfBoundingBox[half];69 52 } 70 53 //----------------------------------------------------------------------- … … 100 83 } 101 84 //----------------------------------------------------------------------- 102 bool PlatformHierarchyInterface::CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects) 85 bool PlatformHierarchyInterface::CheckFrustumVisible(GtpVisibility::HierarchyNode *node, 86 bool &intersects) 103 87 { 104 88 #ifdef GTP_VISIBILITY_MODIFIED_OGRE … … 109 93 } 110 94 //----------------------------------------------------------------------- 111 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(GtpVisibility::HierarchyNode *node) 95 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 96 GtpVisibility::HierarchyNode *node) 112 97 { 113 98 // get next available test id … … 123 108 return query; 124 109 } 110 //----------------------------------------------------------------------- 111 SolidHalfBoundingBox *PlatformHierarchyInterface::GetSolidHalfBoundingBox() 112 { 113 if(!mSolidHalfBoundingBox) 114 mSolidHalfBoundingBox = new SolidHalfBoundingBox; 115 116 return mSolidHalfBoundingBox; 117 } 125 118 126 119 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r74 r85 123 123 AxisAlignedBox *SceneNodeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 124 124 { 125 SceneNode *sceneNode = static_cast<SceneNode *>(node); 125 if(node != mPreviousNode) 126 { 127 mPreviousNode = node; 128 129 mBox = static_cast<SceneNode *>(node)->_getWorldAABB(); 130 } 131 126 132 return &mBox; 127 133 } -
trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp
r59 r85 12 12 #define POSITION_BINDING 0 13 13 //----------------------------------------------------------------------- 14 SolidHalfBoundingBox::SolidHalfBoundingBox(bool isFirstHalf) 15 :WireBoundingBox(), mIsFirstHalf(isFirstHalf) 14 SolidHalfBoundingBox::SolidHalfBoundingBox() 16 15 { 17 setOcclusionQueryMaterial();16 SetOcclusionQueryMaterial(); 18 17 19 18 mRenderOp.vertexData->vertexCount = 8; … … 21 20 } 22 21 //----------------------------------------------------------------------- 23 void SolidHalfBoundingBox::setupBoundingBoxVertices(const AxisAlignedBox& aab) { 24 22 void SolidHalfBoundingBox::SetupBoundingBoxVertices(const AxisAlignedBox& aab, 23 const bool isFirstHalf) 24 { 25 25 Vector3 vmax = aab.getMaximum(); 26 26 Vector3 vmin = aab.getMinimum(); 27 28 27 29 28 Real sqLen = std::max(vmax.squaredLength(), vmin.squaredLength()); 30 29 mRadius = Math::Sqrt(sqLen); … … 38 37 Real minz = vmin.z; 39 38 40 // fill in the Vertex buffer: 12 lines with 2 endpoints each make up a box39 // fill the vertex buffer: 12 lines with 2 endpoints each make up a box 41 40 HardwareVertexBufferSharedPtr vbuf = 42 41 mRenderOp.vertexData->vertexBufferBinding->getBuffer(POSITION_BINDING); … … 55 54 56 55 // fan 1 57 if( mIsFirstHalf)56 if(isFirstHalf) 58 57 { 59 58 *pPos++ = minx; *pPos++ = maxy; *pPos++ = maxz; //011 … … 66 65 *pPos++ = minx; *pPos++ = miny; *pPos++ = minz; //000 67 66 *pPos++ = minx; *pPos++ = miny; *pPos++ = maxz; //001 68 69 67 } 70 68 else … … 84 82 vbuf->unlock(); 85 83 } 86 87 void SolidHalfBoundingBox::setupBoundingBox(const AxisAlignedBox& aabb) 84 //----------------------------------------------------------------------- 85 void SolidHalfBoundingBox::SetupBoundingBox(const AxisAlignedBox& aabb, 86 const bool isFirstHalf) 88 87 { 89 88 // init the vertices to the aabb 90 S olidHalfBoundingBox::setupBoundingBoxVertices(aabb);89 SetupBoundingBoxVertices(aabb, isFirstHalf); 91 90 92 91 // setup the bounding box of this SimpleRenderable 93 92 setBoundingBox(aabb); 94 93 } 95 // Override this method to prevent parent transforms (rotation,translation,scale) 96 void SolidHalfBoundingBox::getWorldTransforms( Matrix4* xform ) const 97 { 98 // return identity matrix to prevent parent transforms 99 *xform = Matrix4::IDENTITY; 100 } 101 102 void SolidHalfBoundingBox::setOcclusionQueryMaterial( void ) 94 //----------------------------------------------------------------------- 95 void SolidHalfBoundingBox::SetOcclusionQueryMaterial( void ) 103 96 { 104 97 m_pMaterial = MaterialManager::getSingleton().getByName("OcclusionQuery"); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r74 r85 19 19 20 20 setVisibilityManager(visManager); 21 mShowBoxes = true;21 //mShowBoxes = true; 22 22 //mDisplayNodes = true; 23 mShowBoundingBoxes = true;23 //mShowBoundingBoxes = true; 24 24 mMaxDepth = 20; 25 25 }
Note: See TracChangeset
for help on using the changeset viewer.