User manual

old releases - latest release - trunk

Cullable Class Reference

Inheritance diagram for Cullable:
Collaboration diagram for Cullable:

List of all members.


Detailed Description

An interface that can be implemented in graphical entities to be able to use the view frustum culling services provided by the Octree.

The concept modeled by this interface is, as the overview says, the ability to be culled. Thus, some crucial information must be provided by the implementing class: bounding volume(s) and a way of accessing the renderable entities that the cullable is comprised of.

Furthermore, a cullable is usually owned by a SceneNode. The rendering process uses information from the owning node when determining what and how to render the cullable's renderables. E.g., it omits the cullable for rendering if it's parent is hidden or in a layer not being drawn.

See also:
Renderable, SceneNode

Public Types

typedef std::list< Renderable * > Renderables
typedef void(* EnumerationCallback )(Renderable *)
 The signature required for the callback functions used to enumerate all of the cullable's renderables.
typedef std::pair< float, float > OnScreenSize

Public Member Functions

 Cullable (OnScreenSize *on_screen_size=0)
virtual ~Cullable ()
 A destroyed cullable automatically removes itself from its parent's list of cullables. Of course this applies only when it's not been orphaned.
virtual Cullableclone () const =0 throw ()
SceneNodeget_parent () throw ()
 Return the SceneNode that owns this Cullable.
const SceneNodeget_parent () const throw ()
virtual void get_renderables (primitives::Camera *camera, EnumerationCallback callback)=0 throw ()
 Call the provided callback function for each of the Cullable's renderables that should be rendered given the specified camera (can be omitted, see below).
Renderables get_renderables () throw ()
 Return a list of all the cullables renderables.
const BoundingSphere & get_bounding_sphere () throw ()
 Get the cullable's bounding sphere.
virtual const BoundingVolumeget_bounding_volume () throw ()
 Get the cullable's bounding volume.
virtual void calculate_bvs ()=0 throw ()
virtual void transform_geometry (const boost::function< Vector3r(const Vector4r &)> &fun)
bool is_size_invariant () const throw ()
const OnScreenSize & get_on_screen_size () const throw (std::logic_error)

Public Attributes

boost::signal< void(Cullable *) on_bv_set )

Protected Member Functions

virtual void set_bounding_sphere (const BoundingSphere &bsphere) throw ()

Private Member Functions

void set_parent (SceneNode *parent) throw ()

Private Attributes

SceneNodem_parent
 The SceneNode "owning" the Cullable.
BoundingSphere m_bsphere
OnScreenSize * m_on_screen_size

Friends

class SceneNode

Member Function Documentation

SceneNode * get_parent (  )  throw ()

Return the SceneNode that owns this Cullable.

Returns:
The owning SceneNode, or null if it has none.

const SceneNode * get_parent (  )  const throw ()

Return the SceneNode that owns this Cullable.

Returns:
The owning SceneNode, or null if it has none.

virtual void get_renderables ( primitives::Camera *  camera,
EnumerationCallback  callback 
) throw () [pure virtual]

Call the provided callback function for each of the Cullable's renderables that should be rendered given the specified camera (can be omitted, see below).

Passing the camera along as a parameter allows us to implement LODs, and do it with much flexibility.

Parameters:
camera The camera used for rendering. If null is specified all of the cullable's renderables should be "returned".
callback The callback function to call with the contained renderables.

const BoundingVolume & get_bounding_volume (  )  throw () [virtual]

Get the cullable's bounding volume.

In the stock implementation the bounding sphere is returned. It can be reimplemented to provide a better approximative volume.


Member Data Documentation

SceneNode* m_parent [private]

The SceneNode "owning" the Cullable.

Initially set to null, signifying that it has no parent.


The documentation for this class was generated from the following files: