A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 0-9
Short description by user MadMarx:
An Entity is an instance of a mesh, and allow different material information for each entity.
Entities are often the most common object in a Ogre application.
Different Entities can have different materials, while sharing the same mesh.
It is possible to create Entities with different meshes too.
In order to move an Entity, attach it to a SceneNode, and move this SceneNode.
Long description
An entity is an instance of a MovableObject in the scene. It could be a car, a person, a dog, a shuriken, whatever. The only assumption is that it does not necessarily have a fixed position in the world.
Entities are based on discrete meshes, i.e. collections of geometry which are self-contained and typically fairly small on a world scale, which are represented by the Mesh object. Multiple entities can be based on the same mesh, since often you want to create multiple copies of the same type of object in a scene.
You create an entity by calling the -SceneManager::createEntity() method, giving it a name and specifying the name of the mesh object which it will be based on (e.g. 'muscleboundhero.mesh'). The -SceneManager will ensure that the mesh is loaded by calling the MeshManager resource manager for you. Only one copy of the -Mesh will be loaded.
Entities are not deemed to be a part of the scene until you attach them to a SceneNode (see the section below). By attaching entities to SceneNodes, you can create complex hierarchical relationships between the positions and orientations of entities. You then modify the positions of the nodes to indirectly affect the entity positions.
When a Mesh is loaded, it automatically comes with a number of materials defined. It is possible to have more than one material attached to a mesh - different parts of the mesh may use different materials. Any entity created from the mesh will automatically use the default materials. However, you can change this on a per-entity basis if you like so you can create a number of entities based on the same mesh but with different textures etc.
To understand how this works, you have to know that all Mesh objects are actually composed of SubMesh objects, each of which represents a part of the mesh using one Material. If a Mesh uses only one Material, it will only have one SubMesh.
When an Entity is created based on this Mesh, it is composed of (possibly) multiple SubEntity objects, each matching 1 for 1 with the SubMesh objects from the original Mesh. You can access the SubEntity objects using the Entity::getSubEntity() method. Once you have a reference to a SubEntity, you can change the material it uses by calling it's setMaterialName() method. In this way you can make an Entity deviate from the default materials and thus create an individual looking version of it.
See also
- Ogre::Entity Class Reference
- Mesh
- ManualObject - useful class for creation of 3D objects by code
- Material
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 0-9