Create RTTs only when loading a track

This commit is contained in:
Marianne Gagnon 2014-05-16 19:30:39 -04:00
parent 12ecd4e58e
commit 4ff8b813fa
5 changed files with 25 additions and 4 deletions

View File

@ -472,9 +472,6 @@ void IrrDriver::initDevice()
if (m_glsl)
{
Log::info("irr_driver", "GLSL supported.");
// Order matters, create RTTs as soon as possible, as they are the largest blocks.
m_rtts = new RTT();
}
// m_glsl might be reset in rtt if an error occurs.
if(m_glsl)
@ -1560,7 +1557,20 @@ video::ITexture* IrrDriver::applyMask(video::ITexture* texture,
mask->drop();
return t;
} // applyMask
// ----------------------------------------------------------------------------
void IrrDriver::onLoadWorld()
{
if (m_glsl)
{
m_rtts = new RTT();
}
}
// ----------------------------------------------------------------------------
void IrrDriver::onUnloadWorld()
{
delete m_rtts;
m_rtts = NULL;
}
// ----------------------------------------------------------------------------
/** Sets the ambient light.
* \param light The colour of the light to set.

View File

@ -590,6 +590,10 @@ public:
} // addDebugMesh
#endif
void onLoadWorld();
void onUnloadWorld();
// --------------------- RTT --------------------
/**
* Class that provides RTT (currently, only when no other 3D rendering

View File

@ -19,6 +19,7 @@
#include "graphics/glwrap.hpp"
#include "utils/ptr_vector.hpp"
#include "utils/leak_check.hpp"
namespace irr {
namespace video {
@ -127,6 +128,8 @@ private:
unsigned DepthStencilTexture;
unsigned shadowFBO, shadowColorTex, shadowDepthTex;
LEAK_CHECK();
};
#endif

View File

@ -345,6 +345,8 @@ Controller* World::loadAIController(AbstractKart *kart)
//-----------------------------------------------------------------------------
World::~World()
{
irr_driver->onUnloadWorld();
if(ReplayPlay::get())
{
// Destroy the old replay object, which also stored the ghost

View File

@ -462,6 +462,8 @@ void RaceManager::startNextRace()
// functions.
World::getWorld()->reset();
irr_driver->onLoadWorld();
// Save the current score and set last time to zero. This is necessary
// if someone presses esc after finishing a gp, and selects restart:
// The race is rerun, and the points and scores get reset ... but if