-
Notifications
You must be signed in to change notification settings - Fork 6
Structure
This is the class containing all the information about the planet. It contains also the main functions to interact with it.
Creating an object of this type, always followed by an initOgre (see Main.cpp), permits to create the planet. The parameter accepted are the number of vertexes that compose the planet (that permit do decide the quality of details) and a ResourceParameter object, which contains all the information regarding the planet.
void PSphere::create(Ogre::Real diameter, Ogre::Real seaFraction, Ogre::uint32 iters)
- diameter: real value indicating the diameter
- seaFraction: real value indicating the percentage of water in the planet (value between 0.0 and 1.0)
- iters: interger value indicating the number of vertexes composing the sphere
**void PSphere::attachMesh(Ogre::SceneNode node, Ogre::SceneManager scene, const std::string &objectName, Ogre::Real x, Ogre::Real y, Ogre::Real z)
- node: SceneNode object to which the planet is attached in the scene
- scene: SceneManager object of the main scene
- objectName: name of the .mesh object to attach to the planet. (the object has to be in a folder pointed in the resource.cfg file, and then declared in the initOgre.start() function)
- x, y, z: integer values representing the coordinates in where the object has to be attached
This function permits to import 3D models from outside, and attach those to the planet. Such object have to be in the format .mesh, and contained in the folder indicated in the resource.cfg file (e.g. FileSystem=media/models). The single object has also to be declared in Ogre, with the function declareResource(), of the ResourceGroupManager class. If this object contains materials, it's suggested to put those in another folder, and just as with the .mesh file, write the folder in the resource.cfg file and declare materials in initialization phase (with the Ogre's function declareResource)
This class contains functions that permit to initialize Ogre, resources and everything that has to come before visualizing the planet.
int initOgre::start()
This function does the following:
- Analyze the resource.cfg file (containing the paths of the resources like meshes, materials, textures etc.)
- Set the LOG file (Generator.LOG)
- Set the render system (e.g. Direct3D9)
- It creates an Ogre root
- It Creates the scene and the window
*void initOgre::setSceneAndRun(PSphere planet)
- planet: PSphere object of the planet previously created
This function shows the planet in the window and make it turns. It sets the camera and the light's position.
In this function is possible to attach objects to the sphere.