openvrml::gl::viewer Class Reference

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

#include <openvrml/gl/viewer.h>

Inheritance diagram for openvrml::gl::viewer:

Classes

struct  event_info
 Input event. More...
struct  light_info
 Light information. More...
class  modelview_matrix_stack
 Encapsulates an extended modelview matrix stack. More...

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...
- Public Types inherited from openvrml::viewer
enum  rendering_mode {
  draw_mode,
  pick_mode
}
 The rendering mode. More...

Public Member Functions

 viewer ()
 Construct a viewer for the specified browser.
virtual ~viewer () throw ()
 Destroy.
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.
- Public Member Functions inherited from openvrml::viewer
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::frustumfrustum () 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 Types

enum  cursor_style {
  cursor_inherit,
  cursor_info,
  cursor_cycle,
  cursor_up_down,
  cursor_crosshair
}
 Cursor style. More...
enum  { maxsensitive = 1000 }

Protected Member Functions

void initialize ()
 Initialize.
void shutdown ()
 Shut down.
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)
void post_redraw ()
 Called to indicate to the windowing system that a redraw is necessary.
void set_cursor (cursor_style c)
 Called to set the cursor style.
void swap_buffers ()
 Called to indicate to the windowing system that the front and back buffers should be swapped.
void set_timer (double interval)
 Set a delay.
- Protected Member Functions inherited from openvrml::viewer
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::frustumdo_frustum () const
virtual void do_frustum (const openvrml::frustum &f)
 Set the frustum.

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.
nodesensitive_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.
- Protected Attributes inherited from openvrml::viewer
openvrml::frustum frustum_
 The frustum.

Private Member Functions

virtual rendering_mode do_mode ()
 Rendering mode.
virtual double do_frame_rate ()
 Frame rate.
virtual void do_reset_user_navigation ()
 Reset the user view to the position and orientation of the currently bound Viewpoint node.
virtual void do_begin_object (const char *id, bool retain)
 Begin a display list.
virtual void do_end_object ()
 End of group scope.
virtual void do_insert_background (const background_node &n)
 Insert a background into a display list.
virtual void do_insert_box (const geometry_node &n, const vec3f &size)
 Insert a box into a display list.
virtual void do_insert_cone (const geometry_node &n, float height, float radius, bool bottom, bool side)
 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)
 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 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 void do_insert_extrusion (const geometry_node &n, unsigned int mask, 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 void do_insert_line_set (const geometry_node &n, 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 void do_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.
virtual void do_insert_shell (const geometry_node &n, 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 void do_insert_sphere (const geometry_node &n, float radius)
 Insert a sphere into a display list.
virtual void do_insert_dir_light (float ambientIntensity, float intensity, const color &color, const vec3f &direction)
 Insert a directional light into a display list.
virtual void do_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 void do_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 void do_remove_object (const node &ref)
 Remove an object from the display list.
virtual void do_enable_lighting (bool)
 Enable/disable lighting.
virtual void do_set_color (const color &rgb, float a=1.0)
 Set the color.
virtual void do_set_fog (const color &color, float visibilityRange, const char *type)
 Set the fog.
virtual void do_set_material (float ambientIntensity, const color &diffuseColor, const color &emissiveColor, float shininess, const color &specularColor, float transparency)
 Set the material.
virtual void do_set_material_mode (size_t tex_components, bool geometry_color)
 Set the material mode.
virtual void do_set_sensitive (node *object)
 Indicate that a node should be sensitive to the pointing device.
virtual void do_insert_texture (const texture_node &n, bool retainHint=false)
 Create a texture object.
virtual void do_remove_texture_object (const texture_node &n)
 Remove a texture from the display list.
virtual void do_set_texture_transform (const vec2f &center, float rotation, const vec2f &scale, const vec2f &translation)
 Set the texture transform.
virtual void do_set_viewpoint (const vec3f &position, const openvrml::rotation &orientation, float avatarSize, float visibilityLimit)
 Set the viewpoint.
virtual void do_transform (const mat4f &mat)
 Multiply the current modelview matrix by mat.
virtual void do_transform_points (size_t nPoints, vec3f *point) const
 Transform points by the current modelview matrix.
virtual void do_draw_bounding_sphere (const bounding_sphere &bs, bounding_volume::intersection intersection)
 Draw a bounding sphere.
virtual void do_post_redraw ()=0
 Called to indicate to the windowing system that a redraw is necessary.
virtual void do_set_cursor (cursor_style c)=0
 Called to set the cursor style.
virtual void do_swap_buffers ()=0
 Called to indicate to the windowing system that the front and back buffers should be swapped.
virtual void do_set_timer (double interval)=0
 Set a delay.

Detailed Description

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

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

Member Enumeration Documentation

anonymous enum
Enumerator:
max_lights 

Maximum number of lights in a scene.

Light type.

Enumerator:
light_unused 

Unused.

light_directional 

Directional.

light_positional 

Positional.

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.

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::initialize ( )
protected

Initialize.

void openvrml::gl::viewer::shutdown ( )
protected

Shut down.

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
[in]xtranslation vector x component.
[in]ytranslation vector y component.
[in]ztranslation vector z component.
void openvrml::gl::viewer::zoom ( float  z)
protected

Zoom.

Parameters
[in]zamount to zoom.
void openvrml::gl::viewer::rotate ( const openvrml::rotation rot) throw ()
protected

Rotate the user view.

Parameters
[in]rotrotation.
void openvrml::gl::viewer::handleKey ( int  key)
protected

Handle keypresses.

Parameters
[in]keykey identifier.
void openvrml::gl::viewer::handleButton ( event_info e)
protected

Handle mouse button up/down.

Parameters
[in]eevent data.
void openvrml::gl::viewer::handleMouseDrag ( int  x,
int  y 
)
protected

Handle mouse dragging.

Parameters
[in]xpointer x-coordinate.
[in]ypointer y-coordinate.
bool openvrml::gl::viewer::checkSensitive ( int  x,
int  y,
event_type  event 
)
protected

Check for pickable objects.

void openvrml::gl::viewer::post_redraw ( )
protected

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

void openvrml::gl::viewer::set_cursor ( cursor_style  c)
protected

Called to set the cursor style.

Parameters
[in]ccursor style identifier.
void openvrml::gl::viewer::swap_buffers ( )
protected

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

Set a delay.

Parameters
[in]intervalmilliseconds to delay.
void openvrml::gl::viewer::update ( double  time = 0.0)

Update the scene.

update is called from a timer callback and from checkSensitive.

Parameters
[in]timecurrent 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
[in]widthnew width.
[in]heightnew height.
void openvrml::gl::viewer::input ( event_info e)

Handle an event generated from user input.

Parameters
[in]eevent data.
openvrml::gl::viewer::rendering_mode openvrml::gl::viewer::do_mode ( )
privatevirtual

Rendering mode.

Returns
the rendering_mode.
double openvrml::gl::viewer::do_frame_rate ( )
privatevirtual

Frame rate.

Returns
the frame rate.
void openvrml::gl::viewer::do_reset_user_navigation ( )
privatevirtual

Reset the user view to the position and orientation of the currently bound Viewpoint node.

void openvrml::gl::viewer::do_begin_object ( const char *  id,
bool  retain 
)
privatevirtual

Begin a display list.

begin_object and 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
[in]idnot used.
[in]retainnot used.
void openvrml::gl::viewer::do_end_object ( )
privatevirtual

End of group scope.

void openvrml::gl::viewer::do_insert_background ( const background_node n)
privatevirtual

Insert a background into a display list.

Parameters
[in]na background_node.
void openvrml::gl::viewer::do_insert_box ( const geometry_node n,
const vec3f size 
)
privatevirtual

Insert a box into a display list.

Parameters
[in]nthe geometry_node corresponding to the box.
[in]sizebox dimensions.
void openvrml::gl::viewer::do_insert_cone ( const geometry_node n,
float  height,
float  radius,
bool  bottom,
bool  side 
)
privatevirtual

Insert a cone into a display list.

Parameters
[in]nthe geometry_node corresponding to the cone.
[in]heightheight.
[in]radiusradius at base.
[in]bottomshow the bottom.
[in]sideshow the side.
void openvrml::gl::viewer::do_insert_cylinder ( const geometry_node n,
float  height,
float  radius,
bool  bottom,
bool  side,
bool  top 
)
privatevirtual

Insert a cylinder into a display list.

Parameters
[in]nthe geometry_node corresponding to the cylinder.
[in]heightheight.
[in]radiusradius.
[in]bottomshow the bottom.
[in]sideshow the side.
[in]topshow the top.
void openvrml::gl::viewer::do_insert_elevation_grid ( const geometry_node node,
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 
)
privatevirtual

Insert an elevation grid into a display list.

Parameters
[in]nodethe geometry_node corresponding to the elevation grid.
[in]mask
[in]heightheight field.
[in]xDimensionvertices in the x direction.
[in]zDimensionvertices in the z direction.
[in]xSpacingdistance between vertices in the x direction.
[in]zSpacingdistance between vertices in the z direction.
[in]colorcolors.
[in]normalnormals.
[in]texCoordtexture coordinates.
void openvrml::gl::viewer::do_insert_extrusion ( const geometry_node n,
unsigned int  mask,
const std::vector< vec3f > &  spine,
const std::vector< vec2f > &  crossSection,
const std::vector< openvrml::rotation > &  orientation,
const std::vector< vec2f > &  scale 
)
privatevirtual

Insert an extrusion into a display list.

Parameters
[in]nthe geometry_node corresponding to the extrusion.
[in]mask
[in]spinespine points.
[in]crossSectioncross-sections.
[in]orientationcross-section orientations.
[in]scalecross-section scales.
void openvrml::gl::viewer::do_insert_line_set ( const geometry_node n,
const std::vector< vec3f > &  coord,
const std::vector< int32 > &  coordIndex,
bool  colorPerVertex,
const std::vector< color > &  color,
const std::vector< int32 > &  colorIndex 
)
privatevirtual

Insert a line set into a display list.

Parameters
[in]nthe geometry_node corresponding to the line set.
[in]coordcoordinates.
[in]coordIndexcoordinate indices.
[in]colorPerVertexwhether colors are applied per-vertex or per- face.
[in]colorcolors.
[in]colorIndexcolor indices.
void openvrml::gl::viewer::do_insert_point_set ( const geometry_node n,
const std::vector< vec3f > &  coord,
const std::vector< color > &  color 
)
privatevirtual

Insert a point set into a display list.

Parameters
[in]nthe geometry_node corresponding to the point set.
[in]coordpoints.
[in]colorcolors.
void openvrml::gl::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 
)
privatevirtual

Insert a shell into a display list.

Parameters
[in]nthe geometry_node corresponding to the shell.
[in]mask
[in]coordcoordinates.
[in]coord_indexcoordinate indices.
[in]colorcolors.
[in]color_indexcolor indices.
[in]normalnormals.
[in]normal_indexnormal indices.
[in]tex_coordtexture coordinates.
[in]tex_coord_indextexture coordinate indices.
void openvrml::gl::viewer::do_insert_sphere ( const geometry_node n,
float  radius 
)
privatevirtual

Insert a sphere into a display list.

Parameters
[in]nthe geometry_node corresponding to the sphere.
[in]radiussphere radius.
void openvrml::gl::viewer::do_insert_dir_light ( float  ambientIntensity,
float  intensity,
const color color,
const vec3f direction 
)
privatevirtual

Insert a directional light into a display list.

Parameters
[in]ambientIntensityambient intensity.
[in]intensityintensity.
[in]colorcolor.
[in]directiondirection.
void openvrml::gl::viewer::do_insert_point_light ( float  ambientIntensity,
const vec3f attenuation,
const color color,
float  intensity,
const vec3f location,
float  radius 
)
privatevirtual

Insert a point light into a display list.

Parameters
[in]ambientIntensityambient intensity.
[in]attenuationattenuation.
[in]colorcolor.
[in]intensityintensity.
[in]locationlocation.
[in]radiusradius.
void openvrml::gl::viewer::do_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 
)
privatevirtual

Insert a point light into a display list.

Parameters
[in]ambientIntensityambient intensity.
[in]attenuationattenuation.
[in]beamWidthbeam width.
[in]colorcolor.
[in]cutOffAnglecut-off angle.
[in]directiondirection.
[in]intensityintensity.
[in]locationlocation.
[in]radiusradius.
void openvrml::gl::viewer::do_remove_object ( const node ref)
privatevirtual

Remove an object from the display list.

Parameters
[in]refobject handle.
void openvrml::gl::viewer::do_enable_lighting ( bool  val)
privatevirtual

Enable/disable lighting.

Parameters
[in]valwhether lighting should be enabled.
void openvrml::gl::viewer::do_set_color ( const color rgb,
float  a = 1.0 
)
privatevirtual

Set the color.

Parameters
[in]rgbred, green, and blue components.
[in]aalpha (transparency) component.
void openvrml::gl::viewer::do_set_fog ( const color color,
float  visibilityRange,
const char *  type 
)
privatevirtual

Set the fog.

Parameters
[in]colorfog color.
[in]visibilityRangethe distance at which objects are fully obscured by fog.
[in]typefog type.
void openvrml::gl::viewer::do_set_material ( float  ambientIntensity,
const color diffuseColor,
const color emissiveColor,
float  shininess,
const color specularColor,
float  transparency 
)
privatevirtual

Set the material.

Parameters
[in]ambientIntensityambient intensity.
[in]diffuseColordiffuse color.
[in]emissiveColoremissive color.
[in]shininessshininess.
[in]specularColorspecular color.
[in]transparencytransparency.
void openvrml::gl::viewer::do_set_material_mode ( size_t  tex_components,
bool  geometry_color 
)
privatevirtual

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
[in]tex_componentstexture components.
[in]geometry_colorgeometry color.
void openvrml::gl::viewer::do_set_sensitive ( node object)
privatevirtual

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

Parameters
[in]objecta node.
void openvrml::gl::viewer::do_insert_texture ( const texture_node n,
bool  retainHint = false 
)
privatevirtual

Create a texture object.

Parameters
[in]ntexture.
[in]retainHintwhether the texture is likely to be reused.
void openvrml::gl::viewer::do_remove_texture_object ( const texture_node ref)
privatevirtual

Remove a texture from the display list.

Parameters
[in]reftexture handle.
void openvrml::gl::viewer::do_set_texture_transform ( const vec2f center,
float  rotation,
const vec2f scale,
const vec2f translation 
)
privatevirtual

Set the texture transform.

Texture coordinate transform Tc' = -C x S x R x C x T x Tc

Parameters
[in]centercenter.
[in]rotationrotation.
[in]scalescale.
[in]translationtranslation.
void openvrml::gl::viewer::do_set_viewpoint ( const vec3f position,
const openvrml::rotation orientation,
float  avatarSize,
float  visibilityLimit 
)
privatevirtual

Set the viewpoint.

Parameters
[in]positionposition.
[in]orientationorientation.
[in]avatarSizeavatar size.
[in]visibilityLimitvisiblity limit.
void openvrml::gl::viewer::do_transform ( const mat4f mat)
privatevirtual

Multiply the current modelview matrix by mat.

Parameters
[in]mata matrix.
void openvrml::gl::viewer::do_transform_points ( size_t  nPoints,
vec3f point 
) const
privatevirtual

Transform points by the current modelview matrix.

Parameters
[in]nPointsnumber of points.
[in]pointpointer to the first point in an array.
void openvrml::gl::viewer::do_draw_bounding_sphere ( const bounding_sphere bs,
bounding_volume::intersection  intersection 
)
privatevirtual

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]bsa bounding sphere; if max, will not be drawn
[in]intersectionone of the bvolume intersection test constants, or 4 to draw in unique way. (useful for debugging)
void openvrml::gl::viewer::do_post_redraw ( )
privatepure virtual

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

void openvrml::gl::viewer::do_set_cursor ( cursor_style  c)
privatepure virtual

Called to set the cursor style.

Parameters
[in]ccursor style identifier.
void openvrml::gl::viewer::do_swap_buffers ( )
privatepure virtual

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

void openvrml::gl::viewer::do_set_timer ( double  interval)
privatepure virtual

Set a delay.

Parameters
[in]intervalmilliseconds to delay.

Member Data Documentation

openvrml::gl::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.

openvrml::node * openvrml::gl::viewer::sensitive_object[openvrml::gl::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.

openvrml::gl::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.