OBJObject Class Reference

#include <OBJObject.h>

Inherits Object.

Inheritance diagram for OBJObject:

Inheritance graph
[legend]
Collaboration diagram for OBJObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OBJObject (const std::string &fileName)
virtual ~OBJObject ()
virtual ObjectcreateCopy ()
virtual void setShader (Shader *sh)
virtual void setCastShadows (bool b)

Protected Member Functions

 OBJObject (const OBJObject &other)
virtual bool doIntersect (Ray &localRay) const
void read (const std::string &fileName, const PrimitiveFactory &factory=TexturedSmoothTriangleFactory())
virtual void calcBounds ()
virtual void buildAccelStructure ()

Protected Attributes

std::vector< Primitive * > * mPrimitives
 List of primitives.
KDTreemKdTree
 Accelerating KDTree.

Classes

class  ObjectFileOpenException

Detailed Description

This object can read .obj files. It uses a KDTree as acceleration structure.

Author:
Alex Busenius

Definition at line 16 of file OBJObject.h.


Constructor & Destructor Documentation

OBJObject::OBJObject ( const std::string &  fileName  ) 

Constructor

Parameters:
fileName File name of a .obj file

Definition at line 81 of file OBJObject.cpp.

References LOG, mPrimitives, and read().

Referenced by createCopy().

OBJObject::~OBJObject (  )  [virtual]

Destructor

Definition at line 107 of file OBJObject.cpp.

References mKdTree, mPrimitives, and Object::mRefCounter.

OBJObject::OBJObject ( const OBJObject other  )  [protected]

Copy constructor that creates a cheap copy using reference counting. A copy constructor should be implemented in all subclasses

Parameters:
other Other object

Definition at line 97 of file OBJObject.cpp.


Member Function Documentation

virtual Object* OBJObject::createCopy (  )  [inline, virtual]

Creates a cheap copy of this object using reference counting. Both object will share the same primitives (and therefore shaders), but they can have different properties, (e.g. they can be transformed independently). Should be overwritten in all subclasses

Implements Object.

Definition at line 33 of file OBJObject.h.

References OBJObject().

void OBJObject::setShader ( Shader sh  )  [virtual]

Set a shader to all primitives of the object

Implements Object.

Definition at line 125 of file OBJObject.cpp.

References mPrimitives.

void OBJObject::setCastShadows ( bool  b  )  [virtual]

Set cast shadows property

Reimplemented from Object.

Definition at line 135 of file OBJObject.cpp.

References mPrimitives, and Object::setCastShadows().

virtual bool OBJObject::doIntersect ( Ray localRay  )  const [inline, protected, virtual]

Do actual intersect with all primitives

Parameters:
localRay Ray to intersect with in local coordinates

Implements Object.

Definition at line 93 of file OBJObject.h.

References KDTree::intersect(), and mKdTree.

void OBJObject::read ( const std::string &  fileName,
const PrimitiveFactory factory = TexturedSmoothTriangleFactory() 
) [protected]

Read object data from a OBJ file

Parameters:
fileName File name of a .obj file
factory Triangle factory to use for creating primitives

Definition at line 151 of file OBJObject.cpp.

References buildAccelStructure(), PrimitiveFactory::create(), LOG, mPrimitives, texCoordinateFromStream(), and vec3fFromStream().

Referenced by OBJObject().

void OBJObject::calcBounds (  )  [protected, virtual]

Calculate bounding box

Implements Object.

Definition at line 268 of file OBJObject.cpp.

References Box::clear(), Box::extend(), LOG, Box::maxVertex(), Object::mBoundingBox, Box::minVertex(), and mPrimitives.

Referenced by buildAccelStructure().

void OBJObject::buildAccelStructure (  )  [protected, virtual]

Build acceleration structure to increase rendering performance

Implements Object.

Definition at line 282 of file OBJObject.cpp.

References KDTree::buildTree(), calcBounds(), Object::mBoundingBox, mKdTree, and mPrimitives.

Referenced by read().


Member Data Documentation

std::vector<Primitive *>* OBJObject::mPrimitives [protected]

List of primitives.

Definition at line 76 of file OBJObject.h.

Referenced by buildAccelStructure(), calcBounds(), OBJObject(), read(), setCastShadows(), setShader(), and ~OBJObject().

KDTree* OBJObject::mKdTree [protected]

Accelerating KDTree.

Definition at line 79 of file OBJObject.h.

Referenced by buildAccelStructure(), doIntersect(), and ~OBJObject().


The documentation for this class was generated from the following files:
Generated on Fri Feb 1 00:02:21 2008 for Grayfall by  doxygen 1.5.1