ground work for an headlight for karts to allow better visiblity in dark tracks

This commit is contained in:
samuncle 2017-01-19 23:45:42 -05:00
parent 7234caffd9
commit 44207e9620
2 changed files with 18 additions and 0 deletions

View File

@ -83,6 +83,17 @@ KartGFX::KartGFX(const AbstractKart *kart)
m_skidding_light_2->setVisible(false);
m_skidding_light_2->setName( ("skidding emitter 2 (" + m_kart->getIdent()
+ ")").c_str() );
m_head_light =
irr_driver->addLight(core::vector3df(0.0f, 0.2f, 1.5f*length),
/* force */ 0.5f,
/*radius*/CVS->isGLSL() ? 5.0f : 1.0f,
1.0f, 1.0f, 1.0f, false, node);
m_head_light->setVisible(true);
m_head_light->setName( ("head light " + m_kart->getIdent()
+ ")").c_str() );
#endif
#ifndef SERVER_ONLY
@ -499,6 +510,7 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
m_skidding_light_1->setVisible(true);
m_skidding_light_2->setVisible(false);
m_head_light->setVisible(false);
}
if (!m_skidding_light_2->isVisible() && red_skidding)
{
@ -509,6 +521,7 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(true);
m_head_light->setVisible(false);
}
setCreationRateAbsolute(KartGFX::KGFX_SKIDL, (float)skidding);
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, (float)skidding);
@ -520,6 +533,7 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0.0f);
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(false);
m_head_light->setVisible(true);
}
#endif
} // setGFXFromReplay
@ -531,5 +545,6 @@ void KartGFX::setGFXInvisible()
m_nitro_light->setVisible(false);
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(false);
m_head_light->setVisible(false);
#endif
} // setGFXInvisible

View File

@ -84,6 +84,9 @@ private:
/** A light that's shown on the second skid-level with another color. */
irr::scene::ISceneNode* m_skidding_light_2;
/** A light that's shown on the second skid-level with another color. */
irr::scene::ISceneNode* m_head_light;
void addEffect(KartGFXType type, const std::string &file_name,
const Vec3 &position, bool important);
void resizeBox(const KartGFXType type, float new_size);