Some code simplification for nitro emitters.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14427 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -55,8 +55,6 @@ AbstractKart::AbstractKart(const std::string& ident,
|
||||
m_kart_length = m_kart_model->getLength();
|
||||
m_kart_highest_point = m_kart_model->getHighestPoint();
|
||||
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
|
||||
m_nitro_emitter_position = m_kart_model->getNitroEmittersPositon();
|
||||
m_has_nitro_emitter = m_kart_model->hasNitroEmitters();
|
||||
} // AbstractKart
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -55,10 +55,6 @@ private:
|
||||
float m_kart_highest_point;
|
||||
/** The position of all four wheels in the 3d model */
|
||||
const Vec3* m_wheel_graphics_position;
|
||||
/** The position of all nitro emitters in the 3d model */
|
||||
const Vec3* m_nitro_emitter_position;
|
||||
/** True if kart has nitro emitters */
|
||||
bool m_has_nitro_emitter;
|
||||
|
||||
/** Index of kart in world. */
|
||||
unsigned int m_world_kart_id;
|
||||
@@ -144,6 +140,9 @@ public:
|
||||
/** Returns this kart's kart model. */
|
||||
KartModel* getKartModel() { return m_kart_model; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns this kart's kart model. */
|
||||
const KartModel* getKartModel() const { return m_kart_model; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the length of the kart. */
|
||||
float getKartLength() const { return m_kart_length; }
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -164,14 +163,6 @@ public:
|
||||
* right, 3 = rear left. */
|
||||
const Vec3& getWheelGraphicsPosition(int i) const
|
||||
{assert(i>=0 && i<4); return m_wheel_graphics_position[i];}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the position of a nitro emitter relative to the kart */
|
||||
const Vec3& getNitroEmitterPosition(int i) const
|
||||
{assert(i>=0 && i<2); return m_nitro_emitter_position[i];}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if kart has nitro emitters */
|
||||
const bool hasNitroEmitter() const
|
||||
{return m_has_nitro_emitter;}
|
||||
|
||||
// ========================================================================
|
||||
// Emergency animation related functions.
|
||||
|
||||
@@ -40,20 +40,11 @@ KartGFX::KartGFX(const AbstractKart *kart)
|
||||
}
|
||||
|
||||
m_kart = kart;
|
||||
/*
|
||||
// FIXME Old Positioning system Maybe usefull for a future effect
|
||||
Vec3 rear_left(-(kart->getKartWidth()+0.20f)*0.35f, (kart->getKartHeight()-0.6f)*0.35f,
|
||||
-kart->getKartLength()*0.35f);
|
||||
|
||||
Vec3 rear_right((kart->getKartWidth()+0.20f)*0.35f, (kart->getKartHeight()-0.6f)*0.35f,
|
||||
-kart->getKartLength()*0.35f);
|
||||
|
||||
|
||||
*/
|
||||
Vec3 rear_left(kart->getWheelGraphicsPosition(3).toIrrVector().X, 0.05f,
|
||||
kart->getWheelGraphicsPosition(3).toIrrVector().Z-0.1f);
|
||||
Vec3 rear_right(kart->getWheelGraphicsPosition(2).toIrrVector().X, 0.05f,
|
||||
kart->getWheelGraphicsPosition(2).toIrrVector().Z-0.1f);
|
||||
Vec3 rear_left(kart->getWheelGraphicsPosition(3).getX(), 0.05f,
|
||||
kart->getWheelGraphicsPosition(3).getZ()-0.1f );
|
||||
Vec3 rear_right(kart->getWheelGraphicsPosition(2).getX(), 0.05f,
|
||||
kart->getWheelGraphicsPosition(2).getZ()-0.1f );
|
||||
|
||||
Vec3 rear_center(0, kart->getKartHeight()*0.35f,
|
||||
-kart->getKartLength()*0.35f);
|
||||
@@ -62,15 +53,12 @@ KartGFX::KartGFX(const AbstractKart *kart)
|
||||
-kart->getKartLength()*0.1f);
|
||||
|
||||
// FIXME Used to match the emitter as seen in blender
|
||||
const float delta = 0.6f;
|
||||
Vec3 rear_nitro_right(kart->getNitroEmitterPosition(0).toIrrVector().X,
|
||||
kart->getNitroEmitterPosition(0).toIrrVector().Y,
|
||||
kart->getNitroEmitterPosition(0).toIrrVector().Z + delta);
|
||||
|
||||
Vec3 rear_nitro_left(kart->getNitroEmitterPosition(1).toIrrVector().X,
|
||||
kart->getNitroEmitterPosition(1).toIrrVector().Y,
|
||||
kart->getNitroEmitterPosition(1).toIrrVector().Z + delta);
|
||||
if (!kart->hasNitroEmitter())
|
||||
const Vec3 delta(0, 0, 0.6f);
|
||||
Vec3 rear_nitro_right = kart->getKartModel()->getNitroEmittersPositon(0)
|
||||
+ delta;
|
||||
Vec3 rear_nitro_left = kart->getKartModel()->getNitroEmittersPositon(1)
|
||||
+ delta;
|
||||
if (!kart->getKartModel()->hasNitroEmitters())
|
||||
rear_nitro_right = rear_nitro_left = rear_nitro_center;
|
||||
|
||||
// Create all effects. Note that they must be created
|
||||
|
||||
@@ -278,9 +278,10 @@ public:
|
||||
{assert(i>=0 && i<4); return m_wheel_graphics_radius[i]; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the position of nitro emitter relative to the kart.
|
||||
* \param i Index of the emitter: 0 = right, 1 = left
|
||||
*/
|
||||
const Vec3* getNitroEmittersPositon() const
|
||||
{return m_nitro_emitter_position;}
|
||||
const Vec3& getNitroEmittersPositon(unsigned int i) const
|
||||
{ assert(i>=0 && i<2); return m_nitro_emitter_position[i]; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if kart has nitro emitters */
|
||||
const bool hasNitroEmitters() const
|
||||
|
||||
Reference in New Issue
Block a user