20080821.0 1213 1217(77-1)
|*View X3D SAI ECMAScript Bindings |
Our X3D Language Bindings standard, Part 1, defines the ECMAScript programming interfaces used to create, access, and update the visualization and behavior of a scene. This is my quick reference for the X3D ECMAScript bindings. Also refer to the the ECMA standard for core ECMAScript features.
Browser.currentScene.Node.field.value;
QUICK ECMASCRIPT SUMMARY
External Connections:
getBrowser
createBrowser
beginUpdate()
endUpdate()
addBrowserCallback(String, object)
removeBrowserCallback(String)
createScene(ProfileInfo[, ComponentInfo n1, ComponentInfo n2, ...])
Browser.
name
version
currentSpeed
currentFrameRate
description
supportedComponents
supportedProfiles
currentScene = X3DScene for Scene name scope
currentScene = X3DExecutionContext for any name scope
replaceWorld(X3DScene)
createX3DFromString(String x3dSyntax)
createX3DFromURL(MFString, String, Object)
loadURL(MFString url[, parameters])
importDocument(DOMNode1)
getRenderingProperty(String)
addBrowserListener(String, Object)
removeBrowserListener(String)
print(Object)
println(Object)
.X3DScene. (top name scope)
specificationVersion
setMetaData(String, String)
getMetaData(String)
getExportedNode(String)
updateExportedNode(String, SFNode)
removeExportedNode(String)
.X3DExecutionContext. (any name scope)
specificationVersion
encoding
ASCII VRML XML BINARY SCRIPTED BIFS NONE
profile
components
worldURL
rootNodes
protos
externprotos
routes
addRoute(X3DRoute)
X3DRoute = fromNode, FromField, toNode, toField
deleteRoute(X3DRoute)
createNode(String)
createProto(String)
getImportedNode(String, String)
updateImportedNode(String, String)
removeImportedNode(String)
getNamedNode(String)
updateNamedNode(String, SFNode)
removeNamedNode(String)
.Node.
getNodeName()
getNodeType()
getFieldDefinitions()
toVRMLString()
toXMLString()
this = SFNode object instance script context = containing X3DScriptNode
.field.
name
accessType
inputOutput inputOnly outputOnly initializeOnly
dataType
getName()
getType()
isReadable()
isWritable()
addFieldCallback(String, object)
removeFieldCallback(String)
GENERAL ECMASCRIPT STRUCTURES
External Basics:
X3DBrowser = document.objx3d.getBrowser();
X3DBrowser.addBrowserCallback(String, Object);
X3DBrowser.removeBrowserCallback(String);
X3DBrowser.createScene(ProfileInfo[, ComponentInfos]);
X3DBrowser.replaceWorld(X3DScene);
X3DBrowserContext = X3DBrowser.currentScene;
X3DBrowser.beginUpdate;
X3DBrowser.endUpdate;
document.objx3d.createBrowser();
document.objx3d.dispose();
Internal Basics:
Browser.createScene(ProfileInfo[, ComponentInfos]);
Browser.loadURL(url);
Browser.replaceWorld(X3DScene);
Browser.addBrowserListener(String, Object);
Browser.removeBrowserCallback(String);
X3DContent = Browser.createX3DFromString(X3DSyntax);
X3DContent = Browser.createX3DFromURL(url);
string = Browser.getRenderingProperty();
string = Browser.name;
string = Browser.version;
string = Browser.description;
string = Browser.supportedComponents;
string = Browser.supportedProfiles;
numeric = Browser.currentSpeed;
numeric = Browser.currentFrameRate;
Browser.print(Object);
Browser.println(Object);
Browser.currentScene.dispose();
# scene = current execution context
scene = Browser.currentScene;
RootNodesList = scene.rootNodes;
scene.addRootNode(X3DContent);
scene.removeRootNode(NodeName);
scene.createNode(NodeName);
NodeName.Field.value;
scene.getNamedNode(NodeName);
scene.updateNamedNode(NodeName, X3DContent);
scene.removeNamedNode(NodeName);
string = scene.specificationVersion;
string = scene.encoding;
ProfileInfo = scene.profile;
ProfileInfo.name
ProfileInfo.level
ProfileInfo.Title
ProfileInfo.providerUrl
ProfileInfo.components
ProfileInfo.length
ProfileInfo.integer
sceneComponentsList = scene.components;
WorldURLString = scene.worldURL;
setMetaData(String, String)
getMetaData(String)
sceneRoutesList = scene.routes;
scene.addRoute(X3DRoute)
X3DRoute = fromNode, fromField, toNode, toField
X3DRoute.getSourceNode
X3DRoute.getSourceField
X3DRoute.getDestinationNode
X3DRoute.getDestinationField
scene.deleteRoute(X3DRoute);
sceneProtosList = scene.protos;
scene.createProto(ProtoName);
String = ProtoInstance.name;
protoFieldListString = ProtoInstance.fields;
falseSFBool = ProtoInstance.isExternProto;
FieldDefinitionList = ProtoInstance.getFieldDefinitions;
SFBool = ProtoInstance.checkLoadState;
ProtoInstance.requestImmediateLoad;
scene.ProtoInstance.dispose();
scene.ExternProtosList = scene.externprotos;
scene.createExternProto(SFNodeName);
ExternProtoName.loadNow();
ExternProtoInstance.name;
ExternProtoFieldList = ExternProtoInstance.fields;
ExternProtoURLsList = ExternProtoInstance.urls;
trueBool = ExternProtoInstance.isExternProto;
loadStateBool = ExternProtoInstance.loadState;
scene.ExternProtoName.dispose();
X3DContent = Browser.importDocument(DOMNode);
scene.getImportedNode(String, String);
scene.updateImportedNode(String, String);
scene.removeImportedNode(String);
SFNode = scene.getExportedNode(String);
scene.updateExportedNode(String, SFNode);
scene.removeExportedNode(String);
General Node services:
# Node = current scene.NodeName
X3DConcreteNodeName.getNodeType()
FieldDefinitionArray = Node.getFieldDefinitions()
X3DClassicVRMLContnet = Node.toVRMLString()
X3DXMLContent = Node.toXMLString()
General Field services:
# field = current Node.fieldName
field.name
field.type
field.accessType;
string = field.getName
numeric = field.getType
numeric = field.getAccessType
SFBool = field.isReadable;
SFBool = field.isWritable;
field.addFieldCallback(String, object);
field.removeFieldCallback(String);
varType = field.getValue
field.setValue.value;
field.dispose();
SFTypes:
numeric = SFType.length;
X3DVString = SFType.toString();
SFBool
SFColor(r, b, g)
setHSV(h, s, v);
numeric[3] = SFColorNode.getHSV();
string = SFColorNode.toString()
SFColorRGBA(r, b, g, a)
SFColorRGBANode.setHSV(h, s, v);
numeric[3] = SFColorRGBANode.getHSV();
string = SFColorRGBANode.toString()
SFDouble
SFImage(width, height, components, array)
numeric = SFImage.width
numeric = SFImage.height
numeric = SFImage.comp
MFInt32 = SFImage.array
SFInt32
SFFloat
SFNode
SFNode.getFieldDefinitions();
SFNode.toVRMLString();
SFNode.toXMLString();
String = SFNode.getNodeName()
String = SFNode.getNodeType()
FieldDefinitionArray = SFNode.getFieldDefinitions()
String = SFNode.toVRMLString()
String = SFNode.toXMLString()
SFRotation(x, y, z, angle)
SFVec3f = SFRotation.getAxis()
SFRotation = SFRotation.inverse()
SFRotation = SFRotation.multiply(rot)
SFVec3f = SFRotation.multiVec(vec)
SFRotation = SFRotation.setAxis(vec)
SFRotation = SFRotation.slerp(dest, t)
String = SFRotation.toString()
SFString
SFTime
SFVec2d(x, y)
same as SFVec3f except no cross
SFVec2f(x, y)
same as SFVec3f except no cross
SFVec3d(x, y, z)
Same as SFVec3f
SFVec3f(x, y, z)
SFVec3f = SFVec3f.add(vec)
SFVec3f = SFVec3f.cross(vec)
SFVec3f = SFVec3f.divide(n)
numeric = SFVec3f.dot(vec)
numeric = SFVec3f.length()
SFVec3f = SFVec3f.multiple(n)
SFVec3f = SFVec3f.negate()
SFVec3f = SFVec3f.normalize()
SFVec3f = SFVec3f.subtract(SFVec3f vec)
String = SFVec3f.toString()
MFTypes:
numeric = MFType.length
X3DVString = MFType.toString()
MFBool[SFBool][, SFBool][, ...])
MFColor([SFColor][, SFColor][, ...])
MFColorRGBA([SFColorRGBA][, SFColorRGBA][, ...])
MFDouble([SFDouble][, SFDouble][, ...])
MFFloat([(SFFloat][, SFFloat][, ...])
MFImage([SFImage][, SFImage][, ...])
MFInt32([SFInt32][, SFInt32][, ...])
MFNode([SFNode][, SFNode][, ...])
MFRotation([SFRotation][, SFRotation][, ...])
MFString(SFString[, SFString][, ...])
MFVec2d([SFVec2d][, SFVec2d][, ...])
MFTime([SFTime][, SFTime][, ...])
MFVec2f([SFVec2f][, SFVec2f][, ...])
MFVec3f([SFVec3f][, SFVec3f][, ...])
MFVec3d([SFVec3d][, SFVec3d][, ...])
Matrix3
X3DMatrix3 = newX3DMatrix3(
f11, f12, f13,
f21, f22, f23,
f31, f32, f33);
setTransform([translation][, rotation][,
scale][, scaleOrientation][, center]);
Transform.getTransform(translation, rotation, scale);
Matrix3 = Transform.inverse();
Matrix3 = Transform.transpose();
Matrix3 = Transform.multRight(Matrix3);
SFVec2f = Transform.multVecMatrix(vec);
SFVec2f = Transform.multMatrixVec(vec);
String = Transform.toString();
Matrix4
X3DMatrix4 = newX3DMatrix4(
f11, f12, f13, f14,
f21, f22, f23, f24,
f31, f32, f33, f34,
f41, f42, f43, f44);
setTransform([translation][, rotation][, scale][, scaleOrientation][, center])
getTransform( translation, rotation, scale)
Matrix4 = Transform.inverse()
Matrix4 = Transform.transpose()
Matrix4 = Transform.multLeft(matrix)
SFVec3f = Transform.multVecMatrix(rowvec)
String = Transform.toString()
Services provided by Script context
initialize([ts])
prepareEvents([ts])
eventsProcessed([ts])
shutdown([ts])
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
=========================