Object Class Reference

#include <Object.h>

Inherits PhysicalObject.

Inherited by OBJObject, SphereObject, and TableBorder.

Inheritance diagram for Object:

Inheritance graph
[legend]
Collaboration diagram for Object:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Object (bool enablePhysics)
virtual ~Object ()
virtual ObjectcreateCopy ()=0
virtual void setShader (Shader *sh)=0
bool intersect (Ray &globalRay) const
bool castShadows () const
virtual void setCastShadows (bool b)
const std::string & name () const
void setName (const std::string &n)
virtual void dump () const
virtual void writeDump (std::ostream &outs)
virtual void readDump (std::istream &ins)

Protected Member Functions

 Object (const Object &other)
virtual bool doIntersect (Ray &localRay) const =0
virtual void calcBounds ()=0
virtual void buildAccelStructure ()=0

Protected Attributes

Box mBoundingBox
 Bounding box of the object.
bool mCastShadows
 A flag if this object casts shadows.
unsigned int * mRefCounter
 Reference counter.
std::string mName
 Name.

Private Member Functions

Objectoperator= (const Object &)

Detailed Description

Abstract base class for all types of objects. An object is a container for multiple primitives with appropriate accelerating structure. Different objects can share same primitives and kd tree but have different properties. Shaders are set to primitives and are shared together with them.

An object can be transformed (manualy or using a physics engine, see also PhysicalObject), transformations change coordinate system of the ray during intersect and do not change any primitives.

Author:
Alex Busenius

Definition at line 25 of file Object.h.


Constructor & Destructor Documentation

Object::Object ( bool  enablePhysics  ) 

Constructor

Parameters:
enablePhysics If this object should be controlled by physics engine

Definition at line 11 of file Object.cpp.

References mRefCounter.

Object::~Object (  )  [virtual]

Destructor

Definition at line 42 of file Object.cpp.

References LOG, mName, and mRefCounter.

Object::Object ( const Object 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 27 of file Object.cpp.

References LOG, mName, and mRefCounter.


Member Function Documentation

virtual Object* Object::createCopy (  )  [pure 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

Implemented in OBJObject, SphereObject, and TableBorder.

Referenced by CopyObjectFactory::create().

virtual void Object::setShader ( Shader sh  )  [pure virtual]

Set a shader to all primitives of the object

Implemented in OBJObject, SphereObject, and TableBorder.

Referenced by SphereObjectFactory::create(), and OBJObjectFactory::create().

bool Object::intersect ( Ray globalRay  )  const [inline]

Intersect a ray with all contained primitives doing global -> local -> global coordinate transformations

Parameters:
globalRay Ray to intersect with in global coordinates

Definition at line 53 of file Object.h.

References doIntersect(), Ray::setObj(), PhysicalObject::toGlobalCoordinates(), and PhysicalObject::toLocalCoordinates().

bool Object::castShadows (  )  const [inline]

Find out if this object casts shadows

Definition at line 75 of file Object.h.

References mCastShadows.

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

Set cast shadows property

Reimplemented in OBJObject, and SphereObject.

Definition at line 61 of file Object.cpp.

References mCastShadows.

Referenced by CopyObjectFactory::create(), SphereObjectFactory::create(), OBJObjectFactory::create(), SphereObject::setCastShadows(), and OBJObject::setCastShadows().

const std::string& Object::name (  )  const [inline]

Get name

Definition at line 86 of file Object.h.

References mName.

Referenced by PhysicsStep::animate(), Collision::dump(), readDump(), BilliardPhysics::willCollide(), and BilliardPhysics::willHitBorder().

void Object::setName ( const std::string &  n  )  [inline]

Set name

Definition at line 93 of file Object.h.

References mName.

Referenced by SceneBuilder::addObject().

virtual void Object::dump (  )  const [inline, virtual]

Dump all info to console

Implements PhysicalObject.

Definition at line 100 of file Object.h.

References LOG, PhysicalObject::mAngularVelocity, Box::maxVertex(), mBoundingBox, PhysicalObject::mInverseTransform, Box::minVertex(), PhysicalObject::mMass, mName, PhysicalObject::mPosition, PhysicalObject::mRotation, PhysicalObject::mScaling, PhysicalObject::mTime, PhysicalObject::mTransform, and PhysicalObject::mVelocity.

void Object::writeDump ( std::ostream &  outs  )  [virtual]

Write all data to file stream in binary format

Parameters:
outs Output file stream

Reimplemented from PhysicalObject.

Definition at line 72 of file Object.cpp.

References mName, and PhysicalObject::writeDump().

void Object::readDump ( std::istream &  ins  )  [virtual]

Read all data from file stream in binary format

Parameters:
ins Input file stream

Reimplemented from PhysicalObject.

Definition at line 83 of file Object.cpp.

References mName, name(), and PhysicalObject::readDump().

virtual bool Object::doIntersect ( Ray localRay  )  const [protected, pure virtual]

Do actual intersect with all primitives. Should be overwritten by all subclasses

Parameters:
localRay Ray to intersect with in local coordinates

Implemented in OBJObject, SphereObject, and TableBorder.

Referenced by intersect().

virtual void Object::calcBounds (  )  [protected, pure virtual]

Calculate bounding box. Should be overwritten by all subclasses

Implemented in OBJObject, SphereObject, and TableBorder.

virtual void Object::buildAccelStructure (  )  [protected, pure virtual]

Build acceleration structure to increase rendering performance. Should be overwritten by all subclasses

Implemented in OBJObject, SphereObject, and TableBorder.

Object& Object::operator= ( const Object  )  [private]

Forbid assignment


Member Data Documentation

Box Object::mBoundingBox [protected]

Bounding box of the object.

Definition at line 129 of file Object.h.

Referenced by OBJObject::buildAccelStructure(), SphereObject::calcBounds(), OBJObject::calcBounds(), and dump().

bool Object::mCastShadows [protected]

A flag if this object casts shadows.

Definition at line 132 of file Object.h.

Referenced by castShadows(), and setCastShadows().

unsigned int* Object::mRefCounter [protected]

Reference counter.

Definition at line 135 of file Object.h.

Referenced by Object(), ~Object(), OBJObject::~OBJObject(), and SphereObject::~SphereObject().

std::string Object::mName [protected]

Name.

Definition at line 138 of file Object.h.

Referenced by dump(), name(), Object(), readDump(), setName(), TableBorder::TableBorder(), writeDump(), and ~Object().


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