Extensible 3D (X3D) language bindings
Part 1: ECMAScript
7 Function definitions
This clause describes key concepts in this part of ISO/IEC 19776. This includes conformance criteria and abstract concepts of the binding defined in this part to the abstract definitions specified in part 2 of ISO/IEC 19775.
See Table 7.1 for the table of contents for this clause.
Table 7.1 — Topics in this clause
All browser services are encapsulated through two host objects:
Browser
and ExternalBrowser
. The
properties of these objects are defined in
Table 7.2.
All functions are considered to be static and are defined in
Table 7.3.
The browser object shall not have the ability to be directly instantiated.
Table 7.2 — Properties of the Browser object
Data Type | Property | Read only | Comment |
---|---|---|---|
String | name | Yes | A browser-implementation specific string describing the browser |
String | version | Yes | A browser-implementation specific string describing the browser version. |
numeric | currentSpeed | Yes | If this is not supported, the string "0.0" is returned |
numeric | currentFrameRate | Yes | If this is not supported, the string "0.0" is returned |
String | description | No | |
ComponentInfoArray | supportedComponents | Yes | The property value cannot be changed, but the properties of the ComponentInfoArray can be. |
ProfileInfoArray | supportedProfiles | Yes | The property value cannot be changed, but the properties of the ProfileInfoArray can be. |
X3DExecutionContext/X3DScene | currentScene | Yes | The real type of this class is dependent on whether the user code is inside a prototype instance or not. If the user code is inside a prototype instance the property shall represent a X3DExecutionContenxt otherwise it shall represent a X3DScene. |
Table 7.3 — Functions of the Browser object
Return Type | Function | Comment |
---|---|---|
void | replaceWorld(X3DScene) | Replace the current world with this new scene that has been loaded or constructed from somewhere. |
X3DScene | createX3DFromString(String x3dSyntax) | The string may be any valid X3D content in any language supported by the browser implementation. If the browser does not support the content encoding the appropriate exception shall be thrown. |
X3DScene | createX3DFromURL(MFString, String, Object) |
If the callback parameter is given, the method is asynchronous and the function name is called when the url list has been loaded. The return value is shall always be null. If the callback argument is not given, the method become synchronous and returns the scene from the completed load process, if it succeeded. |
void | loadURL(MFString url, MFString parameter) |
Valid values for the parameters can be found in ISO/IEC 19775-1 |
Scene | importDocument(DOMNode1) | |
String | getRenderingProperty(String) | All properties are converted to a string internally, even when their normal native type would be an numeric value. |
void | addBrowserListener(String, Object) | The string describes the name of the callback function to be called within the current ECMAScript context. |
void | removeBrowserListener(String) | The string describes the name of the callback function to be called within the current ECMAScript context. |
void | print(Object) | Prints the object to the browser's console without a newline character. Successive calls to this function append the descriptions on the same line. The output is the implicit call to the object's toString() function. |
void | println(Object) | Prints the object to the browser's console, inserting a newline character after the output. Successive calls to this function will result in each output presented on separate lines. The output is the implicit call to the object's toString() function. |
1DOMNode represents a DOM node object.
Note that the createX3DFromStream() service is not available to ECMAScript-based SAI interaction as ECMAScript does not include inherent I/O capabilities, which would be needed in order to handle this service request.
Table 7.4 describes the functions that are available when the browser accessed from an external application. These functions are in addition to those described by Table 7.3.
Table 7.4 — External Browser Functions
Return value | Function |
---|---|
void | beginUpdate() |
void | endUpdate() |
void | addBrowserCallback(String, object) |
void | removeBrowserCallback(String) |
Scene | createScene(ProfileInfo, ComponentInfo n1, ComponentInfo n2, ...) |
For external interactions, this service request is provided through an application-specific context and is also dependent on the environment being used. For example, inside a web page script, it may use the HTML DOM to access the embedded object for the X3D plug-in that supplies the getBrowser function call. The object returned shall be an instance of ExternalBrowser.
Internal interactions do not need this call as the Browser object reference is provided automatically as a static object available to every script context.
For external interactions, this service request is provided through an application-specific context and is also dependent on the environment being used. For example, inside a web page script, it may use the HTML DOM to access the embedded object for the X3D plug-in, which supplies the createBrowser function call. The object returned shall be an instance of ExternalBrowser. A browser is not required to provide this service and the implementation shall be browser specific.
Browsers implementers may extend the basic Browser object in accordance with 3.2.2 Conformance. Because ECMAScript does not permit object inheritance, the process of providing custom extensions will be through adding additional functions to the Browser object.
This is the representation of the SAIExecutionContextID abstract type.
This object cannot be instantiated by the user.
The properties defined for the ExecutionContext host object are defined in Table 7.5
Table 7.5 — Execution context properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
String | specificationVersion | Yes | The string shall represent the basic specification version used by the parsed file in decimal format. For example, a scene conforming to this specification will return the value "3.0". |
String | encoding | Yes | The encoding is represented as a string that describes the data encoding used. Valid values are "ASCII", "VRML", "XML", "BINARY", "SCRIPTED", "BIFS", "NONE" |
ProfileInfo | profile | Yes | |
ComponentInfoArray | components | Yes | |
String | worldURL | Yes | |
MFNode | rootNodes | Yes/No | When used inside a prototype instance, this property shall not be writable. The MFNode object instance shall also not be writable. When used anywhere else, it shall be writable. |
ProtoDeclarationArray | protos | No | |
ExternProtoDeclarationArray | externprotos | No | |
RouteArray | routes | Yes |
The functions defined for the X3DExecutionContext host object are defined in Table 7.6
Table 7.6 — Execution context functions
Return Type | Function |
---|---|
X3DRoute | addRoute(SFNode fromNode, String fromReadableField, SFNode toNode, String toWritableField) |
void | deleteRoute(X3DRoute) |
SFNode | createNode(String) |
SFNode | createProto(String) |
SFNode | getImportedNode(String, String) |
void | updateImportedNode(String, String) |
void | removeImportedNode(String) |
SFNode | getNamedNode(String) |
void | updateNamedNode(String, SFNode) |
void | removeNamedNode(String) |
The Scene
object extends the ExecutionContext
object and adds the properties defined in Table 7.7 and functions in
Table 7.8 to those defined in
Table 7.5 and
Table 7.6 respectively. An
Scene
object is created by the function defined in
Table 7.4.
It shall not be possible to directly create an instance of this object.
The properties defined for the X3DScene host object is defined in Table 7.7
Data type | Property Name | Read Only | Description |
---|---|---|---|
String | specificationVersion | Yes | The string shall represent the basic specification version used by the parsed file in decimal format. For example, a scene conforming to this specification will return the value "3.0". |
The functions defined for the X3DScene host object are defined in Table 7.8
Return Type | Function |
---|---|
void | setMetaData(String, String) |
String | getMetaData(String) |
SFNode | getExportedNode(String) |
void | updateExportedNode(String, SFNode) |
void | removeExportedNode(String) |
In addition to providing node field services, the SFNode host object is also used to represent node objects. The services defined for node objects are split to avoid confusion. When the user wishes to directly access and modify the fields of a node, the properties and functions defined by 7.6.4 SFNode shall be used. However, the nodes also need to provide definition information about themselves such as the field definitions available. To avoid clashes with fields of the node, function calls are used to return the appropriate information.
All objects that represent fields shall have the functions defined in Table 7.9.
Data type | Property Name | Description |
---|---|---|
String | getName | The name of this field |
numeric | getType | One of the constant values defined in the X3DConstants object. |
Boolean | isReadable | true if this field is currently readable; false, otherwise. |
Boolean | isWritable | true if this field is currently writable; false, otherwise |
void | addFieldCallback(String, object) | The string is the name of the callback function to use. The object is any arbitrary identifying object that user code wishes to associate with the callback. |
void | removeFieldCallback(String) | The string is the name of the callback function to be removed on this field. |
The X3DFieldDefinition object represents all of the descriptive properties of a single field of a node. The properties of an X3DFieldDefinition object are defined in Table 7.10.
It shall not be possible to directly create an instance of this object.
Table 7.10 — X3DFieldDefinition properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
String | name | Yes | The field name (e.g., "children"). |
numeric | accessType | Yes | Value from the X3DConstants object describing the accessType (e.g., "inputOnly"). |
numeric | dataType | Yes | Value from X3DConstants cobject describing the field's data type (e.g., "SFBool"). |
No functions are defined for this object.
The SFColor object corresponds to a X3D SFColor field. All properties defined in Table 7.12 are accessed using the syntax sfColorObjectName.<property>, where sfColorObjectName is an instance of an SFColor object. The properties may also be accessed by the indices [0] for red, [1] for green and [2] blue. All functions are invoked using the syntax sfColorObjectName.method(<argument-list>), where sfColorObjectName is an instance of an SFColor object. An SFColor object is created using the function defined in Table 7.11. The functions in Table 7.13 are available for manipulating an SFColor object.
Table 7.11 — SFColor instance creation function
Object | Parameter List | Description |
---|---|---|
SFColor | (float r, float g, float b) | r, g, and b are the red, green, and blue values of the colour. Missing values will be filled by 0.0. |
Table 7.12 — SFColor properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | r | No | Red component of the colour |
numeric | g | No | Green component of the colour |
numeric | b | No | Blue component of the colour |
Table 7.13 — SFColor functions
Return Type | Function | Description |
---|---|---|
void | setHSV(float h, float s, float v) | Sets the value of the colour by specifying the values of hue, saturation, and value. |
numeric[3] | getHSV() | Returns the value of the colour in a 3 element numeric array, with hue at index 0, saturation at index 1, and value at index 2. |
String | toString() | Returns a String containing the value of r, g and b encoded using the Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The SFImage object corresponds to a X3D SFImage field. All properties are accessed using the syntax sfImageObjectName.<property>, where sfImageObjectName is an instance of an SFImage object. An SFImage object may be created using the function defined in Table 7.14. The properties of SFImage are defined in Table 7.15. The functions that may be used to manipulate an SFImage object are defined in Table 7.16.
Table 7.14 — SFImage instance creation function
Object | Parameter List | Description |
---|---|---|
SFImage | (numeric x, numeric y, numeric comp, MFInt32 array) |
x is the x-dimension of the image. y is the y-dimension of the image. comp is the number of components of the image (1 for greyscale, 2 for greyscale+alpha, 3 for rgb, 4 for rgb+alpha). Array contains the x * y values for the pixels of the image. The format of each pixel is an SFImage as in the PixelTexture node (see part 1 of ISO/IEC 19775). |
Table 7.15 — SFImage properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | width | No | Width dimension of the image in pixels |
numeric | height | No | Height dimension of the image in pixels |
numeric | comp | No | Number of components of the image
|
MFInt32 | array | No | Returns a String containing the value of x, y, comp and array encoded using the Classic VRML encoding (see part 2 of ISO/IEC 19776). |
Table 7.16 — SFImage functions
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of x, y, comp and array encoded using the Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The SFNode object corresponds to an X3D SFNode field. There are no explicitly defined properties. Functions for accessing SFNode fiels are defined in Table 7.17.
This object cannot be directly instantiated
There are no explicitly defined properties; however, each node may assign values to its writable fields and obtain the last output values of its readable fields using the sfNodeObjectName.fieldName syntax.
Return Type | Function | Description |
---|---|---|
String | getNodeName() | Returns the node name |
Array | getNodeType() | Returns, in the array, a list of constant values that indicate node typess as provided in the X3DConstants object. |
FieldDefinitionArray | getFieldDefinitions() | Returns a list of fields defined for the SFNode object. |
String | toVRMLString() | Returns the X3D Classic VRML-encoded string that, if parsed as the value of an SFNode field, would produce this node. If the browser is unable to reproduce this node, the name of the node followed by the open brace and close brace shall be returned. Additional information may be included as one or more Classic VRML comment strings. | String | toXMLString() | Returns the X3D XML-encoded string that, if parsed as the value of an SFNode field, would produce this node. If the browser is unable to reproduce this node, a simple XML Element definition shall be returned. Additional information may be included as one or more XML comments. |
The SFRotation object corresponds to an X3D SFRotation field. It has four numeric properties as defined in Table 7.19: x, y, z (the axis of rotation) and angle. These may also be addressed by indices [0] through [3]. An SFRotation object may be created using one of the functions defined in Table 7.18. An SFRotation object may be manipulated using the functions defined in Table 7.20.
Table 7.18 — SFRotation instance creation functions
Object | Parameter List | Description |
---|---|---|
SFRotation | (numeric x, numeric y, numeric z, numeric angle) |
x, y, and z are the axis of the rotation. angle is the angle of the rotation (in radians). Missing values default to 0.0, except y, which defaults to 1.0. |
SFRotation | (SFVec3f axis, numeric angle) |
axis is the axis of rotation. angle is the angle of the rotation (in radians) |
SFRotation | (SFVec3f fromVector, SFVec3f toVector) |
fromVector and toVector are normalized and the rotation value that would rotate from the fromVector to the toVector is stored in the object. |
Table 7.19 — SFRotation properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | x | No | first value of the axis vector |
numeric | y | No | second value of the axis vector |
numeric | z | No | third value of the axis vector |
numeric | angle | No | the angle of the rotation (in radians) |
Table 7.20 — SFRotation functions
Return Type | Function | Description |
---|---|---|
SFVec3f | getAxis() | Returns the axis of rotation. |
SFRotation | inverse() | Returns the inverse of this object's rotation. |
SFRotation | multiply(SFRotation rot) | Returns the object multiplied by the passed value. |
SFVec3f | multiVec(SFVec3f vec) | Returns the value of vec multiplied by the matrix corresponding to this object's rotation. |
void | setAxis(SFVec3f vec) | Sets the axis of rotation to the value passed in vec. |
SFRotation | slerp(SFRotation dest, numeric t) | Returns the value of the spherical linear interpolation between this object's rotation and dest at value 0 ≤ t ≤ 1. For t = 0, the value is this object`s rotation. For t = 1, the value is dest. |
String | toString() | Returns a String containing the value of x, y, z, and angle encoding using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The SFVec2d object corresponds to an X3D SFVec2d field. Each component of the vector can be accessed using the x and y properties or using C-style array dereferencing (i.e., sfVec2dObjectName[0] or sfVec2dObjectName[1]). An SFVec2d object may be created using the function in Table 7.21. The properties of an SFVec2d object are defined in Table 7.22. The functions defined in Table 7.23 may be used to manipulate an SFVec2d object.
Table 7.21 — SFVec2d instance creation function
Object | Parameter List | Description |
---|---|---|
SFVec2f | (numeric x, numeric y) | Missing values default to 0.0d+00. |
Table 7.22 — SFVec2d properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | x | No | First value of the vector |
numeric | y | No | Second value of the vector |
Table 7.23 — SFVec2d functions
Return Type | Function | Description |
---|---|---|
SFVec2d | add(SFVec2d vec) | Returns the value of the passed value added, component-wise, to the object. |
SFVec2d | divide(numeric n) | Returns the value of the object divided by the passed value. |
numeric | dot(SFVec2d vec) | Returns the dot product of this vector and the passed value. |
numeric | length() | Returns the geometric length of this vector. |
SFVec2d | multiply(numeric n) | Returns the value of the object multiplied by the passed value. |
SFVec2d | normalize() | Returns the object converted to unit length . |
SFVec2d | subtract(SFVec2d vec) | Returns the value of the passed value subtracted, component-wise, from the object. |
String | toString() | Returns a String containing the value of x and y encoding using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The SFVec2f object corresponds to an X3D SFVec2f field. Each component of the vector can be accessed using the x and y properties or using C-style array dereferencing (i.e., sfVec2fObjectName[0] or sfVec2fObjectName[1]). An SFVec2f object may be created using the function in Table 7.24. The properties of an SFVec2f object are defined in Table 7.25. The functions defined in Table 7.26 may be used to manipulate an SFVec2f object.
Table 7.24 — SFVec2f instance creation function
Object | Parameter List | Description |
---|---|---|
SFVec2f | (numeric x, numeric y) | Missing values default to 0.0. |
Table 7.25 — SFVec2f properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | x | No | First value of the vector |
numeric | y | No | Second value of the vector |
Table 7.26 — SFVec2f functions
Return Type | Function | Description |
---|---|---|
SFVec2f | add(SFVec2f vec) | Returns the value of the passed value added, component-wise, to the object. |
SFVec2f | divide(numeric n) | Returns the value of the object divided by the passed value. |
numeric | dot(SFVec2f vec) | Returns the dot product of this vector and the passed value. |
numeric | length() | Returns the geometric length of this vector. |
SFVec2f | multiply(numeric n) | Returns the value of the object multiplied by the passed value. |
SFVec2f | normalize() | Returns the object converted to unit length . |
SFVec2f | subtract(SFVec2f vec) | Returns the value of the passed value subtracted, component-wise, from the object. |
String | toString() | Returns a String containing the ISO/IEC xxxxx UTF-8 encoded value of x and y. |
The SFVec3d object corresponds to a X3D SFVec3d field. Each component of the vector can be accessed using the x, y, and z properties or using C-style array dereferencing (i.e., sfVec3dObjectName[0], sfVec3dObjectName[1] or sfVec3dObjectName[2]). An SFVec3d object may be created using the function in Table 7.27. The properties of an SFVec3d object are defined in Table 7.28. The functions defined in Table 7.29 may be used to manipulate an SFVec3d object.
Table 7.27 — SFVec3d instance creation function
Object | Parameter List | Description |
---|---|---|
SFVec3d | (numeric x, numeric y, numeric z) | Missing values default to 0.0d+00. |
Table 7.28 — SFVec3d properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | x | No | First value of the vector. |
numeric | y | No | Second value of the vector. |
numeric | z | No | Third value of the vector. |
Table 7.29 — SFVec3d functions
Return Type | Function | Description |
---|---|---|
SFVec3d | add(SFVec3d vec) | Returns the value of the passed value added, component-wise, to the object. |
SFVec3d | cross(SFVec3d vec) | Returns the cross product of the object and the passed value. |
SFVec3d | divide(numeric n) | Returns the value of the object divided by the passed value. |
numeric | dot(SFVec3d vec) | Returns the dot product of this vector and the passed value as a double precision value. |
numeric | length() | Returns the geometric length of this vector as a double precision value. |
SFVec3d | multiple(numeric n) | Returns the value of the object multiplied by the passed value. |
SFVec3d | negate() | Returns the value of the component-wise negation of the object. |
SFVec3d | normalize() | Returns the object converted to unit length . |
SFVec3d | subtract(SFVec3f vec) | Returns the value of the passed value subtracted, component-wise, from the object. |
String | toString() | Returns a String containing the value of x, y, and z encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The SFVec3f object corresponds to a X3D SFVec3f field. Each component of the vector can be accessed using the x, y, and z properties or using C-style array dereferencing (i.e., sfVec3fObjectName[0], sfVec3fObjectName[1] or sfVec3fObjectName[2]). An SFVec3f object may be created using the function in Table 7.30. The properties of an SFVec3f object are defined in Table 7.31. The functions defined in Table 7.32 may be used to manipulate an SFVec3f object.
Table 7.30 — SFVec3f instance creation function
Object | Parameter List | Description |
---|---|---|
SFVec3f | (numeric x, numeric y, numeric z) | Missing values default to 0.0. |
Table 7.31 — SFVec3f properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | x | No | First value of the vector. |
numeric | y | No | Second value of the vector. |
numeric | z | No | Third value of the vector. |
Table 7.32 — SFVec3f functions
Return Type | Function | Description |
---|---|---|
SFVec3f | add(SFVec3f vec) | Returns the value of the passed value added, component-wise, to the object. |
SFVec3f | cross(SFVec3f vec) | Returns the cross product of the object and the passed value. |
SFVec3f | divide(numeric n) | Returns the value of the object divided by the passed value. |
numeric | dot(SFVec3f vec) | Returns the dot product of this vector and the passed value. |
numeric | length() | Returns the geometric length of this vector. |
SFVec3f | multiple(numeric n) | Returns the value of the object multiplied by the passed value. |
SFVec3f | negate() | Returns the value of the component-wise negation of the object. |
SFVec3f | normalize() | Returns the object converted to unit length . |
SFVec3f | subtract(SFVec3f vec) | Returns the value of the passed value subtracted, component-wise, from the object. |
String | toString() | Returns a String containing the value of x, y, and z encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFBool object corresponds to an X3D MFBool field. It is used to store a one-dimensional array of boolean values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfBoolObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to FALSE. An MFBool object may be created using the function in Table 7.33. The properties of an MFBool object are defined in Table 7.34. The functions defined in Table 7.35 may be used to manipulate an MFBool object.
Table 7.33 — MFBool instance creation function
Object | Parameter List | Description |
---|---|---|
MFBool | (boolean n1, boolean n2, ...) |
The creation function shall initialize the array using 0 or more boolean-valued expressions passed as parameters. |
Table 7.34 — MFBool properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | Property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFBool array encoding using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFColor object corresponds to an X3D MFColor field. It is used to store a one-dimensional array of SFColor objects. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfColorObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFColor (0, 0, 0). An MFColor object may be created using the function in Table 7.36. The properties of an MFColor object are defined in Table 7.37. The functions defined in Table 7.38 may be used to manipulate an MFColor object.
Table 7.36 — MFColor instance creation function
Object | Parameter List | Description |
---|---|---|
MFColor | (SFColor c1, SFColor c2, ...) |
The creation function shall initialize the array using zero or more SFColor-valued expressions passed as parameters. |
Table 7.37 — MFColor properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | .toString() | Returns a String containing the value of the MFColor array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFDouble object corresponds to an X3D MFDouble field. It is used to store a one-dimensional array of double precision numeric values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfDoubleObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to 0.0d+00. An MFDouble object may be created using the function in Table 7.39. The properties of an MFDouble object are defined in Table 7.40. The functions defined in Table 7.41 may be used to manipulate an MFDouble object.
Table 7.39 — MFDouble instance creation function
Object | Parameter List | Description |
---|---|---|
MFDouble | (numeric n1, numeric n2, ...) | The creation function shall initialize the array using zero or more numeric-valued expressions passed as parameters. |
Table 7.40 — MFDouble properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Table 7.41 — MFDouble function
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFDouble array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFFloat object corresponds to an X3D MFFloat field. It is used to store a one-dimensional array of single precision numeric values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfFloatObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to 0.0. An MFFloat object may be created using the function in Table 7.42. The properties of an MFFloat object are defined in Table 7.43. The functions defined in Table 7.44 may be used to manipulate an MFFloat object.
Table 7.42 — MFFloat instance creation function
Object | Parameter List | Description |
---|---|---|
MFFloat | (numeric n1, numeric n2, ...) |
The creation function shall initialize the array using zero or more numeric-valued expressions passed as parameters. |
Table 7.43 — MFFloat properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Table 7.44 — MFFloat functions
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFFloat array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFImage object corresponds to a X3D MFImage field. It is used to store a one-dimensional array of SFImage values. An MFImage object may be created using the function in Table 7.45. The properties of an MFImage object are defined in Table 7.46. The functions defined in Table 7.47 may be used to manipulate an MFImage object.
Table 7.45 — MFImage instance creation function
Object | Parameter List | Description |
---|---|---|
MFImage | (SFImage i1, SFImage i2, ...) |
The creation function shall initialize the array using 0 or more SFImage-valued expressions passed as parameters. |
Table 7.46 — MFImage properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | Property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFImage array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFInt32 object corresponds to a X3D MFInt32 field. It is used to store a one-dimensional array of integer values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfInt32ObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to 0. An MFInt32 object may be created using the function in Table 7.48. The properties of an MFInt32 object are defined in Table 7.49. The functions defined in Table 7.50 may be used to manipulate an MFInt32 object.
Table 7.48 — MFInt32 Instance creation function
Object | Parameter List | Description |
---|---|---|
MFInt32 | (integer n1, integer n2, ...) |
The creation function shall initialize the array using zero or more integer-valued expressions passed as parameters. |
Table 7.49 — MFInt32 properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFInt32 array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFNode object corresponds to an X3D MFNode field. It is used to store a one-dimensional array of SFNode objects. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfNodeObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to NULL. An MFNode object may be created using the function in Table 7.51. The properties of an MFNode object are defined in Table 7.52. The functions defined in Table 7.53 may be used to manipulate an MFNode object.
Table 7.51 — MFNode instance creation function
Object | Parameter List | Description |
---|---|---|
MFNode | (SFNode n1, SFNode n2, ...) |
The creation function shall initialize the array using zero or more SFNode-valued expressions passed as parameters. |
Table 7.52 — MFNode Properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | Property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns the X3D Classic VRML-encoded string that, if parsed as the value of a MFNode field, would produce this array of nodes. If the browser is unable to reproduce this node, the name of the node followed by the open brace and close brace shall be returned. Additional information may be included as one or more X3D comment strings. |
The MFRotation object corresponds to a X3D MFRotation field. It is used to store a one-dimensional array of SFRotation objects. Individual elements of the array can be referenced using the standard dereferencing operator (e.g., mfRotationObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFRotation (0, 0, 1, 0). An MFRotation object may be created using the function in Table 7.54. The properties of an MFRotation object are defined in Table 7.55. The functions defined in Table 7.56 may be used to manipulate an MFRotation object.
Table 7.54 — MFRotation instance creation function
Object | Parameter List | Description |
---|---|---|
MFRotation | (SFRotation r1, SFRotation r2, ...) |
The creation function shall initialize the array using zero or more SFRotation-valued expressions passed as parameters. |
Table 7.55 — MFRotation properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Table 7.56 — MFRotation function
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFRotation array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFVec2d object corresponds to an X3D MFVec2d field. It is used to store a one-dimensional array of SFVec2d values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfVec2dObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFVec2d (0.0d+00, 0.0d+00). An MFVec2d object may be created using the function in Table 7.57. The properties of an MFVec2d object are defined in Table 7.58. The functions defined in Table 7.59 may be used to manipulate an MFVec2d object.
Table 7.57 — MFVec2d Instance creation function
Object | Parameter List | Description |
---|---|---|
MFVec2d | (SFVec2d v1, SFVec2d v2, ...) | The creation function shall initialize the array using zero or more SFVec2d-valued expressions passed as parameters. |
Table 7.58 — MFVec2d properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFVec2d array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFVec2f object corresponds to a X3D MFVec2f field. It is used to store a one-dimensional array of SFVec2f values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfVec2fObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFVec2f (0.0, 0.0). An MFVec2f object may be created using the function in Table 7.60. The properties of an MFVec2f object are defined in Table 7.61. The functions defined in Table 7.62 may be used to manipulate an MFVec2f object.
Table 7.60 — MFVec2f instance creation function
Object | Parameter List | Description |
---|---|---|
MFVec2f | (SFVec2f v1, SFVec2f v2, ...) | The creation function shall initialize the array using zero or more SFVec2f-valued expressions passed as parameters. |
Table 7.61 — MFVec2f properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFVec2f array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFVec3d object corresponds to an X3D MFVec3d field. It is used to store a one-dimensional array of SFVec3d values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfVec3dObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFVec3d (0.0d+00, 0.0d+00, 0.0d+00). An MFVec3d object may be created using the function in Table 7.63. The properties of an MFVec3d object are defined in Table 7.64. The functions defined in Table 7.65 may be used to manipulate an MFVec3d object.
Table 7.63 — MFVec3d instance creation function
Object | Parameter List | Description |
---|---|---|
MFVec3d | (SFVec3d v1, SFVec3d v2, ...) | The creation function shall initialize the array using zero or more SFVec3d-valued expressions passed as parameters. |
Table 7.64 — MFVec3d properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFVec3d array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The MFVec3f object corresponds to an X3D MFVec3f field. It is used to store a one-dimensional array of SFVec3f values. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g., mfVec3fObjectName[index], where index is an integer-valued expression with 0 ≤ index < length and length is the number of elements in the array). Assigning to an element with index ≥ length results in the array being dynamically expanded to contain length elements. All elements not explicitly initialized are set to SFVec3f (0.0, 0.0, 0.0). An MFVec3f object may be created using the function in Table 7.66. The properties of an MFVec3f object are defined in Table 7.67. The functions defined in Table 7.68 may be used to manipulate an MFVec3f object.
Table 7.66 — MFVec3f instance creation function
Object | Parameter List | Description |
---|---|---|
MFVec3f | (SFVec3f v1, SFVec3f v2, ...) | The creation function shall initialize the array using zero or more SFVec3-valued expressions passed as parameters. |
Table 7.67 — MFVec3f properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
numeric | length | No | property for getting/setting the number of elements in the array. |
Return Type | Function | Description |
---|---|---|
String | toString() | Returns a String containing the value of the MFVec3f array encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
Routes are represented by the X3DRoute host object. This object cannot be directly instantiated. Routes may only be created through calls to the addRoute() function of X3DExecutionContext. The properties of the X3DRoute object are defined in Table 7.69.
This object cannot be directly instantiated
Data type | Property Name | Read Only | Description |
---|---|---|---|
SFNode | sourceNode | yes | A reference to the node that is the source of this route. |
String | sourceField | yes | The name of the field in the source node. |
SFNode | destinationNode | yes | A reference to the node that is the destination of this route. |
String | destinationField | yes | The name of the field in the destination node. |
There are no functions defined for this object.
A PROTO declaration is represented by the X3DProtoDeclaration host object. The user cannot create instances of this object. This object can only be fetched using the X3DExecutionContext object. The properties of a PROTO declaration are defined in Table 7.70. The functions defined in Table 7.71 may be used to manipulate a ProtoDeclare object.
This object cannot be directly instantiated.
Table 7.70 — ProtoDeclaration properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
String | name | yes | The declared name of this proto |
FieldDefinitionArray | fields | yes | The list of all the fields defined for this proto |
Boolean | isExternProto | yes | Always has the value of false |
An EXTERNPROTO declaration is represented by the X3DExternProtoDeclaration host object. The user cannot create instances of this object. EXTERNPROTO declarations can only be fetched using the X3DExecutionContext object. The properties of an EXTERNPROTO declaration are defined in Table 7.72. The functions defined in Table 7.73 may be used to manipulate a ExternProtoDeclare object.
This object cannot be directly instantiated.
Table 7.72 — ExternProtoDeclaration properties
Data type | Property Name | Read Only | Description |
---|---|---|---|
String | name | yes | The declared name of this proto |
FieldDefinitionArray | fields | yes | The list of all the fields defined for this proto |
MFString | urls | yes | The list of all the URIs defined for this proto |
Boolean | isExternProto | yes | Always has the value of true |
numeric | loadState | yes | The value is one of the _STATE properties defined in the X3DConstants object |
Table 7.73 — ExternProtoDeclaration function
Return Type | Function |
---|---|
SFNode | newInstance() |
void | loadNow() |
This object stores information about a particular X3D profile. Table 7.74 lists the items maintained by a ProfileInfo object.
Table 7.74 — ProfileInfo properties
Data type | Property name | Description |
---|---|---|
String | name | The formal name as defined in part 1 of ISO/IEC 19775. |
Numeric | level | The level of support of this instance |
String | Title | A generic, freeform title string provided by the browser manufacturer |
String | providerUrl | If provided, the URL to the entity that wrote this component. This assumes that extensions to the browser may not necessarily be provided by the browser writer's themselves. |
ComponentInfoArray | components | An array of the ComponentInfo object instances that make
up this profile.
|
The ProfileInfoArray object is an object that represents an array of ProfileInfo objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.75 lists the items maintained by a ProfileInfoArray object.
Table 7.75 — ProfileInfoArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
ProfileInfo | integer | Treated as an array, this is ProfileInfo at the given index |
The ComponentInfo object stores information about a particular X3D component. The object consists solely of read-only properties. It does not define any additional functions. It shall be an error to write to any of these properties. Table 7.76 lists the items maintained by a ComponentInfo object.
Table 7.76 — ComponentInfo functions
Data type | Property Name | Description |
---|---|---|
String | name | The formal name as defined in the appropriate Part 1, Clause |
Numeric | level | The level of support of this instance |
String | Title | A generic, freeform title string provided by the browser manufacturer |
String | providerUrl | If provided, The URL to the entity that wrote this component. Assumes that extensions to the browser may not necessarily be provided by the browser writer's themselves. |
The ComponentInfoArray object is an object that represents an array of ComponentInfo objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.77 lists the items maintained by a ComponentInfoArray object.
Table 7.77 — ComponentInfoArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
ComponentInfo | integer | Treated as an array, this is ComponentInfo at the given index |
FieldDefinitionArray is an object that represents an array of X3DFieldDefinition objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.78 lists the items maintained by a FieldDefinitionArray object.
Table 7.78 — FieldDefinitionArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
X3DFieldDefinition | integer | Treated as an array, this is X3DFieldDefinition at the given index |
ExternProtoDeclarationArray is an object that represents an array of X3DExternProtoDeclaration objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.79 lists the items maintained by an ExternProtoDeclarationArray object.
Table 7.79 — ExternProtoDeclarationArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
X3DExternProtoDeclaration | integer | Treated as an array, this is the X3DExternProtoDeclaration at the given index |
ProtoDeclarationArray is an object that represents an array of X3DProtoDeclaration objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.80 lists the items maintained by a ProtoDeclarationArray object.
Table 7.80 — ProtoDeclarationArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
ComponentInfo | integer | Treated as an array, this is the X3DProtoDeclaration at the given index |
RouteArray is an object that represents an array of X3DRoute objects. This is a read-only object. The user is not permitted to create a new instance of this object. Table 7.81 lists the items maintained by a RouteArray object.
Table 7.81 — RouteArray functions
Data type | Property Name | Description |
---|---|---|
numeric | length | The number of items currently in this array |
Route | integer | Treated as an array, this is ComponentInfo at the given index |
The X3DMatrix3 object provides many useful functions for performing manipulations on 3x3 matrices. Each of element of the matrix can be accessed using C-style array dereferencing (i.e., x3dMatrixObjectName[0][1] is the element in row 0, column 1). The results of dereferencing a Matrix3 object using a single index (i.e., x3dMatrixObjectName[0]) are undefined. The translation elements are in the third row. For example, x3dMatrixObjectName[2][0] is the X offset. A Matrix3 object may be created using the function defined in Table 7.82. A Matrix3 object may be manipulated by the functions defined in Table 7.83.
Table 7.82 — Matrix3 instance creation function
Object | Parameter List | Description |
---|---|---|
X3DMatrix3 | (numeric f11, numeric f12, numeric f13, numeric f21, numeric f22, numeric f23, numeric f31, numeric f32, numeric f33) |
The creation function shall initialize the array using zero or more SFVec3-valued expressions passed as parameters. |
The individual values of the matrix may be addressed using array-style indexing. The values are organized in a flat array in row-major order (e.g., [0] is f11, [2] is f12, and [3] is f13.
Table 7.83 — Matrix3 functions
Return Type | Function | Description |
---|---|---|
void | setTransform(SFVec2f translation, SFVec3f rotation, SFVec2f scale, SFVec3f scaleOrientation, SFVec2f center) |
Sets the Matrix to the passed values. Any of the rightmost parameters may be omitted. The function has zero to five parameters. For example, specifying zero parameters results in an identity matrix while specifying one parameter results in a translation and specifying two parameters results in a translation and a rotation. Any unspecified parameter is set to its default as specified for the Transform node. Values are applied to the matrix in the same order as the matrix field calculations for the Transform node. |
void | getTransform(SFVec2f translation, SFVec3f rotation, SFVec2f scale) |
Decomposes the Matrix and returns the components in the passed translation, rotation, and scale objects. The types of these passed objects is the same as the first three arguments to setTransform. If any passed object is not sent, or if the null object is sent for any value, that value is not returned. Any projection or shear information in the matrix is ignored. |
Matrix3 | inverse() | Returns a Matrix whose value is the inverse of this object. |
Matrix3 | transpose() | Returns a Matrix whose value is the transpose of this object. |
Matrix3 | multLeft(Matrix3) | Returns a Matrix whose value is the object multiplied by the passed matrix on the left. |
Matrix3 | multRight(Matrix3) | Returns a Matrix whose value is the object multiplied by the passed matrix on the right. |
SFVec2f | multVecMatrix(SFVec2f vec) | Returns an SFVec3f whose value is the object multiplied by the passed row vector. |
SFVec2f | multMatrixVec(SFVec2f vec) | Returns an SFVec3f whose value is the object multiplied by the passed column vector. |
String | toString() | Returns a String containing the matrix contents encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The X3DMatrix4 object provides many useful functions for performing manipulations on 4x4 matrices. Each of element of the matrix can be accessed using C-style array dereferencing (i.e., x3dMatrixObjectName[0][1] is the element in row 0, column 1). The results of dereferencing a Matrix4 object using a single index (i.e., x3dMatrixObjectName[0]) are undefined. The translation elements are in the fourth row. For example, x3dMatrixObjectName[3][0] is the X offset. A Matrix4 object may be created using the function defined in Table 7.84. A Matrix4 object may be manipulated by the functions defined in Table 7.85.
Table 7.84 — Matrix4 Instance creation function
Object | Parameter List | Description |
---|---|---|
X3DMatrix4 | (numeric f11, numeric f12, numeric f13, numeric f14, numeric f21, numeric f22, numeric f23, numeric f24, numeric f31, numeric f32, numeric f33, numeric f34, numeric f41, numeric f42, numeric f43, numeric f44) |
The creation function shall initialize the array using zero or more SFVec3-valued expressions passed as parameters. |
The individual values of the matrix may be addressed using array-style indexing. The values are organized in a flat array in row-major order (e.g., [0] is f11, [3] is f14, and [4] is f21).
Table 7.85 — Matrix4 functions
Return Type | Function | Description |
---|---|---|
void | setTransform(SFVec3f translation, SFRotation rotation, SFVec3f scale, SFRotation scaleOrientation, SFVec3f center) |
Sets the Matrix to the passed values. Any of the rightmost parameters may be omitted. The function has zero to five parameters. For example, specifying zero parameters results in an identity matrix while specifying one parameter results in a translation and specifying two parameters results in a translation and a rotation. Any unspecified parameter is set to its default as specified for the Transform node. Values are applied to the matrix in the same order as the matrix field calculations for the Transform node. |
void | getTransform(SFVec3f translation, SFRotation rotation, SFVec3f scale) |
Decomposes the Matrix and returns the components in the passed translation, rotation, and scale objects. The types of these passed objects is the same as the first three arguments to setTransform. If any passed object is not sent, or if the null object is sent for any value, that value is not returned. Any projection or shear information in the matrix is ignored. |
Matrix4 | inverse() | Returns a Matrix whose value is the inverse of this object. |
Matrix4 | transpose() | Returns a Matrix whose value is the transpose of this object. |
Matrix4 | multLeft(Matrix4 matrix) | Returns a Matrix whose value is the object multiplied by the passed matrix on the left. |
Matrix4 | multRight(Matrix4 matrix) | Returns a Matrix whose value is the object multiplied by the passed matrix on the right. |
SFVec3f | multVecMatrix(SFVec3f vec) | Returns an SFVec3f whose value is the object multiplied by the passed row vector. |
SFVec3f | multMatrixVec(SFVec3f vec) | Returns an SFVec3f whose value is the object multiplied by the passed column vector. |
String | toString() | Returns a String containing the matrix contents encoded using the X3D Classic VRML encoding (see part 2 of ISO/IEC 19776). |
The X3DConstants host object is used to define constants values used
throughout this language binding. Each property is defined as a numeric,
read-only value. The individual values are not specified; these shall be
implementation-dependent. These constants may be used anywhere that a
service request wishes to return some fixed value such as if
or switch
statements. The list of known values are defined
in Table 7.86:
Table 7.86 — X3DConstant values
INITIALIZED_EVENT | SHUTDOWN_EVENT | CONNECTION_ERROR | INITIALIZED_ERROR |
NOT_STARTED_STATE | IN_PROGRESS_STATE | COMPLETE_STATE | FAILED_STATE |
SFBool | MFBool | MFInt32 | SFInt32 |
SFFloat | MFFloat | SFDouble | MFDouble |
SFTime | MFTime | SFNode | MFNode |
SFVec2f | MFVec2f | SFVec3f | MFVec3f |
SFVec3d | MFVec3d | MFRotation | SFRotation |
MFColor | SFColor | SFImage | MFImage |
MFColorRGBA | SFColorRGBA | SFString | MFString |
X3DBoundedObject | X3DMetadataObject | X3DUrlObject | X3DTriggerNode |
X3DInfoNode | X3DAppearanceNode | X3DAppearanceChildNode | X3DMaterialNode |
X3DTextureNode | X3DTexture2DNode | X3DTexture3DNode | X3DTextureTransformNode |
X3DGeometryNode | X3DGeometry3DNode | X3DTextureTransformNode | X3DCoordinateNode |
X3DParametricGeometryNode | X3DGeometricPropertyNode | X3DColorNode | X3DProtoInstance |
X3DNormalNode | X3DTextureCoordinateNode | X3DFontStyleNode | X3DGroupingNode |
X3DChildNode | X3DBindableNode | X3DBackgroundNode | X3DInterpolatorNode |
X3DShapeNode | X3DScriptNode | X3DSensorNode | X3DEnvironmentalSensorNode |
X3DLightNode | X3DNetworkSensorNode | X3DPointingDeviceSensorNode | X3DDragSensorNode |
X3DKeyDeviceSensorNode | X3DSequencerNode | X3DTimeDependentNode | X3DSoundNode |
X3DSoundSourceNode | X3DTouchSensorNode | inputOnly | outputOnly |
inputOutput | initializeOnly |
Authors may define a function named initialize() that is invoked before the browser presents the world to the user and before any events are processed by any nodes in the same X3D file as the Script node containing this script (see part 2 of ISO/IEC 19775], initialize and shutdown service request definitions).
The initialize()
function has no parameters. Events generated from
initialize()
are given the timestamp of when the Script node was loaded.
The prepareEvents()
function represents the service request
that is called every frame. If the user code defines this function, it
shall be called by the browser every frame.
The prepareEvents()
function takes a single optional argument that is
the current timestamp.
The eventsProcessed()
function represents the service request
that is called after
some set of events has been received. This allows Script nodes that do not
rely on the ordering of events received to generate fewer events than an
equivalent Script node that generates events whenever events are received
(see 4.3.5.4 Receiving events).
The eventsProcessed()
function takes no parameters. Events generated
from it are given the timestamp of the last event processed.
Authors may define a function named shutdown()
that is invoked
when the corresponding Script node is deleted or when the world containing
the Script node is unloaded or replaced by another world
(see part 2 of ISO/IEC 19775, initialize and
shutdown service request definitions).
The shutdown() function has no parameters. Events generated from shutdown() are given the timestamp of when the containing node was deleted or the URL replaced.