Avoid unneeded copying in sky box and SH
This commit is contained in:
@@ -514,10 +514,12 @@ void Material::install(bool srgb, bool premul_alpha)
|
||||
// now set the name to the basename, so that all tests work as expected
|
||||
m_texname = StringUtils::getBasename(m_texname);
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
if (!CVS->isGLSL() && m_mask.size() > 0)
|
||||
{
|
||||
irr_driver->applyMask(m_texture, m_mask);
|
||||
}
|
||||
#endif
|
||||
m_texture->grab();
|
||||
} // install
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "graphics/skybox.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/stk_texture.hpp"
|
||||
#include "graphics/texture_shader.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -160,15 +161,8 @@ void Skybox::generateCubeMapFromTextures()
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
{
|
||||
unsigned idx = texture_permutation[i];
|
||||
|
||||
video::IImage* image = irr_driver->getVideoDriver()
|
||||
->createImageFromData(m_skybox_textures[idx]->getColorFormat(),
|
||||
m_skybox_textures[idx]->getSize(),
|
||||
m_skybox_textures[idx]->lock(), false );
|
||||
m_skybox_textures[idx]->unlock();
|
||||
|
||||
image->copyToScaling(rgba[i], size, size);
|
||||
image->drop();
|
||||
static_cast<STKTexture*>(m_skybox_textures[idx])->getTextureImage()
|
||||
->copyToScaling(rgba[i], size, size);
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
for (unsigned int j = 0; j < size * size; j++)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/spherical_harmonics.hpp"
|
||||
#include "graphics/stk_texture.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -405,17 +406,8 @@ void SphericalHarmonics::setTextures(const std::vector<video::ITexture *> &spher
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
{
|
||||
unsigned idx = texture_permutation[i];
|
||||
|
||||
video::IImage* image = irr_driver->getVideoDriver()->createImageFromData(
|
||||
m_spherical_harmonics_textures[idx]->getColorFormat(),
|
||||
m_spherical_harmonics_textures[idx]->getSize(),
|
||||
m_spherical_harmonics_textures[idx]->lock(),
|
||||
false
|
||||
);
|
||||
m_spherical_harmonics_textures[idx]->unlock();
|
||||
|
||||
image->copyToScaling(sh_rgba[i], sh_w, sh_h);
|
||||
delete image;
|
||||
static_cast<STKTexture*>(m_spherical_harmonics_textures[idx])
|
||||
->getTextureImage()->copyToScaling(sh_rgba[i], sh_w, sh_h);
|
||||
} //for (unsigned i = 0; i < 6; i++)
|
||||
|
||||
Color *float_tex_cube[6];
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
STKTexManager::~STKTexManager()
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -110,6 +110,8 @@ public:
|
||||
unsigned int getTextureSize() const { return m_texture_size; }
|
||||
// ------------------------------------------------------------------------
|
||||
void reload(bool no_upload = false, video::IImage* pre_loaded_tex = NULL);
|
||||
// ------------------------------------------------------------------------
|
||||
video::IImage* getTextureImage() { return m_texture_image; }
|
||||
|
||||
}; // STKTexture
|
||||
|
||||
|
||||
Reference in New Issue
Block a user