We only have to add one new line to get the names:
for
loop body, add the following print statement:std::cout << node->getName() << "::" << ent->getName() << std::endl;
for
loop iterates 50 times 50 over our code. Here are the last lines:Unnamed_2488::Ogre/MO2487
Unnamed_2489::Ogre/MO2488
Unnamed_2490::Ogre/MO2489
Unnamed_2491::Ogre/MO2490
Unnamed_2492::Ogre/MO2491
Unnamed_2493::Ogre/MO2492
Unnamed_2494::Ogre/MO2493
Unnamed_2495::Ogre/MO2494
Unnamed_2496::Ogre/MO2495
Unnamed_2497::Ogre/MO2496
Unnamed_2498::Ogre/MO2497
Unnamed_2499::Ogre/MO2498
Unnamed_2500::Ogre/MO2499
We just printed the names of the scene node and the entity we created to understand the automatic naming scheme Ogre 3D uses when we don't give a name as a parameter. We see that scene node names use the following scheme: Unnamed_Nr
, where Nr is a counter that get increased each time we create a new unnamed scene node. Entities use a similar scheme, but they use MO instead of Unnamed_; MO is the short form for movable object. A movable object is a class used as the base class for many different classes in Ogre 3D. Everything that can be moved using scene nodes inherits from a movable object. There are entities and lights, but there are a lot more classes that inherit from a movable object. Here is a picture from the Ogre 3D documentation that shows all the classes which inherit from MovableObject
.
Source: http://www.ogre3d.org/docs/api/html/classOgre_1_1MovableObject.html
We see that even the camera is a movable object; this is necessary because otherwise we wouldn't be able to attach it to a scene node. Only a child class of MovableObject
can be attached to a scene node. The difference in the numbers attached to the scene nodes names and the movable object names is due to the creation of an unnamed scene node we had done while adding our plane to the scene with the following code:
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
18.220.163.91