Core Library
A simple library for handling 3D scenes
Object Class Reference

The Object class represents a 3D object. More...

#include <object.h>

List of all members.

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)

Detailed Description

Each object consists of a collection of vertices and a collection of faces. Objects also store a bounding box.


Constructor & Destructor Documentation

Object::Object ( std::string  name)

Constructs an empty object.

Parameters:
nameis the name of the new object.

Member Function Documentation

void Object::applyGT ( const QMatrix4x4 &  mat)

Applies geometric transform to all vertices; updates normals & bounding box.

Returns the value of the bounding box property. This property is undefined unless computeBoundingBox() has been called.

Recomputes the object bounding box.

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.

 All Classes Functions