diff --git a/src/modes/soccer_world.cpp b/src/modes/soccer_world.cpp index 6c8990236..e3e8f8d8d 100644 --- a/src/modes/soccer_world.cpp +++ b/src/modes/soccer_world.cpp @@ -116,7 +116,7 @@ void SoccerWorld::reset() continue; obj->reset(); - obj->getPhysics()->reset(); + obj->getPhysicalObject()->reset(); } if (m_goal_sound != NULL && @@ -205,7 +205,7 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal) continue; obj->reset(); - obj->getPhysics()->reset(); + obj->getPhysicalObject()->reset(); } //Resetting the ball triggers the goal check line one more time. diff --git a/src/modes/three_strikes_battle.cpp b/src/modes/three_strikes_battle.cpp index e9895434f..c449fea52 100644 --- a/src/modes/three_strikes_battle.cpp +++ b/src/modes/three_strikes_battle.cpp @@ -349,7 +349,7 @@ void ThreeStrikesBattle::update(float dt) getTrack()->getTrackObjectManager()->insertObject(tire_obj); // FIXME: orient the force relative to kart orientation - tire_obj->getPhysics()->getBody() + tire_obj->getPhysicalObject()->getBody() ->applyCentralForce(btVector3(60.0f, 0.0f, 0.0f)); m_insert_tire--; diff --git a/src/physics/physical_object.cpp b/src/physics/physical_object.cpp index 761282ab9..952fccaac 100644 --- a/src/physics/physical_object.cpp +++ b/src/physics/physical_object.cpp @@ -187,9 +187,7 @@ void PhysicalObject::move(const Vec3& xyz, const core::vector3df& hpr) irr::core::quaternion tempQuat(mat); q = btQuaternion(tempQuat.X, tempQuat.Y, tempQuat.Z, tempQuat.W); - - Vec3 p(xyz); - btTransform trans(q,p); + btTransform trans(q,xyz); m_motion_state->setWorldTransform(trans); } // move diff --git a/src/tracks/track_object.cpp b/src/tracks/track_object.cpp index 07dcc40d8..934c9257b 100644 --- a/src/tracks/track_object.cpp +++ b/src/tracks/track_object.cpp @@ -38,7 +38,8 @@ * model, enable/disable status, timer information. * \param lod_node Lod node (defaults to NULL). */ -TrackObject::TrackObject(const XMLNode &xml_node, scene::ISceneNode* parent, LodNodeLoader& lod_loader) +TrackObject::TrackObject(const XMLNode &xml_node, scene::ISceneNode* parent, + LodNodeLoader& lod_loader) { init(xml_node, parent, lod_loader); } @@ -61,7 +62,7 @@ TrackObject::TrackObject(const core::vector3df& xyz, const core::vector3df& hpr, m_enabled = true; m_presentation = NULL; m_animator = NULL; - m_rigid_body = NULL; + m_physical_object = NULL; m_interaction = interaction; m_presentation = presentation; @@ -69,7 +70,7 @@ TrackObject::TrackObject(const core::vector3df& xyz, const core::vector3df& hpr, if (m_interaction != "ghost" && m_interaction != "none" && physics_settings ) { - m_rigid_body = new PhysicalObject(is_dynamic, + m_physical_object = new PhysicalObject(is_dynamic, *physics_settings, this); } @@ -78,8 +79,8 @@ TrackObject::TrackObject(const core::vector3df& xyz, const core::vector3df& hpr, } // TrackObject // ---------------------------------------------------------------------------- - -void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent, LodNodeLoader& lod_loader) +void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent, + LodNodeLoader& lod_loader) { m_init_xyz = core::vector3df(0,0,0); m_init_hpr = core::vector3df(0,0,0); @@ -88,7 +89,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent, LodNo m_presentation = NULL; m_animator = NULL; - m_rigid_body = NULL; + m_physical_object = NULL; xml_node.get("xyz", &m_init_xyz ); xml_node.get("hpr", &m_init_hpr ); @@ -158,7 +159,8 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent, LodNo if (lod_instance) { m_type = "lod"; - TrackObjectPresentationLOD* lod_node = new TrackObjectPresentationLOD(xml_node, parent, lod_loader); + TrackObjectPresentationLOD* lod_node = + new TrackObjectPresentationLOD(xml_node, parent, lod_loader); m_presentation = lod_node; glownode = ((LODNode*)lod_node->getNode())->getAllNodes()[0]; @@ -175,9 +177,10 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent, LodNo std::string render_pass; xml_node.get("renderpass", &render_pass); - if (m_interaction != "ghost" && m_interaction != "none" && render_pass != "skybox") + if (m_interaction != "ghost" && m_interaction != "none" && + render_pass != "skybox" ) { - m_rigid_body = PhysicalObject::fromXML(type == "movable", + m_physical_object = PhysicalObject::fromXML(type == "movable", xml_node, this); } @@ -228,7 +231,7 @@ TrackObject::~TrackObject() { delete m_presentation; delete m_animator; - delete m_rigid_body; + delete m_physical_object; } // ~TrackObject // ---------------------------------------------------------------------------- @@ -240,6 +243,7 @@ void TrackObject::reset() if (m_animator != NULL) m_animator->reset(); } // reset + // ---------------------------------------------------------------------------- /** Enables or disables this object. This affects the visibility, i.e. * disabled objects will not be displayed anymore. @@ -250,12 +254,13 @@ void TrackObject::setEnable(bool mode) m_enabled = mode; if (m_presentation != NULL) m_presentation->setEnable(m_enabled); } // setEnable + // ---------------------------------------------------------------------------- void TrackObject::update(float dt) { if (m_presentation != NULL) m_presentation->update(dt); - if (m_rigid_body != NULL) m_rigid_body->update(dt); + if (m_physical_object != NULL) m_physical_object->update(dt); if (m_animator != NULL) m_animator->update(dt); } // update @@ -264,21 +269,21 @@ void TrackObject::update(float dt) // ---------------------------------------------------------------------------- void TrackObject::move(const core::vector3df& xyz, const core::vector3df& hpr, - const core::vector3df& scale, bool updateRigidBody) + const core::vector3df& scale, bool update_rigid_body) { if (m_presentation != NULL) m_presentation->move(xyz, hpr, scale); - if (updateRigidBody && m_rigid_body != NULL) m_rigid_body->move(xyz, hpr); -} + if (update_rigid_body && m_physical_object != NULL) + m_physical_object->move(xyz, hpr); +} // move // ---------------------------------------------------------------------------- - const core::vector3df& TrackObject::getPosition() const { if (m_presentation != NULL) return m_presentation->getPosition(); else return m_init_xyz; -} +} // getPosition // ---------------------------------------------------------------------------- @@ -288,7 +293,7 @@ const core::vector3df TrackObject::getAbsolutePosition() const return m_presentation->getAbsolutePosition(); else return m_init_xyz; -} +} // getAbsolutePosition // ---------------------------------------------------------------------------- @@ -298,7 +303,7 @@ const core::vector3df& TrackObject::getRotation() const return m_presentation->getRotation(); else return m_init_xyz; -} +} // getRotation // ---------------------------------------------------------------------------- @@ -308,4 +313,4 @@ const core::vector3df& TrackObject::getScale() const return m_presentation->getScale(); else return m_init_xyz; -} +} // getScale diff --git a/src/tracks/track_object.hpp b/src/tracks/track_object.hpp index 2e22cd681..5cbccc77c 100644 --- a/src/tracks/track_object.hpp +++ b/src/tracks/track_object.hpp @@ -78,7 +78,7 @@ protected: float m_distance; - PhysicalObject* m_rigid_body; + PhysicalObject* m_physical_object; ThreeDAnimation* m_animator; @@ -113,8 +113,8 @@ public: bool isGarage() const { return m_garage; } float getDistance() const { return m_distance; } - const PhysicalObject* getPhysics() const { return m_rigid_body; } - PhysicalObject* getPhysics() { return m_rigid_body; } + const PhysicalObject* getPhysicalObject() const { return m_physical_object; } + PhysicalObject* getPhysicalObject() { return m_physical_object; } const core::vector3df getInitXYZ() const { return m_init_xyz; } const core::vector3df getInitRotation() const { return m_init_hpr; } diff --git a/src/tracks/track_object_manager.cpp b/src/tracks/track_object_manager.cpp index 6e20f4208..f4a49b81c 100644 --- a/src/tracks/track_object_manager.cpp +++ b/src/tracks/track_object_manager.cpp @@ -101,8 +101,8 @@ void TrackObjectManager::handleExplosion(const Vec3 &pos, const PhysicalObject * TrackObject* curr; for_in (curr, m_all_objects) { - if(secondary_hits || mp == curr->getPhysics()) - curr->handleExplosion(pos, mp == curr->getPhysics()); + if(secondary_hits || mp == curr->getPhysicalObject()) + curr->handleExplosion(pos, mp == curr->getPhysicalObject()); } } // handleExplosion diff --git a/src/tracks/track_object_presentation.cpp b/src/tracks/track_object_presentation.cpp index 47c660817..763cae3c7 100644 --- a/src/tracks/track_object_presentation.cpp +++ b/src/tracks/track_object_presentation.cpp @@ -178,15 +178,15 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(const XMLNode& xml_node m_is_in_skybox = true; } - bool tangent = false; - xml_node.get("tangents", &tangent); + bool tangent = false; + xml_node.get("tangents", &tangent); //std::string full_path = // World::getWorld()->getTrack()->getTrackFile(model_name); bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects || World::getWorld()->getIdent() == IDENT_CUSTSCENE); - bool displacing = false; + bool displacing = false; xml_node.get("displacing", &displacing); animated &= !displacing; @@ -198,9 +198,9 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(const XMLNode& xml_node { m_mesh = irr_driver->getMesh(model_name); - if (tangent) - { - scene::IMeshManipulator* manip = irr_driver->getVideoDriver()->getMeshManipulator(); + if (tangent) + { + scene::IMeshManipulator* manip = irr_driver->getVideoDriver()->getMeshManipulator(); // TODO: perhaps the original mesh leaks here? m_mesh = manip->createMeshWithTangents(m_mesh); } @@ -253,7 +253,7 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node, scene::ISceneNod bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects || World::getWorld()->getIdent() == IDENT_CUSTSCENE); - bool displacing = false; + bool displacing = false; xml_node->get("displacing", &displacing); animated &= !displacing; @@ -615,27 +615,27 @@ void TrackObjectPresentationParticles::triggerParticles() TrackObjectPresentationLight::TrackObjectPresentationLight(const XMLNode& xml_node, scene::ISceneNode* parent) : TrackObjectPresentationSceneNode(xml_node) -{ - xml_node.get("color", &m_color); - const video::SColorf colorf(m_color); - - //m_distance = 25.0f; - //xml_node.get("distance", &m_distance); - - m_energy = 1.0f; - xml_node.get("energy", &m_energy); - - if (irr_driver->isGLSL()) - { - m_node = irr_driver->addLight(m_init_xyz, m_energy, colorf.r, colorf.g, colorf.b, false, parent); - } - else - { - m_node = NULL; // lights require shaders to work - //scene::ILightSceneNode* node = irr_driver->getSceneManager()->addLightSceneNode(NULL, m_init_xyz, m_color, m_distance); - //node->setLightType(video::ELT_POINT); - //node->enableCastShadow(true); - //m_node = node; +{ + xml_node.get("color", &m_color); + const video::SColorf colorf(m_color); + + //m_distance = 25.0f; + //xml_node.get("distance", &m_distance); + + m_energy = 1.0f; + xml_node.get("energy", &m_energy); + + if (irr_driver->isGLSL()) + { + m_node = irr_driver->addLight(m_init_xyz, m_energy, colorf.r, colorf.g, colorf.b, false, parent); + } + else + { + m_node = NULL; // lights require shaders to work + //scene::ILightSceneNode* node = irr_driver->getSceneManager()->addLightSceneNode(NULL, m_init_xyz, m_color, m_distance); + //node->setLightType(video::ELT_POINT); + //node->enableCastShadow(true); + //m_node = node; } }