Kwang1imsa, welcome to Mogre.
It's nice to see that you read our tutorials and give a feedback about the newcomer problems.
Now I got the idea to create a wiki page which explains some basics.
Ok, I try to explain it a little bit.
Here is an overview of classes which inherit from the abstract class MovableObject
. Most of them are for display something.
If you want to learn more about this classes, have a look to the Ogre Class Reference
, which describes the classes and shows the class members (e.g. functions). Here
is the page from where I got the graphic. Just click onto a "block" in the graphic (e.g. Ogre::Entity) and your browser will load the related page of the class reference.
Well, now a little bit more practical notes for some important classes:
There are different kinds of resource files. 3D objects you call Mesh.
When you want to load a Mesh, you create an Entity which loads the 3D information of the Mesh.
When you want to create a visible object by code
then use ManualObject.
This is fine for creation of lines, triangles, boxes, or any other shapes. You can even create very complex 3D objects with several faces, textures, etc.
To make visible a Mesh, ManualObject, etc. you attach it to a SceneNode.
By "help" of the SceneNode you can scale, move, rotate and hide the attached objects.
It's just a "helper class". Ogre use it internally to load the content of a mesh file. By this class it's also possible to save 3D models from the memory to a file. Common users don't need to care about this class.
Now I try to explain how to load 3D objects:
Ogre needs to know where to search for "resource" files.
By default the user define the paths in the file resources.cfg
Alternatively it can be done by code as smiley80 said.
The ResourceManager of Ogre keep them all in mind.
When the user (programmer) want to load a 3D object from a file, he doesn't need to know the directory of the file. He just tell the name (e.g. myModel.mesh
) to the resource manager.
If you have mesh files with the same name, you have 2 choices: Make the file names unique (this I recommend) or use different resource groups for different mesh files. (e.g. for each directory which contains mesh files)
When a 3D object contains materials or textures, then this information is not inside the mesh file. Materials and textures are stored seperately. The mesh file just contains it's name as a reference (e.g. "myRedMaterial"). Material files and texture files are loaded similar to the mesh files. When a Mesh "needs" a material, it just asks the MaterialManager (a "helper" of the ResourceManager) for the material with the specified name (e.g. "myRedMaterial") and then it will be loaded. Important is to keep the material names unique to avoid conflicts.
The name of material files doesn't matter. Ogre just look to the names, which are defined inside the material files. (A material file can contain several material definitions.)
I use Blender for creating mesh files. Inside of Blender I rename the default material names (e.g. "red.001") to a unique name (e.g. "myVehicleName_red"). To be shure it's unique, you can also add a random ID to the material name (e.g. "myVehicleName_red__825103").
You were confused about the different Managers.
The SceneManager is responsible for managing all objects, which are loaded to a scene. It's position, visibility, etc.
The ResourceManager is responsible for loading and handling different types of resources. It has several specialized "helpers". See the picture below:
I hope now you understand this part of Ogre a little bit more.
If something is unclear, just ask.
If something is wrong, please correct me.