Fix crash if skybox / SH shares textures from track
This commit is contained in:
parent
57e16dcb73
commit
d57841bcb8
@ -161,8 +161,10 @@ void Skybox::generateCubeMapFromTextures()
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
{
|
||||
unsigned idx = texture_permutation[i];
|
||||
static_cast<STKTexture*>(m_skybox_textures[idx])->getTextureImage()
|
||||
->copyToScaling(rgba[i], size, size);
|
||||
video::IImage* img = static_cast<STKTexture*>
|
||||
(m_skybox_textures[idx])->getTextureImage();
|
||||
assert(img != NULL);
|
||||
img->copyToScaling(rgba[i], size, size);
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
for (unsigned int j = 0; j < size * size; j++)
|
||||
|
@ -406,8 +406,10 @@ void SphericalHarmonics::setTextures(const std::vector<video::ITexture *> &spher
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
{
|
||||
unsigned idx = texture_permutation[i];
|
||||
static_cast<STKTexture*>(m_spherical_harmonics_textures[idx])
|
||||
->getTextureImage()->copyToScaling(sh_rgba[i], sh_w, sh_h);
|
||||
video::IImage* img = static_cast<STKTexture*>
|
||||
(m_spherical_harmonics_textures[idx])->getTextureImage();
|
||||
assert(img != NULL);
|
||||
img->copyToScaling(sh_rgba[i], sh_w, sh_h);
|
||||
} //for (unsigned i = 0; i < 6; i++)
|
||||
|
||||
Color *float_tex_cube[6];
|
||||
|
@ -72,7 +72,7 @@ STKTexture* STKTexManager::getTexture(const std::string& path, bool srgb,
|
||||
bool mesh_tex, bool no_upload)
|
||||
{
|
||||
auto ret = m_all_textures.find(path);
|
||||
if (ret != m_all_textures.end())
|
||||
if (!no_upload && ret != m_all_textures.end())
|
||||
return ret->second;
|
||||
|
||||
STKTexture* new_texture = NULL;
|
||||
@ -82,7 +82,7 @@ STKTexture* STKTexManager::getTexture(const std::string& path, bool srgb,
|
||||
new_texture = findTextureInFileSystem(path, &full_path);
|
||||
if (full_path == "")
|
||||
return NULL;
|
||||
if (new_texture)
|
||||
if (!no_upload && new_texture)
|
||||
return new_texture;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user