H3D API  2.4.1
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
H3D::Inline Class Reference

The Inline node embeds an X3D scene stored at a location on the World Wide Web into the current scene. More...

#include <H3D/Inline.h>

Inheritance diagram for H3D::Inline:
Inheritance graph

Classes

class  LoadedScene
 The LoadedScene class updates itself from the load and url field and sets itself to the first url that parses successfully if the load field is true, and to NULL otherwise. More...
 
class  SFBound
 SFBound is specialized to update from the SFBound fields routed to it. More...
 

Public Member Functions

 Inline (Inst< SFNode > _metadata=0, Inst< DisplayList > _displayList=0, Inst< MFString > _url=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< SFBool > _load=0, Inst< LoadedScene > _loadedScene=0, Inst< SFString > _importMode=0, Inst< SFBool > _traverseOn=0)
 Constructor.
 
virtual void initialize ()
 Sets up the bound field using the bboxCenter and bboxSize fields. More...
 
virtual void render ()
 Render the inlined scenegraph, if loaded.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the inline scenegraph, if loaded.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DUrlObject
 X3DUrlObject (Inst< MFString > _url=0)
 Constructor.
 
virtual LoadStatus loadStatus ()
 The loadStatus function returns the status of the loading of the current urls in order to be used with the LoadSensor node.
 
virtual H3DFloat loadProgress ()
 The loadProgress() functions returns a value between 0 and 1 indicating how much of the current url has been loaded. More...
 
void setURLUsed (const string &_url_used)
 Set the url that is currently loaded.
 
const string & getURLUsed ()
 Get the url that is currently loaded.
 
void setURLBase (const string &_url_base)
 Set the url base address.
 
const string & getURLBase ()
 Get the current url base address.
 
string resolveURLAsFile (const string &url, bool *is_tmp_file=NULL)
 Get the url as a local file.
 
string resolveURLAsString (const string &url)
 Get the content of the URL as a string.
 
bool removeTmpFile (const string &file)
 Remove a tmpfile with the given name. More...
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

H3DUniquePtr< SFBoolload
 If the load field is set to TRUE (the default field value), the X3D file specified by the url field is loaded immediately. More...
 
H3DUniquePtr< LoadedSceneloadedScene
 The scene that is currently loaded by the inline node. More...
 
H3DUniquePtr< SFStringimportMode
 The autoImport mode defines the way that the Inline node exports its nodes and how they are imported into the scene that use the Inline node. More...
 
H3DUniquePtr< SFBooltraverseOn
 If set to false the children nodes of the Inline node will not be traversed at all, basically making them not part of the scene graph unless specific nodes are used elsewhere with a USE statement. More...
 
X3D::DEFNodes exported_nodes
 A DEFNodes structure from the name of nodes exported with the EXPORT statement in the url of the Inline node, to the actual node.
 
X3D::DEFNodes DEF_nodes
 A DEFNodes structure from the name of nodes named with the DEF statement in the url of the Inline node, to the actual node.
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::X3DUrlObject
H3DUniquePtr< MFStringurl
 The urls in decreasing order of preference.
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Public Types inherited from H3D::X3DUrlObject
enum  LoadStatus { INIT , LOADED , LOADING , FAILED }
 The load status of the given url. More...
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Protected Member Functions inherited from H3D::X3DUrlObject
string resolveURL (const string &_url, bool return_contents, bool *is_tmp_file=NULL)
 Helper function for resolveURLAs*() functions.
 
void addInlinePrefix (const string &s)
 Add a inline prefix that this node supports.
 
int getInlinedContentOffset (const std::string &url)
 If the URL contains any inline prefix, return the index of the start of the inlined content. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 
- Protected Attributes inherited from H3D::X3DUrlObject
string url_used
 If loadStatus() returns LOADED this string should contain the url that is loaded. More...
 
string url_base
 The base URL for urls in this url object. More...
 
list< string > supported_inline_prefixes
 A list of inline prefixes that are supported by this url object. More...
 

Detailed Description

The Inline node embeds an X3D scene stored at a location on the World Wide Web into the current scene.

The Inline node embeds an X3D scene stored at a location on the World Wide Web into the current scene. Exactly when the Inline scene is read and displayed is defined by the value of the load field, in profiles that support that field. In profiles that do not support the load field, exactly when the scene is read and displayed is not defined (e.g. reading the scene may be delayed until the Inline node's bounding box is visible to the viewer). Once the Inline scene is loaded, its children are added to the current scene and are treated as children of the Inline for rendering and interaction; however the children are not exposed to the current scene for routing and DEF name access unless their names have been explicitly imported into the scene using the IMPORT statement (see 4.4.6.2 IMPORT semantics). However this can be changed using the importMode field.

The importMode field defines the way that the Inline node exports its nodes and how they are imported into the scene that use the Inline node.

Each specified URL shall refer to a valid X3D file that contains a list of children nodes, prototypes and routes at the top level as described in 10.2.1 Grouping and children node types. The results are undefined if the URL refers to a file that is not an X3D file, or if the X3D file contains an invalid scene.

It shall be an error to specify a file in the URL field that has a set of component definitions that is not a subset of the components of the containing world. In addition, the components shall not be of a higher support level than those used by the containing world, either implicitly or through the PROFILE declaration or additional COMPONENT statements. When an inlined world requests capabilities greater than its parent, the following actions shall occur:

If the load field is set to TRUE (the default field value), the X3D file specified by the url field is loaded immediately. If the load field is set to FALSE, no action is taken. It is possible to explicitly load the URL at a later time by sending a TRUE event to the load field (e.g., as the result of a ProximitySensor or other sensor firing an event). If a FALSE event is sent to the load field of a previously loaded Inline, the contents of the Inline will be unloaded from the scene graph.

An event sent to url can be used to change the scene that is inlined by the Inline node. If this value is set after the Inline is already loaded, its contents will be unloaded and the scene to which the new URL points will be loaded.

The user is able to specify a bounding box for the Inline node using the bboxCenter and bboxSize fields. This is a hint to the browser and could be used for optimization purposes such as culling.

Examples:

Internal routes:

Member Function Documentation

◆ closestPoint()

void Inline::closestPoint ( const Vec3f &  p,
NodeIntersectResult result 
)
virtual

Find closest point on Node to p.

Parameters
pThe point to find the closest point to.
resultA struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::Node.

References H3D::X3DGroupingNode::closestPoint(), load, and loadedScene.

◆ initialize()

virtual void H3D::Inline::initialize ( )
inlinevirtual

Sets up the bound field using the bboxCenter and bboxSize fields.

If bboxSize is (-1, -1, -1) the bound will be the union of all the bound objects of the Nodes in the children field. Otherwise it will be a BoxBound with center and origin determined by the bboxCenter and bboxOrigin fields.

Reimplemented from H3DUtil::RefCountedClass.

References H3D::BoxBound::center, H3DUtil::RefCountedClass::initialize(), and H3D::BoxBound::size.

◆ lineIntersect()

bool Inline::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult result 
)
virtual

Detect intersection between a line segment and the Node.

Parameters
fromThe start of the line segment.
toThe end of the line segment.
resultContains info about the closest intersection for every object that intersects the line.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References H3D::X3DGroupingNode::lineIntersect(), load, and loadedScene.

◆ movingSphereIntersect()

bool Inline::movingSphereIntersect ( H3DFloat  radius,
const Vec3f &  from,
const Vec3f &  to,
NodeIntersectResult result 
)
virtual

Detect collision between a moving sphere and the Node.

Only nodes to which collision is possible will return true

Parameters
radiusThe radius of the sphere
fromThe start position of the sphere
toThe end position of the sphere.
resultA struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References load, loadedScene, and H3D::X3DGroupingNode::movingSphereIntersect().

Member Data Documentation

◆ importMode

H3DUniquePtr< SFString > H3D::Inline::importMode

The autoImport mode defines the way that the Inline node exports its nodes and how they are imported into the scene that use the Inline node.

  • "DEFAULT" - Explicit EXPORT/IMPORT statements are needed as per X3D spec.
  • "AUTO" - All nodes with a DEF name will be exported and imported without the requirement of an explicit EXPORT/IMPORT statement.
  • "AUTO_IMPORT" - All nodes exported with the EXPORT statement will be automatically imported into the scene that uses the Inline node.
  • "AUTO_EXPORT" - All nodes with a DEF name will be automatically exported.

Access type: initializeOnly
Default value: "DEFAULT"
Valid values: "DEFAULT", "AUTO", "AUTO_IMPORT", "AUTO_EXPORT"

Referenced by Inline(), and H3D::Inline::LoadedScene::update().

◆ load

H3DUniquePtr< SFBool > H3D::Inline::load

If the load field is set to TRUE (the default field value), the X3D file specified by the url field is loaded immediately.

If the load field is set to FALSE, no action is taken.

Access type: inputOutput
Default value: true

Referenced by closestPoint(), Inline(), lineIntersect(), movingSphereIntersect(), render(), and traverseSG().

◆ loadedScene

H3DUniquePtr< LoadedScene > H3D::Inline::loadedScene

The scene that is currently loaded by the inline node.

Access type: outputOnly

Referenced by closestPoint(), Inline(), lineIntersect(), movingSphereIntersect(), render(), and traverseSG().

◆ traverseOn

H3DUniquePtr< SFBool > H3D::Inline::traverseOn

If set to false the children nodes of the Inline node will not be traversed at all, basically making them not part of the scene graph unless specific nodes are used elsewhere with a USE statement.

Access type: initializeOnly
Default value: true

Referenced by Inline(), render(), and traverseSG().


The documentation for this class was generated from the following files: