<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<![CDATA[
ecmascript: function initialize() { for(i = 0; i < 3; i++) { BarTransformNode.scale[i] = 1; if(i == 2) { PointerTransformNode.scale[i] = 0.1; } else { PointerTransformNode.scale[i] = 1; } } setBarSize(); setPointerSize(); setCurrentValueTransform(); setNameTransform(); } function setBarSize() { BarTransformNode.scale[0] = Length * BarTransformNode.scale[0]; BarTransformNode.scale[1] = Width * BarTransformNode.scale[1]; } function setPointerSize() { PointerTransformNode.scale[0] = Width * PointerTransformNode.scale[0]; PointerTransformNode.scale[1] = Width * PointerTransformNode.scale[1]; SVPlaneSensorNode.minPosition[0] = Length * SVPlaneSensorNode.minPosition[0]; SVPlaneSensorNode.maxPosition[0] = Length * SVPlaneSensorNode.maxPosition[0]; } function setCurrentValueTransform() { CurrentValueTransformNode.translation[0] = (BarTransformNode.scale[0] * 0.05 / 2) + (BarTransformNode.scale[1] * 0.001 * 2); } function setNameTransform() { SliderNameTransformNode.translation[0] = -((BarTransformNode.scale[0] * 0.05 / 2) + (BarTransformNode.scale[1] * 0.001 * 2)); }
]]>
<![CDATA[
ecmascript: var totalLength; function initialize() { realValue = (MaxValue + MinValue) / 2; realValue = roundOff(realValue, Precision); CurrentValueFloat = realValue; CurrentValueInt = Math.round(realValue); totalLength = SVPlaneSensorNode.maxPosition[0] - SVPlaneSensorNode.minPosition[0]; updateCurrentValueText(realValue.toString()); } //Map pointer translation value to the real value function updateCurrentValue(translation, timeEvent) { var displayString; var curPositionOnBar = translation[0] + totalLength / 2; var x = (MaxValue - MinValue) * curPositionOnBar / totalLength; var realValue = MinValue + x; if(Precision == 0) { //If CurrentValueInt = Math.round(realValue); displayString = CurrentValueInt.toString(); } else { CurrentValueFloat = roundOff(realValue, Precision); displayString = CurrentValueFloat.toString(); } updateCurrentValueText(displayString); } function updateCurrentValueText(dispStr) { CurrentValueTextNode.string[0] = dispStr; } //A function to round the values regarding to given precision. function roundOff(value, precision) { var result; var isNegative = false; var wholeInt = Math.round(value * Math.pow(10, precision)); //Negative numbers creates exceptional condition, therefor they are converted //to positive values. if(wholeInt < 0) { wholeInt = -wholeInt; isNegative = true; } var whole = wholeInt.toString(); var decPoint = whole.length - precision; //Exception when precision is bigger than the string length if(decPoint < 0) { i = -decPoint; for(i; i > 0; i--) { whole ='0' + whole; } //Calculate decPoint according to new string expanded with 0s decPoint = whole.length - precision; } if(whole !='0') { //Put the decimal point on the appropriate place result = whole.substring(0, decPoint); result +='.'; result += whole.substring(decPoint, whole.length); } else { //If the string is'0', then result is'0' result = whole; } //Negative numbers are altered. if(isNegative) { result ='-' + result; } //Convert the String value to Float. resultFloat = parseFloat(result); return resultFloat; }
]]>
Event Graph ROUTE Table entries with 5 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
CurrentValueFinder
Script |
No ROUTE connection found for output from this node. Contains SFNode field with indirect access to another node. |
ShapeOrganizer
Script |
No ROUTE connection found for output from this node. Contains SFNode field with indirect access to another node. |
HudProx
ProximitySensor position_changed SFVec3f |
HudTransform
Transform set_translation SFVec3f |
|
HudProx
ProximitySensor orientation_changed SFRotation |
HudTransform
Transform set_rotation SFRotation |
ProtoInstance ProjectileSliderBar |
No ROUTE connection found for output from this node. Contains SFNode/MFNode field with indirect access to other nodes. |
SVPlaneSensor
PlaneSensor translation_changed SFVec3f |
pointerTransform
Transform set_translation SFVec3f |
|
SVPlaneSensor
PlaneSensor translation_changed SFVec3f |
CurrentValueFinder
Script updateCurrentValue SFVec3f |
<!--
Online at
https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileSliderBarPrototypeIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileSliderBarPrototype.x3d
-->
<!--
Color legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance
name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->