[x3d-public] continuing route issue with X3DJSAIL -set_Valueprefixandvalue_changed suffix

Andreas Plesch andreasplesch at gmail.com
Sun Apr 23 20:06:00 PDT 2017


Date: Sun, 23 Apr 2017 19:44:18 -0700
From: Don Brutzman <brutzman at nps.edu>


John, as it turns out, the set_ prefix and _changed suffix are only
optional when connecting to accessType inputOutput fields.  They are
required for a large number of output_only and inputOnly fields
(respectively).


>From what I can see in
http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.
html#FieldSemantics

the set_ and _changed adornments are _recommended_ , presumably for reasons
of better readability. Since these did not seem to be required, browser
makers had to allow for both options, pure and adorned. Can you clarify
your argument for a strict requirement ?

Andreas



I have improved the tooltips regarding this matter, hopefully adding
clarity.

I fixed the prior X3DJSAIL code problem when testing accessType and type,
hopefully it is better aligned now.  Deployed last night. Will test further
special cases in the future.

Improved tooltips are also posted:

        X3D Tooltips: ROUTE
        http://www.web3d.org/x3d/content/X3dTooltips.html#ROUTE

==================================
[fromField type NMTOKEN #REQUIRED]
fromField is the field name in the source node which is originating an
event.
Hint: if (and only if) corresponding field has accessType inputOutput,
author has option to append "_changed" suffix to field name - both forms
are functionally equivalent.
Warning: if corresponding field has accessType outputOnly or inputOnly, do
not modify the set_ prefix or the _changed suffix on the field name.
Hint: X3D Abstract Specification 4.4.2.2 Field Semantics
http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.
html#FieldSemantics
Hint: X3D Compressed Binary Encoding, 4.2.3 X3D Canonical Form
http://www.web3d.org/documents/specifications/19776-3/V3.3/Part03/concepts.
html#X3DCanonicalForm
==================================
[toField type NMTOKEN #REQUIRED]
toField is the field name in the destination node which is receiving an
event.
Hint: if (and only if) corresponding field has accessType inputOutput,
author has option to prepend "set_" prefix to field name - both forms are
functionally equivalent.
Warning: if corresponding field has accessType outputOnly or inputOnly, do
not modify the set_ prefix or the _changed suffix on the field name.
Hint: X3D Abstract Specification 4.4.2.2 Field Semantics
http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.
html#FieldSemantics
Hint: X3D Compressed Binary Encoding, 4.2.3 X3D Canonical Form
http://www.web3d.org/documents/specifications/19776-3/V3.3/Part03/concepts.
html#X3DCanonicalForm
==================================

Hopefully this prose is clear.  Improvements or question/clarifications or
hints/warnings are always welcome.

Updated version of your example attached with set_ and _changed inserted.
It now compiles and runs.

corrected exerpt:

.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
cycleTime").setToNode("RandomTourTime").setToField("cycle"))
.addChild(new ROUTEObject().setFromNode("RandomTourTime").setFromField(
"orientation").setToNode("TourOrientation").setToField("keyValue"))
.addChild(new ROUTEObject().setFromNode("RandomTourTime").setFromField(
"position").setToNode("TourPosition").setToField("keyValue"))
.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
fraction_changed").setToNode("TourOrientation").setToField("set_fraction"))
.addChild(new ROUTEObject().setFromNode("TourOrientation").
setFromField("value_changed").setToNode("Tour").setToField("orientation"))
.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
fraction_changed").setToNode("TourPosition").setToField("set_fraction"))
.addChild(new ROUTEObject().setFromNode("TourPosition").setFromField("
value_changed").setToNode("Tour").setToField("position")))      ;


On 4/20/2017 11:51 PM, yottzumm at gmail.com wrote:
> I am now changing field declarations to remove set_ and _changed.  We
shall see.  Things may improve.
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
>
> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Friday, April 21, 2017 1:06 AM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>; Roy
Walmsley <mailto:roy.walmsley at ntlworld.com>; Job at alexkern.de <mailto:
Job at alexkern.de>
> *Subject: *RE: continuing route issue with X3DJSAIL
-set_Valueprefixandvalue_changed suffix
>
> Even if I remove most of the references to set_cycle, the error still
occurs (Actually, I think it?s worse).
>
> See attached Java code.  The XML is different now because of my
serializer.  This is hand modified code.
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
>
> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Friday, April 21, 2017 12:56 AM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>; Roy
Walmsley <mailto:roy.walmsley at ntlworld.com>; Job at alexkern.de <mailto:
Job at alexkern.de>
> *Subject: *RE: continuing route issue with X3DJSAIL -
set_Valueprefixandvalue_changed suffix
>
> Okay, if I remove set_ or _changed, then my code shows a unknown access
type and a unknown field type.  I will provide an example later.
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
>
> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Thursday, April 20, 2017 11:43 PM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>; Roy
Walmsley <mailto:roy.walmsley at ntlworld.com>; Job at alexkern.de <mailto:
Job at alexkern.de>
> *Subject: *RE: continuing route issue with X3DJSAIL - set_Value
prefixandvalue_changed suffix
>
> I don? think that ?set_? or ?_changed? is the problem.  I believe you
handled them last time I looked at the code.  My initial tests modifying my
serializer say the problem still exists.  More examples later.
>
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows 10
>
> *From: *Don Brutzman <mailto:brutzman at nps.edu>
> *Sent: *Thursday, April 20, 2017 10:32 AM
> *To: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>; Roy
Walmsley <mailto:roy.walmsley at ntlworld.com>; Job at alexkern.de <mailto:
Job at alexkern.de>
> *Subject: *Re: continuing route issue with X3DJSAIL - set_Value prefix
andvalue_changed suffix
>
> this is a very useful example.  am thinking through various ways to allow
set_ prefix and _changed suffix in ROUTE toField fromField, then realized
we have a specification omission.
>
> On 4/18/2017 9:24 PM, Don Brutzman wrote:
>
>  > John, the diagnostic is telling us what it doesn't like.  It can't
reconcile set_cycleTime with cycleTime.
>
>  >
>
>  > Am doing my best to produce both valid .x3d and corresponding .java so
that we can, in each case,
>
>  > - decide if an .x3d scene is in error;
>
>  > - decide if X3DJSAIL API is in error, or inadequate;
>
>  > - decide if the .java program is in error; or, rarely,
>
>  > - decide if the specification is in error.
>
> Section 4.4.2.2 Field Semantics is OK.  However if we look at X3D
Canonical Form:
>
>                  4.2.3 X3D canonical form
>
>                  http://www.web3d.org/documents/specifications/
19776-3/V3.3/Part03/concepts.html#X3DCanonicalForm
>
> rules a..o there do not include this case
>
> It looks like they should, since the purposes of canonicalization (c14n)
are to
>
> - provide most compact and unambiguous form of an X3D scene
>
> - provide unique form of .x3d encoding to enable XML Digital Signature
for authentication and XML Encryption for privacy.
>
> In general X3DJSAIL strives to provide X3D Canonical Form as its default
output for toX3dFile() serialization.
>
>                  X3DObject: toFileX3D (javadoc)
>
>                  http://www.web3d.org/specifications/java/javadoc/
org/web3d/x3d/jsail/Core/X3DObject.html#toFileX3D-java.lang.String-
>
> So I plan to modify the accessor and validate() methods for ROUTEObject
to omit "set_" and "_changed" prefix/suffix before checking and when
saving.  Most likely this will prevent other unexpected edge cases from
emerging later as well.
>
> Comments welcome.  Code change and recommended specification addition to
follow in near future.
>
>  > You don't have to debug stylesheet unless you want too.  Whatever
works, I'll keep plugging away whenever possible.  Sorry but I have my
hands full right now with the library and conversion stylesheet and example
archives... if we can isolate bugs, and debug our respective tools
accordingly, that is great.
>
>  >
>
>  > The guiding spec prose here is
>
>  >
>
>  >      4.4.2.2 Field semantics
>
>  >      http://www.web3d.org/documents/specifications/
19775-1/V3.3/Part01/concepts.html#Routes
>
>  >
>
>  > I believe that if a field has accessType inputOutput, then a ROUTE can
refer to it as zzz or set_zzz or zzz_changed as appropriate - see following
spec prose.
>
>  >
>
>  > If correct, since most fields are accessType inputOutput, then there
are two allowed forms within most ROUTE fromName and toName values.
>
>  >
>
>  > ============================================================
================
>
>  > 4.4.2.2 Field semantics
>
>  >
>
>  > Fields define the persistent state of nodes, and values which nodes
may send or receive in the form of events. X3D supports four types of
access to a node's fields:
>
>  >
>
>  >      initializeOnly access, which allows content to supply an initial
value for the field but does not allow subsequent changes to its value;
>
>  >      inputOnly access, which means that the node may receive an event
to change the value of its field, but does not allow the field's value to
be read;
>
>  >      outputOnly access, which means that the node may send an event
when its value changes, but does not allow the field's value to be written;
and
>
>  >      inputOutput access, which allows full access to the field:
content may supply an initial value for the field, the node may receive an
event to change the value of its field, and the node may send an event when
its value changes.
>
>  >
>
>  > An inputOutput field can receive events like an inputOnly field, can
generate events like an outputOnly field, and can be stored in X3D files
like an initializeOnly field. An inputOutput field named zzz can be
referred to as 'set_zzz' and treated as an inputOnly, and can be referred
to as 'zzz_changed' and treated as an outputOnly field. Within ISO/IEC
19775, fields with inputOutput access or inputOnly access are collectively
referred to as input fields, fields with inputOutput access or outputOnly
access are collectively referred to as output fields, and the events these
fields receive and send are called input events and output events,
respectively.
>
>  >
>
>  > The initial value of an inputOutput field is its value in the X3D
file, or the default value for the node in which it is contained, if a
value is not specified. When an inputOutput field receives an event it
shall generate an event with the same value and timestamp. The following
sources, in precedence order, shall be used to determine the initial value
of the inputOutput field:
>
>  >
>
>  >      the user-defined value in the instantiation (if one is specified);
>
>  >      the default value for that field as specified in the node or
prototype definition.
>
>  >
>
>  > The recommendations for naming initializeOnly fields, inputOutput
fields, outputOnly fields, and inputOnly fields for built-in nodes are as
follows:
>
>  >
>
>  >      All names containing multiple words start with a lower case
letter, and the first letter of all subsequent words is capitalized (e.g.,
addChildren), with the exception of set_ and _changed, as described below.
>
>  >      It is recommended that all inputOnly fields have the prefix
?set_?, with the exception of the addChildren and removeChildren fields.
>
>  >      Certain inputOnly fields and outputOnly fields of type SFTime do
not use the "set_" prefix or "_changed" suffix.
>
>  >      It is recommended that all other outputOnly fields have the
suffix ?_changed? appended, with the exception of outputOnly fields of type
SFBool.
>
>  > ============================================================
====================
>
>  >
>
>  > Have been striving to make X3DJSAIL exceptions sufficiently
explanatory to enable author debugging and correction.  Let's try that...
>
>  >
>
>  > And so, looking at the exception you caught below, it appears that the
ROUTEObject validation output should accept either either name prior to
checking type.  That would be an X3DJSAIL effort.
>
>  >
>
>  > Please let me know if that diagnosis seems correct.  I will look at
the ROUTEObject code when time permits.
>
>  >
>
>  > I should likely also add words to tooltips to describe this allowed
variance.
>
>  >
>
>  >      http://www.web3d.org/x3d/content/X3dTooltips.html#ROUTE
>
>  >
>
>  > Hope this email makes sense.  Step by step...
>
>  >
>
>  >
>
>  > On 4/18/2017 10:24 AM, yottzumm at gmail.com wrote:
>
>  >> Java code and X3D attached.   Please provide generated Java code back
which runs, so I can look at it and get my java serializer working.  I will
soon download X3dToJava.xslt, and play with it.  I guess you want me to
test it too? ? or instead? LOL!  Not everyone wants to run a stylesheet.
I?ve been doing it because I don?t have a good XML to X3D JSON converter
yet ?.  Let?s break the monopoly!  This was my start of one:
https://github.com/coderextreme/X3DJSONLD/blob/master/Standard.js  Let?s
just say generating X3DJSON is hard.  I was even able to generate JSON for
the three-x3d-loader.  The code is found here: https://github.com/
coderextreme/X3DJSONLD/blob/master/Three2Serializer.js  so you might base
it on that.  IDK, working with X3DJSON as a source seems easy enough.
>
>  >>
>
>  >> John
>
>  >>
>
>  >> $ java bubbles
>
>  >>
>
>  >> org.web3d.x3d.sai.InvalidFieldValueException:  ROUTE details: FROM
TourTime.cycleTime (TimeSensor.SFTime.outputOnly) TO
RandomTourTime.set_cycle (Script.ERROR_UNKNOWN_FIELD_TYPE.inputOnly)
>
>  >>
>
>  >> ROUTE has source-destination type mismatch, fromField='cycleTime'
source and toField='set_cycle' destination have different types.
>
>  >>
>
>  >> org.web3d.x3d.sai.InvalidFieldValueException:  ROUTE details: FROM
TourTime.cycleTime (TimeSensor.SFTime.outputOnly) TO
RandomTourTime.set_cycle (Script.ERROR_UNKNOWN_FIELD_TYPE.inputOnly)
>
>  >>
>
>  >> ROUTE has source-destination type mismatch, fromField='cycleTime'
source and toField='set_cycle' destination have different types.
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.ROUTEObject.validate(
ROUTEObject.java:721)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.SceneObject.validate(
SceneObject.java:547)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.
java:1831)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(
X3DObject.java:730)
>
>  >>
>
>  >>          at bubbles.main(bubbles.java:79)
>
>  >>
>
>  >> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException:
ROUTE details: FROM TourTime.cycleTime (TimeSensor.SFTime.outputOnly) TO
RandomTourTime.set_cycle (Script.ERROR_UNKNOWN_FIELD_TYPE.inputOnly)
>
>  >>
>
>  >> ROUTE has source-destination type mismatch, fromField='cycleTime'
source and toField='set_cycle' destination have different types.
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.ROUTEObject.validate(
ROUTEObject.java:721)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.SceneObject.validate(
SceneObject.java:547)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.
java:1831)
>
>  >>
>
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(
X3DObject.java:730)
>
>  >>
>
>  >>          at bubbles.main(bubbles.java:79)
>
>  >>
>
>  >> John
>
>  >>
>
>  >
>
>  >
>
>  > all the best, Don
>
> all the best, Don
>
> --
>
> Don Brutzman  Naval Postgraduate School, Code USW/Br
brutzman at nps.edu
>
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
+1.831.656.2149
>
> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/
brutzman
>


all the best, Don
--
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
import org.web3d.x3d.jsail.*;
import org.web3d.x3d.jsail.CADGeometry.*;
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.CubeMapTexturing.*;
import org.web3d.x3d.jsail.DIS.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.EnvironmentalSensor.*;
import org.web3d.x3d.jsail.EventUtilities.*;
import org.web3d.x3d.jsail.Followers.*;
import org.web3d.x3d.jsail.Geometry2D.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Geospatial.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.HAnim.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.KeyDeviceSensor.*;
import org.web3d.x3d.jsail.Layering.*;
import org.web3d.x3d.jsail.Layout.*;
import org.web3d.x3d.jsail.Lighting.*;
import org.web3d.x3d.jsail.NURBS.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Networking.*;
import org.web3d.x3d.jsail.ParticleSystems.*;
import org.web3d.x3d.jsail.Picking.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.RigidBodyPhysics.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Shaders.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Sound.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Texturing3D.*;
import org.web3d.x3d.jsail.Texturing.*;
import org.web3d.x3d.jsail.Time.*;
import org.web3d.x3d.jsail.VolumeRendering.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.sai.*;
import org.web3d.x3d.sai.CADGeometry.*;
import org.web3d.x3d.sai.Core.*;
import org.web3d.x3d.sai.CubeMapTexturing.*;
import org.web3d.x3d.sai.DIS.*;
import org.web3d.x3d.sai.EnvironmentalEffects.*;
import org.web3d.x3d.sai.EnvironmentalSensor.*;
import org.web3d.x3d.sai.EventUtilities.*;
import org.web3d.x3d.sai.Followers.*;
import org.web3d.x3d.sai.Geometry2D.*;
import org.web3d.x3d.sai.Geometry3D.*;
import org.web3d.x3d.sai.Geospatial.*;
import org.web3d.x3d.sai.Grouping.*;
import org.web3d.x3d.sai.HAnim.*;
import org.web3d.x3d.sai.Interpolation.*;
import org.web3d.x3d.sai.KeyDeviceSensor.*;
import org.web3d.x3d.sai.Layering.*;
import org.web3d.x3d.sai.Layout.*;
import org.web3d.x3d.sai.Lighting.*;
import org.web3d.x3d.sai.NURBS.*;
import org.web3d.x3d.sai.Navigation.*;
import org.web3d.x3d.sai.Networking.*;
import org.web3d.x3d.sai.ParticleSystems.*;
import org.web3d.x3d.sai.Picking.*;
import org.web3d.x3d.sai.PointingDeviceSensor.*;
import org.web3d.x3d.sai.Rendering.*;
import org.web3d.x3d.sai.RigidBodyPhysics.*;
import org.web3d.x3d.sai.Scripting.*;
import org.web3d.x3d.sai.Shaders.*;
import org.web3d.x3d.sai.Shape.*;
import org.web3d.x3d.sai.Sound.*;
import org.web3d.x3d.sai.Text.*;
import org.web3d.x3d.sai.Texturing3D.*;
import org.web3d.x3d.sai.Texturing.*;
import org.web3d.x3d.sai.Time.*;
import org.web3d.x3d.sai.VolumeRendering.*;
public class bubblesEventNamesChanged {
  public static void main(String[] args) {
    ConfigurationProperties.setShowDefaultAttributes(true);
    ConfigurationProperties.setXsltEngine(ConfigurationProperties.XSLT_
ENGINE_nativeJava);
    ConfigurationProperties.setDeleteIntermediateFiles(false);
    new bubblesEventNamesChanged().initialize().toFileJSON("
bubbles.new.json");
    }
    public X3DObject initialize() {
      return new X3DObject().setProfile("Immersive").setVersion("3.3")
      .setHead(new headObject()
        .addComponent(new componentObject().setName("EnvironmentalEffects").
setLevel(1))
        .addComponent(new componentObject().setName("EnvironmentalEffects").
setLevel(3))
        .addMeta(new metaObject().setName("title").
setContent("bubbles.x3d"))
        .addMeta(new metaObject().setName("creator").setContent("John
Carlson"))
        .addMeta(new metaObject().setName("generator").setContent("manual"))
        .addMeta(new metaObject().setName("identifier").setContent("http:
//coderextreme.net/X3DJSONLD/bubbles.x3d"))
        .addMeta(new metaObject().setName("description").setContent("not
sure what this is")))
      .setScene(new SceneObject()
        .addChild(new NavigationInfoObject().setType(new MFStringObject(new
MFString0().getArray())))
        .addChild(new ViewpointObject().setDEF("Tour").setDescription("Tour
Views"))
        .addChild(new ViewpointObject().setPosition(new float[]
{0f,0f,4f}).setDescription("sphere in road"))
        .addChild(new BackgroundObject().setBackUrl(new MFStringObject(new
MFString1().getArray())).setBottomUrl(new MFStringObject(new
MFString2().getArray())).setFrontUrl(new MFStringObject(new
MFString3().getArray())).setLeftUrl(new MFStringObject(new
MFString4().getArray())).setRightUrl(new MFStringObject(new
MFString5().getArray())).setTopUrl(new MFStringObject(new
MFString6().getArray())))
        .addChild(new TransformObject().setDEF("Rose01")
          .addChild(new ShapeObject()
            .setGeometry(new SphereObject())
            .setAppearance(new AppearanceObject().setDEF("_01_-_Default")
              .setMaterial(new MaterialObject().setDiffuseColor(new float[]
{0.7f,0.7f,0.7f}).setSpecularColor(new float[] {0.5f,0.5f,0.5f}))
              .setTexture(new ComposedCubeMapTextureObject()
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString7().getArray())))
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString8().getArray())))
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString9().getArray())))
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString10().getArray())))
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString11().getArray())))
                .setTop(new ImageTextureObject().setUrl(new
MFStringObject(new MFString12().getArray()))))
              .addShaders(new ComposedShaderObject().setDEF(
"ComposedShader").setLanguage("GLSL")
                .addField(new fieldObject().setName("cube").
setAccessType("inputOutput").setType(fieldObject.TYPE_
SFINT32).setValue("0"))
                .addField(new fieldObject().setName("chromaticDispersion").
setAccessType("inputOutput").setType(fieldObject.TYPE_SFVEC3F).setValue("0.98
1 1.033"))
                .addField(new fieldObject().setName("bias").
setAccessType("inputOutput").setType(fieldObject.TYPE_
SFFLOAT).setValue("0.5"))
                .addField(new fieldObject().setName("scale")
.setAccessType("inputOutput").setType(fieldObject.TYPE_
SFFLOAT).setValue("0.5"))
                .addField(new fieldObject().setName("power")
.setAccessType("inputOutput").setType(fieldObject.TYPE_
SFFLOAT).setValue("2"))
                .addParts(new ShaderPartObject().setUrl(new
MFStringObject(new MFString13().getArray())).setType("VERTEX"))
                .addParts(new ShaderPartObject().setUrl(new
MFStringObject(new MFString14().getArray())).setType("FRAGMENT"))))))
        .addChild(new TimeSensorObject().setDEF("
TourTime").setCycleInterval(5).setLoop(true))
        .addChild(new PositionInterpolatorObject().
setDEF("TourPosition").setKey(new MFFloatObject(new
MFFloat15().getArray())).setKeyValue(new MFVec3fObject(new
MFVec3f16().getArray())))
        .addChild(new OrientationInterpolatorObject(
).setDEF("TourOrientation").setKey(new MFFloatObject(new
MFFloat17().getArray())).setKeyValue(new MFRotationObject(new
MFRotation18().getArray())))
        .addChild(new ScriptObject().setDEF("RandomTourTime")
          .addField(new fieldObject().setName("cycle")
.setAccessType("inputOnly").setType(fieldObject.TYPE_SFTIME))
          .addField(new fieldObject().setName("lastKey").setAccessType("
inputOutput").setType(fieldObject.TYPE_SFFLOAT).setValue("0"))
          .addField(new fieldObject().setName("
orientations").setAccessType("inputOutput").setType(
fieldObject.TYPE_MFROTATION).setValue("0 1 0 0 0 1 0 -1.57 0 1 0 3.14 0 1 0
1.57 0 1 0 0 1 0 0 -1.57 0 1 0 0 1 0 0 1.57 0 1 0 0"))
          .addField(new fieldObject().setName("positions").setAccessType("
inputOutput").setType(fieldObject.TYPE_MFVEC3F).setValue("0 0 10 -10 0 0 0
0 -10 10 0 0 0 0 10 0 10 0 0 0 10 0 -10 0 0 0 10"))
          .addField(new fieldObject().setName("position").setAccessType("
outputOnly").setType(fieldObject.TYPE_MFVEC3F))
          .addField(new fieldObject().setName("orientation").setAccessType("
outputOnly").setType(fieldObject.TYPE_MFROTATION))
          .setSourceCode("ecmascript:\n"+
"               function set_cycle(value) {\n"+
"                        //var positions = [[0, 0, 10], [-10, 0, 0], [0, 0,
-10], [10, 0, 0], [0, 0, 10], [0, 10, 0], [0, 0, 10], [0, -10, 0], [0, 0,
10]];\n"+
"                        //var orientations = [[0, 1, 0, 0], [0, 1, 0,
-1.57], [0, 1, 0, 3.14], [0, 1, 0, 1.57], [0, 1, 0, 0] [1, 0, 0, -1.57],
[0, 1, 0, 0], [1, 0, 0, 1.57], [0, 1, 0, 0]];\n"+
"                        //Browser.println(lastKey);\n"+
"                        var ov = lastKey;\n"+
"                        // Browser.println(ov);      \n"+
"                        //Browser.println(positions.length);
    \n"+
"                        do {\n"+
"                            lastKey = Math.round(Math.random()*(
positions.length-1));\n"+
"                        } while (lastKey === ov);\n"+
"                        // Browser.println(lastKey);\n"+
"                        var vc = lastKey;\n"+
"                        \n"+
"                        // Browser.println(orientations[ov]);\n"+
"                        // Browser.println(orientations[vc]);\n"+
"                        orientation = new MFRotation();\n"+
"                        orientation[0] = new SFRotation(orientations[ov][0],
orientations[ov][1], orientations[ov][2], orientations[ov][3]);\n"+
"                        orientation[1] = new SFRotation(orientations[vc][0],
orientations[vc][1], orientations[vc][2], orientations[vc][3]);\n"+
"                        // Browser.println(positions[ov]);\n"+
"                        // Browser.println(positions[vc]);\n"+
"                        position = new MFVec3f();\n"+
"                        position[0] = new SFVec3f(positions[ov][0],
positions[ov][1],positions[ov][2]);\n"+
"                        position[1] = new SFVec3f(positions[vc][0],
positions[vc][1],positions[vc][2]);\n"+
"                    // }\n"+
"               }\n"+
""))
.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
cycleTime").setToNode("RandomTourTime").setToField("cycle"))
.addChild(new ROUTEObject().setFromNode("RandomTourTime").setFromField(
"orientation").setToNode("TourOrientation").setToField("keyValue"))
.addChild(new ROUTEObject().setFromNode("RandomTourTime").setFromField(
"position").setToNode("TourPosition").setToField("keyValue"))
.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
fraction_changed").setToNode("TourOrientation").setToField("set_fraction"))
.addChild(new ROUTEObject().setFromNode("TourOrientation").
setFromField("value_changed").setToNode("Tour").setToField("orientation"))
.addChild(new ROUTEObject().setFromNode("TourTime").setFromField("
fraction_changed").setToNode("TourPosition").setToField("set_fraction"))
.addChild(new ROUTEObject().setFromNode("TourPosition").setFromField("
value_changed").setToNode("Tour").setToField("position")))      ;
    }
protected class MFString0 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"EXAMINE"});
  }
}
protected class MFString1 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_back.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_back.png"});
  }
}
protected class MFString2 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_bottom.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_bottom.png"});
  }
}
protected class MFString3 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_front.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_front.png"});
  }
}
protected class MFString4 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_left.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_left.png"});
  }
}
protected class MFString5 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_right.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_right.png"});
  }
}
protected class MFString6 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_top.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_top.png"});
  }
}
protected class MFString7 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_back.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_back.png"});
  }
}
protected class MFString8 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_bottom.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_bottom.png"});
  }
}
protected class MFString9 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_front.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_front.png"});
  }
}
protected class MFString10 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_left.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_left.png"});
  }
}
protected class MFString11 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_right.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_right.png"});
  }
}
protected class MFString12 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cubemap/all_probes/uffizi_
cross/uffizi_top.png","http://coderextreme.net/X3DJSONLD/
cubemap/all_probes/uffizi_cross/uffizi_top.png"});
  }
}
protected class MFString13 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"cobweb_bubbles.vs","http://
coderextreme.net/X3DJSONLD/cobweb_bubbles.vs"});
  }
}
protected class MFString14 {
  protected MFStringObject getArray() {
    return new MFStringObject(new String[] {"pc_bubbles.fs","http://
coderextreme.net/X3DJSONLD/pc_bubbles.fs"});
  }
}
protected class MFFloat15 {
  protected MFFloatObject getArray() {
    return new MFFloatObject(new float[] {0f,1f});
  }
}
protected class MFVec3f16 {
  protected MFVec3fObject getArray() {
    return new MFVec3fObject(new float[] {0f,0f,10f,0f,0f,-10f});
  }
}
protected class MFFloat17 {
  protected MFFloatObject getArray() {
    return new MFFloatObject(new float[] {0f,1f});
  }
}
protected class MFRotation18 {
  protected MFRotationObject getArray() {
    return new MFRotationObject(new float[] {0f,1f,0f,0f,0f,1f,0f,3.1416f});
  }
}
}

------------------------------

Subject: Digest Footer

_______________________________________________
x3d-public mailing list
x3d-public at web3d.org
http://web3d.org/mailman/listinfo/x3d-public_web3d.org


------------------------------

End of x3d-public Digest, Vol 97, Issue 82
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170423/33fe9d7c/attachment-0001.html>


More information about the x3d-public mailing list