- Timestamp:
- 05/13/05 15:14:12 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgreSolidBoundingBox.h
r92 r97 32 32 /** 33 33 Sets the material used for occlusion queries. 34 @remark the material is called " OcclusionQuery" and34 @remark the material is called "QueryMaterial" and 35 35 uses no lighting, no depth write, and no colours 36 36 */ -
trunk/VUT/Ogre/include/OgreSolidHalfBoundingBox.h
r92 r97 32 32 /** 33 33 Sets the material used for occlusion queries. 34 @remark the material is called " OcclusionQuery" and34 @remark the material is called "QueryMaterial" and 35 35 uses no lighting, no depth write, and no colours 36 36 */ -
trunk/VUT/Ogre/src/OgreSolidBoundingBox.cpp
r94 r97 119 119 void SolidBoundingBox::SetOcclusionQueryMaterial() 120 120 { 121 m_pMaterial = MaterialManager::getSingleton().getByName(" OcclusionQuery");121 m_pMaterial = MaterialManager::getSingleton().getByName("QueryMaterial"); 122 122 123 123 if(m_pMaterial.isNull()) 124 124 { 125 125 m_pMaterial = MaterialManager::getSingleton(). 126 create(" OcclusionQuery", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);126 create("QueryMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 127 127 128 128 m_pMaterial->setColourWriteEnabled(false); … … 131 131 } 132 132 133 setMaterial(" OcclusionQuery");133 setMaterial("QueryMaterial"); 134 134 } 135 135 -
trunk/VUT/Ogre/src/OgreSolidHalfBoundingBox.cpp
r91 r97 87 87 void SolidHalfBoundingBox::SetOcclusionQueryMaterial( void ) 88 88 { 89 m_pMaterial = MaterialManager::getSingleton().getByName(" OcclusionQuery");89 m_pMaterial = MaterialManager::getSingleton().getByName("QueryMaterial"); 90 90 91 91 if(m_pMaterial.isNull()) 92 92 { 93 93 m_pMaterial = MaterialManager::getSingleton(). 94 create(" OcclusionQuery", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);94 create("QueryMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 95 95 } 96 96 … … 99 99 m_pMaterial->setLightingEnabled(false); 100 100 101 setMaterial(" OcclusionQuery");101 setMaterial("QueryMaterial"); 102 102 } 103 103 -
trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp
r87 r97 1 1 #include "TerrainContentGenerator.h" 2 #include <windows.h>3 2 4 3 namespace Ogre { -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r94 r97 27 27 if(mTerrainContentGenerator) 28 28 delete mTerrainContentGenerator; 29 //if(mVisualizationCamera) delete mVisualizationCamera;30 29 } 31 30 //----------------------------------------------------------------------- … … 83 82 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000, false); 84 83 //mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8, 500, false ); 85 86 /* // Define the required skyplane87 Plane plane;88 // 5000 world units from the camera89 plane.d = 5000;90 // Above the camera, facing down91 plane.normal = -Vector3::UNIT_Y;92 // Create the plane 10000 units wide, tile the texture 3 times93 mSceneMgr->setSkyPlane(true, plane, "Examples/SpaceSkyPlane",10000,3);*/94 84 95 85 std::string terrain_cfg("terrain.cfg"); -
trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9HardwareOcclusionQuery.cpp
r88 r97 71 71 } 72 72 73 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 73 74 //------------------------------------------------------------------ 74 75 // Occlusion query functions (see base class documentation for this) … … 78 79 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 79 80 { 80 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 81 } 82 } 83 //------------------------------------------------------------------ 81 if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 82 83 if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 84 { 85 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 86 } 87 } 88 } 89 84 90 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 85 91 { 86 92 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 87 93 { 88 m_pD3DQuery->Issue(D3DISSUE_END); 94 if (m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 95 { 96 m_pD3DQuery->Issue(D3DISSUE_END); 97 } 98 m_SkipCounter++; // The skip counter is increased 89 99 } 90 100 } … … 95 105 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 96 106 //-- 97 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ) 98 { 99 return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 107 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments) 108 { 109 HRESULT hr; 110 111 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 112 { 113 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 114 115 if ( hr != S_OK ) 116 { 117 return false; 118 } 119 else 120 { 121 m_uintPixelCount = *NumOfFragments; 122 return true; 123 } 124 } 125 else 126 { 127 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 128 return true; 129 } 100 130 } 101 131 … … 106 136 // Note: OpenGL dosn't use this flag at all so the application running OpenGL won't display any different behaviour. 107 137 //-- 138 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ) 139 { 140 HRESULT hr; 141 142 // TO DO: USE lockOpts= D3D9Mappings::get(options); instead of RS_OCCLUSIONQUERY enum 143 144 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 145 { 146 147 switch( flag ) 148 { 149 case HWOCCLUSIONQUERY_FLUSH : 150 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), D3DGETDATA_FLUSH ); 151 break; 152 153 case HWOCCLUSIONQUERY_NOFLUSH : 154 hr = m_pD3DQuery->GetData( NumOfFragments, sizeof( NumOfFragments ), 0 ); 155 break; 156 }; 157 158 159 160 if ( hr != S_OK ) 161 { 162 return false; 163 } 164 else 165 { 166 m_uintPixelCount = *NumOfFragments; 167 return true; 168 } 169 } 170 else 171 { 172 m_uintPixelCount = 100000; // Fails quitlly if hardware occlusion is not supported - every object is visable 173 return true; 174 } 175 } 176 #else // GTP_VISIBILITY_MODIFIED_OGRE 177 //------------------------------------------------------------------ 178 void D3D9HardwareOcclusionQuery::beginOcclusionQuery() 179 { 180 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 181 { 182 m_pD3DQuery->Issue(D3DISSUE_BEGIN); 183 } 184 } 185 //------------------------------------------------------------------ 186 void D3D9HardwareOcclusionQuery::endOcclusionQuery() 187 { 188 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 189 { 190 m_pD3DQuery->Issue(D3DISSUE_END); 191 } 192 } 193 //------------------------------------------------------------------ 194 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ) 195 { 196 return pullOcclusionQuery(NumOfFragments, waitForResult, HWOCCLUSIONQUERY_FLUSH); 197 } 198 199 //------------------------------------------------------------------ 108 200 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 109 201 const HW_OCCLUSIONQUERY flag ) … … 114 206 return pullOcclusionQuery(NumOfFragments, waitForResult, queryFlag); 115 207 } 208 116 209 //------------------------------------------------------------------ 117 210 bool D3D9HardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, … … 137 230 return hr == S_OK; 138 231 } 232 233 234 #endif // GTP_VISIBILITY_MODIFIED_OGRE 235 139 236 } // namespace OGre -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp
r88 r97 50 50 */ 51 51 52 52 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 53 53 /** 54 54 * Default object constructor … … 95 95 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 96 96 { 97 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 97 if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 98 if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 99 { 100 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 101 } 98 102 } 99 103 } … … 103 107 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 104 108 { 105 glEndOcclusionQueryNV_ptr(); 106 } 107 } 108 109 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult) 110 { 111 unsigned int isAvailable = GL_TRUE; 112 113 if( m_bHWOcclusionSupport ) 114 { 115 if(!waitForResult) 116 { 117 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable ); 118 } 119 120 if(isAvailable == GL_TRUE) 121 { 122 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 123 } 109 if( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 110 { 111 glEndOcclusionQueryNV_ptr(); 112 } 113 m_SkipCounter++; 114 } 115 } 116 117 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments) 118 { 119 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 120 { 121 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 124 122 } 125 123 else 126 124 { 127 // In case hardware occlusion isn't supported, every object is set visible. 128 *NumOfFragments = 100000; 125 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable. 129 126 } 130 127 131 128 m_uintPixelCount = *NumOfFragments; 132 129 133 return isAvailable == GL_TRUE;134 } 135 136 //------------------------------------------------------------------ 137 // OpenGL do esn't use the flag, but to implementthe abstract interface we need to include this function.130 return true; 131 } 132 133 //------------------------------------------------------------------ 134 // OpenGL dosn't use the flag, but to fulfil the abstract interface we need to include this function. 138 135 // Using this function in OpenGL mode simple works the same way as calling the other function without the flag parameter, 139 136 // but in DX9 it works differentlly, see notes in the DX9 implementation. 140 137 //-- 138 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ) 139 { 140 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 141 { 142 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 143 } 144 else 145 { 146 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable. 147 } 148 149 m_uintPixelCount = *NumOfFragments; 150 151 return true; 152 } 153 154 #else // GTP_VISIBILITY_MODIFIED_OGRE 155 156 //------------------------------------------------------------------ 157 GLHardwareOcclusionQuery::GLHardwareOcclusionQuery() 158 { 159 m_uintPixelCount = 0; 160 m_SkipCounter = 0; 161 162 // Check for hardware occlusion support 163 // if( glDeleteOcclusionQueriesNV_ptr != 0 ) // This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported. 164 if( glDeleteQueriesARB_ptr != 0 ) 165 { 166 m_bHWOcclusionSupport = true; 167 } 168 else 169 { 170 m_bHWOcclusionSupport = false; 171 } 172 173 if( m_bHWOcclusionSupport ) 174 { 175 //glGenOcclusionQueriesNV_ptr( 1, m_uintQuery ); 176 glGenQueriesARB_ptr(1, m_uintQuery); 177 } 178 } 179 180 181 //------------------------------------------------------------------ 182 GLHardwareOcclusionQuery::~GLHardwareOcclusionQuery() 183 { 184 if( m_bHWOcclusionSupport ) 185 { 186 //glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] ); 187 glDeleteQueriesARB_ptr(1, &m_uintQuery[0]); 188 } 189 } 190 191 //------------------------------------------------------------------ 192 void GLHardwareOcclusionQuery::beginOcclusionQuery() 193 { 194 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 195 { 196 // do the actual occlusion query for this node 197 //glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 198 glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, m_uintQuery[0]); 199 } 200 } 201 202 void GLHardwareOcclusionQuery::endOcclusionQuery() 203 { 204 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 205 { 206 //glEndOcclusionQueryNV_ptr(); 207 glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB); 208 } 209 } 210 //------------------------------------------------------------------ 211 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult) 212 { 213 //unsigned int isAvailable = GL_TRUE; 214 int isAvailable = GL_TRUE; 215 216 if( m_bHWOcclusionSupport ) 217 { 218 if(!waitForResult) 219 { 220 //glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable ); 221 glGetQueryivARB_ptr(m_uintQuery[0], GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable); 222 } 223 224 if(isAvailable == GL_TRUE) 225 { 226 glGetQueryObjectuivARB_ptr( m_uintQuery[0], GL_QUERY_RESULT_ARB, NumOfFragments); 227 //glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 228 } 229 } 230 else 231 { 232 // In case hardware occlusion isn't supported, every object is set visible. 233 *NumOfFragments = 100000; 234 } 235 236 m_uintPixelCount = *NumOfFragments; 237 238 return isAvailable == GL_TRUE; 239 } 240 241 //------------------------------------------------------------------ 141 242 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag ) 142 243 { … … 144 245 } 145 246 146 } 147 148 247 #endif // GTP_VISIBILITY_MODIFIED_OGRE 248 249 250 } 251 252
Note: See TracChangeset
for help on using the changeset viewer.