The Object class represents a 3D object. More...
#include <object.h>
Public Member Functions | |
| Object (std::string name) | |
| void | readObj (const char *filename) |
| Box | boundingBox () const |
| const vector< Face > & | faces () const |
| const vector< Vertex > & | vertices () const |
| vector< Vertex > & | vertices () |
| void | computeNormals () |
| void | computeBoundingBox () |
| void | applyGT (const QMatrix4x4 &mat) |
Each object consists of a collection of vertices and a collection of faces. Objects also store a bounding box.
| Object::Object | ( | std::string | name | ) |
Constructs an empty object.
| name | is the name of the new object. |
| void Object::applyGT | ( | const QMatrix4x4 & | mat | ) |
Applies geometric transform to all vertices; updates normals & bounding box.
| Box Object::boundingBox | ( | ) | const |
Returns the value of the bounding box property. This property is undefined unless computeBoundingBox() has been called.
| void Object::computeBoundingBox | ( | ) |
Recomputes the object bounding box.
| void Object::computeNormals | ( | ) |
Recomputes per-face normals (for all faces of the object).
| const vector< Face > & Object::faces | ( | ) | const |
Returns a constant reference (read-only) to the vector of faces of the object.
| void Object::readObj | ( | const char * | filename | ) |
Imports a Wavefront OBJ file as a single object. Previous faces and vertices, if any, are deleted.
| const vector< Vertex > & Object::vertices | ( | ) | const |
Returns a constant reference (read-only) to the vector of vertices of the object.
| vector< Vertex > & Object::vertices | ( | ) |
Returns a reference to the vector of vertices of the object. If vertices are modified, computeNormals() and computeBoundingBox() methods should be called to update per-face normals and the object's bounding box.