From 41f69b89bd16fa636e364ad78d2f7b9ee00e7f4a Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sun, 8 Aug 2010 22:54:04 +0000 Subject: [PATCH] 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 --- src/graphics/explosion.cpp | 3 +++ src/graphics/nitro.cpp | 4 ++++ src/graphics/shadow.cpp | 4 ++++ src/graphics/skid_marks.cpp | 5 +++++ src/graphics/slip_stream.cpp | 4 ++++ src/graphics/smoke.cpp | 4 ++++ src/graphics/stars.cpp | 3 +++ src/graphics/water_splash.cpp | 5 +++++ src/items/attachment.cpp | 4 ++++ src/items/flyable.cpp | 6 ++++++ src/items/item.cpp | 6 ++++++ src/items/rubber_band.cpp | 5 +++++ src/karts/kart_model.cpp | 8 ++++++++ src/tracks/quad_graph.cpp | 8 ++++++++ src/tracks/track.cpp | 14 +++++++++++++- src/tracks/track_object.cpp | 4 ++++ 16 files changed, 86 insertions(+), 1 deletion(-) diff --git a/src/graphics/explosion.cpp b/src/graphics/explosion.cpp index 79cdeb353..22fa889a7 100644 --- a/src/graphics/explosion.cpp +++ b/src/graphics/explosion.cpp @@ -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()); diff --git a/src/graphics/nitro.cpp b/src/graphics/nitro.cpp index 508bf2797..a35860960 100644 --- a/src/graphics/nitro.cpp +++ b/src/graphics/nitro.cpp @@ -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"); diff --git a/src/graphics/shadow.cpp b/src/graphics/shadow.cpp index 1eb8d24d1..72b2c45bc 100644 --- a/src/graphics/shadow.cpp +++ b/src/graphics/shadow.cpp @@ -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; diff --git a/src/graphics/skid_marks.cpp b/src/graphics/skid_marks.cpp index cae6369c9..d6d54394f 100644 --- a/src/graphics/skid_marks.cpp +++ b/src/graphics/skid_marks.cpp @@ -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. diff --git a/src/graphics/slip_stream.cpp b/src/graphics/slip_stream.cpp index ae6d2fdf8..7c7caa768 100644 --- a/src/graphics/slip_stream.cpp +++ b/src/graphics/slip_stream.cpp @@ -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, diff --git a/src/graphics/smoke.cpp b/src/graphics/smoke.cpp index 41a282fe6..ad47858fa 100644 --- a/src/graphics/smoke.cpp +++ b/src/graphics/smoke.cpp @@ -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 diff --git a/src/graphics/stars.cpp b/src/graphics/stars.cpp index 6928d2398..10e6042a1 100644 --- a/src/graphics/stars.cpp +++ b/src/graphics/stars.cpp @@ -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()); diff --git a/src/graphics/water_splash.cpp b/src/graphics/water_splash.cpp index 42185ce80..9feefd885 100644 --- a/src/graphics/water_splash.cpp +++ b/src/graphics/water_splash.cpp @@ -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 diff --git a/src/items/attachment.cpp b/src/items/attachment.cpp index 998ea5b3e..1587401ba 100644 --- a/src/items/attachment.cpp +++ b/src/items/attachment.cpp @@ -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 diff --git a/src/items/flyable.cpp b/src/items/flyable.cpp index a123e66d2..36f01d3e3 100644 --- a/src/items/flyable.cpp +++ b/src/items/flyable.cpp @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/items/item.cpp b/src/items/item.cpp index 84464fe11..5ec64a6c7 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -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()); diff --git a/src/items/rubber_band.cpp b/src/items/rubber_band.cpp index ed1ed6dda..7796e22f8 100644 --- a/src/items/rubber_band.cpp +++ b/src/items/rubber_band.cpp @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp index 80dee1db8..14155addc 100644 --- a/src/karts/kart_model.cpp +++ b/src/karts/kart_model.cpp @@ -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 diff --git a/src/tracks/quad_graph.cpp b/src/tracks/quad_graph.cpp index 87c129a67..c79740b33 100644 --- a/src/tracks/quad_graph.cpp +++ b/src/tracks/quad_graph.cpp @@ -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: diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 94799b46e..213f2c703 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -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", diff --git a/src/tracks/track_object.cpp b/src/tracks/track_object.cpp index c4f844355..f9c2c7679 100644 --- a/src/tracks/track_object.cpp +++ b/src/tracks/track_object.cpp @@ -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;