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

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

# openvrml::scene Class Reference

List of all members.

## Detailed Description

A scene in the VRML world.

## Public Member Functions

| scene (openvrml::browser &browser, const std::vector< std::string > &url, scene *parent=0) throw (invalid_vrml, no_alternative_url, std::bad_alloc)
| Construct a scene from a URI.
void | initialize (double timestamp) throw (std::bad_alloc)
| Initialize the scene.
const std::vector< node_ptr > & | nodes () const throw ()
| Root nodes for the scene.
const std::string | url () const throw (std::bad_alloc)
| Get the absolute URI for the scene.
void | render (openvrml::viewer &viewer, rendering_context context)
| Render the scene.
void | load_url (const std::vector< std::string > &url, const std::vector< std::string > &parameter) throw (std::bad_alloc)
| Load a resource into browser.
void | shutdown (double timestamp) throw ()
| Shut down the nodes in the scene.

## Public Attributes

openvrml::browser & | browser
| A reference to the browser associated with the scene.
scene *const | parent
| A pointer to the parent scene.

## Private Attributes

std::vector< node_ptr > | nodes_
| The nodes for the scene.
std::string | url_
| The URI for the scene.

## Constructor & Destructor Documentation

openvrml::scene::scene | ( | openvrml::browser & | browser,
|  | const std::vector< std::string > & | url,
|  | scene * | parent = `0`
| ) | throw (invalid_vrml, no_alternative_url, std::bad_alloc)

Construct a scene from a URI.

Parameters:

  | browser | the browser associated with the scene.
  | url | the URI for the scene.
  | parent | the parent scene.

Exceptions:

  | invalid_vrml | if there is a syntax error in the VRML input.
  | std::bad_alloc | if memory allocation fails.

## Member Function Documentation

void openvrml::scene::initialize | ( | double | timestamp | ) | throw (std::bad_alloc)

Initialize the scene.

Parameters:

  | timestamp | the current time.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

const std::vector< node_ptr > & openvrml::scene::nodes | ( |  | ) | const throw ()`[inline]`

Root nodes for the scene.

Returns:
  the root nodes for the scene.

const std::string openvrml::scene::url | ( |  | ) | 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 openvrml::scene::render | ( | openvrml::viewer & | viewer,
|  | rendering_context | context
| ) |

Render the scene.

Parameters:

  | viewer | a Viewer to render to.
  | context | a rendering_context.

void openvrml::scene::load_url | ( | const std::vector< std::string > & | url,
|  | const std::vector< std::string > & | parameter
| ) | throw (std::bad_alloc)

Load a resource into browser.

This method simply resolves any relative references in `uri` and calls browser::load_url.

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:

  | url | 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 `url` is invalid. Should this throw invalid_url?

void openvrml::scene::shutdown | ( | double | timestamp | ) | throw ()

Shut down the nodes in the scene.

This function must be called before the scene is destroyed.

Parameters:

  | timestamp | the current time.

## Member Data Documentation

mfnode openvrml::scene::nodes_`[private]`

| The nodes for the scene.

const std::string openvrml::scene::url_`[private]`

| The URI for the scene. uri may be a relative or an absolute reference.

browser & openvrml::scene::browser

| A reference to the browser associated with the scene.

scene *const openvrml::scene::parent

| A pointer to the parent scene. If the scene is the root scene, parent will be 0.