Changeset 139 for trunk/VUT/work
- Timestamp:
- 06/20/05 08:13:57 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r133 r139 94 94 95 95 /***********************************************/ 96 /* TerrainFrameListener implementation 96 /* TerrainFrameListener implementation */ 97 97 /***********************************************/ 98 98 //----------------------------------------------------------------------- … … 294 294 mShowVisualization = !mShowVisualization; 295 295 296 mSceneMgr->setOption(" ShowVisualization", &mShowVisualization);296 mSceneMgr->setOption("PrepareVisualization", &mShowVisualization); 297 297 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); 298 298 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r137 r139 75 75 mCullCamera(false), 76 76 mRecord(false), 77 m UseShadows(false),77 mShowShadows(false), 78 78 mShowHelp(false), 79 79 mDisplayCameraDetails(false), … … 159 159 mSceneMgr->setOption("ShowOctree", &mShowOctree); 160 160 mSceneMgr->setOption("CullCamera", &mCullCamera); 161 mSceneMgr->setOption(" ShowVisualization", &mShowVisualization);161 mSceneMgr->setOption("PrepareVisualization", &mShowVisualization); 162 162 163 163 // TODO: change this (does not work with other scene manager plugins) … … 257 257 } 258 258 259 // mInputDevice->capture(); 259 if (mDisplayCameraDetails) 260 { 261 // Print camera details 262 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + 263 " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation())); 264 } 260 265 261 266 //-- IMPORTANT: must be set, otherwise terrain is not rendered correctly … … 706 711 void TerrainFrameListener::toggleShowViz() 707 712 { 708 mShowVisualization = !mShowVisualization; 709 mVisualizeCulledNodes = !mVisualizeCulledNodes; 710 713 mVisualizeCulledNodes = mShowVisualization = !mShowVisualization; 714 711 715 // create viewport with priority VIZ_VIEWPORT_Z_ORDER: 712 716 // will be rendered over standard viewport … … 721 725 // Alter the camera aspect ratio to match the viewport 722 726 mVizCamera->setAspectRatio(Real(vizvp->getActualWidth()) / 723 Real(vizvp->getActualHeight()));727 Real(vizvp->getActualHeight())); 724 728 725 729 mSceneMgr->setOption("VisualizeCulledNodes", &mVisualizeCulledNodes); … … 733 737 mSceneMgr->setSkyPlane(true, plane, "Examples/TransparentTest", 4000, 75, false); 734 738 */ 735 736 739 } 737 740 else 738 741 { 742 // remove visualization viewport 739 743 mWindow->removeViewport(VIZ_VIEWPORT_Z_ORDER); 740 // if octree was enabled for visualization purpose, reset now 744 745 // octree bounding boxes are shown for visualization purpose, reset now 741 746 mSceneMgr->setOption("ShowOctree", &mShowOctree); 742 747 } 743 748 } 744 749 //----------------------------------------------------------------------- 745 void TerrainFrameListener::toggle UseShadows()746 { 747 m UseShadows = !mUseShadows;748 749 mSunLight->setCastShadows(m UseShadows);750 751 if (m UseShadows)750 void TerrainFrameListener::toggleShowShadows() 751 { 752 mShowShadows = !mShowShadows; 753 754 mSunLight->setCastShadows(mShowShadows); 755 756 if (mShowShadows) 752 757 { 753 758 mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE); 759 //mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE); 760 //mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); 754 761 } 755 762 else … … 805 812 break; 806 813 case KC_S: 807 toggle UseShadows();814 toggleShowShadows(); 808 815 break; 809 816 … … 857 864 break; 858 865 } 859 860 if (mDisplayCameraDetails)861 {862 // Print camera details863 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) +864 " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation()));865 }866 866 867 867 CEGUI::System::getSingleton().injectKeyDown(e->getKey()); -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r135 r139 98 98 void toggleShowStats(); 99 99 100 void toggle UseShadows();100 void toggleShowShadows(); 101 101 void toggleDisplayCameraDetails(); 102 102 void takeScreenShot(); … … 175 175 bool mCullCamera; 176 176 bool mRecord; 177 bool m UseShadows;177 bool mShowShadows; 178 178 bool mVisualizeCulledNodes; 179 179 bool mShowHelp; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r137 r139 84 84 { 85 85 // Set ambient light 86 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 86 mAmbientLight = ColourValue(0.5, 0.5, 0.5); 87 mSceneMgr->setAmbientLight(mAmbientLight); 87 88 88 89 //-- create light … … 100 101 mSunLight->setDirection(dir); 101 102 //mSunLight->setDirection(Vector3::NEGATIVE_UNIT_Y); 102 103 103 mSunLight->setDiffuseColour(1, 1, 1); 104 104 mSunLight->setSpecularColour(1, 1, 1); … … 137 137 */ 138 138 mSceneMgr->setShadowTextureSettings(1024, 2); 139 /* if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE))140 { // In D3D, use a 1024x1024 shadow texture141 mSceneMgr->setShadowTextureSettings(1024, 2); } else {142 // Use 512x512 texture in GL since we can't go higher than the window res143 mSceneMgr->setShadowTextureSettings(512, 2);}144 */145 146 //mSceneMgr->setShadowColour(ColourValue(0, 0, 0));147 139 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 148 // 140 //mSceneMgr->setShowDebugShadows(true); 149 141 150 142 … … 220 212 const bool nShowViz = !showViz; 221 213 222 // ambient light must be full for visualization 214 mSavedShadowTechnique = mSceneMgr->getShadowTechnique(); 215 mSavedAmbientLight = mSceneMgr->getAmbientLight(); 216 217 // -- ambient light must be full for visualization, shadows disabled 223 218 if (showViz) 224 219 { 225 220 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 226 } 227 else 228 { 229 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); 230 } 231 232 mSceneMgr->setOption("ShowVisualization", &showViz); 221 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 222 } 223 224 mSceneMgr->setOption("PrepareVisualization", &showViz); 233 225 mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); 234 226 //mSceneMgr->setOption("SkyPlaneEnabled", &showViz); … … 239 231 void VisualizationRenderTargetListener::postRenderTargetUpdate(const RenderTargetEvent &evt) 240 232 { 233 // reset values 234 mSceneMgr->setShadowTechnique(mSavedShadowTechnique); 235 mSceneMgr->setAmbientLight(mSavedAmbientLight); 236 241 237 RenderTargetListener::postRenderTargetUpdate(evt); 242 238 } -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r133 r139 3 3 4 4 #include "CEGUIForwardRefs.h" 5 #include <OgreRenderTargetListener.h> 5 6 #include "ExampleApplication.h" 7 6 8 #include "OgreTerrainContentGenerator.h" 7 8 #include <OgreRenderTargetListener.h>9 9 #include "TerrainFrameListener.h" 10 10 … … 19 19 20 20 SceneManager *mSceneMgr; 21 22 ShadowTechnique mSavedShadowTechnique; 23 ColourValue mSavedAmbientLight; 21 24 }; 22 25 … … 54 57 SceneNode *mCamNode; 55 58 Light *mSunLight; 56 VisualizationRenderTargetListener *mRenderTargetListener;57 59 58 60 TerrainFrameListener *mTerrainFrameListener; 61 ColourValue mAmbientLight; 62 //VisualizationRenderTargetListener *mVizRenderTargetListener; 59 63 60 64 private: -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderQueueSortingGrouping.h
r115 r139 197 197 void clear(void); 198 198 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 199 199 200 /** Clears solids in this group of renderables. Leaves transparents in group. 200 201 */ 201 202 void clearSolids(void); 203 204 enum {SOLID_PASSES = 1, 205 SOLID_PASSES_DECAL = 2, 206 SOLID_PASSES_DIFFUSE_SPECULAR = 4, 207 SOLID_PASSES_NOSHADOW = 8, 208 TRANSPARENT_PASSES = 16}; 209 210 /** Clears passes determined by parameter. 211 @param passes can be one or several (combined by |) of: 212 SOLID_PASSES 213 SOLID_PASSES_DECAL 214 SOLID_PASSES_DIFFUSE_SPECULAR 215 SOLID_PASSES_NOSHADOW 216 TRANSPARENT_PASSES 217 */ 218 void clear(const int leavePassesInQueue); 202 219 #endif // GTP_VISIBILITY_MODIFIED_OGRE 203 220 /** Sets whether or not the queue will split passes by their lighting type, … … 306 323 } 307 324 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 325 void clear(int passes) 326 { 327 PriorityMap::iterator i, iend; 328 iend = mPriorityGroups.end(); 329 for (i = mPriorityGroups.begin(); i != iend; ++i) 330 { 331 i->second->clear(passes); 332 } 333 334 } 308 335 /** Clears only solid renderables. Leaves transparents in queue. */ 309 336 void clearSolids(void) -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
r131 r139 128 128 @param node scene node to be rendered 129 129 @param cam current camera 130 @param leave TransparentsInQueue if only solid objects should be rendered131 */ 132 void _renderSceneNode(Camera *cam, SceneNode *node, bool leaveTransparentsInQueue = false);130 @param leavePassesInQueue list of passes which are left in queue 131 */ 132 void _renderSceneNode(Camera *cam, SceneNode *node, const int leavePassesInQueue = 0); 133 133 /** deletes all processed queues 134 @remark clears render queues after rendering scene node 135 */ 136 void _deleteRenderedQueueGroups(bool leaveTransparentsInQueue); 134 @param leavePassesInQueue pass list which is not deleted from queue 135 @remark used to clear render queues before rendering scene node 136 */ 137 void _deleteRenderedQueueGroups(int leavePassesInQueue = 0); 137 138 /** Internal method used by _renderVisibleObjects to deal with renderables 138 139 which override the camera's own view / projection materices. … … 156 157 /** Renders an Ogre MovableObject. 157 158 */ 158 void _renderMovableObject(MovableObject *mov, const bool leaveTransparentsInQueue);159 void _renderMovableObject(MovableObject *mov, const int leavePassesInQueue); 159 160 160 161 #endif // GTP_VISIBILITY_MODIFIED_OGRE -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderQueueSortingGrouping.cpp
r115 r139 280 280 void RenderPriorityGroup::clearSolids(void) 281 281 { 282 /*SolidRenderablePassMap::iterator i, iend;282 /*SolidRenderablePassMap::iterator i, iend; 283 283 // Delete queue groups which are using passes which are to be 284 284 // deleted, we won't need these any more and they clutter up … … 313 313 clearSolidPassMap(mSolidPassesNoShadow); 314 314 } 315 //----------------------------------------------------------------------- 316 void RenderPriorityGroup::clear(const int leavePassesInQueue) 317 { 318 SolidRenderablePassMap::iterator i, iend; 319 320 // -- standard method if no passes are left in queue 321 if (leavePassesInQueue == 0) 322 { 323 clear(); 324 return; 325 } 326 327 // We do not clear the unchanged solid pass maps, only the contents of each list 328 // This is because we assume passes are reused a lot and it saves resorting 329 if (!(leavePassesInQueue & SOLID_PASSES)) 330 clearSolidPassMap(mSolidPasses); 331 if (!(leavePassesInQueue & SOLID_PASSES_DECAL)) 332 clearSolidPassMap(mSolidPassesDecal); 333 if (!(leavePassesInQueue & SOLID_PASSES_DIFFUSE_SPECULAR)) 334 clearSolidPassMap(mSolidPassesDiffuseSpecular); 335 if (!(leavePassesInQueue & SOLID_PASSES_NOSHADOW)) 336 clearSolidPassMap(mSolidPassesNoShadow); 337 338 if (!(leavePassesInQueue & TRANSPARENT_PASSES)) 339 mTransparentPasses.clear(); 340 } 315 341 #endif // GTP_VISIBILITY_MODIFIED_OGRE 316 342 //----------------------------------------------------------------------- -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
r135 r139 1909 1909 1910 1910 itransend = objs.end(); 1911 for (itrans = objs.begin(); 1912 itrans != itransend; ++itrans) 1911 for (itrans = objs.begin(); itrans != itransend; ++itrans) 1913 1912 { 1914 1913 Renderable *r = itrans->renderable; … … 4197 4196 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 4198 4197 //----------------------------------------------------------------------- 4199 void SceneManager::_renderSceneNode(Camera *cam, SceneNode *node, bool leaveTransparentsInQueue)4198 void SceneManager::_renderSceneNode(Camera *cam, SceneNode *node, const int leavePassesInQueue) 4200 4199 { 4201 4200 // delete previously rendered objects from renderqueue 4202 _deleteRenderedQueueGroups(leave TransparentsInQueue);4201 _deleteRenderedQueueGroups(leavePassesInQueue); 4203 4202 4204 4203 node->_findVisibleObjects(cam, getRenderQueue(), false, mDisplayNodes, false); … … 4206 4205 } 4207 4206 //----------------------------------------------------------------------- 4208 void SceneManager::_deleteRenderedQueueGroups( bool leaveTransparentsInQueue)4207 void SceneManager::_deleteRenderedQueueGroups(const int leavePassesInQueue) 4209 4208 { 4210 4209 RenderQueue::QueueGroupIterator queueIt = getRenderQueue()->_getQueueGroupIterator(); … … 4218 4217 if (isRenderQueueToBeProcessed(qId)) 4219 4218 { 4220 if (leaveTransparentsInQueue) 4221 { 4222 pGroup->clearSolids(); 4223 } 4224 else 4225 { 4226 pGroup->clear(); 4227 } 4219 /*if (leaveTransparentsInQueue) 4220 { pGroup->clearSolids(); } else 4221 { pGroup->clear(); }*/ 4222 pGroup->clear(leavePassesInQueue); 4228 4223 } 4229 4224 } … … 4245 4240 }*/ 4246 4241 //----------------------------------------------------------------------- 4247 void SceneManager::_renderMovableObject(MovableObject *mov, const bool leaveTransparentsInQueue)4242 void SceneManager::_renderMovableObject(MovableObject *mov, const int leavePassesInQueue) 4248 4243 { 4249 4244 // delete previously rendered objects from renderqueue 4250 _deleteRenderedQueueGroups(leave TransparentsInQueue);4245 _deleteRenderedQueueGroups(leavePassesInQueue); 4251 4246 4252 4247 mov->_updateRenderQueue(getRenderQueue()); -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h
r115 r139 112 112 @param octree the octant to be rendered (without children) 113 113 @param onlyShadowCasters if only shadow casters are rendered 114 @param leaveTransparentsInQueue if transparemtshould be left in queue for later processing114 @param passes if passes should be left in queue for later processing 115 115 */ 116 void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters, bool leaveTransparentsInQueue = false); 116 void _renderOctant(Camera* cam, Octree *octree, bool onlyShadowCasters, 117 const int leavePassesInQueue = 0); 117 118 118 119 /** Returns stored list of boxes */ -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
r135 r139 36 36 #include <OgreOctree.h> 37 37 #include <OgreOctreeNode.h> 38 #include <OgreLogManager.h> 38 39 39 40 namespace Ogre … … 109 110 mDepth = 0; 110 111 112 _updateBounds(); 111 113 #endif //GTP_VISIBILITY_MODIFIED_OGRE 112 114 mNumNodes = 0; … … 175 177 //mWireBoundingBox->setupBoundingBox(mBox); 176 178 mWireBoundingBox->setupBoundingBox(mWorldAABB); 179 177 180 return mWireBoundingBox; 178 181 } … … 229 232 // Reset bounds first 230 233 mWorldAABB.setNull(); 231 234 232 235 // Update bounds from own attached objects 233 236 NodeList::iterator it, it_end; … … 247 250 for (int k = 0; k < 2; ++k) 248 251 { 249 if (mChildren[i][j][k] != 0)252 if (mChildren[i][j][k]) 250 253 { 251 254 mWorldAABB.merge(mChildren[i][j][k]->_getWorldAABB()); … … 254 257 } 255 258 } 259 // HACK: clamp to bounds 260 AxisAlignedBox box; 261 _getCullBounds(&box); 262 mWorldAABB = mWorldAABB.intersection(box); 263 264 //std::stringstream d; d << "updating box: " << mWorldAABB << ", depth: " << mDepth << "null: " << mBox.isNull(); 265 //LogManager::getSingleton().logMessage(d.str()); 266 256 267 // recursively update parent bounds 257 268 if (mParent) -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
r135 r139 1176 1176 //----------------------------------------------------------------------- 1177 1177 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant, bool onlyShadowCasters, 1178 bool leaveTransparentsInQueue)//, bool useZPassQueue)1178 const int leavePassesInQueue) 1179 1179 { 1180 1180 // delete previously rendered objects from the render queue 1181 _deleteRenderedQueueGroups(leave TransparentsInQueue);1181 _deleteRenderedQueueGroups(leavePassesInQueue); 1182 1182 1183 1183 //Add stuff to be rendered; -
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreTerrainRenderable.cpp
r132 r139 388 388 if (mLastNextLevel != nextLevel) 389 389 { 390 //LogManager::getSingleton().logMessage("vbuffer binding"); 391 if (nextLevel > 0) 392 { 393 //LogManager::getSingleton().logMessage("level > 0"); 394 mTerrain->vertexBufferBinding->setBinding(DELTA_BINDING, 390 if (nextLevel > 0) 391 { 392 mTerrain->vertexBufferBinding->setBinding(DELTA_BINDING, 395 393 mDeltaBuffers[nextLevel - 1]); 396 394 } 397 395 else 398 { 399 //LogManager::getSingleton().logMessage("level <= 0 (dummy b)"); 396 { 400 397 // bind dummy (incase bindings checked) 401 398 mTerrain->vertexBufferBinding->setBinding(DELTA_BINDING, … … 406 403 407 404 } 408 //else LogManager::getSingleton().logMessage("no lod morph");409 /*std::stringstream d;410 d << "terrain: " << this->getName() << ", notify camera: " << cam->getName() << ", pos: " << StringConverter::toString(cam->getDerivedPosition()) <<411 ", distance: " << StringConverter::toString(L) << ", lod level: " << mLastNextLevel412 << ", render level: " << getRenderLevel() << ", morph factor: " << mLODMorphFactor;413 LogManager::getSingleton().logMessage(d.str());*/414 415 405 } 416 406 //-----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.