mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 21:42:13 +00:00
fixed a terrain-related Redemption crash
This commit is contained in:
parent
2d2af4b28a
commit
557e97bab4
@ -14,7 +14,7 @@ namespace MWRender
|
|||||||
{
|
{
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
TerrainManager::TerrainManager(Ogre::SceneManager* mgr, const MWWorld::Environment& evn) :
|
TerrainManager::TerrainManager(Ogre::SceneManager* mgr, const MWWorld::Environment& evn) :
|
||||||
mEnvironment(evn), mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize))
|
mEnvironment(evn), mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize))
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@ namespace MWRender
|
|||||||
//due to the sudden flick between composite and non composite textures,
|
//due to the sudden flick between composite and non composite textures,
|
||||||
//this seemed the distance where it wasn't too noticeable
|
//this seemed the distance where it wasn't too noticeable
|
||||||
mTerrainGlobals.setCompositeMapDistance(mWorldSize*2);
|
mTerrainGlobals.setCompositeMapDistance(mWorldSize*2);
|
||||||
|
|
||||||
mActiveProfile->setLightmapEnabled(false);
|
mActiveProfile->setLightmapEnabled(false);
|
||||||
mActiveProfile->setLayerSpecularMappingEnabled(false);
|
mActiveProfile->setLayerSpecularMappingEnabled(false);
|
||||||
mActiveProfile->setLayerNormalMappingEnabled(false);
|
mActiveProfile->setLayerNormalMappingEnabled(false);
|
||||||
@ -73,16 +73,16 @@ namespace MWRender
|
|||||||
TerrainManager::~TerrainManager()
|
TerrainManager::~TerrainManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void TerrainManager::setDiffuse(const ColourValue& diffuse)
|
void TerrainManager::setDiffuse(const ColourValue& diffuse)
|
||||||
{
|
{
|
||||||
mTerrainGlobals.setCompositeMapDiffuse(diffuse);
|
mTerrainGlobals.setCompositeMapDiffuse(diffuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void TerrainManager::setAmbient(const ColourValue& ambient)
|
void TerrainManager::setAmbient(const ColourValue& ambient)
|
||||||
{
|
{
|
||||||
mTerrainGlobals.setCompositeMapAmbient(ambient);
|
mTerrainGlobals.setCompositeMapAmbient(ambient);
|
||||||
@ -160,7 +160,7 @@ namespace MWRender
|
|||||||
numTextures,
|
numTextures,
|
||||||
indexes);
|
indexes);
|
||||||
|
|
||||||
if ( land->landData->usingColours )
|
if ( land && land->landData->usingColours )
|
||||||
{
|
{
|
||||||
// disable or enable global colour map (depends on available vertex colours)
|
// disable or enable global colour map (depends on available vertex colours)
|
||||||
mActiveProfile->setGlobalColourMapEnabled(true);
|
mActiveProfile->setGlobalColourMapEnabled(true);
|
||||||
@ -253,7 +253,7 @@ namespace MWRender
|
|||||||
|
|
||||||
assert( (int)mEnvironment.mWorld->getStore().landTexts.getSize() >= (int)ltexIndex - 1 &&
|
assert( (int)mEnvironment.mWorld->getStore().landTexts.getSize() >= (int)ltexIndex - 1 &&
|
||||||
"LAND.VTEX must be within the bounds of the LTEX array");
|
"LAND.VTEX must be within the bounds of the LTEX array");
|
||||||
|
|
||||||
std::string texture;
|
std::string texture;
|
||||||
if ( ltexIndex == 0 )
|
if ( ltexIndex == 0 )
|
||||||
{
|
{
|
||||||
@ -359,7 +359,7 @@ namespace MWRender
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//this provides a transition shading but also
|
//this provides a transition shading but also
|
||||||
//rounds off the corners slightly
|
//rounds off the corners slightly
|
||||||
pBlend[index] = std::min(1.0f, pBlend[index] + 0.5f);
|
pBlend[index] = std::min(1.0f, pBlend[index] + 0.5f);
|
||||||
}
|
}
|
||||||
@ -458,10 +458,10 @@ namespace MWRender
|
|||||||
TEX_TYPE_2D, size, size, 0, PF_BYTE_BGR);
|
TEX_TYPE_2D, size, size, 0, PF_BYTE_BGR);
|
||||||
|
|
||||||
HardwarePixelBufferSharedPtr pixelBuffer = tex->getBuffer();
|
HardwarePixelBufferSharedPtr pixelBuffer = tex->getBuffer();
|
||||||
|
|
||||||
pixelBuffer->lock(HardwareBuffer::HBL_DISCARD);
|
pixelBuffer->lock(HardwareBuffer::HBL_DISCARD);
|
||||||
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
|
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
|
||||||
|
|
||||||
uint8* pDest = static_cast<uint8*>(pixelBox.data);
|
uint8* pDest = static_cast<uint8*>(pixelBox.data);
|
||||||
|
|
||||||
if ( land != NULL )
|
if ( land != NULL )
|
||||||
@ -501,7 +501,7 @@ namespace MWRender
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pixelBuffer->unlock();
|
pixelBuffer->unlock();
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
|
Loading…
Reference in New Issue
Block a user