Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

Viewer Class Reference

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

Inheritance diagram for Viewer:

ViewerOpenGL List of all members.

Public Types

typedef long Object
 An object handle.

typedef long TextureObject
 An texture object handle.

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  RenderMode {
  RENDER_MODE_DRAW,
  RENDER_MODE_PICK
}
 The rendering mode. More...


Public Methods

virtual ~Viewer ()=0
 Destructor.

virtual RenderMode getRenderMode ()=0
 Get the rendering mode.

virtual double getFrameRate ()=0
 Get the frame rate.

virtual void resetUserNavigation ()=0
 Return view to the last bound Viewpoint.

virtual void getUserNavigation (VrmlMatrix &M)=0
 Get the user's navigation from the last bound viewpoint.

virtual Object beginObject (const char *, bool=false)=0
 Begin a display list.

virtual void endObject ()=0
 End a display list.

virtual Object insertBackground (size_t nGroundAngles=0, const float *groundAngle=0, const float *groundColor=0, size_t nSkyAngles=0, const float *skyAngle=0, const float *skyColor=0, int *whc=0, unsigned char **pixels=0)=0
 Insert a background into a display list.

virtual Object insertBox (float, float, float)=0
 Insert a box into a display list.

virtual Object insertCone (float, float, bool, bool)=0
 Insert a cone into a display list.

virtual Object insertCylinder (float, float, bool, bool, bool)=0
 Insert a cylinder into a display list.

virtual Object insertElevationGrid (unsigned int mask, size_t nx, size_t nz, const float *height, float dx, float dz, const float *tc, const float *normals, const float *colors)=0
 Insert an elevation grid into a display list.

virtual Object insertExtrusion (unsigned int, size_t nOrientation, const float *orientation, size_t nScale, const float *scale, size_t nCrossSection, const float *crossSection, size_t nSpine, const float *spine)=0
 Insert an extrusion into a display list.

virtual Object insertLineSet (size_t nCoords, const float *coord, size_t nCoordIndex, const long *coordIndex, bool colorPerVertex, const float *color, size_t nColorIndex, const long *colorIndex)=0
 Insert a line set into a display list.

virtual Object insertPointSet (size_t nv, const float *v, const float *c)=0
 Insert a point set into a display list.

virtual Object insertShell (unsigned int mask, size_t npoints, const float *points, size_t nfaces, const long *faces, const float *tc, size_t ntci, const long *tci, const float *normal, size_t nni, const long *ni, const float *color, size_t nci, const long *ci)=0
 Insert a shell into a display list.

virtual Object insertSphere (float radius)=0
 Insert a sphere into a display list.

virtual Object insertDirLight (float, float, const float[], const float[])=0
 Insert a directional light into a display list.

virtual Object insertPointLight (float, const float[], const float[], float, const float[], float)=0
 Insert a point light into a display list.

virtual Object insertSpotLight (float ambientIntensity, const float attenuation[], float beamWidth, const float color[], float cutOffAngle, const float direction[], float intensity, const float location[], float radius)=0
 Insert a point light into a display list.

virtual Object insertReference (Object existingObject)=0
 Insert a reference to an existing object into a display list.

virtual void removeObject (Object)=0
virtual void enableLighting (bool)=0
virtual void setFog (const float *color, float visibilityRange, const char *fogType)=0
virtual void setColor (float r, float g, float b, float a=1.0)=0
 Set the color.

virtual void setMaterial (float ambientIntensity, const float diffuseColor[3], const float emissiveColor[3], float shininess, const float specularColor[3], float transparency)=0
virtual void setMaterialMode (int nTexComponents, bool geometryColor)=0
virtual void setSensitive (Node *object)=0
virtual void scaleTexture (size_t w, size_t h, size_t newW, size_t newH, size_t nc, unsigned char *pixels)=0
virtual TextureObject insertTexture (size_t w, size_t h, size_t nc, bool repeat_s, bool repeat_t, const unsigned char *pixels, bool retainHint=false)=0
virtual void insertTextureReference (TextureObject, int)=0
virtual void removeTextureObject (TextureObject)=0
virtual void setTextureTransform (const float center[2], float rotation, const float scale[2], const float translation[2])=0
virtual void setViewpoint (const float position[3], const float orientation[4], float fieldOfView, float avatarSize, float visLimit)=0
virtual void transform (const VrmlMatrix &mat)=0
 Transform the modelview.

virtual void transformPoints (int nPoints, float *points)=0
virtual const VrmlFrustumgetFrustum () const
virtual void setFrustum (const VrmlFrustum &afrust)
virtual BVolume::Intersection intersectViewVolume (const BVolume &bvolume) const
virtual void drawBSphere (const BSphere &bs, BVolume::Intersection intersection)=0

Public Attributes

Browserbrowser
 The Browser associated with the Viewer.


Protected Methods

 Viewer (Browser &browser)
 Constructor.


Protected Attributes

VrmlFrustum d_frust

Private Methods

 Viewer (const Viewer &)
Viewer & operator= (const Viewer &)

Detailed Description

Map the scene graph to the underlying graphics library.


Member Typedef Documentation

Object
 

An object handle.

TextureObject
 

An texture object handle.


Member Enumeration Documentation

enum RenderMode
 

The rendering mode.

Enumeration values:
RENDER_MODE_DRAW  Draw mode.

RENDER_MODE_PICK  Pick mode.


Constructor & Destructor Documentation

~Viewer   [pure virtual]
 

Destructor.

Viewer Browser   browser [explicit, protected]
 

Constructor.

Parameters:
browser a Browser.

Member Function Documentation

Viewer::Object beginObject const char *   ,
bool    = false
[pure virtual]
 

Begin a display list.

void drawBSphere const BSphere   bs,
BVolume::Intersection    intersection
[pure virtual]
 

Draw a bounding sphere. Used for debugging view culling. Probably should be drawBVolume and handle aaboxes 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)

void endObject   [pure virtual]
 

End a display list.

double getFrameRate   [pure virtual]
 

Get the frame rate.

Returns:
the frame rate.

const VrmlFrustum & getFrustum   const [virtual]
 

Todo:
We're forcing everybody to carry around a frust whether they want it or not. It shouldn't be used except for debugging and stuff since it might not be valid in some implementations

Viewer::RenderMode getRenderMode   [pure virtual]
 

Get the rendering mode.

Returns:
the rendering mode.

void getUserNavigation VrmlMatrix   M [pure virtual]
 

Get the user's navigation from the last bound viewpoint.

Return values:
M orthonormal navigation transformation.

Viewer::Object insertBackground size_t    nGroundAngles = 0,
const float *    groundAngle = 0,
const float *    groundColor = 0,
size_t    nSkyAngles = 0,
const float *    skyAngle = 0,
const float *    skyColor = 0,
int *    whc = 0,
unsigned char **    pixels = 0
[pure virtual]
 

Insert a background into a display list.

Viewer::Object insertBox float   ,
float   ,
float   
[pure virtual]
 

Insert a box into a display list.

Viewer::Object insertCone float   ,
float   ,
bool   ,
bool   
[pure virtual]
 

Insert a cone into a display list.

Viewer::Object insertCylinder float   ,
float   ,
bool   ,
bool   ,
bool   
[pure virtual]
 

Insert a cylinder into a display list.

Viewer::Object insertDirLight float   ,
float   ,
const    float[],
const    float[]
[pure virtual]
 

Insert a directional light into a display list.

Viewer::Object insertElevationGrid unsigned int    mask,
size_t    nx,
size_t    nz,
const float *    height,
float    dx,
float    dz,
const float *    tc,
const float *    normals,
const float *    colors
[pure virtual]
 

Insert an elevation grid into a display list.

Viewer::Object insertExtrusion unsigned    int,
size_t    nOrientation,
const float *    orientation,
size_t    nScale,
const float *    scale,
size_t    nCrossSection,
const float *    crossSection,
size_t    nSpine,
const float *    spine
[pure virtual]
 

Insert an extrusion into a display list.

Viewer::Object insertLineSet size_t    nCoords,
const float *    coord,
size_t    nCoordIndex,
const long *    coordIndex,
bool    colorPerVertex,
const float *    color,
size_t    nColorIndex,
const long *    colorIndex
[pure virtual]
 

Insert a line set into a display list.

Viewer::Object insertPointLight float   ,
const    float[],
const    float[],
float   ,
const    float[],
float   
[pure virtual]
 

Insert a point light into a display list.

Viewer::Object insertPointSet size_t    nv,
const float *    v,
const float *    c
[pure virtual]
 

Insert a point set into a display list.

Viewer::Object insertReference Object    existingObject [pure virtual]
 

Insert a reference to an existing object into a display list.

Viewer::Object insertShell unsigned int    mask,
size_t    npoints,
const float *    points,
size_t    nfaces,
const long *    faces,
const float *    tc,
size_t    ntci,
const long *    tci,
const float *    normal,
size_t    nni,
const long *    ni,
const float *    color,
size_t    nci,
const long *    ci
[pure virtual]
 

Insert a shell into a display list.

Viewer::Object insertSphere float    radius [pure virtual]
 

Insert a sphere into a display list.

Viewer::Object insertSpotLight float    ambientIntensity,
const float    attenuation[],
float    beamWidth,
const float    color[],
float    cutOffAngle,
const float    direction[],
float    intensity,
const float    location[],
float    radius
[pure virtual]
 

Insert a point light into a display list.

BVolume::Intersection intersectViewVolume const BVolume   bvolume const [virtual]
 

Intersect the given bounding volume with the view volume. This goes into the viewer to provide a hook for systems that use non-standard 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 is, then reimplement to always return BVolume::inside.

Parameters:
bvolume the bounding volume to intersect with the view volume.
Returns:
BVolume::inside, BVolume::outside, or BVolume::partial.

void resetUserNavigation   [pure virtual]
 

Return view to the last bound Viewpoint.

void setColor float    r,
float    g,
float    b,
float    a = 1.0
[pure virtual]
 

Set the color.

The default implementation is a nop.

void transform const VrmlMatrix   mat [pure virtual]
 

Transform the modelview.

Multiply the current modelview matrix by mat; the result is the new modelview matrix.

Parameters:
mat matrix in VrmlMatrix format (Same as OGL)

Implemented in ViewerOpenGL.


Member Data Documentation

Browser & browser
 

The Browser associated with the Viewer.