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

toxic::Octree Class Reference

#include <octree.h>

Inheritance diagram for toxic::Octree:

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

Public Member Functions

 Octree (const sheep::Matrix4 &m, int pop_threshold=DEFAULT_OCTREE_POP_THRESHOLD, int max_subdiv=DEFAULT_OCTREE_MAX_SUBDIV, IntersectionMask intersection_mask=INTERSECT_ALL_RAYS)
 m is the object space to world space transformation matrix.

virtual ~Octree ()
 An octree deletes its children when it is destructed.

void Insert (IBoundedObject *object)
virtual void Finalize (const Context &context)
virtual int GetObjectCount () const
virtual const sheep::AABB3GetAABB () const
virtual sheep::Real ComputeSurfaceArea () const
 Computes the surface area of this object.

virtual void EvaluateSurface (const sheep::Point2 &input, sheep::Point3 *point, sheep::Vector3 *geometric_normal) 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< IBoundedObject * > object_vector
typedef object_vector::const_iterator object_vector_const_it
typedef sheep::OctreeNode<
const IBoundedObject * > 
octree_node
typedef sheep::Octree< const
IBoundedObject * > 
octree

Private Attributes

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

int m_pop_threshold
 Octree parameters.

int m_max_subdiv
octreem_octree
 Used only if the octree contains enough objects.

sheep::AABB3 m_aabb
 Bounding box of the object, expressed in world space.


Member Typedef Documentation

typedef std::vector<IBoundedObject *> toxic::Octree::object_vector [private]
 

Definition at line 107 of file toxic/src/renderer/octree.h.

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

Definition at line 108 of file toxic/src/renderer/octree.h.

typedef sheep::Octree<const IBoundedObject *> toxic::Octree::octree [private]
 

Definition at line 111 of file toxic/src/renderer/octree.h.

Referenced by Finalize().

typedef sheep::OctreeNode<const IBoundedObject *> toxic::Octree::octree_node [private]
 

Definition at line 110 of file toxic/src/renderer/octree.h.


Constructor & Destructor Documentation

toxic::Octree::Octree const sheep::Matrix4 m,
int  pop_threshold = DEFAULT_OCTREE_POP_THRESHOLD,
int  max_subdiv = DEFAULT_OCTREE_MAX_SUBDIV,
IntersectionMask  intersection_mask = INTERSECT_ALL_RAYS
 

m is the object space to world space transformation matrix.

Definition at line 37 of file toxic/src/renderer/octree.cpp.

toxic::Octree::~Octree  )  [virtual]
 

An octree deletes its children when it is destructed.

Definition at line 49 of file toxic/src/renderer/octree.cpp.


Member Function Documentation

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

Reimplemented from toxic::IObject.

Definition at line 180 of file toxic/src/renderer/octree.cpp.

Real toxic::Octree::ComputeSurfaceArea  )  const [virtual]
 

Computes the surface area of this object.

Todo:
Implement.

Implements toxic::IBoundedObject.

Definition at line 101 of file toxic/src/renderer/octree.cpp.

void toxic::Octree::EvaluateSurface const sheep::Point2 input,
sheep::Point3 point,
sheep::Vector3 geometric_normal
const [virtual]
 

Given a point in the unit square (the set of points in [0..1]^2), this method computes the corresponding surface point and normal (both are expressed in world space).

Todo:
Implement.

Implements toxic::IBoundedObject.

Definition at line 107 of file toxic/src/renderer/octree.cpp.

void toxic::Octree::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.

Todo:
This is probably incorrect...

Reimplemented from toxic::IObject.

Definition at line 62 of file toxic/src/renderer/octree.cpp.

References toxic::IObject::Finalize(), toxic::IObject::GetObjectCount(), sheep::AABB3::Include(), sheep::AABB3::Invalidate(), m_max_subdiv, m_pop_threshold, and octree.

const sheep::AABB3 & toxic::Octree::GetAABB  )  const [inline, virtual]
 

Returns the Axis Aligned Bounding Box of this object. The AABB is expressed in world space.

Implements toxic::IBoundedObject.

Definition at line 184 of file toxic/src/renderer/octree.h.

int toxic::Octree::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 179 of file toxic/src/renderer/octree.h.

void toxic::Octree::Insert IBoundedObject object  ) 
 

Definition at line 57 of file toxic/src/renderer/octree.cpp.

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

bool toxic::Octree::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 octree transformation.
Parameters:
ray  'ray' is expressed in world space.

Implements toxic::IObject.

Definition at line 118 of file toxic/src/renderer/octree.cpp.

References toxic::Ray::GetType(), toxic::IObject::Intersect(), toxic::Hit::m_abscissa, toxic::Ray::m_direction, toxic::Octree::octree_test_visitor::m_found, toxic::Octree::octree_full_visitor::m_nearest, toxic::Ray::m_origin, and max().


Member Data Documentation

sheep::AABB3 toxic::Octree::m_aabb [private]
 

Bounding box of the object, expressed in world space.

Definition at line 153 of file toxic/src/renderer/octree.h.

int toxic::Octree::m_max_subdiv [private]
 

Definition at line 149 of file toxic/src/renderer/octree.h.

Referenced by Finalize().

int toxic::Octree::m_object_count [private]
 

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

Definition at line 145 of file toxic/src/renderer/octree.h.

object_vector toxic::Octree::m_objects [private]
 

Definition at line 144 of file toxic/src/renderer/octree.h.

octree* toxic::Octree::m_octree [private]
 

Used only if the octree contains enough objects.

Definition at line 151 of file toxic/src/renderer/octree.h.

int toxic::Octree::m_pop_threshold [private]
 

Octree parameters.

Definition at line 148 of file toxic/src/renderer/octree.h.

Referenced by Finalize().


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