Home | Download | Screen shots | Discussion | Documentation |
---|
Collaboration diagram for openvrml::browser:
Public Types | |
typedef void(* | scene_cb )(cb_reason reason) |
A pointer to a browser callback function. | |
enum | cb_reason { destroy_world_id, replace_world_id } |
Valid reasons for browser callback. More... | |
Public Member Functions | |
browser (std::ostream &out, std::ostream &err) throw (std::bad_alloc) | |
Constructor. | |
virtual | ~browser () throw () |
Destructor. | |
const std::vector< node_ptr > & | root_nodes () const throw () |
Get the root nodes for the browser. | |
const node_path | find_node (const node &n) const throw (std::bad_alloc) |
Get the path to a node in the scene graph. | |
viewpoint_node & | active_viewpoint () const throw () |
Get the active viewpoint_node. | |
void | active_viewpoint (viewpoint_node &viewpoint) throw () |
Set the active viewpoint_node. | |
void | reset_default_viewpoint () throw () |
Reset the active viewpoint_node to the default. | |
void | add_viewpoint (viewpoint_node &viewpoint) throw (std::bad_alloc) |
Add a viewpoint_node to the list of viewpoint_nodes for the browser. | |
void | remove_viewpoint (viewpoint_node &viewpoint) throw () |
Remove a viewpoint_node from the list of viewpoint_nodes for the browser. | |
const std::list< viewpoint_node * > & | viewpoints () const throw () |
Get the list of viewpoint_nodes for the world. | |
virtual const char * | name () const throw () |
Get the browser name. | |
virtual const char * | version () const throw () |
Get the browser version. | |
float | current_speed () |
Get the average navigation speed in meters per second. | |
const std::string | world_url () const throw (std::bad_alloc) |
Get the URI for the world. | |
void | replace_world (const std::vector< node_ptr > &nodes) |
virtual void | load_url (const std::vector< std::string > &url, const std::vector< std::string > ¶meter) throw (std::bad_alloc) |
Load a resource into the browser. | |
virtual void | description (const std::string &description) |
Send a string to the user interface. | |
const std::vector< node_ptr > | create_vrml_from_stream (std::istream &in) |
Generate nodes from a stream of VRML syntax. | |
void | create_vrml_from_url (const std::vector< std::string > &url, const node_ptr &node, const std::string &event) |
void | add_world_changed_callback (scene_cb) |
Add a callback function to be called when the world changes. | |
void | sensitive_event (node *object, double timestamp, bool is_over, bool is_active, double *point) |
void | queue_event (double timestamp, field_value *value, const node_ptr &toNode, const std::string &to_eventin) |
Queue an event for a node. | |
bool | events_pending () |
Check if any events are waiting to be distributed. | |
void | flush_events () |
Discard all pending events. | |
double | frame_rate () const |
Get the current frame rate. | |
bool | update (double current_time=-1.0) |
Process events (update the browser). | |
void | render (openvrml::viewer &viewer) |
Draw this browser into the specified viewer. | |
void | modified (bool value) |
Indicate whether rendering is necessary. | |
bool | modified () const |
Check if the browser has been modified. | |
void | delta (double d) |
Set the time until the next update is needed. | |
double | delta () const |
Get the time interval between browser updates. | |
void | add_navigation_info (vrml97_node::navigation_info_node &) |
Add a NavigationInfo node to the list of NavigationInfo nodes for the browser. | |
void | remove_navigation_info (vrml97_node::navigation_info_node &) |
Remove a NavigationInfo node from the list of NavigationInfo nodes for the browser. | |
vrml97_node::navigation_info_node * | bindable_navigation_info_top () |
Get the active node on the bound NavigationInfo stack. | |
void | bindable_push (vrml97_node::navigation_info_node *) |
Push a NavigationInfo node onto the bound NavigationInfo node stack. | |
void | bindable_remove (vrml97_node::navigation_info_node *) |
Remove a NavigationInfo node from the bound NavigationInfo node stack. | |
void | add_scoped_light (vrml97_node::abstract_light_node &) |
Add a scoped light node to the browser. | |
void | remove_scoped_light (vrml97_node::abstract_light_node &) |
Remove a scoped light node from the browser. | |
void | add_time_sensor (vrml97_node::time_sensor_node &) |
Add a TimeSensor node to the browser. | |
void | remove_time_sensor (vrml97_node::time_sensor_node &) |
Remove a time_sensor node from the browser. | |
void | add_audio_clip (vrml97_node::audio_clip_node &) |
Add an AudioClip node to the browser. | |
void | remove_audio_clip (vrml97_node::audio_clip_node &) |
Remove an audio_clip node from the browser. | |
void | add_movie (vrml97_node::movie_texture_node &) |
Add a MovieTexture node to the browser. | |
void | remove_movie (vrml97_node::movie_texture_node &) |
Remove a movie_texture node from the browser. | |
void | add_proto (ProtoNode &node) |
Add a PROTO instance to the browser. | |
void | remove_proto (ProtoNode &node) |
Remove a PROTO instance from the browser. | |
void | add_script (script_node &) |
Add a Script node to the browser. | |
void | remove_script (script_node &) |
Remove a Script node from the browser. | |
void | update_flags () |
Propagate the bvolume dirty flag from children to ancestors. | |
Static Public Member Functions | |
double | current_time () throw () |
Get the current time. | |
Public Attributes | |
std::ostream & | out |
Output stream, generally for console output. | |
std::ostream & | err |
Error output stream. | |
bool | flags_need_updating |
Set by node::setBVolumeDirty on any node in this browser graph, cleared by update_flags. | |
Protected Types | |
typedef std::list< scene_cb > | scene_cb_list_t |
List of functions to call when the world is changed. | |
enum | { max_events = 400 } |
Protected Member Functions | |
bool | headlight_on () |
Indicate whether the headlight is on. | |
void | do_callbacks (cb_reason reason) |
Execute browser callback functions. | |
const node_ptr | bindable_top (const bind_stack_t &stack) |
Get the top node of a bind_stack_t. | |
void | bindable_push (bind_stack_t &stack, const node_ptr &node) |
Push a node onto a bind_stack_t. | |
void | bindable_remove (bind_stack_t &stack, const node_ptr &node) |
Remove a node from a bind_stack_t. | |
Protected Attributes | |
scene_cb_list_t | scene_callbacks |
List of functions to call when the world is changed. | |
double | frame_rate_ |
Frame rate. | |
event | event_mem [max_events] |
The event queue. | |
size_t | first_event |
Index of the first pending event. | |
size_t | last_event |
Index of the last pending event. | |
Private Types | |
typedef std::map< std::string, node_class_ptr > | node_class_map_t |
Maps URIs to node_classes. | |
typedef std::list< node_ptr > | bind_stack_t |
A list of bound nodes. | |
Private Member Functions | |
browser (const browser &) | |
Construct a copy. | |
browser & | operator= (const browser &) |
Assign. | |
void | init_node_class_map () |
Initialize the node_class map with the available node implementations. | |
Private Attributes | |
std::auto_ptr< null_node_class > | null_node_class_ |
"Null" class object for default nodes (e.g., default_viewpoint). | |
std::auto_ptr< null_node_type > | null_node_type_ |
"Null" type object for default nodes (e.g., default_viewpoint). | |
node_class_map_t | node_class_map |
A map of URIs to node implementations. | |
script_node_class | script_node_class_ |
node_class for Script nodes in the browser. | |
scene * | scene_ |
Pointer to the root scene. | |
node_ptr | default_viewpoint |
The "default" viewpoint_node used when no viewpoint_node in the scene is bound. | |
viewpoint_node * | active_viewpoint_ |
The currently "active" viewpoint_node. | |
std::list< viewpoint_node * > | viewpoint_list |
A list of all the Viewpoint nodes in the browser. | |
bind_stack_t | navigation_info_stack |
The stack of bound NavigationInfo nodes. | |
std::list< node * > | navigation_infos |
A list of all the NavigationInfo nodes in the browser. | |
std::list< node * > | scoped_lights |
A list of all the scoped light nodes in the browser. | |
std::list< script_node * > | scripts |
A list of all the Script nodes in the browser. | |
std::list< node * > | timers |
A list of all the TimeSensor nodes in the browser. | |
std::list< node * > | audio_clips |
A list of all the AudioClip nodes in the browser. | |
std::list< node * > | movies |
A list of all the MovieTexture nodes in the browser. | |
std::list< ProtoNode * > | proto_node_list |
A list of all the prototype nodes in the browser. | |
bool | modified_ |
Flag to indicate whether the browser has been modified. | |
bool | new_view |
Flag to indicate if the user has changed to a new view. | |
double | delta_time |
Time elapsed since the last update. | |
Friends | |
class | Vrml97Parser |
VRML97 parser generated by ANTLR. | |
class | ProtoNodeClass |
Class object for ProtoNodes. | |
class | Vrml97RootScope |
Root scope that is initialized with the VRML97 node types. |
|
A pointer to a browser callback function. The callback function provoides a way to let the app know when a world is loaded, changed, etc. |
|
|
Valid reasons for browser callback.
|
|
Constructor.
|
|
Construct a copy.
For internal use only. Not implemented. browser is not copyable. |
|
Set the active viewpoint_node.
|
|
Get the active viewpoint_node. The active viewpoint_node is the one currently associated with the user view.
|
|
Add an AudioClip node to the browser.
|
|
Add a MovieTexture node to the browser.
|
|
Add a NavigationInfo node to the list of NavigationInfo nodes for the browser.
|
|
Add a PROTO instance to the browser.
|
|
Add a scoped light node to the browser.
|
|
Add a Script node to the browser.
|
|
Add a TimeSensor node to the browser.
|
|
Add a viewpoint_node to the list of viewpoint_nodes for the browser.
|
|
Add a callback function to be called when the world changes.
|
|
Get the active node on the bound NavigationInfo stack.
|
|
Push a node onto a bind_stack_t.
|
|
Push a NavigationInfo node onto the bound NavigationInfo node stack.
|
|
Remove a node from a bind_stack_t.
|
|
Remove a NavigationInfo node from the bound NavigationInfo node stack.
|
|
Get the top node of a bind_stack_t.
|
|
Generate nodes from a stream of VRML syntax. In addition to the exceptions listed, this method may throw any exception that may result from reading the input stream.
|
|
|
|
Get the average navigation speed in meters per second.
|
|
Get the time interval between browser updates.
|
|
Set the time until the next update is needed.
|
|
Send a string to the user interface.
The default implementation of this method simply prints
|
|
Execute browser callback functions.
|
|
Check if any events are waiting to be distributed.
|
|
Get the path to a node in the scene graph.
|
|
Get the current frame rate.
|
|
Indicate whether the headlight is on.
|
|
Load a resource into the browser.
The default implementation of this method simply loads a VRML world into the browser. If the resource at Implementations should override this method to handle non-VRML resources, handing them off to a Web browser or other appropriate handler.
|
|
Check if the browser has been modified.
|
|
Indicate whether rendering is necessary.
|
|
Get the browser name.
|
|
Assign.
For internal use only. Not implemented. browser is not copyable. |
|
Queue an event for a node. Current events are in the array event_mem[first_event, last_event). If first_event == last_event, the queue is empty. There is a fixed maximum number of events. If we are so far behind that the queue is filled, the oldest events get overwritten. |
|
Remove an audio_clip node from the browser.
|
|
Remove a movie_texture node from the browser.
|
|
Remove a NavigationInfo node from the list of NavigationInfo nodes for the browser.
|
|
Remove a PROTO instance from the browser.
|
|
Remove a scoped light node from the browser.
|
|
Remove a Script node from the browser.
|
|
Remove a time_sensor node from the browser.
|
|
Remove a viewpoint_node from the list of viewpoint_nodes for the browser.
|
|
|
|
Get the root nodes for the browser.
|
|
Called by the viewer when the cursor passes over, clicks, drags, or releases a sensitive object (an Anchor or another grouping node with an enabled TouchSensor child). |
|
Process events (update the browser). This method should be called after each frame is rendered.
|
|
Propagate the bvolume dirty flag from children to ancestors. The invariant is that if a node's bounding volume is out of date, then the bounding volumes of all that nodes's ancestors must be out of date. However, Node does not maintain a parent pointer. So we must do a traversal of the entire browser graph to do the propagation.
|
|
Get the browser version.
|
|
Get the list of viewpoint_nodes for the world.
|
|
Get the URI for the world.
|
|
The event queue.
|
|
Set by node::setBVolumeDirty on any node in this browser graph, cleared by update_flags.
|