Disabling GFX should not result in ghost track objects
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9861 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "animations/animation_base.hpp"
|
||||
|
||||
#include "animations/ipo.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
@@ -106,9 +107,12 @@ void AnimationBase::reset()
|
||||
void AnimationBase::update(float dt, core::vector3df *xyz,
|
||||
core::vector3df *hpr, core::vector3df *scale)
|
||||
{
|
||||
Ipo* curr;
|
||||
for_in (curr, m_all_ipos)
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
{
|
||||
curr->update(dt, xyz, hpr, scale);
|
||||
Ipo* curr;
|
||||
for_in (curr, m_all_ipos)
|
||||
{
|
||||
curr->update(dt, xyz, hpr, scale);
|
||||
}
|
||||
}
|
||||
} // float dt
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "animations/billboard_animation.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
@@ -50,13 +51,16 @@ BillboardAnimation::BillboardAnimation(const XMLNode &xml_node)
|
||||
* \param dt Time since last call. */
|
||||
void BillboardAnimation::update(float dt)
|
||||
{
|
||||
core::vector3df xyz=m_node->getPosition();
|
||||
// Rotation doesn't make too much sense for a billboard,
|
||||
// so just set it to 0
|
||||
core::vector3df hpr(0, 0, 0);
|
||||
core::vector3df scale = m_node->getScale();
|
||||
AnimationBase::update(dt, &xyz, &hpr, &scale);
|
||||
m_node->setPosition(xyz);
|
||||
m_node->setScale(scale);
|
||||
// Setting rotation doesn't make sense
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
{
|
||||
core::vector3df xyz=m_node->getPosition();
|
||||
// Rotation doesn't make too much sense for a billboard,
|
||||
// so just set it to 0
|
||||
core::vector3df hpr(0, 0, 0);
|
||||
core::vector3df scale = m_node->getScale();
|
||||
AnimationBase::update(dt, &xyz, &hpr, &scale);
|
||||
m_node->setPosition(xyz);
|
||||
m_node->setScale(scale);
|
||||
// Setting rotation doesn't make sense
|
||||
}
|
||||
} // update
|
||||
|
||||
@@ -122,34 +122,37 @@ ThreeDAnimation::~ThreeDAnimation()
|
||||
*/
|
||||
void ThreeDAnimation::update(float dt)
|
||||
{
|
||||
core::vector3df xyz = m_node->getPosition();
|
||||
core::vector3df scale = m_node->getScale();
|
||||
AnimationBase::update(dt, &xyz, &m_hpr, &scale); //updates all IPOs
|
||||
m_node->setPosition(xyz);
|
||||
m_node->setScale(scale);
|
||||
// Note that the rotation order of irrlicht is different from the one
|
||||
// in blender. So in order to reproduce the blender IPO rotations
|
||||
// correctly, we have to get the rotations around each axis and combine
|
||||
// them in the right order for irrlicht
|
||||
core::matrix4 m;
|
||||
m.makeIdentity();
|
||||
core::matrix4 mx;
|
||||
mx.setRotationDegrees(core::vector3df(m_hpr.X, 0, 0));
|
||||
core::matrix4 my;
|
||||
my.setRotationDegrees(core::vector3df(0, m_hpr.Y, 0));
|
||||
core::matrix4 mz;
|
||||
mz.setRotationDegrees(core::vector3df(0, 0, m_hpr.Z));
|
||||
m = my*mz*mx;
|
||||
core::vector3df hpr = m.getRotationDegrees();
|
||||
m_node->setRotation(hpr);
|
||||
|
||||
// Now update the position of the bullet body if there is one:
|
||||
if(m_body)
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
{
|
||||
hpr = DEGREE_TO_RAD*hpr;
|
||||
btQuaternion q(-hpr.Z, -hpr.X, -hpr.Y);
|
||||
Vec3 p(xyz);
|
||||
btTransform trans(q,p);
|
||||
m_motion_state->setWorldTransform(trans);
|
||||
core::vector3df xyz = m_node->getPosition();
|
||||
core::vector3df scale = m_node->getScale();
|
||||
AnimationBase::update(dt, &xyz, &m_hpr, &scale); //updates all IPOs
|
||||
m_node->setPosition(xyz);
|
||||
m_node->setScale(scale);
|
||||
// Note that the rotation order of irrlicht is different from the one
|
||||
// in blender. So in order to reproduce the blender IPO rotations
|
||||
// correctly, we have to get the rotations around each axis and combine
|
||||
// them in the right order for irrlicht
|
||||
core::matrix4 m;
|
||||
m.makeIdentity();
|
||||
core::matrix4 mx;
|
||||
mx.setRotationDegrees(core::vector3df(m_hpr.X, 0, 0));
|
||||
core::matrix4 my;
|
||||
my.setRotationDegrees(core::vector3df(0, m_hpr.Y, 0));
|
||||
core::matrix4 mz;
|
||||
mz.setRotationDegrees(core::vector3df(0, 0, m_hpr.Z));
|
||||
m = my*mz*mx;
|
||||
core::vector3df hpr = m.getRotationDegrees();
|
||||
m_node->setRotation(hpr);
|
||||
|
||||
// Now update the position of the bullet body if there is one:
|
||||
if(m_body)
|
||||
{
|
||||
hpr = DEGREE_TO_RAD*hpr;
|
||||
btQuaternion q(-hpr.Z, -hpr.X, -hpr.Y);
|
||||
Vec3 p(xyz);
|
||||
btTransform trans(q,p);
|
||||
m_motion_state->setWorldTransform(trans);
|
||||
}
|
||||
}
|
||||
} // update
|
||||
|
||||
@@ -116,13 +116,10 @@ void TrackObjectManager::handleExplosion(const Vec3 &pos, const PhysicalObject *
|
||||
*/
|
||||
void TrackObjectManager::update(float dt)
|
||||
{
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
TrackObject* curr;
|
||||
for_in (curr, m_all_objects)
|
||||
{
|
||||
TrackObject* curr;
|
||||
for_in (curr, m_all_objects)
|
||||
{
|
||||
curr->update(dt);
|
||||
}
|
||||
curr->update(dt);
|
||||
}
|
||||
} // update
|
||||
|
||||
|
||||
Reference in New Issue
Block a user