Added names to scene nodes.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5731 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-08-08 22:54:04 +00:00
parent 9dfa90beed
commit 41f69b89bd
16 changed files with 86 additions and 1 deletions

View File

@ -34,6 +34,9 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound)
{
m_remaining_time = burst_time; // short emision time, explosion, not constant flame
m_node = irr_driver->addParticleNode();
#ifdef DEBUG
m_node->setName("explosion");
#endif
m_node->setPosition(coord.toIrrVector());
Material* m = material_manager->getMaterial("explode.png");
m_node->setMaterialTexture(0, m->getTexture());

View File

@ -29,6 +29,10 @@ Nitro::Nitro(Kart* kart) : m_kart(kart)
{
const float particle_size = 0.25f;
m_node = irr_driver->addParticleNode();
#ifdef DEBUG
std::string debug_name = m_kart->getIdent()+" (nitro)";
m_node->setName(debug_name.c_str());
#endif
m_node->setParent(m_kart->getNode());
m_node->setPosition(core::vector3df(0, particle_size*0.25f, -m_kart->getKartLength()*0.5f));
Material *m= material_manager->getMaterial("nitro-particle.png");

View File

@ -48,6 +48,10 @@ Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node)
buffer->recalculateBoundingBox();
m_node = irr_driver->addMesh(m_mesh);
#ifdef DEBUG
m_node->setName("shadow");
#endif
m_mesh->drop(); // the node grabs the mesh, so we can drop this reference
m_node->setAutomaticCulling(scene::EAC_OFF);
m_parent_kart_node = node;

View File

@ -178,6 +178,11 @@ void SkidMarks::update(float dt)
m_avoid_z_fighting);
new_mesh->addMeshBuffer(smq_right);
scene::IMeshSceneNode *new_node = irr_driver->addMesh(new_mesh);
#ifdef DEBUG
std::string debug_name = m_kart.getIdent()+" (skid-mark)";
new_node->setName(debug_name.c_str());
#endif
// We don't keep a reference to the mesh here, so we have to decrement
// the reference count (which is set to 1 when doing "new SMesh()".
// The scene node will keep the mesh alive.

View File

@ -45,6 +45,10 @@ SlipStream::SlipStream(Kart* kart) : MovingTexture(0, 0), m_kart(kart)
createMesh(m);
m_node = irr_driver->addMesh(m_mesh);
#ifdef DEBUG
std::string debug_name = m_kart->getIdent()+" (slip-stream)";
m_node->setName(debug_name.c_str());
#endif
//m_node->setParent(m_kart->getNode());
m_node->setPosition(core::vector3df(0,
0*0.25f+2.5,

View File

@ -29,6 +29,10 @@
Smoke::Smoke(Kart* kart) : m_kart(kart), m_particle_size(0.33f)
{
m_node = irr_driver->addParticleNode();
#ifdef DEBUG
std::string debug_name = m_kart->getIdent()+" (smoke)";
m_node->setName(debug_name.c_str());
#endif
// Note: the smoke system is NOT child of the kart, since bullet
// gives the position of the wheels on the ground in world coordinates.
// So it's easier not to move the particle system with the kart, and set

View File

@ -44,6 +44,9 @@ Stars::Stars(scene::ISceneNode* parentKart)
scene::ISceneNode* billboard = irr_driver->addBillboard(core::dimension2d< f32 >(STAR_SIZE, STAR_SIZE),
texture,
parentKart);
#ifdef DEBUG
billboard->setName("star");
#endif
star_material->setMaterialProperties(&(billboard->getMaterial(0)));
//billboard->getMaterial(0).MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
billboard->setMaterialTexture(0, star_material->getTexture());

View File

@ -29,6 +29,11 @@
WaterSplash::WaterSplash(Kart* kart) : m_kart(kart), m_particle_size(0.33f)
{
m_node = irr_driver->addParticleNode();
#ifdef DEBUG
std::string debug_name = m_kart->getIdent()+" (water-splash)";
m_node->setName(debug_name.c_str());
#endif
// Note: the smoke system is NOT child of the kart, since bullet
// gives the position of the wheels on the ground in world coordinates.
// So it's easier not to move the particle system with the kart, and set

View File

@ -40,6 +40,10 @@ Attachment::Attachment(Kart* kart)
// have to attach some kind of mesh, but make it invisible.
m_node = irr_driver->addAnimatedMesh(
attachment_manager->getMesh(ATTACH_BOMB));
#ifdef DEBUG
std::string debug_name = kart->getIdent()+" (attachment)";
m_node->setName(debug_name.c_str());
#endif
m_node->setParent(m_kart->getNode());
m_node->setVisible(false);
} // Attachment

View File

@ -108,6 +108,12 @@ Flyable::Flyable(Kart *kart, PowerupManager::PowerupType type, float mass)
// Add the graphical model
setNode(irr_driver->addMesh(m_st_model[type]));
#ifdef DEBUG
std::string debug_name("flyable: ");
debug_name += type;
getNode()->setName(debug_name.c_str());
#endif
} // Flyable
// ----------------------------------------------------------------------------

View File

@ -42,6 +42,12 @@ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
: -1 ;
m_original_mesh = mesh;
m_node = irr_driver->addMesh(mesh);
#ifdef DEBUG
std::string debug_name("item: ");
debug_name += m_type;
m_node->setName(debug_name.c_str());
#endif
m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
m_node->setPosition(xyz.toIrrVector());
m_node->setRotation(hpr.toIrrHPR());

View File

@ -74,6 +74,11 @@ RubberBand::RubberBand(Plunger *plunger, const Kart &kart) :
updatePosition();
m_node = irr_driver->addMesh(m_mesh);
#ifdef DEBUG
std::string debug_name = m_owner.getIdent()+" (rubber-band)";
m_node->setName(debug_name.c_str());
#endif
} // RubberBand
// ----------------------------------------------------------------------------

View File

@ -118,11 +118,19 @@ void KartModel::attachModel(scene::ISceneNode **node)
: 0;
*node = irr_driver->addMesh(m_mesh->getMesh(straight_frame));
}
#ifdef DEBUG
std::string debug_name = m_model_filename+" (kart-model)";
(*node)->setName(debug_name.c_str());
#endif
for(unsigned int i=0; i<4; i++)
{
m_wheel_node[i] = irr_driver->addMesh(m_wheel_model[i]);
m_wheel_node[i]->setPosition(m_wheel_graphics_position[i].toIrrVector());
#ifdef DEBUG
std::string debug_name = m_wheel_filename[i]+" (wheel)";
m_wheel_node[i]->setName(debug_name.c_str());
#endif
(*node)->addChild(m_wheel_node[i]);
}
} // attachModel

View File

@ -279,6 +279,10 @@ void QuadGraph::createDebugMesh()
v[i].Color = c;
}
m_node = irr_driver->addMesh(m_mesh);
#ifdef DEBUG
m_node->setName("track-debug-mesh");
#endif
} // createDebugMesh
// -----------------------------------------------------------------------------
@ -477,6 +481,10 @@ video::ITexture *QuadGraph::makeMiniMap(const core::dimension2du &dimension,
}
m_node = irr_driver->addMesh(m_mesh); // add Debug Mesh
#ifdef DEBUG
m_node->setName("minimap-mesh");
#endif
m_node->setMaterialFlag(video::EMF_LIGHTING, false);
// Add the camera:

View File

@ -526,6 +526,10 @@ bool Track::loadMainTrack(const XMLNode &root)
m_all_meshes.push_back(merged_mesh);
//scene::ISceneNode *scene_node = irr_driver->addMesh(merged_mesh);
scene::IMeshSceneNode *scene_node = irr_driver->addOctTree(merged_mesh);
#ifdef DEBUG
std::string debug_name=model_name+" (main track, octtree)";
scene_node->setName(debug_name.c_str());
#endif
//merged_mesh->setHardwareMappingHint(scene::EHM_STATIC);
core::vector3df xyz(0,0,0);
@ -564,6 +568,11 @@ bool Track::loadMainTrack(const XMLNode &root)
}
m_all_meshes.push_back(a_mesh);
scene::ISceneNode *scene_node = irr_driver->addAnimatedMesh(a_mesh);
#ifdef DEBUG
std::string debug_name = model_name+" (static track-object)";
scene_node->setName(debug_name.c_str());
#endif
//core::vector3df xyz(0,0,0);
Vec3 xyz(0,0,0);
n->get("xyz", &xyz);
@ -687,7 +696,10 @@ void Track::createWater(const XMLNode &node)
wave_height,
wave_speed,
wave_length);
#ifdef DEBUG
std::string debug_name = model_name+"(water node)";
scene_node->setName(debug_name.c_str());
#endif
if(!mesh || !scene_node)
{
fprintf(stderr, "Warning: Water model '%s' in '%s' not found, ignored.\n",

View File

@ -54,6 +54,10 @@ TrackObject::TrackObject(const XMLNode &xml_node)
} // if(!m_animated_mesh)
}
m_animated_node = irr_driver->addAnimatedMesh(m_animated_mesh);
#ifdef DEBUG
std::string debug_name = model_name+" (track-object)";
m_animated_node->setName(debug_name.c_str());
#endif
// Get the information from the xml node.
m_enabled = true;