| Home | Download | Screen shots | Discussion | Documentation |
|---|
A scene in the VRML world. More...
#include <openvrml/scene.h>
Public Member Functions | |
| scene (openvrml::browser &browser, scene *parent=0) throw () | |
| Construct. | |
| virtual | ~scene () throw () |
| Destroy. | |
| openvrml::browser & | browser () const throw () |
Get the associated browser. | |
| scene * | parent () const throw () |
Get the parent scene. | |
| void | load (resource_istream &in) |
Load the scene from a stream. | |
| void | initialize (double timestamp) throw ( std::bad_alloc ) |
Initialize the scene. | |
| const std::string | meta (const std::string &key) const throw ( std::invalid_argument , std::bad_alloc ) |
| Get metadata. | |
| void | meta (const std::string &key, const std::string &value) throw ( std::bad_alloc ) |
| Set metadata. | |
| const std::vector< std::string > | meta_keys () const throw ( std::bad_alloc ) |
| Get the metadata keys. | |
| const std::vector < boost::intrusive_ptr< node > > | nodes () const throw ( std::bad_alloc ) |
Root nodes for the scene. | |
| void | nodes (const std::vector< boost::intrusive_ptr< node > > &n) throw ( std::invalid_argument , std::bad_alloc ) |
Set the root nodes for the scene. | |
| const scope * | root_scope () const throw () |
Get the root scope. | |
| 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 > ¶meter) throw ( std::bad_alloc ) |
| Load a resource into browser. | |
| std::auto_ptr< resource_istream > | get_resource (const std::vector< std::string > &url) const throw ( no_alternative_url , std::bad_alloc ) |
| Get a resource using a list of alternative URIs. | |
| void | read_stream (std::auto_ptr< resource_istream > in, std::auto_ptr< stream_listener > listener) |
| Read a stream in a new thread. | |
| void | create_vrml_from_url (const std::vector< std::string > &url, const boost::intrusive_ptr< node > &node, const std::string &event) throw ( unsupported_interface , std::bad_cast , boost::thread_resource_error ) |
| Create nodes from a URI. | |
| void | shutdown (double timestamp) throw () |
| Shut down the nodes in the scene. | |
Private Member Functions | |
| virtual void | scene_loaded () |
Function called once the scene has been loaded. | |
A scene in the VRML world.
| openvrml::scene::scene | ( | openvrml::browser & | browser, |
| scene * | parent = 0 |
||
| ) | throw () [explicit] |
Construct.
| [in] | browser | the browser associated with the scene. |
| [in] | parent | the parent scene. |
| openvrml::scene::~scene | ( | ) | throw () [virtual] |
Destroy.
| openvrml::browser & openvrml::scene::browser | ( | ) | const throw () |
Get the associated browser.
browser. | openvrml::scene * openvrml::scene::parent | ( | ) | const throw () |
Get the parent scene.
scene, or 0 if this is the root scene. | void openvrml::scene::load | ( | resource_istream & | in | ) |
Load the scene from a stream.
This function calls scene_loaded once parsing the scene from in has completed.
| [in,out] | in | an input stream. |
| bad_media_type | if in.type() is not “model/vrml”, “x-world/x-vrml”, or “model/x3d-vrml”. |
| invalid_vrml | if in has invalid syntax. |
| void openvrml::scene::initialize | ( | double | timestamp | ) | throw ( std::bad_alloc ) |
Initialize the scene.
| [in] | timestamp | the current time. |
| std::bad_alloc | if memory allocation fails. |
| const std::string openvrml::scene::meta | ( | const std::string & | key | ) | const throw ( std::invalid_argument , std::bad_alloc ) |
Get metadata.
| [in] | key | metadata key. |
key.| std::invalid_argument | if there is no value associated with key. |
| std::bad_alloc | if memory allocation fails. |
| void openvrml::scene::meta | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | throw ( std::bad_alloc ) |
Set metadata.
| [in] | key | metadata key. |
| [in] | value | metadata value. |
| std::bad_alloc | if memory allocation fails. |
| const std::vector< std::string > openvrml::scene::meta_keys | ( | ) | const throw ( std::bad_alloc ) |
Get the metadata keys.
| const std::vector< boost::intrusive_ptr< openvrml::node > > openvrml::scene::nodes | ( | ) | const throw ( std::bad_alloc ) |
Root nodes for the scene.
nodes for the scene.| std::bad_alloc | if memory allocation fails. |
| void openvrml::scene::nodes | ( | const std::vector< boost::intrusive_ptr< node > > & | n | ) | throw ( std::invalid_argument , std::bad_alloc ) |
Set the root nodes for the scene.
This function calls shutdown to shut down the scene's existing nodes.
| [in] | n | the new root nodes for the scene. |
| std::invalid_argument | if any of the nodes in n has already been initialized. |
| std::bad_alloc | if memory allocation fails. |
| const openvrml::scope * openvrml::scene::root_scope | ( | ) | const throw () |
Get the root scope.
scope. | const std::string openvrml::scene::url | ( | ) | const throw ( std::bad_alloc ) |
Get the absolute URI for the scene.
scene.| std::bad_alloc | if memory allocation fails. |
| void openvrml::scene::render | ( | openvrml::viewer & | viewer, |
| rendering_context | context | ||
| ) |
Render the scene.
| [in,out] | viewer | a viewer to render to. |
| [in] | 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.
#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.#NodeId” and no Viewpoint named “NodeId” exists in the scene, this method will not try any subsequent URIs in the list.| [in] | url | an array of URIs. Per VRML97 convention, the first resource in the sequence that can be reached will be loaded into the browser. |
| [in] | parameter | an array of parameters to be associated with the URIs in uri. |
| std::bad_alloc | if memory allocation fails. |
| std::auto_ptr< openvrml::resource_istream > openvrml::scene::get_resource | ( | const std::vector< std::string > & | url | ) | const throw ( no_alternative_url , std::bad_alloc ) |
Get a resource using a list of alternative URIs.
Relative URIs in url are resolved against the absolute URI of the scene.
| [in] | url | a list of alternative URIs. |
| no_alternative_url | if none of the elements of url can be resolved. |
| std::bad_alloc | if memory allocation fails. |
| void openvrml::scene::read_stream | ( | std::auto_ptr< resource_istream > | in, |
| std::auto_ptr< stream_listener > | listener | ||
| ) |
Read a stream in a new thread.
read_stream takes ownership of its arguments; the resources are released when reading the stream completes and the thread terminates.
| [in] | in | an input stream. |
| [in] | listener | a stream listener. |
| void openvrml::scene::create_vrml_from_url | ( | const std::vector< std::string > & | url, |
| const boost::intrusive_ptr< node > & | node, | ||
| const std::string & | event | ||
| ) | throw ( unsupported_interface , std::bad_cast , boost::thread_resource_error ) |
Create nodes from a URI.
This function executes asynchronously. When the nodes have been completely loaded, they are sent to the event MFNode eventIn of node.
| [in] | url | an alternative URI list. |
| [in] | node | the node to which the nodes loaded from url should be sent as an event. |
| [in] | event | the event of node to which the new nodes will be sent. |
| unsupported_interface | if node has no eventIn event. |
| std::bad_cast | if the event eventIn of node is not an MFNode. |
| boost::thread_resource_error | if thread creation fails. |
| void openvrml::scene::shutdown | ( | double | timestamp | ) | throw () |
Shut down the nodes in the scene.
This function must be called before the scene is destroyed.
| [in] | timestamp | the current time. |
| void openvrml::scene::scene_loaded | ( | ) | [private, virtual] |
Function called once the scene has been loaded.
load calls this function once the scene has finished loading. The default implementation does nothing.