Viewer
A plugin-based viewer for learning Computer Graphics and OpenGL
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 ()

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

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.


The documentation for this class was generated from the following files:
 All Classes Functions