Home | Download | Screen shots | Discussion | Documentation
--- | --- | --- | --- | ---

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

# openvrml::child_node Class Reference
[Nodes]

Inheritance diagram for openvrml::child_node:

[legend]
List of all members.

## Detailed Description

Abstract base class for child nodes.

## Public Member Functions

virtual | ~child_node ()=0 throw ()
| Destructor.
void | relocate () throw (std::bad_alloc)
| Called when the node is relocated to a new position in the scene graph.
void | render_child (viewer &v, rendering_context context)
| Render the node.

## Protected Member Functions

| child_node (const node_type &type, const boost::shared_ptr< openvrml::scope > &scope) throw ()
| Constructor.

## Private Member Functions

virtual child_node * | to_child () throw ()
| Cast to a child_node.
virtual void | do_relocate () throw (std::bad_alloc)
| node subclass-specific relocation update.
virtual void | do_render_child (viewer &v, rendering_context context)
| render_child implementation.

## Constructor & Destructor Documentation

openvrml::child_node::~child_node | ( |  | ) | throw ()`[pure virtual]`

| Destructor.

openvrml::child_node::child_node | ( | const node_type & | type,
|  | const boost::shared_ptr< openvrml::scope > & | scope
| ) | throw ()`[protected]`

Constructor.

Parameters:

  | type | the node_type associated with the node.
  | scope | the Scope the node belongs to.

## Member Function Documentation

void openvrml::child_node::relocate | ( |  | ) | throw (std::bad_alloc)

Called when the node is relocated to a new position in the scene graph.

This function delegates to the virtual function do_relocate. relocate should be called by eventIn handlers that receive nodes.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

void openvrml::child_node::render_child | ( | viewer & | v,
|  | rendering_context | context
| ) |

Render the node.

Actually, most of the rendering work is delegated to the viewer, but this method is responsible for traversal to the node's renderable children, including culling. Each node class needs to implement this routine appropriately. It's not abstract since it doesn't make sense to call render on some nodes. Alternative would be to break render out into a seperate mixins class, but that's probably overkill.

Parameters:

  | v | viewer implementation responsible for actually doing the drawing.
  | context | generic context argument; holds things like the accumulated modelview transform.

child_node * openvrml::child_node::to_child | ( |  | ) | throw ()`[private, virtual]`

Cast to a child_node.

Returns:
  a pointer to this child_node.

Reimplemented from openvrml::node.

void openvrml::child_node::do_relocate | ( |  | ) | throw (std::bad_alloc)`[private, virtual]`

node subclass-specific relocation update.

This method is called by child_node::relocate. Subclasses of child_node should override this method for any subclass-specific updates that need to be performed following relocation of a node to a new position in the scene graph (for example, updating a node_path).

The default implementation of this method does nothing.

Reimplemented in openvrml::vrml97_node::viewpoint_node.

void openvrml::child_node::do_render_child | ( | viewer & | v,
|  | rendering_context | context
| ) | `[private, virtual]`

render_child implementation.

Rendered child nodes should override this method.

Parameters:

  | v | viewer implementation responsible for actually doing the drawing.
  | context | generic context argument; holds things like the accumulated modelview transform.

Reimplemented in openvrml::script_node, openvrml::vrml97_node::group_node, openvrml::vrml97_node::anchor_node, openvrml::vrml97_node::billboard_node, openvrml::vrml97_node::cylinder_sensor_node, openvrml::vrml97_node::directional_light_node, openvrml::vrml97_node::inline_node, openvrml::vrml97_node::lod_node, openvrml::vrml97_node::plane_sensor_node, openvrml::vrml97_node::proximity_sensor_node, openvrml::vrml97_node::shape_node, openvrml::vrml97_node::sound_node, openvrml::vrml97_node::sphere_sensor_node, openvrml::vrml97_node::switch_node, openvrml::vrml97_node::transform_node, and openvrml::vrml97_node::visibility_sensor_node.