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

Scene Class Reference

A scene in the VRML world. More...

List of all members.


Public Methods

 Scene (Browser &browser, const MFString &uri, Scene *parent=0) throw (InvalidVrml, std::bad_alloc)
 Construct a Scene from a URI.

const MFNodegetNodes () const throw ()
const std::string getURI () const throw (std::bad_alloc)
 Get the absolute URI for the Scene.

void initialize (double timestamp)
 Initialize the scene.

void render (Viewer &viewer, VrmlRenderContext context)
 Render the Scene.

void loadURI (const MFString &uri, const MFString &parameter) throw (std::bad_alloc)
 Load a resource into browser.


Public Attributes

Browserbrowser
 A reference to the Browser associated with the Scene.

Scene *const parent
 A pointer to the parent scene.


Private Methods

 Scene (const Scene &)
Scene & operator= (const Scene &)

Private Attributes

MFNode nodes
 The nodes for the scene.

std::string uri
 The URI for the scene.


Detailed Description

A scene in the VRML world.


Constructor & Destructor Documentation

Scene Browser   browser,
const MFString   uri,
Scene *    parent = 0
throw (InvalidVrml, std::bad_alloc)
 

Construct a Scene from a URI.

Parameters:
browser the Browser associated with the Scene.
uri the URI for the Scene.
parent the parent Scene.
Exceptions:
InvalidVrml if there is a syntax error in the VRML input.
std::bad_alloc if memory allocation fails.

Member Function Documentation

const std::string getURI   const throw (std::bad_alloc)
 

Get the absolute URI for the Scene.

Returns:
the absolute URI for the Scene.
Exceptions:
std::bad_alloc if memory allocation fails.

void initialize double    timestamp
 

Initialize the scene.

void loadURI const MFString   uri,
const MFString   parameter
throw (std::bad_alloc)
 

Load a resource into browser.

This method simply resolves any relative references in uri and calls Browser::loadURI.

Note:
There are a couple of edge cases here where we are probably doing the wrong thing:
  • If there is a URI in the list of the form "#NodeId" and it is not the first URI in the list, this URI will be loaded as if it were a new world rather than as a Viewpoint that should simply be bound.
  • If the first URI in the list is of the form "#NodeId" and no Viewpoint named "NodeId" exists in the scene, this method will not try any subsequent URIs in the list.
Parameters:
uri an array of URIs. Per VRML97 convention, the first resource in the sequence that can be reached will be loaded into the Browser.
parameter an array of parameters to be associated with the URIs in uri.
Exceptions:
std::bad_alloc if memory allocation fails.

Todo:
This method currently fails silently if any of the URIs in uri is invalid. Should this throw InvalidURI?

void render Viewer   viewer,
VrmlRenderContext    context
 

Render the Scene.

Parameters:
viewer a Viewer to render to.
context a VrmlRenderContext.

Member Data Documentation

Browser & browser
 

A reference to the Browser associated with the Scene.

MFNode nodes [private]
 

The nodes for the scene.

Scene *const parent
 

A pointer to the parent scene.

If the Scene is the root Scene, parent will be 0.

const std::string uri [private]
 

The URI for the scene.

uri may be a relative or an absolute reference.