Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

toxic::Collection Class Reference

#include <collection.h>

Inheritance diagram for toxic::Collection:

toxic::IObject toxic::Basis List of all members.

Public Member Functions

 Collection (const sheep::Matrix4 &m, IntersectionMask intersection_mask=INTERSECT_ALL_RAYS)
 m is the object space to world space transformation matrix.

virtual ~Collection ()
 A collection deletes its children when it is destructed.

void Insert (IObject *object)
virtual void Finalize (const Context &context)
virtual int GetObjectCount () const
virtual bool Intersect (const Context &context, const Ray &ray, Hit *hit=0) const
virtual void Annotate (const Context &context, const ICamera *camera, Framebuffer *framebuffer) const

Private Types

typedef std::vector< IObject * > object_vector
typedef object_vector::const_iterator object_vector_const_it

Private Attributes

object_vector m_objects
int m_object_count
 Number of child objects. Computed by the Finalize() method.


Member Typedef Documentation

typedef std::vector<IObject *> toxic::Collection::object_vector [private]
 

Definition at line 79 of file collection.h.

typedef object_vector::const_iterator toxic::Collection::object_vector_const_it [private]
 

Definition at line 80 of file collection.h.

Referenced by Annotate(), Finalize(), Intersect(), and ~Collection().


Constructor & Destructor Documentation

Collection::Collection const sheep::Matrix4 m,
IntersectionMask  intersection_mask = INTERSECT_ALL_RAYS
 

m is the object space to world space transformation matrix.

Definition at line 34 of file collection.cpp.

Collection::~Collection  )  [virtual]
 

A collection deletes its children when it is destructed.

Definition at line 41 of file collection.cpp.

References object_vector_const_it.


Member Function Documentation

void Collection::Annotate const Context context,
const ICamera camera,
Framebuffer framebuffer
const [virtual]
 

Reimplemented from toxic::IObject.

Definition at line 105 of file collection.cpp.

References object_vector_const_it.

void Collection::Finalize const Context context  )  [virtual]
 

This method must be called only once, after the object is completely configured, and before it is used for the first time.

Reimplemented from toxic::IObject.

Definition at line 52 of file collection.cpp.

References toxic::IObject::Finalize(), toxic::IObject::GetObjectCount(), m_object_count, and object_vector_const_it.

Referenced by toxic::SceneBuilder::SceneBuilder().

int Collection::GetObjectCount  )  const [inline, virtual]
 

This method returns the number of objects contained into this object. For primitives, it returns 1. For composite objects (like the Collection object), it returns the number of child objects.

Reimplemented from toxic::IObject.

Definition at line 109 of file collection.h.

void Collection::Insert IObject object  ) 
 

Definition at line 47 of file collection.cpp.

Referenced by toxic::SceneBuilder::insert_into_scene(), and toxic::SceneBuilder::SceneBuilder().

bool Collection::Intersect const Context context,
const Ray ray,
Hit hit = 0
const [virtual]
 

This method returns true if the ray intersect the object, or false otherwise. If 'hit' is not null, intersection data are reported through the 'hit' parameter (only if an intersection has been found; if no intersection has been found, the 'hit' parameter is left unchanged). The ray is expressed in world space.

Todo:
Handle collection transformation.
Parameters:
ray  'ray' is expressed in world space.

Implements toxic::IObject.

Definition at line 64 of file collection.cpp.

References toxic::Ray::GetType(), toxic::IObject::Intersect(), toxic::Hit::m_abscissa, max(), and object_vector_const_it.


Member Data Documentation

int toxic::Collection::m_object_count [private]
 

Number of child objects. Computed by the Finalize() method.

Definition at line 83 of file collection.h.

Referenced by Finalize().

object_vector toxic::Collection::m_objects [private]
 

Definition at line 82 of file collection.h.


The documentation for this class was generated from the following files:
Generated on Tue May 11 01:31:57 2004 for toxic by doxygen 1.3.6