#include <sgObject.h>
Public Member Functions | |
sgObject (sgObject *p, sgObject *n) | |
sgObject * | createObject (const char *name) |
void | cloneMaterial (unsigned int mat) |
void | setAnimation (const char *name, float percent) |
void | destroy () |
void | destroyAll () |
void | updateModel () |
Public Attributes | |
sgVector3 | position |
sgQuaternion | rotation |
sgVector3 | scale |
sgMatrix4x4 | matmodel |
sgMatrix4x4 | matnormal |
std::vector< sgMaterial * > | materials |
std::vector< sgMesh * > | meshs |
sgObject * | next |
sgObject * | prev |
Object class. Responsible for object handling.
Constructor. Creates an empty object.
p | the previous object in the linked object list | |
n | the next object in the linked object list |
void sgObject::cloneMaterial | ( | unsigned int | mat | ) |
Clone material. Makes the given material a clone from the previous one, to allow independant materials for objects of the same type.
mat | index of the material to clone |
sgObject * sgObject::createObject | ( | const char * | name | ) |
Create object. Creates a new object loaded from a model file or a predefined name and makes it next of this.
name | name of the object or the file to load it from |
void sgObject::destroy | ( | ) |
Destroy. Destroys this object.
void sgObject::destroyAll | ( | ) |
Destroy All. Destroys this and all objects connected to it.
void sgObject::setAnimation | ( | const char * | name, | |
float | percent | |||
) |
Set animation. Sets the meshes given animation frame.
name | name of the animation | |
percent | position within the animation in percent |
void sgObject::updateModel | ( | ) |
Update model. Updates this objects model transformation matrix. This function is called automatically before rendering.
std::vector<sgMaterial*> sgObject::materials |
Materials. A vector of the materials. There have to be as many materials as meshes, where each mesh is rendered with the material at the same position as the mesh in the mesh array.
Model matrix. The transformation matrix of this object.
Normal matrix. The normal transformation matrix of this object.
std::vector<sgMesh*> sgObject::meshs |
Meshs. A vector of the meshs. There have to be as many meshes as materials, where each mesh is rendered with the material at the same position in the material array.
Next. Pointer to the next object within the object list or NULL if there is none.
Position. The position of this object.
Previous. Pointer to the previous object within the object list or NULL if there is none.
Rotation. The rotation of this object as quaternion.
Scale. The scale of this object.