Changeset 130 for trunk/VUT/Ogre/src
- Timestamp:
- 06/14/05 02:50:05 (20 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r115 r130 9 9 10 10 //----------------------------------------------------------------------- 11 OctreeHierarchyInterface::OctreeHierarchyInterface( SceneManager *sm, RenderSystem *rsys):12 PlatformHierarchyInterface(sm, rsys)11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys): 12 SceneNodeHierarchyInterface(sm, rsys) 13 13 { 14 14 } … … 106 106 octant->setLastRendered(mFrameId); 107 107 108 static_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera,108 dynamic_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera, 109 109 octant, mOnlyShadowCasters, mLeaveTransparentsInQueue); 110 110 111 m NumRenderedNodes ++;111 mRenderedNodes.push_back(node); 112 112 } 113 113 #endif … … 157 157 } 158 158 159 static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 160 } 159 dynamic_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box); 160 } 161 //----------------------------------------------------------------------- 162 void OctreeHierarchyInterface::GetGeometry(GtpVisibility::HierarchyNode *node, 163 GtpVisibility::GeometryList *geometryList, 164 bool includeChildren) 165 { 166 NodeList::const_iterator nodeIt, nodeIt_end; 167 nodeIt_end = static_cast<Octree *>(node)->mNodes.end(); 168 169 for (nodeIt = static_cast<Octree *>(node)->mNodes.begin(); nodeIt != nodeIt_end; ++nodeIt) 170 { 171 SceneNodeHierarchyInterface::GetGeometry(*nodeIt, geometryList, includeChildren); 172 } 173 } 174 //----------------------------------------------------------------------- 175 /*bool OctreeHierarchyInterface::FindVisibleObjects(GtpVisibility::HierarchyNode *node, 176 InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 177 bool includeChildren) 178 { 179 bool foundVisible = false; 180 181 PlatformOcclusionQuery query(mRenderSystem); 182 183 NodeList *nodes = &static_cast<Octree *>(node)->mNodes; 184 185 NodeList::const_iterator nodeIt = nodes->begin(), nodeIt_end; 186 187 nodeIt_end = nodes->end(); 188 189 while (nodeIt != nodeIt_end) 190 { 191 OctreeNode *octreeNode = (*nodeIt); 192 if (SceneNodeHierarchyInterface::FindVisibleObjects(octreeNode, visibleGeometry, includeChildren)) 193 { 194 foundVisible = true; 195 } 196 ++nodeIt; 197 } 198 199 return foundVisible; 200 }*/ 201 161 202 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r122 r130 1 1 #include <OgreCamera.h> 2 2 #include <OgreLogManager.h> 3 #include <OgreSubEntity.h> 4 #include <OgreEntity.h> 5 #include <OgreMovableObject.h> 3 6 #include "OgreSolidBoundingBox.h" 4 7 #include "OgrePlatformHierarchyInterface.h" … … 138 141 mCullCamera = cullCam ? cullCam : cam; 139 142 140 if (mCullCamera != mCamera)141 LogManager::getSingleton().logMessage("cullcamera is not camera!");143 //if (mCullCamera != mCamera) 144 // LogManager::getSingleton().logMessage("cullcamera is not camera"); 142 145 143 146 // create materials for node visualization … … 186 189 { 187 190 mIsBoundingBoxQuery = true; 191 188 192 //LogManager::getSingleton().logMessage("render box\n"); 189 193 RenderBoundingBox(GetBoundingBox(node)); … … 197 201 } 198 202 //----------------------------------------------------------------------- 199 void PlatformHierarchyInterface::SetOcclusionPass() 203 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(GtpVisibility::Mesh *mesh) 204 { 205 // get next available test id 206 GtpVisibility::OcclusionQuery *query = GetNextOcclusionQuery(); 207 208 //-- the actual query test 209 query->BeginQuery(); 210 211 RenderGeometry(mesh); 212 213 query->EndQuery(); 214 215 return query; 216 } 217 //----------------------------------------------------------------------- 218 /*void PlatformHierarchyInterface::SetOcclusionPass() 200 219 { 201 220 // disable vertex and fragment program … … 215 234 // Set colour write mode off 216 235 mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false); 217 } 236 }*/ 218 237 //----------------------------------------------------------------------- 219 238 SolidBoundingBox *PlatformHierarchyInterface::GetSolidBoundingBox() … … 228 247 { 229 248 mOnlyShadowCasters = onlyShadowCasters; 230 //mIsShadowPass = mOnlyShadowCasters ;231 249 } 232 250 //----------------------------------------------------------------------- … … 245 263 return mIsBoundingBoxQuery; 246 264 } 265 //----------------------------------------------------------------------- 266 void PlatformHierarchyInterface::RenderGeometry(GtpVisibility::Mesh *geom) 267 { 268 mSceneManager->_renderMovableObject(geom, mLeaveTransparentsInQueue); 269 } 270 //----------------------------------------------------------------------- 271 SceneManager *PlatformHierarchyInterface::GetSceneManager() 272 { 273 return mSceneManager; 274 } 275 //----------------------------------------------------------------------- 276 RenderSystem *PlatformHierarchyInterface::GetRenderSystem() 277 { 278 return mRenderSystem; 279 } 247 280 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r121 r130 186 186 return true; 187 187 } 188 188 189 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r115 r130 1 #include "OgreSceneNodeHierarchyInterface.h"2 1 #include <OgreIteratorWrappers.h> 3 2 #include <OgreCamera.h> 4 3 #include <OgreSceneNode.h> 4 #include <OgreEntity.h> 5 #include <OgreSubEntity.h> 6 #include <OgreLogManager.h> 7 #include "OgreSceneNodeHierarchyInterface.h" 8 #include "OgrePlatformOcclusionQuery.h" 9 5 10 6 11 namespace Ogre { … … 40 45 { 41 46 sceneNode->setLastRendered(sceneNode->lastVisited()); 42 m NumRenderedNodes ++;47 mRenderedNodes.push_back(node); 43 48 44 49 mSceneManager->_renderSceneNode(mCamera, sceneNode, mLeaveTransparentsInQueue); … … 130 135 // TODO 131 136 } 137 //----------------------------------------------------------------------- 138 void SceneNodeHierarchyInterface::GetGeometry(GtpVisibility::HierarchyNode *node, 139 GtpVisibility::GeometryList *geometryList, 140 bool includeChildren) 141 { 142 SceneNode::ObjectIterator objIt = 143 static_cast<SceneNode *>(node)->getAttachedObjectIterator(); 144 145 while (objIt.hasMoreElements()) 146 { 147 MovableObject *movable = objIt.getNext(); 148 149 // we are interested only in the entities, i.e., intances of geometry 150 if (movable->getMovableType() == "Entity") 151 { 152 Entity *ent = static_cast<Entity *>(movable); 153 //std::stringstream d; d << "ent " << ent->getName(); 154 //LogManager::getSingleton().logMessage(d.str()); 155 geometryList->push_back(ent); 156 } 157 } 158 } 132 159 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreTerrainContentGenerator.cpp
r111 r130 68 68 //----------------------------------------------------------------------- 69 69 SceneNode *TerrainContentGenerator::GenerateSceneObject(const Vector3 &position, 70 const Vector3 &rotation, const String& objName )70 const Vector3 &rotation, const String& objName, const bool clampToTerrain) 71 71 { 72 72 Vector3 queryResult; 73 73 // set y to max height so we are sure to be over terrain 74 74 Vector3 pos(position.x, MAX_HEIGHT, position.z); 75 76 if (!clampToTerrain) 77 { 78 return SceneContentGenerator::GenerateSceneObject(queryResult, rotation, objName); 79 } 75 80 76 81 if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r129 r130 24 24 mDelayRenderTransparents(true), 25 25 mUseDepthPass(false), 26 mRenderItemBuffer( true),26 mRenderItemBuffer(false), 27 27 mCurrentEntityId(0) 28 28 { 29 29 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 30 30 mQueryManager = new PlatformQueryManager(mHierarchyInterface, mCurrentViewport); 31 32 mVisibilityManager->SetQueryManager(mQueryManager); 31 33 //mDisplayNodes = true; 32 34 //mShowBoundingBoxes = true; … … 87 89 mHierarchyInterface = NULL; 88 90 } 91 if (mQueryManager) 92 { 93 delete mQueryManager; 94 mQueryManager = NULL; 95 } 89 96 } 90 97 //----------------------------------------------------------------------- 91 98 void VisibilityTerrainSceneManager::ShowVisualization(Camera *cam) 92 99 { 93 LogManager::getSingleton().logMessage("***********VISUALIZATION************");94 100 // add player camera for visualization purpose 95 101 try … … 189 195 setAmbientLight(ColourValue(1,1,1,1)); 190 196 } 191 192 LogManager::getSingleton().logMessage("***********FIND OBJECTS************"); 193 getRenderQueue()->clear(); 197 //getRenderQueue()->clear(); 194 198 195 199 //-- show visible scene nodes and octree bounding boxes from last frame … … 221 225 void VisibilityTerrainSceneManager::_renderVisibleObjects() 222 226 { 223 /*224 std::stringstream d;225 d << "Terrain render level: " << TerrainRenderable::getCurrentRenderLevelIndex();226 LogManager::getSingleton().logMessage(d.str());227 228 227 // increase terrain renderlevel 229 228 int renderLevel = TerrainRenderable::getCurrentRenderLevelIndex() + 1; … … 233 232 renderLevel = 0; 234 233 } 235 */ 234 236 235 // visualization: apply standard rendering 237 236 if (mShowVisualization) 238 237 { 239 238 TerrainSceneManager::_renderVisibleObjects(); 240 //TerrainRenderable::setCurrentRenderLevelIndex(renderLevel);239 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 241 240 return; 242 241 } 243 244 LogManager::getSingleton().logMessage("***********RENDER OBJECTS************");245 242 246 243 InitDepthPass(); // create material for depth pass … … 309 306 TerrainSceneManager::_renderVisibleObjects(); 310 307 311 //TerrainRenderable::setCurrentRenderLevelIndex(renderLevel);308 TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 312 309 //WriteLog(); // write out stats 313 310 } … … 374 371 // notifiy that frame has ended so terrain render level can be reset for correct 375 372 // terrain rendering 376 /*if (key == "TerrainLevelIdx")373 if (key == "TerrainLevelIdx") 377 374 { 378 375 TerrainRenderable::setCurrentRenderLevelIndex((*static_cast<const int *>(val))); 379 376 return true; 380 } */377 } 381 378 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 382 379 setOption(key, val) || TerrainSceneManager::setOption(key, val); … … 507 504 //<< ", renderable name: " << irend-> 508 505 RenderSingleObjectForItemBuffer(*irend, ipass->first); 509 RenderSingleObjectForOcclusionQuery(506 //RenderSingleObjectForOcclusionQuery( 510 507 } 511 508 } … … 562 559 //LogManager::getSingleton().logMessage("has vertex program"); 563 560 Pass *usedPass = setPass(mItemBufferPass); 564 //Pass *usedPass = setPass(pass);561 //Pass *usedPass = setPass(pass); 565 562 std::stringstream d; 566 563 d << "item buffer id: " << rend->getId() << ", col: " << col; … … 571 568 } 572 569 //----------------------------------------------------------------------- 573 Entity* VisibilityTerrainSceneManager::createEntity(const String& entityName, const String& meshName) 570 GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::GetVisibilityManager() 571 { 572 return mVisibilityManager; 573 } 574 //----------------------------------------------------------------------- 575 Entity* VisibilityTerrainSceneManager::createEntity(const String& entityName, 576 const String& meshName) 574 577 { 575 578 Entity *ent = SceneManager::createEntity(entityName, meshName); 576 579 577 for (int i = 0; i < ent->getNumSubEntities(); ++i)580 for (int i = 0; i < (int)ent->getNumSubEntities(); ++i) 578 581 { 579 582 ent->getSubEntity(i)->setId(mCurrentEntityId ++);
Note: See TracChangeset
for help on using the changeset viewer.