Grab light in the correct place, fixed all leaking of lights

This commit is contained in:
Benau 2016-10-12 11:48:18 +08:00
parent ddcf6fbb14
commit 48e6128e12
3 changed files with 11 additions and 6 deletions

View File

@ -2664,8 +2664,6 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
else
light = new SunNode(m_scene_manager, parent, r, g, b);
light->grab();
light->setPosition(pos);
light->updateAbsolutePosition();
@ -2695,9 +2693,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
void IrrDriver::clearLights()
{
u32 i;
const u32 max = (int)m_lights.size();
for (i = 0; i < max; i++)
for (unsigned int i = 0; i < m_lights.size(); i++)
{
m_lights[i]->drop();
}

View File

@ -80,6 +80,13 @@ KartGFX::KartGFX(const AbstractKart *kart)
m_skidding_light_2->setName( ("skidding emitter 2 (" + m_kart->getIdent()
+ ")").c_str() );
if (CVS->isGLSL())
{
m_nitro_light->grab();
m_skidding_light_1->grab();
m_skidding_light_2->grab();
}
// Create particle effects
Vec3 rear_left(kart->getWheelGraphicsPosition(3).getX(), 0.05f,
kart->getWheelGraphicsPosition(3).getZ()-0.1f );

View File

@ -1868,8 +1868,10 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
sun->getLightData().SpecularColor = m_sun_specular_color;
}
else
{
irr_driver->createSunInterposer();
m_sun->grab();
}
createPhysicsModel(main_track_count);