Removed patched 10044 to 10047, since there is a much

easier patch to fix #458.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10050 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2011-10-27 01:04:16 +00:00
parent fc94795eac
commit da80f39ed4
7 changed files with 51 additions and 84 deletions

View File

@@ -19,9 +19,7 @@
#include <string>
#include <IMeshSceneNode.h>
#include <IMeshManipulator.h>
#include <ISceneManager.h>
#include <SMesh.h>
#include "audio/music_manager.hpp"
#include "io/file_manager.hpp"
@@ -241,7 +239,7 @@ void ThreeStrikesBattle::update(float dt)
std::string tire;
float scale = 0.5f;
float radius = 0.5f;
PhysicalObject::bodyTypes tire_physics_shape;
PhysicalObject::bodyTypes tire_model;
// insert blown away tire(s) now if was requested
while (m_insert_tire > 0)
@@ -252,12 +250,12 @@ void ThreeStrikesBattle::update(float dt)
tire = file_manager->getModelFile("tire.b3d");
scale = 0.5f;
radius = 0.5f;
tire_physics_shape = PhysicalObject::MP_CYLINDER_Y;
tire_model = PhysicalObject::MP_CYLINDER_Y;
}
else
{
scale = 1.0f;
tire_physics_shape = PhysicalObject::MP_CYLINDER_X;
tire_model = PhysicalObject::MP_CYLINDER_X;
radius = m_tire_radius[m_insert_tire-2];
tire_offset = m_tire_offsets[m_insert_tire-2];
if (m_insert_tire == 2)
@@ -270,44 +268,25 @@ void ThreeStrikesBattle::update(float dt)
tire = m_tire_dir+"/wheel-rear-right.b3d";
}
TrackObjectManager* tom = m_track->getTrackObjectManager();
scene::IMesh* tire_mesh = NULL;
if (file_manager->fileExists(tire))
{
tire_mesh = irr_driver->getMesh(tire);
}
if (!tire_mesh)
{
fprintf(stderr, "Warning: '%s' not found and is ignored.\n",
tire.c_str());
}
else
{
scene::IMeshManipulator* manipulator = irr_driver->getSceneManager()->getMeshManipulator();
scene::IMesh* tire_mesh_copy = manipulator->createMeshCopy(tire_mesh);
PhysicalObject* obj =
tom->insertObject(tire_mesh_copy,
tire_physics_shape,
15 /* mass */,
radius /* radius */,
core::vector3df(800.0f,0,m_tire_rotation
/ M_PI * 180 + 180) ,
m_tire_position + tire_offset,
core::vector3df(scale,scale,scale) /* scale */);
tire_mesh_copy->drop(); // PhysicalObject grabbed it
// FIXME: orient the force relative to kart orientation
obj->getBody()->applyCentralForce(btVector3(60.0f, 0.0f, 0.0f));
m_tires.push_back(obj);
}
TrackObjectManager* tom = m_track->getTrackObjectManager();
PhysicalObject* obj =
tom->insertObject(tire,
tire_model,
15 /* mass */,
radius /* radius */,
core::vector3df(800.0f,0,m_tire_rotation
/ M_PI * 180 + 180) ,
m_tire_position + tire_offset,
core::vector3df(scale,scale,scale) /* scale */);
// FIXME: orient the force relative to kart orientation
obj->getBody()->applyCentralForce(btVector3(60.0f, 0.0f, 0.0f));
m_insert_tire--;
if(m_insert_tire == 1)
m_insert_tire = 0;
m_tires.push_back(obj);
}
} // update

View File

@@ -35,7 +35,6 @@ using namespace irr;
#include <ISceneManager.h>
#include <IMeshManipulator.h>
#include <IMeshSceneNode.h>
// -----------------------------------------------------------------------------
PhysicalObject::PhysicalObject(const XMLNode &xml_node)
@@ -88,7 +87,7 @@ PhysicalObject::PhysicalObject(const XMLNode &xml_node)
// -----------------------------------------------------------------------------
PhysicalObject::PhysicalObject(scene::IMesh* model,
PhysicalObject::PhysicalObject(const std::string& model,
bodyTypes shape, float mass, float radius,
const core::vector3df& hpr,
const core::vector3df& pos,
@@ -124,20 +123,11 @@ void PhysicalObject::init()
// 1. Determine size of the object
// -------------------------------
Vec3 min, max;
scene::IMesh *mesh = NULL;
if (m_node->getType() == scene::ESNT_ANIMATED_MESH)
{
mesh = ((scene::IAnimatedMeshSceneNode*)m_node)->getMesh();
}
else
{
mesh = ((scene::IMeshSceneNode*)m_node)->getMesh();
}
scene::IAnimatedMesh *mesh
= ((scene::IAnimatedMeshSceneNode*)m_node)->getMesh();
MeshTools::minMax3D(mesh, &min, &max);
Vec3 extend = max-min;
// Adjust the mesh of the graphical object so that its center is where it
// Adjust the mesth of the graphical object so that its center is where it
// is in bullet (usually at (0,0,0)). It can be changed in the case clause
// if this is not correct for a particular shape.
Vec3 offset_from_center = -0.5f*(max+min);

View File

@@ -79,7 +79,7 @@ private:
public:
PhysicalObject (const XMLNode &node);
PhysicalObject(scene::IMesh* model,
PhysicalObject(const std::string& model,
bodyTypes shape, float mass, float radius,
const core::vector3df& hpr,
const core::vector3df& pos,

View File

@@ -28,10 +28,6 @@
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include <IMeshSceneNode.h>
#include <IMeshCache.h>
#include <ISceneManager.h>
/** A track object: any additional object on the track. This object implements
* a graphics-only representation, i.e. there is no physical representation.
* Derived classes can implement a physical representation (see
@@ -121,7 +117,7 @@ TrackObject::TrackObject(const XMLNode &xml_node)
m_mesh->grab();
irr_driver->grabAllTextures(m_mesh);
scene::IAnimatedMeshSceneNode *node =
irr_driver->addAnimatedMesh( (scene::IAnimatedMesh*)m_mesh );
irr_driver->addAnimatedMesh(m_mesh);
m_node = node;
#ifdef DEBUG
std::string debug_name = model_name+" (track-object)";
@@ -146,7 +142,7 @@ TrackObject::TrackObject(const XMLNode &xml_node)
// ----------------------------------------------------------------------------
TrackObject::TrackObject(const core::vector3df& pos, const core::vector3df& hpr,
const core::vector3df& scale, scene::IMesh* model)
const core::vector3df& scale, const std::string& model_name)
{
m_init_xyz = pos;
m_init_hpr = hpr;
@@ -155,27 +151,35 @@ TrackObject::TrackObject(const core::vector3df& pos, const core::vector3df& hpr,
m_is_looped = false;
m_sound = NULL;
// Some animated objects (billboards, sound emitters) don't use the mesh
// scene node
if (model == NULL)
// Some animated objects (billboards, sound emitters) don't use this scene node
if (model_name == "")
{
m_node = NULL;
m_mesh = NULL;
}
else
{
m_mesh = model;
if(file_manager->fileExists(model_name))
{
m_mesh = irr_driver->getAnimatedMesh(model_name);
}
if(!m_mesh)
{
fprintf(stderr, "Warning: '%s' not found and is ignored.\n",
model_name.c_str());
return;
}
m_mesh->grab();
irr_driver->grabAllTextures(m_mesh);
scene::IMeshSceneNode *node = irr_driver->addMesh(model);
scene::IAnimatedMeshSceneNode *node=irr_driver->addAnimatedMesh(m_mesh);
m_node = node;
#ifdef DEBUG
std::string debug_name = "(track-object)";
std::string debug_name = model_name+" (track-object)";
m_node->setName(debug_name.c_str());
#endif
m_frame_start = 0;
m_frame_end = 0;
m_frame_start = node->getStartFrame();
m_frame_end = node->getEndFrame();
if(!m_enabled)
m_node->setVisible(false);
@@ -192,19 +196,14 @@ TrackObject::TrackObject(const core::vector3df& pos, const core::vector3df& hpr,
* drops the textures of the mesh. Sound buffers are also freed.
*/
TrackObject::~TrackObject()
{
{
if(m_node)
irr_driver->removeNode(m_node);
if(m_mesh)
{
scene::IMeshCache* cache = irr_driver->getSceneManager()->getMeshCache();
bool is_in_cache = (cache->getMeshIndex(m_mesh) != -1);
irr_driver->dropAllTextures(m_mesh);
m_mesh->drop();
if (is_in_cache && m_mesh->getReferenceCount() == 1)
if(m_mesh->getReferenceCount()==1)
irr_driver->removeMeshFromCache(m_mesh);
}
@@ -227,6 +226,9 @@ void TrackObject::reset()
scene::IAnimatedMeshSceneNode *a_node =
(scene::IAnimatedMeshSceneNode*)m_node;
a_node->setPosition(m_init_xyz);
a_node->setRotation(m_init_hpr);
a_node->setScale(m_init_scale);
a_node->setLoopMode(m_is_looped);
if(m_is_looped)
@@ -234,10 +236,6 @@ void TrackObject::reset()
a_node->setFrameLoop(m_frame_start, m_frame_end);
}
}
m_node->setPosition(m_init_xyz);
m_node->setRotation(m_init_hpr);
m_node->setScale(m_init_scale);
} // reset
// ----------------------------------------------------------------------------
/** Enables or disables this object. This affects the visibility, i.e.

View File

@@ -70,7 +70,7 @@ protected:
/** The mesh used here. It needs to be stored so that it can be
* removed from irrlicht's mesh cache when it is deleted. */
scene::IMesh *m_mesh;
scene::IAnimatedMesh *m_mesh;
/** The initial XYZ position of the object. */
core::vector3df m_init_xyz;
@@ -87,7 +87,7 @@ protected:
public:
TrackObject(const XMLNode &xml_node);
TrackObject(const core::vector3df& pos, const core::vector3df& hpr,
const core::vector3df& scale, scene::IMesh* model);
const core::vector3df& scale, const std::string& model);
~TrackObject();
virtual void update(float dt);
virtual void reset();

View File

@@ -189,7 +189,7 @@ void TrackObjectManager::enableFog(bool enable)
// ----------------------------------------------------------------------------
PhysicalObject* TrackObjectManager::insertObject(scene::IMesh* model,
PhysicalObject* TrackObjectManager::insertObject(const std::string& model,
PhysicalObject::bodyTypes shape,
float mass, float radius,
const core::vector3df& hpr,

View File

@@ -54,7 +54,7 @@ public:
/** Enable or disable fog on objects */
void enableFog(bool enable);
PhysicalObject* insertObject(scene::IMesh* model,
PhysicalObject* insertObject(const std::string& model,
PhysicalObject::bodyTypes shape,
float mass, float radius,
const core::vector3df& hpr,