Changeset 74 for trunk/VUT/work
- Timestamp:
- 05/01/05 23:29:27 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/TestCulling.vcproj
r64 r74 21 21 Name="VCCLCompilerTool" 22 22 Optimization="0" 23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../include "24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS "23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../include;../../GtpVisibility/include" 24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 25 25 MinimalRebuild="TRUE" 26 26 BasicRuntimeChecks="3" … … 37 37 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCulling.exe" 38 38 LinkIncremental="2" 39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\ Debug";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug";"$(OGRE_PATH)\OgreMain\Lib\Debug";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib""39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib"" 40 40 GenerateDebugInformation="TRUE" 41 41 ProgramDatabaseFile="$(OutDir)/TestCulling.pdb" … … 66 66 <Configuration 67 67 Name="Release|Win32" 68 OutputDirectory=" Release"69 IntermediateDirectory=" Release"68 OutputDirectory=".\bin\$(ConfigurationName)" 69 IntermediateDirectory=".\obj\$(ConfigurationName)" 70 70 ConfigurationType="1" 71 71 CharacterSet="2"> 72 72 <Tool 73 73 Name="VCCLCompilerTool" 74 AdditionalIncludeDirectories=" ..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"75 PreprocessorDefinitions="_WINDOWS ,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"74 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../include;../../GtpVisibility/include" 75 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE" 76 76 RuntimeLibrary="2" 77 77 UsePrecompiledHeader="0" … … 83 83 <Tool 84 84 Name="VCLinkerTool" 85 AdditionalDependencies="OGREMain.LIB "86 OutputFile=" ..\..\..\Samples\Common\Bin\Release\TestCulling.exe"85 AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib" 86 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCulling.exe" 87 87 LinkIncremental="1" 88 AdditionalLibraryDirectories=" ..\..\..\OgreMain\Lib\Release"88 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib"" 89 89 GenerateDebugInformation="TRUE" 90 90 SubSystem="2" -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r61 r74 3 3 TestCullingApplication.cpp 4 4 \brief 5 Tests the occlusionculling algorithm5 Tests the visibility culling algorithm 6 6 */ 7 7 … … 15 15 #include "Ogre.h" 16 16 #include "TestCullingApplication.h" 17 //#include "OgreVisibilitySceneTraverser.h"18 17 19 18 #define WIN32_LEAN_AND_MEAN … … 93 92 //----------------------------------------------------------------------- 94 93 void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio, 95 const Vector3 &rotationRatio, const int idx, const String& entName) 94 const Vector3 &rotationRatio, 95 const int idx, 96 const String& entName) 96 97 { 97 98 Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 98 Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation); 99 Vector3 translation = mMinTranslation + 100 translationRatio * (mMaxTranslation - mMinTranslation); 99 101 100 102 char name[16]; 101 103 sprintf( name, "object%d", idx ); 102 104 103 Entity *ent = mSceneMgr->createEntity( name, entName ); 104 SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( String(name) + "Node", translation); 105 Entity *ent = mSceneMgr->createEntity(name, entName); 106 SceneNode *node = mSceneMgr->getRootSceneNode()-> 107 createChildSceneNode(String(name) + "Node", translation); 105 108 node->attachObject(ent); 106 109 node->scale(0.1,0.1,0.1); … … 150 153 mRotateSpeed *= 2; 151 154 152 mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT;155 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 153 156 mThreshold = 0; 154 157 … … 161 164 Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay"); 162 165 163 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo"); 164 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo"); 165 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo"); 166 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo"); 167 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo"); 168 mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo"); 169 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo"); 170 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo"); 166 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 167 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 168 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 169 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 170 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 171 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 172 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 171 173 172 174 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 175 177 mQueryCulledNodesInfo->setCaption(": 0"); 176 178 mTraversedNodesInfo->setCaption(": 0"); 177 mSceneNodesInfo->setCaption(": 0");178 179 mHierarchyNodesInfo->setCaption(": 0"); 179 180 mRenderedNodesInfo->setCaption(": 0"); … … 275 276 void MouseQueryListener::changeAlgorithm() 276 277 { 277 //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES;278 mCurrentAlgorithm = ++mCurrentAlgorithm % GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 278 279 279 280 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 295 296 mTraversedNodesInfo->setCaption(str); 296 297 297 mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 298 mSceneNodesInfo->setCaption(str); 299 300 mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 298 mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 301 299 mHierarchyNodesInfo->setCaption(str); 302 300 -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r61 r74 5 5 #include "CEGUIForwardRefs.h" 6 6 #include "ExampleApplication.h" 7 //#include "OgreVisibilitySceneTraverser.h"7 #include "VisibilityEnvironment.h" 8 8 9 9 … … 18 18 } 19 19 20 String mCurrentAlgorithmCaptions[ 3] =20 String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 21 21 { 22 " Cull Frustum",23 "Stop and Wait ",24 "Coherent OcclusionCulling"22 "View Frustum Culling", 23 "Stop and Wait Culling", 24 "Coherent Hierarchical Culling" 25 25 }; 26 26 … … 80 80 OverlayElement *mTraversedNodesInfo; 81 81 OverlayElement *mHierarchyNodesInfo; 82 OverlayElement *mSceneNodesInfo;83 82 OverlayElement *mRenderedNodesInfo; 84 83 }; -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp
r61 r74 3 3 TerrainContentGenerator.cpp 4 4 \brief 5 Creates content for the terrain ,5 Creates content for the terrain. 6 6 */ 7 7 #include "TerrainContentGenerator.h" 8 8 9 /********************************************/ 10 /* TerrainContentGenerator implementation */ 11 /********************************************/ 9 12 //----------------------------------------------------------------------- 10 13 TerrainContentGenerator::TerrainContentGenerator( SceneManager *sm, RayQueryExecutor *rayQueryEx ) … … 13 16 mRayQueryExecutor = rayQueryEx; 14 17 15 mMin Translation = Vector3(-70.0f, -70.0f,0.0f);16 mMax Translation = Vector3(70.0f, 70.0f, 600.0f);18 mMinPos = Vector3(-200.0f, -70.0f, 200.0f); 19 mMaxPos = Vector3(200.0f, 70.0f, 200.0f); 17 20 18 21 mMinAngle = 0; … … 48 51 // Setup the ray scene query 49 52 Real rotation = mMinAngle + rotationRatio.x * (mMaxAngle - mMinAngle); 50 Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);53 Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos); 51 54 52 translation.y = 5000;55 position.y = 5000; 53 56 54 57 Vector3 queryResult; 55 58 56 if(mRayQueryExecutor->executeRayQuery(&queryResult, translation, Vector3::NEGATIVE_UNIT_Y))59 if(mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 57 60 { 58 61 char name[16]; … … 60 63 61 64 Entity *ent = mSceneMgr->createEntity(name, entName); 62 SceneNode *currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", queryResult); 65 SceneNode *currentObject = mSceneMgr->getRootSceneNode()-> 66 createChildSceneNode(String(name) + "Node", queryResult); 63 67 currentObject->attachObject(ent); 64 68 currentObject->setScale(0.1f, 0.1f, 0.1f); 65 69 } 66 70 } 71 /****************************************/ 72 /* RayQueryExecutor implementation */ 73 /****************************************/ 67 74 //----------------------------------------------------------------------- 68 RayQueryExecutor::RayQueryExecutor( SceneManager *sm)75 RayQueryExecutor::RayQueryExecutor(SceneManager *sm) 69 76 { 70 77 mRaySceneQuery = sm->createRayQuery(Ray()); … … 76 83 } 77 84 //----------------------------------------------------------------------- 78 bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir)85 bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir) 79 86 { 80 Ray ray(pos, dir); 87 return executeRayQuery(result, Ray(pos, dir)); 88 } 89 90 bool RayQueryExecutor::executeRayQuery(Vector3 *result, const Ray &ray) 91 { 81 92 mRaySceneQuery->setRay(ray); 82 93 83 94 // Perform the scene query 84 95 RaySceneQueryResult &queryResult = mRaySceneQuery->execute(); 85 RaySceneQueryResult::iterator it = queryResult.begin( 96 RaySceneQueryResult::iterator it = queryResult.begin(); 86 97 87 98 if (it != queryResult.end() && it->worldFragment) -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h
r61 r74 5 5 #include "ExampleApplication.h" 6 6 7 /** Class which executes a simple ray query. 8 */ 7 9 class RayQueryExecutor 8 10 { 9 11 public: 10 RayQueryExecutor( SceneManager *sm ); 11 ~RayQueryExecutor( ); 12 bool executeRayQuery( Vector3 *result, const Vector3 &pos, const Vector3 &dir ); 12 RayQueryExecutor(SceneManager *sm); 13 ~RayQueryExecutor(); 14 15 bool executeRayQuery(Vector3 *result, const Vector3 &pos, const Vector3 &dir); 16 bool RayQueryExecutor::executeRayQuery( Vector3 *result, const Ray &ray); 17 13 18 protected: 14 19 RaySceneQuery *mRaySceneQuery; 15 20 }; 16 21 /** Class which fills a terrain with content in a random way. 22 */ 17 23 class TerrainContentGenerator 18 24 { 19 25 public: 20 TerrainContentGenerator( SceneManager *sm, RayQueryExecutor *rayQueryEx);26 TerrainContentGenerator(SceneManager *sm, RayQueryExecutor *rayQueryEx); 21 27 /** Generates a the scene hierarchy with random values . 22 @param number of objects to generate28 @param number of objects to generate 23 29 */ 24 void generateScene( int numObjects ); 25 /** 26 generates a new scene object 30 void generateScene(int numObjects); 31 /** Generates a new scene object 27 32 @param tranlationRatio ratio between minimal and maximal possible translation 28 33 @param rotationRatio ratio between minimal and maximal possible rotation … … 30 35 @entName the name of the object entity 31 36 */ 32 void generateSceneObject( 33 const int idx, const String &entName);37 void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 38 const int idx, const String &entName); 34 39 35 40 protected: … … 37 42 Real mMinAngle; 38 43 Real mMaxAngle; 39 Vector3 mMax Translation;40 Vector3 mMin Translation;44 Vector3 mMaxPos; 45 Vector3 mMinPos; 41 46 42 47 RayQueryExecutor *mRayQueryExecutor; -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj
r64 r74 21 21 Name="VCCLCompilerTool" 22 22 Optimization="0" 23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../ include"24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS "23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../../GtpVisibility/include;../include" 24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 25 25 MinimalRebuild="TRUE" 26 26 BasicRuntimeChecks="3" … … 37 37 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe" 38 38 LinkIncremental="2" 39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\ Debug";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug";"$(OGRE_PATH)\OgreMain\Lib\Debug";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib""39 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib"" 40 40 GenerateDebugInformation="TRUE" 41 41 ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb" … … 66 66 <Configuration 67 67 Name="Release|Win32" 68 OutputDirectory=" Release"69 IntermediateDirectory=" Release"68 OutputDirectory=".\bin\$(ConfigurationName)" 69 IntermediateDirectory=".\obj\$(ConfigurationName)" 70 70 ConfigurationType="1" 71 71 CharacterSet="2"> 72 72 <Tool 73 73 Name="VCCLCompilerTool" 74 AdditionalIncludeDirectories=" ..\..\..\Samples\Common\Include, ..\..\..\OgreMain\include"75 PreprocessorDefinitions="_WINDOWS ,_STLP_USE_DYNAMIC_LIB,OGRE_LIBRARY_IMPORTS,_RELEASE,WIN32,_STLP_RELEASE"74 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";../../GtpVisibility/include;../include" 75 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_RELEASE;WIN32;_STLP_RELEASE;GTP_VISIBILITY_MODIFIED_OGRE" 76 76 RuntimeLibrary="2" 77 77 UsePrecompiledHeader="0" … … 83 83 <Tool 84 84 Name="VCLinkerTool" 85 AdditionalDependencies="OGREMain.LIB "86 OutputFile=" ..\..\..\Samples\Common\Bin\Release\TestCullingTerrain.exe"85 AdditionalDependencies="OGREMain.LIB Plugin_OctreeSceneManager.lib CEGUIBase.lib OgreGUIRenderer.lib" 86 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCullingTerrain.exe" 87 87 LinkIncremental="1" 88 AdditionalLibraryDirectories=" ..\..\..\OgreMain\Lib\Release"88 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib"" 89 89 GenerateDebugInformation="TRUE" 90 90 SubSystem="2" -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r61 r74 3 3 TestCullingTerrainApplication.cpp 4 4 \brief 5 Tests the occlusionculling algorithm5 Tests the visibility culling algorithm 6 6 */ 7 7 … … 44 44 } 45 45 //----------------------------------------------------------------------- 46 void TestCullingTerrainApplication::generateSceneObject(const Vector3 &translationRatio,47 const Vector3 &rotationRatio, const int idx, const String& entName)48 {49 // Setup the ray scene query50 /*Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);51 Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);52 53 translation.y = 5000;54 Ray ray(translation, Vector3::NEGATIVE_UNIT_Y);55 mRaySceneQuery->setRay(ray);56 57 // Execute query58 RaySceneQueryResult &result = mRaySceneQuery->execute();59 RaySceneQueryResult::iterator itr = result.begin( );60 61 // Get results, create a node/entity on the position62 if ( itr != result.end() && itr->worldFragment )63 {64 char name[16];65 sprintf( name, "%s%d", entName.c_str(), mCount++ );66 67 Entity *ent = mSceneMgr->createEntity( name, entName );68 SceneNode currentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );69 currentObject->attachObject( ent );70 currentObject->setScale( 0.1f, 0.1f, 0.1f );71 }*/72 }73 74 //-----------------------------------------------------------------------75 46 void TestCullingTerrainApplication::createScene( void ) 76 47 { 77 48 mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 78 49 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr, mRayQueryExecutor); 50 79 51 // Set ambient light 80 52 mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); … … 111 83 terrain_cfg = mResourcePath + terrain_cfg; 112 84 #endif 113 mSceneMgr -> setWorldGeometry( terrain_cfg);85 mSceneMgr->setWorldGeometry(terrain_cfg); 114 86 // Infinite far plane? 115 87 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) … … 124 96 // CEGUI setup 125 97 setupGui(); 98 99 mTerrainContentGenerator->generateScene(100); 126 100 } 127 101 //----------------------------------------------------------------------- … … 149 123 void TestCullingTerrainApplication::chooseSceneManager(void) 150 124 { 151 //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);152 125 mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE); 153 126 } … … 171 144 mRotateSpeed *= 2; 172 145 173 mCurrentAlgorithm = 0;//VisibilitySceneTraverser::RENDER_COHERENT;146 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING, 174 147 mThreshold = 0; 175 148 … … 179 152 mEventProcessor->addKeyListener(this); 180 153 181 mRay SceneQuery = mSceneMgr->createRayQuery(Ray());154 mRayQueryExecutor = new RayQueryExecutor(mSceneMgr); 182 155 183 156 // show overlay 184 157 Overlay* pOver = OverlayManager::getSingleton().getByName("Example/VisibilityDemoOverlay"); 185 158 186 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/AlgorithmInfo"); 187 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/ThresholdInfo"); 188 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/FrustumCulledNodesInfo"); 189 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/QueryCulledNodesInfo"); 190 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/TraversedNodesInfo"); 191 mSceneNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/SceneNodesInfo"); 192 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/HierarchyNodesInfo"); 193 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Occlusion/RenderedNodesInfo"); 159 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 160 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 161 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 162 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); 163 mTraversedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/TraversedNodesInfo"); 164 mHierarchyNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/HierarchyNodesInfo"); 165 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 194 166 195 167 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 198 170 mQueryCulledNodesInfo->setCaption(": 0"); 199 171 mTraversedNodesInfo->setCaption(": 0"); 200 mSceneNodesInfo->setCaption(": 0");201 172 mHierarchyNodesInfo->setCaption(": 0"); 202 173 mRenderedNodesInfo->setCaption(": 0"); … … 207 178 MouseQueryListener::~MouseQueryListener( ) 208 179 { 209 delete mRay SceneQuery;180 delete mRayQueryExecutor; 210 181 } 211 182 //----------------------------------------------------------------------- … … 225 196 // Setup the ray scene query 226 197 Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() ); 227 mRaySceneQuery->setRay( mouseRay ); 228 229 // Execute query 230 RaySceneQueryResult &result = mRaySceneQuery->execute(); 231 RaySceneQueryResult::iterator itr = result.begin( ); 232 198 199 Vector3 queryResult; 233 200 // Get results, create a node/entity on the position 234 if ( itr != result.end() && itr->worldFragment)201 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay)) 235 202 { 236 203 char name[16]; 237 204 sprintf( name, "Robot%d", mCount++ ); 238 205 239 Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" ); 240 mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection ); 206 Entity *ent = mSceneMgr->createEntity(name, "robot.mesh"); 207 mCurrentObject = mSceneMgr->getRootSceneNode()-> 208 createChildSceneNode( String(name) + "Node", queryResult); 241 209 mCurrentObject->attachObject( ent ); 242 210 mCurrentObject->setScale( 0.1f, 0.1f, 0.1f ); … … 275 243 if ( mLMouseDown ) 276 244 { 277 Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() ); 278 mRaySceneQuery->setRay( mouseRay ); 279 280 RaySceneQueryResult &result = mRaySceneQuery->execute(); 281 RaySceneQueryResult::iterator itr = result.begin( ); 282 283 if ( itr != result.end() && itr->worldFragment ) 245 Vector3 queryResult; 246 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY()); 247 248 if(mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay)) 284 249 { 285 mCurrentObject->setPosition( itr->worldFragment->singleIntersection);286 } 250 mCurrentObject->setPosition(queryResult); 251 } 287 252 } 288 253 // If we are dragging the right mouse button. … … 297 262 { 298 263 // clamp to terrain 299 Vector3 camPos = mCamera->getPosition( ); 300 Ray cameraRay( Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y ); 301 mRaySceneQuery->setRay( cameraRay ); 302 303 // Perform the scene query 304 RaySceneQueryResult &queryResult = mRaySceneQuery->execute(); 305 RaySceneQueryResult::iterator it = queryResult.begin( ); 306 307 if (it != queryResult.end() && it->worldFragment) 264 Vector3 camPos = mCamera->getPosition(); 265 Vector3 queryResult; 266 267 if(mRayQueryExecutor->executeRayQuery(&queryResult, 268 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 308 269 { 309 SceneQuery::WorldFragment* wf = it->worldFragment; 310 311 mCamera->setPosition(mCamera->getPosition().x, wf->singleIntersection.y + 10, 270 mCamera->setPosition(mCamera->getPosition().x, queryResult.y + 10, 312 271 mCamera->getPosition().z); 313 272 } … … 347 306 void MouseQueryListener::changeAlgorithm() 348 307 { 349 //mCurrentAlgorithm = ++mCurrentAlgorithm % VisibilitySceneTraverser::NUM_RENDERMODES; 308 mCurrentAlgorithm = ++mCurrentAlgorithm % 309 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS, 350 310 351 311 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 367 327 mTraversedNodesInfo->setCaption(str); 368 328 369 mSceneMgr->getOption("NumSceneNodes", &opt); sprintf(str,": %d", opt); 370 mSceneNodesInfo->setCaption(str); 371 372 mSceneMgr->getOption("NumOctreeNodes", &opt); sprintf(str,": %d", opt); 329 mSceneMgr->getOption("NumHierarchyNodes", &opt); sprintf(str,": %d", opt); 373 330 mHierarchyNodesInfo->setCaption(str); 374 331 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r61 r74 6 6 #include "ExampleApplication.h" 7 7 #include "TerrainContentGenerator.h" 8 #include "VisibilityEnvironment.h" 8 9 9 10 Real timeDelay = 0; … … 17 18 } 18 19 19 String mCurrentAlgorithmCaptions[ 3/*VisibilitySceneTraverser::NUM_RENDERMODES*/] =20 String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] = 20 21 { 21 " Cull Frustum",22 "Stop and Wait ",23 "Coherent OcclusionCulling"22 "View Frustum Culling", 23 "Stop and Wait Culling", 24 "Coherent Hierarchical Culling" 24 25 }; 25 26 … … 83 84 84 85 SceneNode *mCurrentObject; // The newly created object 85 RaySceneQuery *mRaySceneQuery; // The ray scene query pointer86 86 int mCount; // The number of robots on the screen 87 87 … … 101 101 virtual void createCamera(void); 102 102 103 /**104 generates a new scene object105 @param tranlationRatio ratio between minimal and maximal possible translation106 @param rotationRatio ratio between minimal and maximal possible rotation107 @idx the index of the new object108 @entName the name of the object entity109 */110 void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,111 const int idx, const String &entName);112 113 103 CEGUI::OgreCEGUIRenderer *mGUIRenderer; 114 104 CEGUI::System *mGUISystem; -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreSceneManager.h
r61 r74 130 130 */ 131 131 void _renderSceneNode( Camera *cam, SceneNode *node ); 132 133 132 /** deletes all queues which we were currently processing 134 133 @remark clears renderqueue after rendering scene node 135 134 */ 136 135 void _deleteRenderedQueueGroups(); 137 138 139 void myrenderSingleObject(Renderable* rend, Pass* pass, bool doLightIteration, 140 const LightList* manualLightList = 0) 141 { 142 setPass(pass); 143 renderSingleObject(rend, pass, doLightIteration, manualLightList);} 144 136 /** Internal method used by _renderVisibleObjects to deal with renderables 137 which override the camera's own view / projection materices. 138 @remark made public by matt 139 */ 140 void useRenderableViewProjMode(Renderable* pRend); 141 /** Method for setting up the renderstate for a rendering pass. 142 @param 143 pass The Pass details to set. 144 @returns 145 A Pass object that was used instead of the one passed in, can 146 happen when rendering shadow passes 147 @remark made public by matt 148 */ 149 virtual Pass* setPass(Pass* pass); 145 150 #endif // GTP_VISIBILITY_MODIFIED_OGRE 146 /** Internal method used by _renderVisibleObjects to deal with renderables 147 which override the camera's own view / projection materices. made 148 public by matt */ 149 void useRenderableViewProjMode(Renderable* pRend); 150 151 151 152 protected: 152 153 … … 250 251 /** Retrieves the internal render queue. */ 251 252 virtual RenderQueue* getRenderQueue(void); 253 #ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section 252 254 /** Internal method for setting up the renderstate for a rendering pass. 253 255 @param … … 258 260 */ 259 261 virtual Pass* setPass(Pass* pass); 262 #endif 260 263 /// A pass designed to let us render shadow colour on white for texture shadows 261 264 Pass* mShadowCasterPlainBlackPass; … … 332 335 AnimationList mAnimationsList; 333 336 AnimationStateSet mAnimationStates; 334 337 #ifndef GTP_VISIBILITY_MODIFIED_OGRE // made public, is found in the modfified section 338 /** Internal method used by _renderVisibleObjects to deal with renderables 339 which override the camera's own view / projection materices. */ 340 void useRenderableViewProjMode(Renderable* pRend); 341 #endif 335 342 /// Controller flag for determining if we need to set view/proj matrices 336 343 bool mCamChanged;
Note: See TracChangeset
for help on using the changeset viewer.