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

# openvrml::viewer Class Reference

Map the scene graph to the underlying graphics library. More...

`#include <openvrml/viewer.h>`

Inheritance diagram for openvrml::viewer:
[legend]

List of all members.

## Public Types
enum | { mask_none = 0, mask_ccw = 1, mask_convex = 2, mask_solid = 4, mask_bottom = 8, mask_top = 16, mask_side = 32, mask_color_per_vertex = 64, mask_normal_per_vertex = 128 }
enum | rendering_mode { draw_mode, pick_mode }
| The rendering mode. More...
## Public Member Functions
virtual | ~viewer ()=0 throw ()
| Destroy.
openvrml::browser * | browser () const throw ()
rendering_mode | mode ()
| Get the rendering mode.
double | frame_rate ()
| Get the frame rate.
void | reset_user_navigation ()
| Return view to the last bound Viewpoint.
void | begin_object (const char *id, bool retain=false)
| Begin a display list.
void | end_object ()
| End a display list.
void | insert_background (const background_node &n)
| Insert a background into a display list.
void | insert_box (const geometry_node &n, const vec3f &size)
| Insert a box into a display list.
void | insert_cone (const geometry_node &n, float height, float radius, bool bottom, bool side)
| Insert a cone into a display list.
void | insert_cylinder (const geometry_node &n, float height, float radius, bool bottom, bool side, bool top)
| Insert a cylinder into a display list.
void | insert_elevation_grid (const geometry_node &n, unsigned int mask, const std::vector< float > &height, int32 x_dimension, int32 z_dimension, float x_spacing, float z_spacing, const std::vector< color > &color, const std::vector< vec3f > &normal, const std::vector< vec2f > &tex_coord)
| Insert an elevation grid into a display list.
void | insert_extrusion (const geometry_node &n, unsigned int mask, const std::vector< vec3f > &spine, const std::vector< vec2f > &cross_section, const std::vector< rotation > &orientation, const std::vector< vec2f > &scale)
| Insert an extrusion into a display list.
void | insert_line_set (const geometry_node &n, const std::vector< vec3f > &coord, const std::vector< int32 > &coord_index, bool color_per_vertex, const std::vector< color > &color, const std::vector< int32 > &color_index)
| Insert a line set into a display list.
void | insert_point_set (const geometry_node &n, const std::vector< vec3f > &coord, const std::vector< color > &color)
| Insert a point set into a display list.
void | insert_shell (const geometry_node &n, unsigned int mask, const std::vector< vec3f > &coord, const std::vector< int32 > &coord_index, const std::vector< color > &color, const std::vector< int32 > &color_index, const std::vector< vec3f > &normal, const std::vector< int32 > &normal_index, const std::vector< vec2f > &tex_coord, const std::vector< int32 > &tex_coord_index)
| Insert a shell into a display list.
void | insert_sphere (const geometry_node &n, float radius)
| Insert a sphere into a display list.
void | insert_dir_light (float ambient_intensity, float intensity, const color &color, const vec3f &direction)
| Insert a directional light into a display list.
void | insert_point_light (float ambient_intensity, const vec3f &attenuation, const color &color, float intensity, const vec3f &location, float radius)
| Insert a point light into a display list.
void | insert_spot_light (float ambient_intensity, const vec3f &attenuation, float beam_width, const color &color, float cut_off_angle, const vec3f &direction, float intensity, const vec3f &location, float radius)
| Insert a point light into a display list.
void | remove_object (const node &n)
| Remove an object from the display list.
void | enable_lighting (bool val)
| Enable/disable lighting.
void | set_fog (const color &color, float visibility_range, const char *type)
| Set the fog.
void | set_color (const color &rgb, float a=1.0)
| Set the color.
void | set_material (float ambient_intensity, const color &diffuse_color, const color &emissive_color, float shininess, const color &specular_color, float transparency)
| Set the material.
void | set_material_mode (size_t tex_components, bool geometry_color)
| Set the material mode.
void | set_sensitive (node *object)
| Indicate that a node should be sensitive to the pointing device.
void | insert_texture (const texture_node &n, bool retainHint=false)
| Create a texture object.
void | remove_texture_object (const texture_node &n)
| Remove a texture from the display list.
void | set_texture_transform (const vec2f &center, float rotation, const vec2f &scale, const vec2f &translation)
| Set the texture transform.
void | set_frustum (float field_of_view, float avatar_size, float visibility_limit)
| Set the frustum.
void | set_viewpoint (const vec3f &position, const rotation &orientation, float avatar_size, float visibility_limit)
| Set the viewpoint.
void | transform (const mat4f &mat)
| Transform the modelview.
void | transform_points (size_t nPoints, vec3f *point) const
| Transform `points` by the current modelview matrix.
const openvrml::frustum & | frustum () const
| The frustum.
void | frustum (const openvrml::frustum &f)
| Set the frustum.
bounding_volume::intersection | intersect_view_volume (const bounding_volume &bvolume) const
| Intersect the given bounding volume with the view volume.
void | draw_bounding_sphere (const bounding_sphere &bs, bounding_volume::intersection intersection)
| Draw a bounding sphere.
## Protected Member Functions
| viewer () throw ()
| Construct.
virtual bounding_volume::intersection | do_intersect_view_volume (const bounding_volume &bvolume) const
| Intersect the given bounding volume with the view volume.
virtual const openvrml::frustum & | do_frustum () const
virtual void | do_frustum (const openvrml::frustum &f)
| Set the frustum.
## Protected Attributes
openvrml::frustum | frustum_
| The frustum.
## Private Member Functions
virtual rendering_mode | do_mode ()=0
| Get the rendering mode.
virtual double | do_frame_rate ()=0
| Get the frame rate.
virtual void | do_reset_user_navigation ()=0
| Return view to the last bound Viewpoint.
virtual void | do_begin_object (const char *id, bool retain=false)=0
| Begin a display list.
virtual void | do_end_object ()=0
| End a display list.
virtual void | do_insert_background (const background_node &n)=0
| Insert a background into a display list.
virtual void | do_insert_box (const geometry_node &n, const vec3f &size)=0
| Insert a box into a display list.
virtual void | do_insert_cone (const geometry_node &n, float height, float radius, bool bottom, bool side)=0
| Insert a cone into a display list.
virtual void | do_insert_cylinder (const geometry_node &n, float height, float radius, bool bottom, bool side, bool top)=0
| Insert a cylinder into a display list.
virtual void | do_insert_elevation_grid (const geometry_node &n, unsigned int mask, const std::vector< float > &height, int32 x_dimension, int32 z_dimension, float x_spacing, float z_spacing, const std::vector< color > &color, const std::vector< vec3f > &normal, const std::vector< vec2f > &tex_coord)=0
| Insert an elevation grid into a display list.
virtual void | do_insert_extrusion (const geometry_node &n, unsigned int mask, const std::vector< vec3f > &spine, const std::vector< vec2f > &cross_section, const std::vector< rotation > &orientation, const std::vector< vec2f > &scale)=0
| Insert an extrusion into a display list.
virtual void | do_insert_line_set (const geometry_node &n, const std::vector< vec3f > &coord, const std::vector< int32 > &coord_index, bool color_per_vertex, const std::vector< color > &color, const std::vector< int32 > &color_index)=0
| Insert a line set into a display list.
virtual void | do_insert_point_set (const geometry_node &n, const std::vector< vec3f > &coord, const std::vector< color > &color)=0
| Insert a point set into a display list.
virtual void | do_insert_shell (const geometry_node &n, unsigned int mask, const std::vector< vec3f > &coord, const std::vector< int32 > &coord_index, const std::vector< color > &color, const std::vector< int32 > &color_index, const std::vector< vec3f > &normal, const std::vector< int32 > &normal_index, const std::vector< vec2f > &tex_coord, const std::vector< int32 > &tex_coord_index)=0
| Insert a shell into a display list.
virtual void | do_insert_sphere (const geometry_node &n, float radius)=0
| Insert a sphere into a display list.
virtual void | do_insert_dir_light (float ambient_intensity, float intensity, const color &color, const vec3f &direction)=0
| Insert a directional light into a display list.
virtual void | do_insert_point_light (float ambient_intensity, const vec3f &attenuation, const color &color, float intensity, const vec3f &location, float radius)=0
| Insert a point light into a display list.
virtual void | do_insert_spot_light (float ambient_intensity, const vec3f &attenuation, float beam_width, const color &color, float cut_off_angle, const vec3f &direction, float intensity, const vec3f &location, float radius)=0
| Insert a point light into a display list.
virtual void | do_remove_object (const node &ref)=0
| Remove an object from the display list.
virtual void | do_enable_lighting (bool val)=0
| Enable/disable lighting.
virtual void | do_set_fog (const color &color, float visibility_range, const char *type)=0
| Set the fog.
virtual void | do_set_color (const color &rgb, float a=1.0)=0
| Set the color.
virtual void | do_set_material (float ambient_intensity, const color &diffuse_color, const color &emissive_color, float shininess, const color &specular_color, float transparency)=0
| Set the material.
virtual void | do_set_material_mode (size_t tex_components, bool geometry_color)=0
| Set the material mode.
virtual void | do_set_sensitive (node *object)=0
| Indicate that a node should be sensitive to the pointing device.
virtual void | do_insert_texture (const texture_node &n, bool retainHint)=0
| Create a texture object.
virtual void | do_remove_texture_object (const texture_node &ref)=0
| Remove a texture from the display list.
virtual void | do_set_texture_transform (const vec2f &center, float rotation, const vec2f &scale, const vec2f &translation)=0
| Set the texture transform.
virtual void | do_set_frustum (float field_of_view, float avatar_size, float visibility_limit)=0
| Set the frustum.
virtual void | do_set_viewpoint (const vec3f &position, const rotation &orientation, float avatar_size, float visibility_limit)=0
| Set the viewpoint.
virtual void | do_transform (const mat4f &mat)=0
| Transform the modelview.
virtual void | do_transform_points (size_t nPoints, vec3f *point) const =0
| Transform `points` by the current modelview matrix.
virtual void | do_draw_bounding_sphere (const bounding_sphere &bs, bounding_volume::intersection intersection)=0
| Draw a bounding sphere.
## Private Attributes
openvrml::browser * | browser_
| A pointer to the `browser` with which the `viewer` is currently associated.
## Friends
class | browser
| A pointer to the `browser` with which the `viewer` is currently associated.

## Detailed Description

Map the scene graph to the underlying graphics library.

## Member Enumeration Documentation

enum openvrml::viewer::rendering_mode

The rendering mode.

Enumerator:

  draw_mode | Draw mode.
  pick_mode | Pick mode.

## Constructor & Destructor Documentation

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

Destroy.

Implemented in openvrml::gl::viewer.

openvrml::viewer::viewer | ( |  | ) | throw ()`[protected]`

Construct.

Reimplemented in openvrml::gl::viewer.

## Member Function Documentation

openvrml::viewer::rendering_mode openvrml::viewer::mode | ( |  | ) |

Get the rendering mode.

This function delegates to `viewer::do_mode`.

Returns:
  the rendering mode.

double openvrml::viewer::frame_rate | ( |  | ) |

Get the frame rate.

This function delegates to `viewer::do_frame_rate`.

Returns:
  the frame rate.

void openvrml::viewer::reset_user_navigation | ( |  | ) |

Return view to the last bound Viewpoint.

This function delegates to `viewer::do_reset_user_navigation`.

void openvrml::viewer::begin_object | ( | const char * | id,
|  | bool | retain = `false` |
| ) |  |  |

Begin a display list.

Parameters:

  `[in]` | id | object identifier.
  `[in]` | retain | whether the object should be retained for reuse.

This function delegates to `viewer::do_begin_object`.

void openvrml::viewer::end_object | ( |  | ) |

End a display list.

This function delegates to `viewer::do_end_object`.

void openvrml::viewer::insert_background | ( | const background_node & | n | ) |

Insert a background into a display list.

This function delegates to `viewer::do_insert_background`.

Parameters:

  `[in]` | n | a `background_node`.

void openvrml::viewer::insert_box | ( | const geometry_node & | n,
|  | const vec3f & | size |
| ) |  |  |

Insert a box into a display list.

This function delegates to `viewer::do_insert_box`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the box.
  `[in]` | size | box dimensions.

void openvrml::viewer::insert_cone | ( | const geometry_node & | n,
|  | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side |
| ) |  |  |

Insert a cone into a display list.

This function delegates to `viewer::do_insert_cone`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the cone.
  `[in]` | height | height.
  `[in]` | radius | radius at base.
  `[in]` | bottom | show the bottom.
  `[in]` | side | show the side.

void openvrml::viewer::insert_cylinder | ( | const geometry_node & | n,
|  | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side,
|  | bool | top |
| ) |  |  |

Insert a cylinder into a display list.

This function delegates to `viewer::do_insert_cylinder`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the cylinder.
  `[in]` | height | height.
  `[in]` | radius | radius.
  `[in]` | bottom | show the bottom.
  `[in]` | side | show the side.
  `[in]` | top | show the top.

void openvrml::viewer::insert_elevation_grid | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< float > & | height,
|  | int32 | x_dimension,
|  | int32 | z_dimension,
|  | float | x_spacing,
|  | float | z_spacing,
|  | const std::vector< color > & | color,
|  | const std::vector< vec3f > & | normal,
|  | const std::vector< vec2f > & | tex_coord |
| ) |  |  |

Insert an elevation grid into a display list.

This function delegates to `viewer::do_insert_elevation_grid`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the elevation grid.
  `[in]` | mask |
  `[in]` | height | height field.
  `[in]` | x_dimension | vertices in the x direction.
  `[in]` | z_dimension | vertices in the z direction.
  `[in]` | x_spacing | distance between vertices in the x direction.
  `[in]` | z_spacing | distance between vertices in the z direction.
  `[in]` | color | colors.
  `[in]` | normal | normals.
  `[in]` | tex_coord | texture coordinates.

void openvrml::viewer::insert_extrusion | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< vec3f > & | spine,
|  | const std::vector< vec2f > & | cross_section,
|  | const std::vector< rotation > & | orientation,
|  | const std::vector< vec2f > & | scale |
| ) |  |  |

Insert an extrusion into a display list.

This function delegates to `viewer::do_insert_extrusion`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the extrusion.
  `[in]` | mask |
  `[in]` | spine | spine points.
  `[in]` | cross_section | cross-sections.
  `[in]` | orientation | cross-section orientations.
  `[in]` | scale | cross-section scales.

void openvrml::viewer::insert_line_set | ( | const geometry_node & | n,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< int32 > & | coord_index,
|  | bool | color_per_vertex,
|  | const std::vector< color > & | color,
|  | const std::vector< int32 > & | color_index |
| ) |  |  |

Insert a line set into a display list.

This function delegates to `viewer::do_insert_line_set`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the line set.
  `[in]` | coord | coordinates.
  `[in]` | coord_index | coordinate indices.
  `[in]` | color_per_vertex | whether colors are applied per-vertex or per-face.
  `[in]` | color | colors.
  `[in]` | color_index | color indices.

void openvrml::viewer::insert_point_set | ( | const geometry_node & | n,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< color > & | color |
| ) |  |  |

Insert a point set into a display list.

This function delegates to `viewer::insert_point_set`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the point set.
  `[in]` | coord | points.
  `[in]` | color | colors.

void openvrml::viewer::insert_shell | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< int32 > & | coord_index,
|  | const std::vector< color > & | color,
|  | const std::vector< int32 > & | color_index,
|  | const std::vector< vec3f > & | normal,
|  | const std::vector< int32 > & | normal_index,
|  | const std::vector< vec2f > & | tex_coord,
|  | const std::vector< int32 > & | tex_coord_index |
| ) |  |  |

Insert a shell into a display list.

This function delegates to `viewer::do_insert_shell`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the shell.
  `[in]` | mask |
  `[in]` | coord | coordinates.
  `[in]` | coord_index | coordinate indices.
  `[in]` | color | colors.
  `[in]` | color_index | color indices.
  `[in]` | normal | normals.
  `[in]` | normal_index | normal indices.
  `[in]` | tex_coord | texture coordinates.
  `[in]` | tex_coord_index | texture coordinate indices.

void openvrml::viewer::insert_sphere | ( | const geometry_node & | n,
|  | float | radius |
| ) |  |  |

Insert a sphere into a display list.

This function delegates to `viewer::do_insert_sphere`.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the sphere.
  `[in]` | radius | sphere radius.

void openvrml::viewer::insert_dir_light | ( | float | ambient_intensity,
|  | float | intensity,
|  | const color & | color,
|  | const vec3f & | direction |
| ) |  |  |

Insert a directional light into a display list.

This function delegates to `viewer::do_insert_dir_light`.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | intensity | intensity.
  `[in]` | color | color.
  `[in]` | direction | direction.

void openvrml::viewer::insert_point_light | ( | float | ambient_intensity,
|  | const vec3f & | attenuation,
|  | const color & | color,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius |
| ) |  |  |

Insert a point light into a display list.

This function delegates to `viewer::do_insert_point_light`.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | attenuation | attenuation.
  `[in]` | color | color.
  `[in]` | intensity | intensity.
  `[in]` | location | location.
  `[in]` | radius | radius.

void openvrml::viewer::insert_spot_light | ( | float | ambient_intensity,
|  | const vec3f & | attenuation,
|  | float | beam_width,
|  | const color & | color,
|  | float | cut_off_angle,
|  | const vec3f & | direction,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius |
| ) |  |  |

Insert a point light into a display list.

This function delegates to `viewer::do_insert_spot_light`.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | attenuation | attenuation.
  `[in]` | beam_width | beam width.
  `[in]` | color | color.
  `[in]` | cut_off_angle | cut-off angle.
  `[in]` | direction | direction.
  `[in]` | intensity | intensity.
  `[in]` | location | location.
  `[in]` | radius | radius.

void openvrml::viewer::remove_object | ( | const node & | ref | ) |

Remove an object from the display list.

This function delegates to `viewer::do_remove_object`.

Parameters:

  `[in]` | ref | object handle.

void openvrml::viewer::enable_lighting | ( | bool | val | ) |

Enable/disable lighting.

This function delegates to `viewer::do_enable_lighting`.

Parameters:

  `[in]` | val | whether lighting should be enabled.

void openvrml::viewer::set_fog | ( | const color & | color,
|  | float | visibility_range,
|  | const char * | type |
| ) |  |  |

Set the fog.

This function delegates to `viewer::do_set_fog`.

Parameters:

  `[in]` | color | fog color.
  `[in]` | visibility_range | the distance at which objects are fully obscured by fog.
  `[in]` | type | fog type.

void openvrml::viewer::set_color | ( | const color & | rgb,
|  | float | a = `1.0` |
| ) |  |  |

Set the color.

This function delegates to `viewer::do_set_color`.

Parameters:

  `[in]` | rgb | red, green, and blue components.
  `[in]` | a | alpha (transparency) component.

void openvrml::viewer::set_material | ( | float | ambient_intensity,
|  | const color & | diffuse_color,
|  | const color & | emissive_color,
|  | float | shininess,
|  | const color & | specular_color,
|  | float | transparency |
| ) |  |  |

Set the material.

This function delegates to `viewer::do_set_material`.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | diffuse_color | diffuse color.
  `[in]` | emissive_color | emissive color.
  `[in]` | shininess | shininess.
  `[in]` | specular_color | specular color.
  `[in]` | transparency | transparency.

void openvrml::viewer::set_material_mode | ( | size_t | tex_components,
|  | bool | geometry_color |
| ) |  |  |

Set the material mode.

This function delegates to `viewer::do_set_material_mode`.

Parameters:

  `[in]` | tex_components | texture components.
  `[in]` | geometry_color | geometry color.

void openvrml::viewer::set_sensitive | ( | node * | object | ) |

Indicate that a node should be sensitive to the pointing device.

This function delegates to `viewer::do_set_sensitive`.

Parameters:

  `[in]` | object | a node.

void openvrml::viewer::insert_texture | ( | const texture_node & | n,
|  | bool | retainHint = `false` |
| ) |  |  |

Create a texture object.

This function delegates to `viewer::do_insert_texture`.

Parameters:

  `[in]` | n | a `texture_node`.
  `[in]` | retainHint | whether the texture is likely to be reused.

void openvrml::viewer::remove_texture_object | ( | const texture_node & | ref | ) |

Remove a texture from the display list.

This function delegates to `viewer::do_remove_texture_object`.

Parameters:

  `[in]` | ref | texture handle.

void openvrml::viewer::set_texture_transform | ( | const vec2f & | center,
|  | float | rotation,
|  | const vec2f & | scale,
|  | const vec2f & | translation |
| ) |  |  |

Set the texture transform.

This function delegates to `viewer::do_set_texture_transform`.

Parameters:

  `[in]` | center | center.
  `[in]` | rotation | rotation.
  `[in]` | scale | scale.
  `[in]` | translation | translation.

void openvrml::viewer::set_frustum | ( | float | field_of_view,
|  | float | avatar_size,
|  | float | visibility_limit |
| ) |  |  |

Set the frustum.

This function delegates to `viewer::do_set_frustum`.

Parameters:

  `[in]` | field_of_view | field of view.
  `[in]` | avatar_size | avatar size.
  `[in]` | visibility_limit | visibility limit.

void openvrml::viewer::set_viewpoint | ( | const vec3f & | position,
|  | const rotation & | orientation,
|  | float | avatar_size,
|  | float | visibility_limit |
| ) |  |  |

Set the viewpoint.

This function delegates to `viewer::do_set_viewpoint`.

Parameters:

  `[in]` | position | position.
  `[in]` | orientation | orientation.
  `[in]` | avatar_size | avatar size.
  `[in]` | visibility_limit | visiblity limit.

void openvrml::viewer::transform | ( | const mat4f & | mat | ) |

Transform the modelview.

Make the modelview matrix the result of multiplying `mat` by the current modelview matrix.

This function delegates to `viewer::do_transform`.

Parameters:

  `[in]` | mat | transformation matrix.

void openvrml::viewer::transform_points | ( | size_t | nPoints,
|  | vec3f * | point |
| ) |  |  | const

Transform `points` by the current modelview matrix.

This function delegates to `viewer::do_transform_points`.

Parameters:

  `[in]` | nPoints | number of points.
  `[in]` | point | pointer to the first point in an array.

const openvrml::frustum & openvrml::viewer::frustum | ( |  | ) | const

The frustum.

This function delegates to `viewer::do_frustum`.

Returns:
  the frustum.

void openvrml::viewer::frustum | ( | const openvrml::frustum & | f | ) |

Set the frustum.

This function delegates to `viewer::do_frustum(const openvrml::frustum &)`.

Parameters:

  `[in]` | f | new frustum value.

openvrml::bounding_volume::intersection openvrml::viewer::intersect_view_volume | ( | const bounding_volume & | bvolume | ) | const

Intersect the given bounding volume with the view volume.

This function delegates to `viewer::do_intersect_view_volume`.

Parameters:

  `[in]` | bvolume | the bounding volume to intersect with the view volume.

Returns:
  bounding_volume::inside, bounding_volume::outside, or bounding_volume::partial.

void openvrml::viewer::draw_bounding_sphere | ( | const bounding_sphere & | bs,
|  | bounding_volume::intersection | intersection |
| ) |  |  |

Draw a bounding sphere.

Used for debugging view culling. Probably should be draw_bounding_volume and handle axis_aligned_bounding_boxes as well.

This function delegates to `viewer::do_draw_bounding_sphere`.

Parameters:

  `[in]` | bs | a bounding sphere; if max, will not be drawn
  `[in]` | intersection | one of the bvolume intersection test constants, or 4 to draw in unique way. (useful for debugging)

openvrml::bounding_volume::intersection openvrml::viewer::do_intersect_view_volume | ( | const bounding_volume & | bvolume | ) | const`[protected, virtual]`

Intersect the given bounding volume with the view volume.

This goes into the viewer to provide a hook for systems that use nonstandard view volumes. Most subclasses should be able to use the default implementation provided here. If your view volume is so strange that there's no way to cull to it, then reimplement to return `bounding_volume::inside` always.

Parameters:

  `[in]` | bvolume | the bounding volume to intersect with the view volume.

Returns:
  `bounding_volume::inside`, `bounding_volume::outside`, or `bounding_volume::partial`.

const openvrml::frustum & openvrml::viewer::do_frustum | ( |  | ) | const`[protected, virtual]`

Returns:
  the frustum.

void openvrml::viewer::do_frustum | ( | const openvrml::frustum & | f | ) | `[protected, virtual]`

Set the frustum.

Parameters:

  `[in]` | f | new frustum value.

openvrml::viewer::rendering_mode openvrml::viewer::do_mode | ( |  | ) | `[private, pure virtual]`

Get the rendering mode.

Returns:
  the rendering mode.

Implemented in openvrml::gl::viewer.

double openvrml::viewer::do_frame_rate | ( |  | ) | `[private, pure virtual]`

Get the frame rate.

Returns:
  the frame rate.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_reset_user_navigation | ( |  | ) | `[private, pure virtual]`

Return view to the last bound Viewpoint.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_begin_object | ( | const char * | id,
|  | bool | retain = `false` |
| ) |  |  | `[private, pure virtual]`

Begin a display list.

Parameters:

  `[in]` | id | object identifier.
  `[in]` | retain | whether the object should be retained for reuse.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_end_object | ( |  | ) | `[private, pure virtual]`

End a display list.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_background | ( | const background_node & | n | ) | `[private, pure virtual]`

Insert a background into a display list.

Parameters:

  `[in]` | n | a `background_node`.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_box | ( | const geometry_node & | n,
|  | const vec3f & | size |
| ) |  |  | `[private, pure virtual]`

Insert a box into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the box.
  `[in]` | size | box dimensions.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_cone | ( | const geometry_node & | n,
|  | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side |
| ) |  |  | `[private, pure virtual]`

Insert a cone into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the cone.
  `[in]` | height | height.
  `[in]` | radius | radius at base.
  `[in]` | bottom | show the bottom.
  `[in]` | side | show the side.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_cylinder | ( | const geometry_node & | n,
|  | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side,
|  | bool | top |
| ) |  |  | `[private, pure virtual]`

Insert a cylinder into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the cylinder.
  `[in]` | height | height.
  `[in]` | radius | radius.
  `[in]` | bottom | show the bottom.
  `[in]` | side | show the side.
  `[in]` | top | show the top.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_elevation_grid | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< float > & | height,
|  | int32 | x_dimension,
|  | int32 | z_dimension,
|  | float | x_spacing,
|  | float | z_spacing,
|  | const std::vector< color > & | color,
|  | const std::vector< vec3f > & | normal,
|  | const std::vector< vec2f > & | tex_coord |
| ) |  |  | `[private, pure virtual]`

Insert an elevation grid into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the elevation grid.
  `[in]` | mask |
  `[in]` | height | height field.
  `[in]` | x_dimension | vertices in the x direction.
  `[in]` | z_dimension | vertices in the z direction.
  `[in]` | x_spacing | distance between vertices in the x direction.
  `[in]` | z_spacing | distance between vertices in the z direction.
  `[in]` | color | colors.
  `[in]` | normal | normals.
  `[in]` | tex_coord | texture coordinates.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_extrusion | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< vec3f > & | spine,
|  | const std::vector< vec2f > & | cross_section,
|  | const std::vector< rotation > & | orientation,
|  | const std::vector< vec2f > & | scale |
| ) |  |  | `[private, pure virtual]`

Insert an extrusion into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the extrusion.
  `[in]` | mask |
  `[in]` | spine | spine points.
  `[in]` | cross_section | cross-sections.
  `[in]` | orientation | cross-section orientations.
  `[in]` | scale | cross-section scales.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_line_set | ( | const geometry_node & | n,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< int32 > & | coord_index,
|  | bool | color_per_vertex,
|  | const std::vector< color > & | color,
|  | const std::vector< int32 > & | color_index |
| ) |  |  | `[private, pure virtual]`

Insert a line set into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the line set.
  `[in]` | coord | coordinates.
  `[in]` | coord_index | coordinate indices.
  `[in]` | color_per_vertex | whether colors are applied per-vertex or per-face.
  `[in]` | color | colors.
  `[in]` | color_index | color indices.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_point_set | ( | const geometry_node & | n,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< color > & | color |
| ) |  |  | `[private, pure virtual]`

Insert a point set into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the point set.
  `[in]` | coord | points.
  `[in]` | color | colors.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_shell | ( | const geometry_node & | n,
|  | unsigned int | mask,
|  | const std::vector< vec3f > & | coord,
|  | const std::vector< int32 > & | coord_index,
|  | const std::vector< color > & | color,
|  | const std::vector< int32 > & | color_index,
|  | const std::vector< vec3f > & | normal,
|  | const std::vector< int32 > & | normal_index,
|  | const std::vector< vec2f > & | tex_coord,
|  | const std::vector< int32 > & | tex_coord_index |
| ) |  |  | `[private, pure virtual]`

Insert a shell into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the shell.
  `[in]` | mask |
  `[in]` | coord | coordinates.
  `[in]` | coord_index | coordinate indices.
  `[in]` | color | colors.
  `[in]` | color_index | color indices.
  `[in]` | normal | normals.
  `[in]` | normal_index | normal indices.
  `[in]` | tex_coord | texture coordinates.
  `[in]` | tex_coord_index | texture coordinate indices.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_sphere | ( | const geometry_node & | n,
|  | float | radius |
| ) |  |  | `[private, pure virtual]`

Insert a sphere into a display list.

Parameters:

  `[in]` | n | the `geometry_node` corresponding to the sphere.
  `[in]` | radius | sphere radius.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_dir_light | ( | float | ambient_intensity,
|  | float | intensity,
|  | const color & | color,
|  | const vec3f & | direction |
| ) |  |  | `[private, pure virtual]`

Insert a directional light into a display list.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | intensity | intensity.
  `[in]` | color | color.
  `[in]` | direction | direction.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_point_light | ( | float | ambient_intensity,
|  | const vec3f & | attenuation,
|  | const color & | color,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius |
| ) |  |  | `[private, pure virtual]`

Insert a point light into a display list.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | attenuation | attenuation.
  `[in]` | color | color.
  `[in]` | intensity | intensity.
  `[in]` | location | location.
  `[in]` | radius | radius.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_spot_light | ( | float | ambient_intensity,
|  | const vec3f & | attenuation,
|  | float | beam_width,
|  | const color & | color,
|  | float | cut_off_angle,
|  | const vec3f & | direction,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius |
| ) |  |  | `[private, pure virtual]`

Insert a point light into a display list.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | attenuation | attenuation.
  `[in]` | beam_width | beam width.
  `[in]` | color | color.
  `[in]` | cut_off_angle | cut-off angle.
  `[in]` | direction | direction.
  `[in]` | intensity | intensity.
  `[in]` | location | location.
  `[in]` | radius | radius.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_remove_object | ( | const node & | ref | ) | `[private, pure virtual]`

Remove an object from the display list.

Parameters:

  `[in]` | ref | object handle.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_enable_lighting | ( | bool | val | ) | `[private, pure virtual]`

Enable/disable lighting.

Parameters:

  `[in]` | val | whether lighting should be enabled.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_fog | ( | const color & | color,
|  | float | visibility_range,
|  | const char * | type |
| ) |  |  | `[private, pure virtual]`

Set the fog.

Parameters:

  `[in]` | color | fog color.
  `[in]` | visibility_range | the distance at which objects are fully obscured by fog.
  `[in]` | type | fog type.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_color | ( | const color & | rgb,
|  | float | a = `1.0` |
| ) |  |  | `[private, pure virtual]`

Set the color.

Parameters:

  `[in]` | rgb | red, green, and blue components.
  `[in]` | a | alpha (transparency) component.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_material | ( | float | ambient_intensity,
|  | const color & | diffuse_color,
|  | const color & | emissive_color,
|  | float | shininess,
|  | const color & | specular_color,
|  | float | transparency |
| ) |  |  | `[private, pure virtual]`

Set the material.

Parameters:

  `[in]` | ambient_intensity | ambient intensity.
  `[in]` | diffuse_color | diffuse color.
  `[in]` | emissive_color | emissive color.
  `[in]` | shininess | shininess.
  `[in]` | specular_color | specular color.
  `[in]` | transparency | transparency.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_material_mode | ( | size_t | tex_components,
|  | bool | geometry_color |
| ) |  |  | `[private, pure virtual]`

Set the material mode.

Parameters:

  `[in]` | tex_components | texture components.
  `[in]` | geometry_color | geometry color.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_sensitive | ( | node * | object | ) | `[private, pure virtual]`

Indicate that a node should be sensitive to the pointing device.

Parameters:

  `[in]` | object | a node.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_insert_texture | ( | const texture_node & | n,
|  | bool | retainHint |
| ) |  |  | `[private, pure virtual]`

Create a texture object.

Parameters:

  `[in]` | n | a `texture_node`.
  `[in]` | retainHint | whether the texture is likely to be reused.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_remove_texture_object | ( | const texture_node & | ref | ) | `[private, pure virtual]`

Remove a texture from the display list.

Parameters:

  `[in]` | ref | a `texture_node`.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_texture_transform | ( | const vec2f & | center,
|  | float | rotation,
|  | const vec2f & | scale,
|  | const vec2f & | translation |
| ) |  |  | `[private, pure virtual]`

Set the texture transform.

Parameters:

  `[in]` | center | center.
  `[in]` | rotation | rotation.
  `[in]` | scale | scale.
  `[in]` | translation | translation.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_set_frustum | ( | float | field_of_view,
|  | float | avatar_size,
|  | float | visibility_limit |
| ) |  |  | `[private, pure virtual]`

Set the frustum.

Parameters:

  `[in]` | field_of_view | field of view.
  `[in]` | avatar_size | avatar size.
  `[in]` | visibility_limit | visibility limit.

void openvrml::viewer::do_set_viewpoint | ( | const vec3f & | position,
|  | const rotation & | orientation,
|  | float | avatar_size,
|  | float | visibility_limit |
| ) |  |  | `[private, pure virtual]`

Set the viewpoint.

Parameters:

  `[in]` | position | position.
  `[in]` | orientation | orientation.
  `[in]` | avatar_size | avatar size.
  `[in]` | visibility_limit | visiblity limit.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_transform | ( | const mat4f & | mat | ) | `[private, pure virtual]`

Transform the modelview.

Make the modelview matrix the result of multiplying `mat` by the current modelview matrix.

Parameters:

  `[in]` | mat | transformation matrix.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_transform_points | ( | size_t | nPoints,
|  | vec3f * | point |
| ) |  |  | const`[private, pure virtual]`

Transform `points` by the current modelview matrix.

Parameters:

  `[in]` | nPoints | number of points.
  `[in]` | point | pointer to the first point in an array.

Implemented in openvrml::gl::viewer.

void openvrml::viewer::do_draw_bounding_sphere | ( | const bounding_sphere & | bs,
|  | bounding_volume::intersection | intersection |
| ) |  |  | `[private, pure virtual]`

Draw a bounding sphere.

Used for debugging view culling. Probably should be draw_bounding_volume and handle axis_aligned_bounding_boxes as well.

Parameters:

  `[in]` | bs | a bounding sphere; if max, will not be drawn
  `[in]` | intersection | one of the bvolume intersection test constants, or 4 to draw in unique way. (useful for debugging)

Implemented in openvrml::gl::viewer.

## Friends And Related Function Documentation

openvrml::browser * openvrml::viewer::browser`[friend]`

A pointer to the `browser` with which the `viewer` is currently associated.

Returns:
  a pointer to the `browser` with which the `viewer` is currently associated, or 0 if the `viewer` is not associated with a `browser`.

## Member Data Documentation

openvrml::browser * openvrml::viewer::browser_`[private]`

A pointer to the `browser` with which the `viewer` is currently associated.

openvrml::frustum openvrml::viewer::frustum_`[protected]`

The frustum.