Proper fix to #94 (finally!!!!)
It was so simple, wasn't it? Additionaly: * fixed texture recoloring after changing texture settings while simulation is running * fixed annoying "could not open textures/shadow*.png" messages * don't ChangeColor() if not in simulation to reduce lag in settingsmaster
parent
7b3ae32626
commit
5593f427f6
|
@ -2246,6 +2246,9 @@ bool CEngine::LoadAllTextures()
|
||||||
|
|
||||||
m_planet->LoadTexture();
|
m_planet->LoadTexture();
|
||||||
|
|
||||||
|
m_firstGroundSpot = true;
|
||||||
|
UpdateGroundSpotTextures();
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
for (int objRank = 0; objRank < static_cast<int>( m_objects.size() ); objRank++)
|
for (int objRank = 0; objRank < static_cast<int>( m_objects.size() ); objRank++)
|
||||||
|
@ -2444,6 +2447,9 @@ bool CEngine::ChangeTextureColor(const std::string& texName,
|
||||||
m_texNameMap[texName] = tex;
|
m_texNameMap[texName] = tex;
|
||||||
m_revTexNameMap[tex] = texName;
|
m_revTexNameMap[tex] = texName;
|
||||||
|
|
||||||
|
// This updates the texture to updated Texture struct on the objects
|
||||||
|
LoadAllTextures();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2824,14 +2830,12 @@ float CEngine::GetGadgetQuantity()
|
||||||
|
|
||||||
void CEngine::SetTextureFilterMode(TexFilter value)
|
void CEngine::SetTextureFilterMode(TexFilter value)
|
||||||
{
|
{
|
||||||
bool changed = m_defaultTexParams.filter != value || m_terrainTexParams.filter != value;
|
if(m_defaultTexParams.filter == value && m_terrainTexParams.filter == value) return;
|
||||||
|
|
||||||
m_defaultTexParams.filter = m_terrainTexParams.filter = value;
|
m_defaultTexParams.filter = m_terrainTexParams.filter = value;
|
||||||
m_defaultTexParams.mipmap = m_terrainTexParams.mipmap = (value == TEX_FILTER_TRILINEAR);
|
m_defaultTexParams.mipmap = m_terrainTexParams.mipmap = (value == TEX_FILTER_TRILINEAR);
|
||||||
if(changed)
|
ResetAfterDeviceChanged();
|
||||||
{
|
CRobotMain::GetInstancePointer()->ChangeColor();
|
||||||
FlushTextureCache();
|
|
||||||
LoadAllTextures();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TexFilter CEngine::GetTextureFilterMode()
|
TexFilter CEngine::GetTextureFilterMode()
|
||||||
|
@ -2843,14 +2847,11 @@ void CEngine::SetTextureMipmapLevel(int value)
|
||||||
{
|
{
|
||||||
if (value < 1) value = 1;
|
if (value < 1) value = 1;
|
||||||
if (value > 16) value = 16;
|
if (value > 16) value = 16;
|
||||||
|
if(m_textureMipmapLevel == value) return;
|
||||||
|
|
||||||
bool changed = m_textureMipmapLevel != value;
|
|
||||||
m_textureMipmapLevel = value;
|
m_textureMipmapLevel = value;
|
||||||
if(changed)
|
ResetAfterDeviceChanged();
|
||||||
{
|
CRobotMain::GetInstancePointer()->ChangeColor();
|
||||||
FlushTextureCache();
|
|
||||||
LoadAllTextures();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEngine::GetTextureMipmapLevel()
|
int CEngine::GetTextureMipmapLevel()
|
||||||
|
@ -2863,13 +2864,11 @@ void CEngine::SetTextureAnisotropyLevel(int value)
|
||||||
if (value < 1) value = 1;
|
if (value < 1) value = 1;
|
||||||
if (value > 16) value = 16;
|
if (value > 16) value = 16;
|
||||||
|
|
||||||
bool changed = m_textureAnisotropy != value;
|
if(m_textureAnisotropy == value) return;
|
||||||
|
|
||||||
m_textureAnisotropy = value;
|
m_textureAnisotropy = value;
|
||||||
if(changed)
|
ResetAfterDeviceChanged();
|
||||||
{
|
CRobotMain::GetInstancePointer()->ChangeColor();
|
||||||
FlushTextureCache();
|
|
||||||
LoadAllTextures();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEngine::GetTextureAnisotropyLevel()
|
int CEngine::GetTextureAnisotropyLevel()
|
||||||
|
|
|
@ -2822,10 +2822,6 @@ void CRobotMain::ScenePerso()
|
||||||
m_lightMan->FlushLights();
|
m_lightMan->FlushLights();
|
||||||
m_particle->FlushParticle();
|
m_particle->FlushParticle();
|
||||||
|
|
||||||
|
|
||||||
ChangeColor();
|
|
||||||
|
|
||||||
|
|
||||||
m_dialog->SetLevel(LevelCategory::Perso, 0, 0);
|
m_dialog->SetLevel(LevelCategory::Perso, 0, 0);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -3910,7 +3906,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
m_build |= BUILD_FLAG;
|
m_build |= BUILD_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetObject && !fixScene)
|
if (!resetObject)
|
||||||
{
|
{
|
||||||
ChangeColor(); // changes the colors of texture
|
ChangeColor(); // changes the colors of texture
|
||||||
m_short->SetMode(false); // vehicles?
|
m_short->SetMode(false); // vehicles?
|
||||||
|
@ -4022,6 +4018,16 @@ int CRobotMain::CreateSpot(Math::Vector pos, Gfx::Color color)
|
||||||
//! Change the colors and textures
|
//! Change the colors and textures
|
||||||
void CRobotMain::ChangeColor()
|
void CRobotMain::ChangeColor()
|
||||||
{
|
{
|
||||||
|
if (m_phase != PHASE_SIMUL &&
|
||||||
|
m_phase != PHASE_SETUPds &&
|
||||||
|
m_phase != PHASE_SETUPgs &&
|
||||||
|
m_phase != PHASE_SETUPps &&
|
||||||
|
m_phase != PHASE_SETUPcs &&
|
||||||
|
m_phase != PHASE_SETUPss &&
|
||||||
|
m_phase != PHASE_WIN &&
|
||||||
|
m_phase != PHASE_LOST &&
|
||||||
|
m_phase != PHASE_APPERANCE ) return;
|
||||||
|
|
||||||
Math::Point ts = Math::Point(0.0f, 0.0f);
|
Math::Point ts = Math::Point(0.0f, 0.0f);
|
||||||
Math::Point ti = Math::Point(1.0f, 1.0f); // the entire image
|
Math::Point ti = Math::Point(1.0f, 1.0f); // the entire image
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue