Preload power up textures

This commit is contained in:
Vincent Lejeune 2014-09-09 01:08:38 +02:00
parent e8db943dc2
commit a83ef4ae2e
2 changed files with 24 additions and 0 deletions

View File

@ -47,6 +47,7 @@
#include "utils/log.hpp"
#include "utils/profiler.hpp"
#include "stkscenemanager.hpp"
#include "items/powerup_manager.hpp"
#include "../../lib/irrlicht/source/Irrlicht/CSceneManager.h"
#include "../../lib/irrlicht/source/Irrlicht/os.h"
@ -62,6 +63,27 @@ void IrrDriver::renderGLSL(float dt)
Track *track = world->getTrack();
for (unsigned i = 0; i < PowerupManager::POWERUP_MAX; i++)
{
scene::IMesh *mesh = powerup_manager->m_all_meshes[i];
if (!mesh)
continue;
for (unsigned j = 0; j < mesh->getMeshBufferCount(); j++)
{
scene::IMeshBuffer *mb = mesh->getMeshBuffer(j);
if (!mb)
continue;
for (unsigned k = 0; k < 4; k++)
{
video::ITexture *tex = mb->getMaterial().getTexture(k);
if (!tex)
continue;
compressTexture(tex, true);
}
}
}
// Overrides
video::SOverrideMaterial &overridemat = m_video_driver->getOverrideMaterial();
overridemat.EnablePasses = scene::ESNRP_SOLID | scene::ESNRP_TRANSPARENT;

View File

@ -115,9 +115,11 @@ private:
/** Last time the bouncing ball was collected */
float m_rubber_ball_collect_time;
public:
/** The mesh for each model (if the powerup has a model), e.g. a switch
has none. */
irr::scene::IMesh *m_all_meshes[POWERUP_MAX];
private:
/** Size of the corresponding mesh. */
btVector3 m_all_extends[POWERUP_MAX];