Changeset 175 for trunk/VUT/Ogre
- Timestamp:
- 07/14/05 20:54:07 (19 years ago)
- Location:
- trunk/VUT/Ogre
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
r174 r175 75 75 @returns occlusion query for this node 76 76 */ 77 GtpVisibility::OcclusionQuery *Issue OcclusionQuery(77 GtpVisibility::OcclusionQuery *IssueNodeOcclusionQuery( 78 78 GtpVisibility::HierarchyNode *node, const bool wasVisible); 79 79 80 80 /** Issue a occlusion query for this mesh. 81 @param node the current mesh82 @returns occlusion query for this node81 @param mesh the mesh for which an occlusion query is issued. 82 @returns occlusion query for this mesh. 83 83 */ 84 GtpVisibility::OcclusionQuery *Issue OcclusionQuery(GtpVisibility::Mesh *mesh);84 GtpVisibility::OcclusionQuery *IssueMeshOcclusionQuery(GtpVisibility::Mesh *mesh); 85 85 86 86 /** If true, the interface finds and renders only objects which are marked as shadow casters. … … 106 106 bool IsBoundingBoxQuery(); 107 107 108 GtpVisibility::OcclusionQuery *Issue OcclusionQuery(GtpVisibility::Patch *patch);108 GtpVisibility::OcclusionQuery *IssuePatchOcclusionQuery(GtpVisibility::Patch *patch); 109 109 110 110 protected: 111 /** Renders geometry111 /** Renders the given geometry 112 112 */ 113 113 void RenderGeometry(GtpVisibility::Mesh *geom); 114 115 /** Renders apatch114 115 /** Renders the given patch 116 116 */ 117 117 void RenderPatch(GtpVisibility::Patch *patch); -
trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp
r174 r175 68 68 69 69 //-- render scene with item buffer (i.e., objects with their id as color codes) 70 //mItemBufferMode = 0; 70 71 if ((mItemBufferMode && mQueryModes) != 0) 71 72 { … … 104 105 GtpVisibility::HierarchyNodeList nodeList; 105 106 106 if (mQueryModes & &NODE_VISIBILITY)107 if (mQueryModes & NODE_VISIBILITY) 107 108 { 108 109 for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt) … … 118 119 119 120 // store geometry of the hierarchy nodes in a geometry list 120 if (mQueryModes & &GEOMETRY_VISIBILITY)121 if (mQueryModes & GEOMETRY_VISIBILITY) 121 122 { 122 123 for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt) … … 133 134 134 135 // store patchges of the geometries in a patch list 135 if (mQueryModes & &PATCH_VISIBILITY)136 if (mQueryModes & PATCH_VISIBILITY) 136 137 { 137 138 for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt) … … 159 160 // for relative visibility we need 2 rendering passes 160 161 int n = relativeVisibility ? 2 : 1; 161 162 if (mItemBufferMode > 0) 163 LogManager::getSingleton().logMessage("item buffer"); 164 162 165 for (int i = 0; i < n; ++i) 163 166 { … … 166 169 { 167 170 // TODO: DELETE QUERIES FROM PREVIOUS RENDER 168 queryList[i].push_back(mHierarchyInterface->Issue OcclusionQuery(*nodeIt, false));171 queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false)); 169 172 } 170 173 171 174 //-- queries for geometry: if item buffer, capture only projected visibility 172 175 if ((mItemBufferMode != GEOMETRY_VISIBILITY) || (i == 1)) 173 { 176 { 174 177 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 175 178 { 176 queryList[i].push_back( mHierarchyInterface->IssueOcclusionQuery(*geometryIt));179 queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt)); 177 180 } 178 181 } … … 183 186 for (patchIt = patchList.begin(); patchIt != patchIt_end; ++patchIt) 184 187 { 185 queryList[i].push_back( mHierarchyInterface->IssueOcclusionQuery(*patchIt));188 queryList[i].push_back(pfHierarchyInterface->IssuePatchOcclusionQuery(*patchIt)); 186 189 } 187 190 } … … 199 202 200 203 201 202 204 // collect occlusion queries for geometry 203 205 if ((mItemBufferMode == GEOMETRY_VISIBILITY) && relativeVisibility) … … 207 209 CollectRelativeGeometryVisibilityForItemBuffer(projQueryIt, &geometryList, visibleGeometry); 208 210 } 209 else 211 else if (mItemBufferMode != GEOMETRY_VISIBILITY) 210 212 { 211 213 CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, visibleGeometry, … … 219 221 CollectRelativePatchVisibilityForItemBuffer(projQueryIt, &patchList, visiblePatches); 220 222 } 221 else 223 else if (mItemBufferMode != PATCH_VISIBILITY) 222 224 { 223 225 CollectPatchVisibility(visQueryIt, projQueryIt, &patchList, visiblePatches, relativeVisibility); … … 244 246 visibleGeometry, visiblePatches, relativeVisibility); 245 247 246 // remove duplicates (duplicates occur if an object is on the edge of the viewport)247 // before duplicates can be deleted we have to add up their visibility248 // adds up their visibility and removes duplicates 249 // (duplicates occur if an object is on the edge of the viewport) 248 250 RemoveDuplicateNodes(visibleNodes); 249 251 … … 258 260 } 259 261 } 260 //------ -----------------------------------------------------------------262 //------j----------------------------------------------------------------- 261 263 void OcclusionQueriesQueryManager::CollectNodeVisibility( 262 264 GtpVisibility::QueryList::iterator &visQueryIt, -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r174 r175 165 165 } 166 166 //----------------------------------------------------------------------- 167 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::Issue OcclusionQuery(167 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueNodeOcclusionQuery( 168 168 GtpVisibility::HierarchyNode *node, const bool wasVisible) 169 169 { … … 200 200 } 201 201 //----------------------------------------------------------------------- 202 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::Issue OcclusionQuery(202 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssuePatchOcclusionQuery( 203 203 GtpVisibility::Patch *patch) 204 204 { … … 216 216 } 217 217 //----------------------------------------------------------------------- 218 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::Issue OcclusionQuery(218 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueMeshOcclusionQuery( 219 219 GtpVisibility::Mesh *mesh) 220 220 { … … 287 287 void PlatformHierarchyInterface::RenderPatch(GtpVisibility::Patch *patch) 288 288 { 289 Pass *pass = patch->getTechnique()->getPass(0); 290 mSceneManager->setPass(pass); 291 mSceneManager->renderSingleObject(patch, pass, false); 289 mSceneManager->_renderSingleRenderable(patch); 292 290 } 293 291 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r160 r175 29 29 void SceneContentGenerator::GenerateScene(int numObjects, const String &objName) 30 30 { 31 // initialise random generator32 srand (time(0));33 34 Vector3 rotationRatio;35 Vector3 translationRatio;36 37 31 int new_size = GetObjectCount() + numObjects; 38 32 int failed_attempts = 0; // counter used to avoid invinite loop … … 42 36 (failed_attempts < MAX_FAILED_ATTEMPTS)) 43 37 { 44 rotationRatio.x = rand() / (float) RAND_MAX;45 rotationRatio.y = rand() / (float) RAND_MAX;46 rotationRatio.z = rand() / (float) RAND_MAX;47 48 translationRatio.x = rand() / (float) RAND_MAX;49 translationRatio.y = rand() / (float) RAND_MAX;50 translationRatio.z = rand() / (float) RAND_MAX;51 52 38 // Setup the ray scene query 53 Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 54 Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos); 39 Vector3 rotation = Vector3(Math::RangeRandom(mMinAngle.x, mMaxAngle.x), 40 Math::RangeRandom(mMinAngle.y, mMaxAngle.y), 41 Math::RangeRandom(mMinAngle.z, mMaxAngle.z)); 42 43 Vector3 position = Vector3(Math::RangeRandom(mMinPos.x, mMaxPos.x), 44 Math::RangeRandom(mMinPos.y, mMaxPos.y), 45 Math::RangeRandom(mMinPos.z, mMaxPos.z)); 55 46 56 47 // failed to generate new object 57 48 if (!GenerateSceneObject(position, rotation, objName)) 58 ++ failed_attempts;49 ++ failed_attempts; 59 50 } 60 51 } … … 68 59 69 60 Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh"); 70 61 ent->setCastShadows(true); 62 71 63 SceneNode *node = mSceneMgr->getRootSceneNode()-> 72 64 createChildSceneNode(String(name) + "Node", position); … … 80 72 mSceneNodes.push_back(node); 81 73 mEntities.push_back(ent); 82 74 83 75 return node; 84 76 } -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r174 r175 237 237 void VisibilityOctreeSceneManager::_renderVisibleObjects() 238 238 { 239 InitDepthPass(); // create material for depth pass 240 InitItemBufferPass(); // create material for item buffer pass 241 239 242 // save ambient light to reset later 240 243 ColourValue savedAmbient = mAmbientLight; … … 629 632 void VisibilityOctreeSceneManager::InitVisibilityCulling(Camera *cam) 630 633 { 631 InitDepthPass(); // create material for depth pass632 InitItemBufferPass(); // create material for item buffer pass633 634 634 // reset culling manager stats 635 635 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r174 r175 240 240 void VisibilityTerrainSceneManager::_renderVisibleObjects() 241 241 { 242 InitDepthPass(); // create material for depth pass 243 InitItemBufferPass(); // create material for item buffer pass 244 242 245 // save ambient light to reset later 243 246 ColourValue savedAmbient = mAmbientLight; … … 629 632 void VisibilityTerrainSceneManager::InitVisibilityCulling(Camera *cam) 630 633 { 631 InitDepthPass(); // create material for depth pass632 InitItemBufferPass(); // create material for item buffer pass633 634 634 // reset culling manager stats 635 635 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
Note: See TracChangeset
for help on using the changeset viewer.