Classes
- PSphere
- attachMesh(Ogre::SceneNode *node, Ogre::SceneManager *scene, const std::string &meshName, const std::string &objectName, Ogre::Real latitude, Ogre::Real longitude)
- checkAccessibility(Ogre::Vector3 location)
- checkIfObjectIsIn(std::string &objectName)
- create(Ogre::uint32 iters, ResourceParameter resourceParameter)
- getRadius()
- void loadToBuffers(const std::string &meshName, const std::string &textureName)
- void moveObject(const std::string &objectName, int direction, float pace)
- void setObserverPosition(Ogre::Vector3 position)
PSphere
This is the class containing all the information about the planet. It contains also the main functions to interact with it.
void attachMesh(Ogre::SceneNode *node, Ogre::SceneManager *scene, const std::string &meshName, const std::string &objectName, Ogre::Real latitude, Ogre::Real longitude)
With this function it's possible to attach objects to the planet. Such objects have to be in the format .mesh, and contained in the folder indicated in the resource.cfg file (e.g. FileSystem=media/models), or loaded manually.
- node: It's the node in which the planet is attached. It's usually the child node of the root scene.
- scene: It's the Ogre's scene in where the planet is created.
- meshName: It's the name of the file containing the mesh object (e.g. "dog.mesh").
- objectName: It's the chosen name of the object. It can be any unique name, that will be useful to select the object in any moment.
- latitude: (degrees between 0 and 360) Latitude in where the object has to be put.
- longitude: (degrees between 0 and 180) Longitude in where the object has to be put.
bool checkAccessibility(Ogre::Vector3 location)
It tells if there's water or if there's already another object in a certain position. If the returned value is true there are no objects or water in that position.
- location: Position of which we want to check the accessibility (if there's already something on it)
bool checkIfObjectIsIn(std::string &objectName)
It tells if an object with a certain name as already been put on the planet. If the returned value is true, an object with that name is already on the planet.
- objectName: Name of the object
void create(Ogre::uint32 iters, ResourceParameter resourceParameter)
It creates a sphere out of a cube that is made of 6 squares. 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.
- iters: number of vertices composing the sphere.
- resourceParameter: it's an object containing all the information regarding the planet. It can be created by a graphical UI or even by a command-line interface.
Ogre::Real getRadius()
It returns the radius of the planet.
- return: Radius of the planet.
void loadToBuffers(const std::string &meshName, const std::string &textureName)
It draws the planet. After setting all the parameters describing the planet, this function draws it in the window. This planet has to be attached to a node in the primary scene.
- meshName: Name of the planet.
- textureName: Name of the texture.
void moveObject(const std::string &objectName, int direction, float pace)
It moves a specified object in a certain direction.
- objectName: Name of the object that we want to move
- direction: Direction of the movemet (UP=1, DOWN=2, LEFT=3, RIGHT=4)
- pace: Length of the movement
void setObserverPosition(Ogre::Vector3 position)
Set position for the observer. This must be a position vector in modelspace, not in worldspace.
- position: Vector representing the position of the observer