#include <OBJObject.h>
Inherits Object.
Inheritance diagram for OBJObject:
Public Member Functions | |
OBJObject (const std::string &fileName) | |
virtual | ~OBJObject () |
virtual Object * | createCopy () |
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. | |
KDTree * | mKdTree |
Accelerating KDTree. | |
Classes | |
class | ObjectFileOpenException |
Definition at line 16 of file OBJObject.h.
OBJObject::OBJObject | ( | const std::string & | fileName | ) |
Constructor
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
other | Other object |
Definition at line 97 of file OBJObject.cpp.
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
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
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().
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().