#VRML V2.0 utf8
# X3D-to-VRML-97 XSL translation autogenerated by X3dToVrml97.xslt
# https://www.web3d.org/x3d/content/X3dToVrml97.xslt
# Generated using XSLT processor: Saxonica
# [X3D] VRML V3.0 utf8
# PROFILE Immersive
# [X3D] version=3.0
# [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.0.xsd
# [head]
# META "title" "SceneNodePrototype.x3d"
# META "creator" "Don Brutzman"
# META "created" "19 December 2000"
# META "modified" "20 October 2019"
# META "description" "Expose functionality of Browser class in Java/ECMAscript annexes of VRML 97 specification. Consider promotion to a native node in X3D/VRML 200x scenes."
# META "warning" "Under development, many of these exposed attributes will be eliminated. Scene node will not be used in X3D proper, but may become a valuable prototype via SAI scripting."
# META "identifier" "https://www.web3d.org/x3d/content/examples/Basic/development/SceneNodePrototype.x3d"
# META "generator" "X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
# META "license" "../license.html"
# [Scene] ========== ========== ==========
NavigationInfo { type [ "EXAMINE" "ANY" ] } ### Default X3D NavigationInfo
WorldInfo {
title "SceneNodePrototype.x3d"
}
PROTO Scene [
# Standard browser attributes exposed via VRML 97 Script annexes
eventIn SFString createVrmlFromString
eventIn SFString createVrmlFromURL
eventOut MFNode createdVrmlNodes
eventOut SFFloat currentFrameRate
eventOut SFFloat currentSpeed
eventIn SFString description
eventIn SFBool evaluate
eventIn SFString loadUrl
eventIn SFString loadUrlParameter
eventOut SFString name
eventIn MFNode replaceWorld
eventOut SFString version
eventOut SFString worldUrl
eventIn SFBool addRoute
eventIn SFBool deleteRoute
eventIn SFNode fromNode
eventIn SFString fromEventOut
eventIn SFNode toNode
eventIn SFString toEventIn
# Candidate additions
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
eventOut SFNode boundBackground
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
eventOut SFNode boundFog
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
eventOut SFNode boundGeoViewpoint
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
eventOut SFNode boundNavigationInfo
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
eventOut SFNode boundViewpoint
eventOut MFString response
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
exposedField SFBool dashboardVisible TRUE
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
exposedField SFInt32 pixelWidth -1
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
exposedField SFInt32 pixelHeight -1
] {
DEF BrowserScript Script {
eventIn SFString createVrmlFromString IS createVrmlFromString
eventIn SFString createVrmlFromURL IS createVrmlFromURL
eventOut MFNode createdVrmlNodes IS createdVrmlNodes
eventOut SFFloat currentFrameRate IS currentFrameRate
eventOut SFFloat currentSpeed IS currentSpeed
eventIn SFString description IS description
eventIn SFBool evaluate IS evaluate
eventIn SFString loadUrl IS loadUrl
eventIn SFString loadUrlParameter IS loadUrlParameter
eventOut SFString name IS name
eventIn MFNode replaceWorld IS replaceWorld
eventOut SFString version IS version
eventOut SFString worldUrl IS worldUrl
eventIn SFBool addRoute IS addRoute
eventIn SFBool deleteRoute IS deleteRoute
eventIn SFNode fromNode IS fromNode
eventIn SFString fromEventOut IS fromEventOut
eventIn SFNode toNode IS toNode
eventIn SFString toEventIn IS toEventIn
eventOut MFString response IS response
directOutput TRUE
### Warning: Script outputOnly field 'response' has no assignment statement such as 'response[someIndex]=(someMFStringExpression);' in contained ecmascript: code
url [ "javascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function evaluate (inputValue, timeStamp)
{
if (inputValue) // Boolean
{
currentFrameRate = Browser.getCurrentFrameRate ();
currentSpeed = Browser.getCurrentSpeed ();
version = Browser.getVersion ();
name = Browser.getName ();
worldUrl = Browser.getWorldURL ();
printingln ('currentFrameRate = ' + currentFrameRate);
printingln ('currentSpeed = ' + currentSpeed);
printingln ('version = ' + version);
printingln ('name = ' + name);
printingln ('worldUrl = ' + worldUrl);
}
}
function createVrmlFromString (inputValue, timeStamp)
{
// note VRML 97 method name didn't follow capitalization convention
createdVrmlNodes = Browser.createVrmlFromString (inputValue);
}
function createVrmlFromUrl (inputValue, timeStamp)
{
// note VRML 97 method name didn't follow capitalization convention
createdVrmlNodes = Browser.createVrmlFromURL (inputValue);
}
function description (inputValue, timeStamp)
{
printingln ('description = ' + inputValue);
Browser.setDescription (inputValue);
}
function replaceWorld (inputValue, timeStamp)
{
Browser.replaceWorld (inputValue);
}
function addRoute (inputValue, timeStamp)
{
if (inputValue) // Boolean
{
Browser.addRoute (fromNode, fromEventOut, toNode, toEventIn);
}
}
function deleteRoute (inputValue, timeStamp)
{
if (inputValue) // Boolean
{
Browser.deleteRoute (fromNode, fromEventOut, toNode, toEventIn);
}
}
function loadURL (inputValue, timeStamp)
{
printingln ('loadURL = ' + inputValue);
printingln ('loadUrlParameter = ' + loadUrlParameter);
Browser.loadURL (inputValue, loadUrlParameter);
}
function createVrmlFromURL (SFStringValue, timestamp)
{
}
function loadUrl (SFStringValue, timestamp)
{
}
function loadUrlParameter (SFStringValue, timestamp)
{
}
function fromNode (SFNodeValue, timestamp)
{
}
function fromEventOut (SFStringValue, timestamp)
{
}
function toNode (SFNodeValue, timestamp)
{
}
function toEventIn (SFStringValue, timestamp)
{
}
" ]
}
}
# Example invocation
DEF SceneNode Scene {
}
Shape {
geometry DEF Output3dText Text {
string [ "Click text for partial Scene node test" ]
fontStyle FontStyle {
justify [ "MIDDLE" "MIDDLE" ]
size 0.5
}
}
appearance Appearance {
material Material {
diffuseColor 0 0.6 0.6
}
}
}
DEF ClickTextSensor TouchSensor {
# description "Click text for partial Scene node test"
}
DEF AssembleBrowserOutputText Script {
eventIn SFFloat currentFrameRate
eventIn SFFloat currentSpeed
eventIn SFString name
eventIn SFString version
eventIn SFString worldUrl
eventOut MFString evaluatedResult
url [ "javascript:
function initialize ()
{
evaluatedResult = new MFString (
'Click for partial Scene node test:',
' ', ' ', ' ', ' ', ' ', ' ', ' ');
}
function currentFrameRate (inputValue, timeStamp)
{
evaluatedResult [2] = 'currentFrameRate=' + inputValue;
}
function currentSpeed (inputValue, timeStamp)
{
evaluatedResult [3] = 'currentSpeed=' + inputValue;
}
function version (inputValue, timeStamp)
{
evaluatedResult [4] = 'version=' + inputValue;
}
function name (inputValue, timeStamp)
{
evaluatedResult [5] = 'name=' + inputValue;
}
function worldUrl (inputValue, timeStamp)
{
evaluatedResult [6] = 'worldUrl=';
evaluatedResult [7] = inputValue;
}
" ]
}
ROUTE ClickTextSensor.isActive TO SceneNode.evaluate
ROUTE SceneNode.currentFrameRate TO AssembleBrowserOutputText.currentFrameRate
ROUTE SceneNode.currentSpeed TO AssembleBrowserOutputText.currentSpeed
ROUTE SceneNode.version TO AssembleBrowserOutputText.version
ROUTE SceneNode.name TO AssembleBrowserOutputText.name
ROUTE SceneNode.worldUrl TO AssembleBrowserOutputText.worldUrl
ROUTE AssembleBrowserOutputText.evaluatedResult TO Output3dText.string