mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-28 17:56:37 +00:00 
			
		
		
		
	Bug #618: Make local map textures static in an attempt to fix the disappearing maps with D3D.
Also removed problematic DISCARDABLE flag for fog of war textures.
This commit is contained in:
		
							parent
							
								
									c98bea2a88
								
							
						
					
					
						commit
						c39a0368cf
					
				
					 2 changed files with 30 additions and 18 deletions
				
			
		|  | @ -44,6 +44,24 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManag | |||
|     mLight->setDirection (Ogre::Vector3(0.3, 0.3, -0.7)); | ||||
|     mLight->setVisible (false); | ||||
|     mLight->setDiffuseColour (ColourValue(0.7,0.7,0.7)); | ||||
| 
 | ||||
|     mRenderTexture = TextureManager::getSingleton().createManual( | ||||
|                     "localmap/rtt", | ||||
|                     ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, | ||||
|                     TEX_TYPE_2D, | ||||
|                     sMapResolution, sMapResolution, | ||||
|                     0, | ||||
|                     PF_R8G8B8, | ||||
|                     TU_RENDERTARGET); | ||||
| 
 | ||||
|     mRenderTarget = mRenderTexture->getBuffer()->getRenderTarget(); | ||||
|     mRenderTarget->setAutoUpdated(false); | ||||
|     Viewport* vp = mRenderTarget->addViewport(mCellCamera); | ||||
|     vp->setOverlaysEnabled(false); | ||||
|     vp->setShadowsEnabled(false); | ||||
|     vp->setBackgroundColour(ColourValue(0, 0, 0)); | ||||
|     vp->setVisibilityMask(RV_Map); | ||||
|     vp->setMaterialScheme("local_map"); | ||||
| } | ||||
| 
 | ||||
| LocalMap::~LocalMap() | ||||
|  | @ -318,7 +336,7 @@ Ogre::TexturePtr LocalMap::createFogOfWarTexture(const std::string &texName) | |||
|                         sFogOfWarResolution, sFogOfWarResolution, | ||||
|                         0, | ||||
|                         PF_A8R8G8B8, | ||||
|                         TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); | ||||
|                         TU_DYNAMIC_WRITE_ONLY); | ||||
|     } | ||||
|     else | ||||
|         tex->unload(); | ||||
|  | @ -378,26 +396,17 @@ void LocalMap::render(const float x, const float y, | |||
|     if (tex.isNull()) | ||||
|     { | ||||
|         // render
 | ||||
|         tex = TextureManager::getSingleton().createManual( | ||||
|         mRenderTarget->update(); | ||||
| 
 | ||||
|         // create a new texture and blit to it
 | ||||
|         Ogre::TexturePtr tex = TextureManager::getSingleton().createManual( | ||||
|                         texture, | ||||
|                         ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, | ||||
|                         TEX_TYPE_2D, | ||||
|                         xw*sMapResolution/sSize, yw*sMapResolution/sSize, | ||||
|                         sMapResolution, sMapResolution, | ||||
|                         0, | ||||
|                         PF_R8G8B8, | ||||
|                         TU_RENDERTARGET); | ||||
| 
 | ||||
|         RenderTarget* rtt = tex->getBuffer()->getRenderTarget(); | ||||
| 
 | ||||
|         rtt->setAutoUpdated(false); | ||||
|         Viewport* vp = rtt->addViewport(mCellCamera); | ||||
|         vp->setOverlaysEnabled(false); | ||||
|         vp->setShadowsEnabled(false); | ||||
|         vp->setBackgroundColour(ColourValue(0, 0, 0)); | ||||
|         vp->setVisibilityMask(RV_Map); | ||||
|         vp->setMaterialScheme("local_map"); | ||||
| 
 | ||||
|         rtt->update(); | ||||
|                         PF_R8G8B8); | ||||
|         tex->getBuffer()->blit(mRenderTexture->getBuffer()); | ||||
|     } | ||||
| 
 | ||||
|     mRenderingManager->enableLights(true); | ||||
|  |  | |||
|  | @ -84,7 +84,6 @@ namespace MWRender | |||
|         OEngine::Render::OgreRenderer* mRendering; | ||||
|         MWRender::RenderingManager* mRenderingManager; | ||||
| 
 | ||||
|         // 1024*1024 pixels for a cell
 | ||||
|         static const int sMapResolution = 512; | ||||
| 
 | ||||
|         // the dynamic texture is a bottleneck, so don't set this too high
 | ||||
|  | @ -126,6 +125,10 @@ namespace MWRender | |||
|         // Both interior and exterior maps are possibly divided into multiple textures.
 | ||||
|         std::map <std::string, std::vector<Ogre::uint32> > mBuffers; | ||||
| 
 | ||||
|         // The render texture we will use to create the map images
 | ||||
|         Ogre::TexturePtr mRenderTexture; | ||||
|         Ogre::RenderTarget* mRenderTarget; | ||||
| 
 | ||||
|         bool mInterior; | ||||
|         int mCellX, mCellY; | ||||
|         Ogre::AxisAlignedBox mBounds; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue