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

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

# openvrml::gl::viewer Class Reference

Inheritance diagram for openvrml::gl::viewer:

[legend]
List of all members.

## Detailed Description

Abstract class for display of VRML models using OpenGL/Mesa.

A window-system specific subclass needs to redefine the pure virtual methods.

## Public Types
enum | { max_lights = 8 }
enum | light_type { light_unused, light_directional, light_positional }
| Light type. More...
enum | event_type { event_key_down, event_mouse_move, event_mouse_click, event_mouse_drag, event_mouse_release }
| Event type. More...
enum | { key_home, key_left, key_up, key_right, key_down, key_page_up, key_page_down }
## Public Member Functions
| viewer ()
| Construct a viewer for the specified browser.
virtual | ~viewer () throw ()
| Destroy.
virtual rendering_mode | mode ()
| Rendering mode.
virtual double | frame_rate ()
| Frame rate.
virtual void | reset_user_navigation ()
| Reset the user view to the position and orientation of the currently bound Viewpoint node.
virtual object_t | begin_object (const char *id, bool retain)
| Begin a display list.
virtual void | end_object ()
| End of group scope.
virtual object_t | insert_background (const std::vector< float > &groundAngle, const std::vector< color > &groundColor, const std::vector< float > &skyAngle, const std::vector< color > &skyColor, const image &front, const image &back, const image &left, const image &right, const image &top, const image &bottom)
| Insert a background into a display list.
virtual object_t | insert_box (const vec3f &size)
| Insert a box into a display list.
virtual object_t | insert_cone (float height, float radius, bool bottom, bool side)
| Insert a cone into a display list.
virtual object_t | insert_cylinder (float height, float radius, bool bottom, bool side, bool top)
| Insert a cylinder into a display list.
virtual object_t | insert_elevation_grid (unsigned int mask, const std::vector< float > &height, int32 xDimension, int32 zDimension, float xSpacing, float zSpacing, const std::vector< color > &color, const std::vector< vec3f > &normal, const std::vector< vec2f > &texCoord)
| Insert an elevation grid into a display list.
virtual object_t | insert_extrusion (unsigned int, const std::vector< vec3f > &spine, const std::vector< vec2f > &crossSection, const std::vector< openvrml::rotation > &orientation, const std::vector< vec2f > &scale)
| Insert an extrusion into a display list.
virtual object_t | insert_line_set (const std::vector< vec3f > &coord, const std::vector< int32 > &coordIndex, bool colorPerVertex, const std::vector< color > &color, const std::vector< int32 > &colorIndex)
| Insert a line set into a display list.
virtual object_t | insert_point_set (const std::vector< vec3f > &coord, const std::vector< color > &color)
| Insert a point set into a display list.
virtual object_t | insert_shell (unsigned int mask, const std::vector< vec3f > &coord, const std::vector< int32 > &coordIndex, const std::vector< color > &color, const std::vector< int32 > &colorIndex, const std::vector< vec3f > &normal, const std::vector< int32 > &normalIndex, const std::vector< vec2f > &texCoord, const std::vector< int32 > &texCoordIndex)
| Insert a shell into a display list.
virtual object_t | insert_sphere (float radius)
| Insert a sphere into a display list.
virtual object_t | insert_dir_light (float ambientIntensity, float intensity, const color &color, const vec3f &direction)
| Insert a directional light into a display list.
virtual object_t | insert_point_light (float ambientIntensity, const vec3f &attenuation, const color &color, float intensity, const vec3f &location, float radius)
| Insert a point light into a display list.
virtual object_t | insert_spot_light (float ambientIntensity, const vec3f &attenuation, float beamWidth, const color &color, float cutOffAngle, const vec3f &direction, float intensity, const vec3f &location, float radius)
| Insert a point light into a display list.
virtual object_t | insert_reference (object_t existing_object)
| Insert a reference to an existing object into a display list.
virtual void | remove_object (object_t ref)
| Remove an object from the display list.
virtual void | enable_lighting (bool)
| Enable/disable lighting.
virtual void | set_color (const color &rgb, float a=1.0)
| Set the color.
virtual void | set_fog (const color &color, float visibilityRange, const char *type)
| Set the fog.
virtual void | set_material (float ambientIntensity, const color &diffuseColor, const color &emissiveColor, float shininess, const color &specularColor, float transparency)
| Set the material.
virtual void | set_material_mode (size_t tex_components, bool geometry_color)
| Set the material mode.
virtual void | set_sensitive (node *object)
| Indicate that a node should be sensitive to the pointing device.
virtual texture_object_t | insert_texture (const image &img, bool repeat_s, bool repeat_t, bool retainHint=false)
| Create a texture object.
virtual void | insert_texture_reference (texture_object_t ref, size_t components)
| Insert a texture into the display list from an existing handle.
virtual void | remove_texture_object (texture_object_t)
| Remove a texture from the display list.
virtual void | set_texture_transform (const vec2f &center, float rotation, const vec2f &scale, const vec2f &translation)
| Set the texture transform.
virtual void | set_viewpoint (const vec3f &position, const openvrml::rotation &orientation, float fieldOfView, float avatarSize, float visibilityLimit)
| Set the viewpoint.
virtual void | transform (const mat4f &mat)
| Multiply the current modelview matrix by `mat`.
virtual void | transform_points (size_t nPoints, vec3f *point) const
| Transform `points` by the current modelview matrix.
virtual void | draw_bounding_sphere (const bounding_sphere &bs, bounding_volume::intersection intersection)
| Draw a bounding sphere.
void | update (double time=0.0)
| Update the scene.
virtual void | redraw ()
| Redraw the scene.
void | resize (size_t width, size_t height)
| Resize the viewport.
void | input (event_info *e)
| Handle an event generated from user input.
## Protected Types
enum | cursor_style { cursor_inherit, cursor_info, cursor_cycle, cursor_up_down, cursor_crosshair }
| Cursor style. More...
enum | { maxsensitive = 1000 }
## Protected Member Functions
virtual void | post_redraw ()=0
| Called to indicate to the windowing system that a redraw is necessary.
virtual void | set_cursor (cursor_style c)=0
| Called to set the cursor style.
virtual void | swap_buffers ()=0
| Called to indicate to the windowing system that the front and back buffers should be swapped.
virtual void | set_timer (double interval)=0
| Set a delay.
void | initialize ()
| Initialize.
void | begin_geometry ()
| Reset per-geometry attributes.
void | end_geometry ()
| Reset attributes changed during geometry insertion.
void | step (float, float, float)
| Translate the user view.
void | zoom (float)
| Zoom.
void | rotate (const openvrml::rotation &rot) throw ()
| Rotate the user view.
void | handleKey (int)
| Handle keypresses.
void | handleButton (event_info *e)
| Handle mouse button up/down.
void | handleMouseDrag (int, int)
| Handle mouse dragging.
bool | checkSensitive (int x, int y, event_type event)
## Protected Attributes
modelview_matrix_stack | modelview_matrix_stack_
| Modelview matrix stack.
bool | gl_initialized
| Indicate whether OpenGL has been initialized for rendering.
bool | blend
| Indicate whether alpha blending is enabled.
bool | lit
| Indicate whether lighting is enabled.
bool | texture
| Indicate whether texture mapping is enabled.
bool | wireframe
| Indicate whether wireframe mode is enabled.
size_t | win_width
| Window width.
size_t | win_height
| Window height.
color | background
| Background color.
size_t | objects
| Number of objects.
size_t | nested_objects
| Number of nested objects.
GLUtesselator * | tesselator
| GLU tesselation object.
size_t | sensitive
| Count of sensitive nodes.
size_t | active_sensitive
| Count of active sensitive nodes.
size_t | over_sensitive
| Count of sensitive nodes the mouse is over.
node * | sensitive_object [maxsensitive]
| Sensitive nodes.
bool | select_mode
| Indicate whether the renderer is in select mode.
double | select_z
| Window z-coordinate of last selection.
light_info | light_info_ [max_lights]
| light_info for the lights in the scene.
int | beginx
| Mouse drag start x-coordinate.
int | beginy
| Mouse drag start y-coordinate.
bool | rotating
| Whether the viewer is in the process of rotating.
bool | scaling
| Whether the viewer is in the process of scaling.
bool | translating
| Whether the viewer is in the process of translating.
bool | draw_bounding_spheres
| Whether to draw bounding spheres.
double | render_time
| Updated at the end of redraw with the time redraw took to execute.
double | render_time1
| Rendering time for the previous cycle.
## Classes
struct | light_info
| Light information. More...
class | modelview_matrix_stack
| Encapsulates an extended modelview matrix stack. More...
struct | event_info
| Input event. More...

## Member Enumeration Documentation

anonymous enum

  | Enumerator:
  max_lights | Maximum number of lights in a scene.
Reimplemented from openvrml::viewer.

enum openvrml::gl::viewer::light_type

  | Light type. Enumerator:
  light_unused | Unused.
  light_directional | Directional.
  light_positional | Positional.

enum openvrml::gl::viewer::event_type

  | Event type. Enumerator:
  event_key_down | Key down.
  event_mouse_move | Mouse movement.
  event_mouse_click | Mouse button click.
  event_mouse_drag | Mouse drag.
  event_mouse_release | Mouse button release.

enum openvrml::gl::viewer::cursor_style`[protected]`

  | Cursor style. Enumerator:
  cursor_inherit | Inherit the parent's cursor style.
  cursor_info | Pointing hand.
  cursor_cycle | Arrows rotating in a circle.
  cursor_up_down | Bidirectional pointing up and down.
  cursor_crosshair | Crosshair.

anonymous enum`[protected]`

  | Enumerator:
  maxsensitive | Maximum number of sensitive nodes.

## Constructor & Destructor Documentation

openvrml::gl::viewer::viewer | ( |  | ) |

| Construct a viewer for the specified browser. Reimplemented from openvrml::viewer.

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

| Destroy. Implements openvrml::viewer.

## Member Function Documentation

void openvrml::gl::viewer::post_redraw | ( |  | ) | `[protected, pure virtual]`

| Called to indicate to the windowing system that a redraw is necessary.

void openvrml::gl::viewer::set_cursor | ( | cursor_style | c | ) | `[protected, pure virtual]`

  | Called to set the cursor style. Parameters:
  | c | cursor style identifier.

void openvrml::gl::viewer::swap_buffers | ( |  | ) | `[protected, pure virtual]`

| Called to indicate to the windowing system that the front and back buffers should be swapped.

void openvrml::gl::viewer::set_timer | ( | double | interval | ) | `[protected, pure virtual]`

  | Set a delay. Parameters:
  | interval | milliseconds to delay.

void openvrml::gl::viewer::initialize | ( |  | ) | `[protected]`

| Initialize.

void openvrml::gl::viewer::begin_geometry | ( |  | ) | `[protected]`

| Reset per-geometry attributes. Called after the appearance/material has been set.

void openvrml::gl::viewer::end_geometry | ( |  | ) | `[protected]`

| Reset attributes changed during geometry insertion.

void openvrml::gl::viewer::step | ( | float | x,
|  | float | y,
|  | float | z
| ) | `[protected]`

  | Translate the user view. Parameters:
  | x | translation vector x component.
  | y | translation vector y component.
  | z | translation vector z component.

void openvrml::gl::viewer::zoom | ( | float | z | ) | `[protected]`

  | Zoom. Parameters:
  | z | amount to zoom.

void openvrml::gl::viewer::rotate | ( | const openvrml::rotation & | rot | ) | throw ()`[protected]`

  | Rotate the user view. Parameters:
  | rot | rotation.

void openvrml::gl::viewer::handleKey | ( | int | key | ) | `[protected]`

  | Handle keypresses. Parameters:
  | key | key identifier.

void openvrml::gl::viewer::handleButton | ( | event_info * | e | ) | `[protected]`

  | Handle mouse button up/down. Parameters:
  | e | event data.

void openvrml::gl::viewer::handleMouseDrag | ( | int | x,
|  | int | y
| ) | `[protected]`

  | Handle mouse dragging. Parameters:
  | x | pointer x-coordinate.
  | y | pointer y-coordinate.

bool openvrml::gl::viewer::checkSensitive | ( | int | x,
|  | int | y,
|  | event_type | event
| ) | `[protected]`

| Check for pickable objects.

viewer::rendering_mode openvrml::gl::viewer::mode | ( |  | ) | `[virtual]`

| Rendering mode. Returns: the rendering_mode. Implements openvrml::viewer.

double openvrml::gl::viewer::frame_rate | ( |  | ) | `[virtual]`

| Frame rate. Returns: the frame rate. Implements openvrml::viewer.

void openvrml::gl::viewer::reset_user_navigation | ( |  | ) | `[virtual]`

| Reset the user view to the position and orientation of the currently bound Viewpoint node. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::begin_object | ( | const char * | id,
|  | bool | retain
| ) | `[virtual]`

  | Begin a display list. begin_object/end_object should correspond to grouping_nodes. Group-level scoping for directional lights, anchors, sensors are handled here. Display lists can optionally be created (but the retain flag is just a hint, not guaranteed). Retained objects can be referred to later to avoid duplicating geometry. OpenGL doesn't allow nested objects. The top-down approach of putting entire groups in display lists is faster for static scenes but uses more memory and means that if anything is changed, the whole object must be tossed. The bottom-up model wraps each piece of geometry in a dlist but requires traversal of the entire scene graph to reference each dlist. The decision about what groups to stuff in an object is punted to the object itself, as it can decide whether it is mutable. The OpenGL viewer never puts objects in display lists, so the retain hint is ignored. Parameters:
  | id | not used.
  | retain | not used.
Returns: 0. Implements openvrml::viewer.

void openvrml::gl::viewer::end_object | ( |  | ) | `[virtual]`

| End of group scope. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_background | ( | const std::vector< float > & | groundAngle,
|  | const std::vector< color > & | groundColor,
|  | const std::vector< float > & | skyAngle,
|  | const std::vector< color > & | skyColor,
|  | const image & | front,
|  | const image & | back,
|  | const image & | left,
|  | const image & | right,
|  | const image & | top,
|  | const image & | bottom
| ) | `[virtual]`

  | Insert a background into a display list. Parameters:
  | groundAngle | ground angles.
  | groundColor | ground colors.
  | skyAngle | sky angles.
  | skyColor | sky colors.
  | front | front texture.
  | back | back texture.
  | left | left texture.
  | right | right texture.
  | top | top texture.
  | bottom | bottom texture.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_box | ( | const vec3f & | size | ) | `[virtual]`

  | Insert a box into a display list. Parameters:
  | size | box dimensions.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_cone | ( | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side
| ) | `[virtual]`

  | Insert a cone into a display list. Parameters:
  | height | height.
  | radius | radius at base.
  | bottom | show the bottom.
  | side | show the side.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_cylinder | ( | float | height,
|  | float | radius,
|  | bool | bottom,
|  | bool | side,
|  | bool | top
| ) | `[virtual]`

  | Insert a cylinder into a display list. Parameters:
  | height | height.
  | radius | radius.
  | bottom | show the bottom.
  | side | show the side.
  | top | show the top.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_elevation_grid | ( | unsigned int | mask,
|  | const std::vector< float > & | height,
|  | int32 | xDimension,
|  | int32 | zDimension,
|  | float | xSpacing,
|  | float | zSpacing,
|  | const std::vector< color > & | color,
|  | const std::vector< vec3f > & | normal,
|  | const std::vector< vec2f > & | texCoord
| ) | `[virtual]`

  | Insert an elevation grid into a display list. Parameters:
  | mask |
  | height | height field.
  | xDimension | vertices in the x direction.
  | zDimension | vertices in the z direction.
  | xSpacing | distance between vertices in the x direction.
  | zSpacing | distance between vertices in the z direction.
  | color | colors.
  | normal | normals.
  | texCoord | texture coordinates.
Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_extrusion | ( | unsigned int | mask,
|  | const std::vector< vec3f > & | spine,
|  | const std::vector< vec2f > & | crossSection,
|  | const std::vector< openvrml::rotation > & | orientation,
|  | const std::vector< vec2f > & | scale
| ) | `[virtual]`

  | Insert an extrusion into a display list. Parameters:
  | mask |
  | spine | spine points.
  | crossSection | cross-sections.
  | orientation | cross-section orientations.
  | scale | cross-section scales.
Returns: display object identifier.

viewer::object_t openvrml::gl::viewer::insert_line_set | ( | const std::vector< vec3f > & | coord,
|  | const std::vector< int32 > & | coordIndex,
|  | bool | colorPerVertex,
|  | const std::vector< color > & | color,
|  | const std::vector< int32 > & | colorIndex
| ) | `[virtual]`

  | Insert a line set into a display list. Parameters:
  | coord | coordinates.
  | coordIndex | coordinate indices.
  | colorPerVertex | whether colors are applied per-vertex or per-face.
  | color | colors.
  | colorIndex | color indices.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_point_set | ( | const std::vector< vec3f > & | coord,
|  | const std::vector< color > & | color
| ) | `[virtual]`

  | Insert a point set into a display list. Parameters:
  | coord | points.
  | color | colors.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_shell | ( | 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
| ) | `[virtual]`

  | Insert a shell into a display list. Parameters:
  | mask |
  | coord | coordinates.
  | coord_index | coordinate indices.
  | color | colors.
  | color_index | color indices.
  | normal | normals.
  | normal_index | normal indices.
  | tex_coord | texture coordinates.
  | tex_coord_index | texture coordinate indices.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_sphere | ( | float | radius | ) | `[virtual]`

  | Insert a sphere into a display list. Parameters:
  | radius | sphere radius.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_dir_light | ( | float | ambientIntensity,
|  | float | intensity,
|  | const color & | color,
|  | const vec3f & | direction
| ) | `[virtual]`

  | Insert a directional light into a display list. Parameters:
  | ambientIntensity | ambient intensity.
  | intensity | intensity.
  | color | color.
  | direction | direction.
Returns: display object identifier. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_point_light | ( | float | ambientIntensity,
|  | const vec3f & | attenuation,
|  | const color & | color,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius
| ) | `[virtual]`

  | Insert a point light into a display list. Parameters:
  | ambientIntensity | ambient intensity.
  | attenuation | attenuation.
  | color | color.
  | intensity | intensity.
  | location | location.
  | radius | radius.
Returns: display object identifier. Todo: Only objects within radius should be lit by each PointLight. Test each object drawn against each point light and enable the lights accordingly? Get light and geometry into consistent coordinates first. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_spot_light | ( | float | ambientIntensity,
|  | const vec3f & | attenuation,
|  | float | beamWidth,
|  | const color & | color,
|  | float | cutOffAngle,
|  | const vec3f & | direction,
|  | float | intensity,
|  | const vec3f & | location,
|  | float | radius
| ) | `[virtual]`

  | Insert a point light into a display list. Parameters:
  | ambientIntensity | ambient intensity.
  | attenuation | attenuation.
  | beamWidth | beam width.
  | color | color.
  | cutOffAngle | cut-off angle.
  | direction | direction.
  | intensity | intensity.
  | location | location.
  | radius | radius.
Returns: 0. Todo: Same comments as for PointLight apply here. Implements openvrml::viewer.

viewer::object_t openvrml::gl::viewer::insert_reference | ( | object_t | existing_object | ) | `[virtual]`

| Insert a reference to an existing object into a display list. Returns: 0.

void openvrml::gl::viewer::remove_object | ( | object_t | ref | ) | `[virtual]`

  | Remove an object from the display list. Parameters:
  | ref | object handle.

void openvrml::gl::viewer::enable_lighting | ( | bool | val | ) | `[virtual]`

  | Enable/disable lighting. Parameters:
  | val | whether lighting should be enabled.
Implements openvrml::viewer.

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

  | Set the color. Parameters:
  | rgb | red, green, and blue components.
  | a | alpha (transparency) component.
Implements openvrml::viewer.

void openvrml::gl::viewer::set_fog | ( | const color & | color,
|  | float | visibilityRange,
|  | const char * | type
| ) | `[virtual]`

  | Set the fog. Parameters:
  | color | fog color.
  | visibilityRange | the distance at which objects are fully obscured by fog.
  | type | fog type.
Implements openvrml::viewer.

void openvrml::gl::viewer::set_material | ( | float | ambientIntensity,
|  | const color & | diffuseColor,
|  | const color & | emissiveColor,
|  | float | shininess,
|  | const color & | specularColor,
|  | float | transparency
| ) | `[virtual]`

  | Set the material. Parameters:
  | ambientIntensity | ambient intensity.
  | diffuseColor | diffuse color.
  | emissiveColor | emissive color.
  | shininess | shininess.
  | specularColor | specular color.
  | transparency | transparency.
Implements openvrml::viewer.

void openvrml::gl::viewer::set_material_mode | ( | size_t | tex_components,
|  | bool | geometry_color
| ) | `[virtual]`

  | Set the material mode. Note: This hack is necessary because setting the color mode needs to know about the appearance (presence & components of texture) and the geometry (presence of colors). Putting this stuff in either insert_texture or insert_<geometry> causes problems when the texture or geometry node is USE'd with a different context. Parameters:
  | tex_components | texture components.
  | geometry_color | geometry color.
Implements openvrml::viewer.

void openvrml::gl::viewer::set_sensitive | ( | node * | object | ) | `[virtual]`

  | Indicate that a node should be sensitive to the pointing device. Parameters:
  | object | a node.
Implements openvrml::viewer.

viewer::texture_object_t openvrml::gl::viewer::insert_texture | ( | const image & | img,
|  | bool | repeat_s,
|  | bool | repeat_t,
|  | bool | retainHint = `false`
| ) | `[virtual]`

  | Create a texture object. Parameters:
  | img | image.
  | repeat_s | repeat in the S direction.
  | repeat_t | repeat in the T direction.
  | retainHint | whether the texture is likely to be reused.
Returns: a handle to the inserted texture. Implements openvrml::viewer.

void openvrml::gl::viewer::insert_texture_reference | ( | texture_object_t | ref,
|  | size_t | components
| ) | `[virtual]`

  | Insert a texture into the display list from an existing handle. Parameters:
  | ref | texture handle.
  | components | number of components.

void openvrml::gl::viewer::remove_texture_object | ( | texture_object_t | ref | ) | `[virtual]`

  | Remove a texture from the display list. Parameters:
  | ref | texture handle.

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

  | Set the texture transform. Texture coordinate transform Tc' = -C x S x R x C x T x Tc Parameters:
  | center | center.
  | rotation | rotation.
  | scale | scale.
  | translation | translation.
Implements openvrml::viewer.

void openvrml::gl::viewer::set_viewpoint | ( | const vec3f & | position,
|  | const openvrml::rotation & | orientation,
|  | float | fieldOfView,
|  | float | avatarSize,
|  | float | visibilityLimit
| ) | `[virtual]`

  | Set the viewpoint. Parameters:
  | position | position.
  | orientation | orientation.
  | fieldOfView | field of view.
  | avatarSize | avatar size.
  | visibilityLimit | visiblity limit.
Implements openvrml::viewer.

void openvrml::gl::viewer::transform | ( | const mat4f & | mat | ) | `[virtual]`

  | Multiply the current modelview matrix by `mat`. Parameters:
  | mat | a matrix.
Implements openvrml::viewer.

void openvrml::gl::viewer::transform_points | ( | size_t | nPoints,
|  | vec3f * | point
| ) | const`[virtual]`

  | Transform `points` by the current modelview matrix. Parameters:
  | nPoints | number of points.
  | point | pointer to the first point in an array.
Implements openvrml::viewer.

void openvrml::gl::viewer::draw_bounding_sphere | ( | const bounding_sphere & | bs,
|  | bounding_volume::intersection | intersection
| ) | `[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:
  | bs | a bounding sphere; if max, will not be drawn
  | intersection | one of the bvolume intersection test constants, or 4 to draw in unique way. (useful for debugging)
Implements openvrml::viewer.

void openvrml::gl::viewer::update | ( | double | time = `0.0` | ) |

  | Update the scene. update is called from a timer callback and from checkSensitive. Parameters:
  | time | current time.

void openvrml::gl::viewer::redraw | ( |  | ) | `[virtual]`

| Redraw the scene.

void openvrml::gl::viewer::resize | ( | size_t | width,
|  | size_t | height
| ) |

  | Resize the viewport. Parameters:
  | width | new width.
  | height | new height.

void openvrml::gl::viewer::input | ( | event_info * | e | ) |

  | Handle an event generated from user input. Parameters:
  | e | event data.

## Member Data Documentation

viewer::modelview_matrix_stack openvrml::gl::viewer::modelview_matrix_stack_`[protected]`

| Modelview matrix stack.

bool openvrml::gl::viewer::gl_initialized`[protected]`

| Indicate whether OpenGL has been initialized for rendering.

bool openvrml::gl::viewer::blend`[protected]`

| Indicate whether alpha blending is enabled.

bool openvrml::gl::viewer::lit`[protected]`

| Indicate whether lighting is enabled.

bool openvrml::gl::viewer::texture`[protected]`

| Indicate whether texture mapping is enabled.

bool openvrml::gl::viewer::wireframe`[protected]`

| Indicate whether wireframe mode is enabled.

size_t openvrml::gl::viewer::win_width`[protected]`

| Window width.

size_t openvrml::gl::viewer::win_height`[protected]`

| Window height.

color openvrml::gl::viewer::background`[protected]`

| Background color.

size_t openvrml::gl::viewer::objects`[protected]`

| Number of objects.

size_t openvrml::gl::viewer::nested_objects`[protected]`

| Number of nested objects.

GLUtesselator * openvrml::gl::viewer::tesselator`[protected]`

| GLU tesselation object.

size_t openvrml::gl::viewer::sensitive`[protected]`

| Count of sensitive nodes.

size_t openvrml::gl::viewer::active_sensitive`[protected]`

| Count of active sensitive nodes.

size_t openvrml::gl::viewer::over_sensitive`[protected]`

| Count of sensitive nodes the mouse is over.

node * openvrml::gl::viewer::sensitive_object[viewer::maxsensitive]`[protected]`

| Sensitive nodes.

bool openvrml::gl::viewer::select_mode`[protected]`

| Indicate whether the renderer is in select mode.

double openvrml::gl::viewer::select_z`[protected]`

| Window z-coordinate of last selection.

viewer::light_info openvrml::gl::viewer::light_info_[viewer::max_lights]`[protected]`

| light_info for the lights in the scene.

int openvrml::gl::viewer::beginx`[protected]`

| Mouse drag start x-coordinate.

int openvrml::gl::viewer::beginy`[protected]`

| Mouse drag start y-coordinate.

bool openvrml::gl::viewer::rotating`[protected]`

| Whether the viewer is in the process of rotating.

bool openvrml::gl::viewer::scaling`[protected]`

| Whether the viewer is in the process of scaling.

bool openvrml::gl::viewer::translating`[protected]`

| Whether the viewer is in the process of translating.

bool openvrml::gl::viewer::draw_bounding_spheres`[protected]`

| Whether to draw bounding spheres.

double openvrml::gl::viewer::render_time`[protected]`

| Updated at the end of redraw with the time redraw took to execute.

double openvrml::gl::viewer::render_time1`[protected]`

| Rendering time for the previous cycle.