Make the graphical y offset configurable (and basically disable
it for now by setting it to 0).
This commit is contained in:
parent
171b442ae6
commit
15cccf9301
@ -155,12 +155,13 @@
|
|||||||
otherwise obstricts too much of the view. -->
|
otherwise obstricts too much of the view. -->
|
||||||
<camera distance="1.5" forward-up-angle="15"
|
<camera distance="1.5" forward-up-angle="15"
|
||||||
backward-up-angle="30"/>
|
backward-up-angle="30"/>
|
||||||
|
<!-- Additional offset to move graphical chassis with regards to the physics. -->
|
||||||
|
<graphics y-offset="0.0"/>
|
||||||
|
|
||||||
<!-- Jump animation related values:
|
<!-- Jump animation related values:
|
||||||
animation-time: only if the estimated time for a jump is larger
|
animation-time: only if the estimated time for a jump is larger
|
||||||
than this value will the jump animation being
|
than this value will the jump animation being shown. -->
|
||||||
shown. -->
|
<jump animation-time="0.5" />
|
||||||
<jump animation-time="0.5" />
|
|
||||||
|
|
||||||
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
|
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
|
||||||
decrease: multiplicative decrease of skidding factor in each frame.
|
decrease: multiplicative decrease of skidding factor in each frame.
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
#include <ISceneNode.h>
|
#include <ISceneNode.h>
|
||||||
|
|
||||||
Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||||
float scale = 1.0, float xOffset = 0.0, float yOffset = 0.0)
|
float scale = 1.0, float x_offset = 0.0, float y_offset = 0.0,
|
||||||
|
float z_offset = 0.0)
|
||||||
{
|
{
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.setTexture(0, texture);
|
m.setTexture(0, texture);
|
||||||
@ -34,10 +35,10 @@ Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
|||||||
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
||||||
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
||||||
irr::video::S3DVertex* v=(video::S3DVertex*)buffer->getVertices();
|
irr::video::S3DVertex* v=(video::S3DVertex*)buffer->getVertices();
|
||||||
v[0].Pos.X = -scale+xOffset; v[0].Pos.Z = scale+yOffset; v[0].Pos.Y = 0.01f;
|
v[0].Pos.X = -scale+x_offset; v[0].Pos.Z = scale+z_offset; v[0].Pos.Y = 0.01f-y_offset;
|
||||||
v[1].Pos.X = scale+xOffset; v[1].Pos.Z = scale+yOffset; v[1].Pos.Y = 0.01f;
|
v[1].Pos.X = scale+x_offset; v[1].Pos.Z = scale+z_offset; v[1].Pos.Y = 0.01f-y_offset;
|
||||||
v[2].Pos.X = scale+xOffset; v[2].Pos.Z = -scale+yOffset; v[2].Pos.Y = 0.01f;
|
v[2].Pos.X = scale+x_offset; v[2].Pos.Z = -scale+z_offset; v[2].Pos.Y = 0.01f-y_offset;
|
||||||
v[3].Pos.X = -scale+xOffset; v[3].Pos.Z = -scale+yOffset; v[3].Pos.Y = 0.01f;
|
v[3].Pos.X = -scale+x_offset; v[3].Pos.Z = -scale+z_offset; v[3].Pos.Y = 0.01f-y_offset;
|
||||||
v[0].TCoords = core::vector2df(0,0);
|
v[0].TCoords = core::vector2df(0,0);
|
||||||
v[1].TCoords = core::vector2df(1,0);
|
v[1].TCoords = core::vector2df(1,0);
|
||||||
v[2].TCoords = core::vector2df(1,1);
|
v[2].TCoords = core::vector2df(1,1);
|
||||||
@ -50,7 +51,6 @@ Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
|||||||
buffer->recalculateBoundingBox();
|
buffer->recalculateBoundingBox();
|
||||||
|
|
||||||
m_node = irr_driver->addMesh(m_mesh);
|
m_node = irr_driver->addMesh(m_mesh);
|
||||||
m_node->setPosition(core::vector3df(0, 0.0f, 0));
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
m_node->setName("shadow");
|
m_node->setName("shadow");
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,9 +46,8 @@ private:
|
|||||||
/** The scene node of the kart to which this shadow belongs. */
|
/** The scene node of the kart to which this shadow belongs. */
|
||||||
scene::ISceneNode *m_parent_kart_node;
|
scene::ISceneNode *m_parent_kart_node;
|
||||||
public:
|
public:
|
||||||
Shadow(video::ITexture *texture,
|
Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||||
scene::ISceneNode *node,
|
float scale, float x_offset, float y_offset,float z_offset);
|
||||||
float scale, float xOffset, float yOffset);
|
|
||||||
~Shadow();
|
~Shadow();
|
||||||
void enableShadow();
|
void enableShadow();
|
||||||
void disableShadow();
|
void disableShadow();
|
||||||
|
@ -2379,7 +2379,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
|||||||
m_node,
|
m_node,
|
||||||
m_kart_properties->getShadowScale(),
|
m_kart_properties->getShadowScale(),
|
||||||
m_kart_properties->getShadowXOffset(),
|
m_kart_properties->getShadowXOffset(),
|
||||||
m_kart_properties->getShadowYOffset());
|
m_kart_properties->getGraphicalYOffset(),
|
||||||
|
m_kart_properties->getShadowZOffset());
|
||||||
|
|
||||||
World::getWorld()->kartAdded(this, m_node);
|
World::getWorld()->kartAdded(this, m_node);
|
||||||
} // loadData
|
} // loadData
|
||||||
@ -2429,7 +2430,8 @@ void Kart::kartIsInRestNow()
|
|||||||
f += wi.m_chassisConnectionPointCS.getY()
|
f += wi.m_chassisConnectionPointCS.getY()
|
||||||
- wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
|
- wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
|
||||||
}
|
}
|
||||||
m_graphical_y_offset = f/m_vehicle->getNumWheels() + 0.0f;
|
m_graphical_y_offset = f/m_vehicle->getNumWheels()
|
||||||
|
+ getKartProperties()->getGraphicalYOffset();
|
||||||
|
|
||||||
m_kart_model->setDefaultSuspension();
|
m_kart_model->setDefaultSuspension();
|
||||||
} // kartIsInRestNow
|
} // kartIsInRestNow
|
||||||
|
@ -540,8 +540,14 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
|||||||
: -0.5f*m_kart_length);
|
: -0.5f*m_kart_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(unsigned int i=0; i<4; i++)
|
|
||||||
m_wheel_graphics_position[i].setY(m_wheel_graphics_position[i].getY()-0.0f);
|
float y_off = kart_properties.getGraphicalYOffset();
|
||||||
|
if(y_off!=0)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < 4; i++)
|
||||||
|
m_wheel_graphics_position[i].setY(
|
||||||
|
m_wheel_graphics_position[i].getY() - y_off);
|
||||||
|
}
|
||||||
|
|
||||||
// Load the wheel models. This can't be done early, since the default
|
// Load the wheel models. This can't be done early, since the default
|
||||||
// values for the graphical position must be defined, which in turn
|
// values for the graphical position must be defined, which in turn
|
||||||
|
@ -57,7 +57,7 @@ KartProperties::KartProperties(const std::string &filename)
|
|||||||
m_shadow_file = "";
|
m_shadow_file = "";
|
||||||
m_shadow_scale = 1.0f;
|
m_shadow_scale = 1.0f;
|
||||||
m_shadow_x_offset = 0.0f;
|
m_shadow_x_offset = 0.0f;
|
||||||
m_shadow_y_offset = 0.0f;
|
m_shadow_z_offset = 0.0f;
|
||||||
|
|
||||||
m_groups.clear();
|
m_groups.clear();
|
||||||
m_custom_sfx_id.resize(SFXManager::NUM_CUSTOMS);
|
m_custom_sfx_id.resize(SFXManager::NUM_CUSTOMS);
|
||||||
@ -93,6 +93,7 @@ KartProperties::KartProperties(const std::string &filename)
|
|||||||
m_bubblegum_fade_in_time = m_bubblegum_speed_fraction =
|
m_bubblegum_fade_in_time = m_bubblegum_speed_fraction =
|
||||||
m_bubblegum_time = m_bubblegum_torque = m_jump_animation_time =
|
m_bubblegum_time = m_bubblegum_torque = m_jump_animation_time =
|
||||||
m_smooth_flying_impulse = m_physical_wheel_position =
|
m_smooth_flying_impulse = m_physical_wheel_position =
|
||||||
|
m_graphical_y_offset =
|
||||||
UNDEFINED;
|
UNDEFINED;
|
||||||
|
|
||||||
m_engine_power.resize(RaceManager::DIFFICULTY_COUNT, UNDEFINED);
|
m_engine_power.resize(RaceManager::DIFFICULTY_COUNT, UNDEFINED);
|
||||||
@ -322,7 +323,7 @@ void KartProperties::getAllData(const XMLNode * root)
|
|||||||
|
|
||||||
root->get("shadow-scale", &m_shadow_scale );
|
root->get("shadow-scale", &m_shadow_scale );
|
||||||
root->get("shadow-x-offset", &m_shadow_x_offset );
|
root->get("shadow-x-offset", &m_shadow_x_offset );
|
||||||
root->get("shadow-y-offset", &m_shadow_y_offset );
|
root->get("shadow-z-offset", &m_shadow_z_offset );
|
||||||
|
|
||||||
root->get("type", &m_kart_type );
|
root->get("type", &m_kart_type );
|
||||||
|
|
||||||
@ -615,6 +616,11 @@ void KartProperties::getAllData(const XMLNode * root)
|
|||||||
startup_node->get("boost", &m_startup_boost);
|
startup_node->get("boost", &m_startup_boost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(const XMLNode *graphics_node = root->getNode("graphics"))
|
||||||
|
{
|
||||||
|
graphics_node->get("y-offset", &m_graphical_y_offset);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_kart_model)
|
if(m_kart_model)
|
||||||
m_kart_model->loadInfo(*root);
|
m_kart_model->loadInfo(*root);
|
||||||
} // getAllData
|
} // getAllData
|
||||||
@ -735,7 +741,7 @@ void KartProperties::checkAllSet(const std::string &filename)
|
|||||||
CHECK_NEG(m_explosion_invulnerability_time,
|
CHECK_NEG(m_explosion_invulnerability_time,
|
||||||
"explosion invulnerability-time");
|
"explosion invulnerability-time");
|
||||||
CHECK_NEG(m_explosion_radius, "explosion radius" );
|
CHECK_NEG(m_explosion_radius, "explosion radius" );
|
||||||
|
CHECK_NEG(m_graphical_y_offset, "graphics y-offset" );
|
||||||
for(unsigned int i=RaceManager::DIFFICULTY_FIRST;
|
for(unsigned int i=RaceManager::DIFFICULTY_FIRST;
|
||||||
i<=RaceManager::DIFFICULTY_LAST; i++)
|
i<=RaceManager::DIFFICULTY_LAST; i++)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ private:
|
|||||||
* for this kart.*/
|
* for this kart.*/
|
||||||
float m_shadow_x_offset; /**< X offset of the shadow plane
|
float m_shadow_x_offset; /**< X offset of the shadow plane
|
||||||
* for this kart.*/
|
* for this kart.*/
|
||||||
float m_shadow_y_offset; /**< Y offset of the shadow plane
|
float m_shadow_z_offset; /**< Z offset of the shadow plane
|
||||||
* for this kart.*/
|
* for this kart.*/
|
||||||
video::ITexture *m_shadow_texture;/**< The texture with the shadow. */
|
video::ITexture *m_shadow_texture;/**< The texture with the shadow. */
|
||||||
video::SColor m_color; /**< Color the represents the kart in the
|
video::SColor m_color; /**< Color the represents the kart in the
|
||||||
@ -204,6 +204,10 @@ private:
|
|||||||
std::string m_wheel_filename[4];
|
std::string m_wheel_filename[4];
|
||||||
/** Radius of the graphical wheels. */
|
/** Radius of the graphical wheels. */
|
||||||
float m_wheel_graphics_radius[4];
|
float m_wheel_graphics_radius[4];
|
||||||
|
/** An additional Y offset added to the y position of the graphical
|
||||||
|
* chassis. Useful for karts that don't have enough space for suspension
|
||||||
|
* compression. */
|
||||||
|
float m_graphical_y_offset;
|
||||||
/** If the kart is supposed to have random wheel rotation at start. */
|
/** If the kart is supposed to have random wheel rotation at start. */
|
||||||
bool m_has_rand_wheels;
|
bool m_has_rand_wheels;
|
||||||
/** Max. length of plunger rubber band. */
|
/** Max. length of plunger rubber band. */
|
||||||
@ -568,6 +572,11 @@ public:
|
|||||||
/** Returns wheel radius. */
|
/** Returns wheel radius. */
|
||||||
float getWheelRadius () const {return m_wheel_radius; }
|
float getWheelRadius () const {return m_wheel_radius; }
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Return the additional Y offset added to the y position of the graphical
|
||||||
|
* chassis. Useful for karts that don't have enough space for suspension
|
||||||
|
* compression. */
|
||||||
|
float getGraphicalYOffset() const {return m_graphical_y_offset; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns parameters for the speed-weighted objects */
|
/** Returns parameters for the speed-weighted objects */
|
||||||
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const
|
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const
|
||||||
@ -831,7 +840,7 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the scale factor by which the shadow plane
|
/** Returns the scale factor by which the shadow plane
|
||||||
* had to be set. */
|
* had to be set. */
|
||||||
float getShadowYOffset () const {return m_shadow_y_offset; }
|
float getShadowZOffset () const {return m_shadow_z_offset; }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns a pointer to the skidding properties. */
|
/** Returns a pointer to the skidding properties. */
|
||||||
|
Loading…
Reference in New Issue
Block a user