[x3d-public] initializing mesh in initialize()--X3DJSAIL

John Carlson yottzumm at gmail.com
Tue Jan 19 20:24:41 PST 2021


I am initializing a mesh in initialize() and I get this error when 
running a Nashorn X3DJSAIL program.   How can express this better? It's 
a 100x100 grid mesh and I don't want to chew up web transfer time.   Can 
I use subdivision in X3DOM?  What tag should I use?  I think what I want 
is GeoElevationGrid, but I don't know if I can update coordinates in 
that.  Perhaps I should dig in to it a bit.    What I think I want is a 
SphereGrid of coordindexes (unless height can be negative in 
GeoElevationGrid)--Below sea level. I'm planning for the height < -radius.

Thanks,

John

org.web3d.x3d.sai.InvalidFieldValueException: ROUTE details: FROM 
OrbitScript.coordIndexes [Script,MFInt32,outputOnly] TO Orbit.coordIndex 
[IndexedFaceSet,MFInt32,initializeOnly]
  ROUTE toField (destination) event can only have 
accessType='inputOutput' or accessType='inputOnly'.
org.web3d.x3d.sai.InvalidFieldValueException: ROUTE details: FROM 
OrbitScript.coordIndexes [Script,MFInt32,outputOnly] TO Orbit.coordIndex 
[IndexedFaceSet,MFInt32,initializeOnly]
  ROUTE toField (destination) event can only have 
accessType='inputOutput' or accessType='inputOnly'.


Sample code:

                             <Script DEF="OrbitScript">
                                 <field accessType="inputOnly" 
name="set_fraction" type="SFFloat"/>
                                 <field accessType="outputOnly" 
name="coordinates" type="MFVec3f"/>
                                 <field accessType="outputOnly" 
name="coordIndexes" type="MFInt32"/>
                                 <field accessType="inputOutput" 
name="e" type="SFFloat" value="5"/>
                                 <field accessType="inputOutput" 
name="f" type="SFFloat" value="5"/>
                                 <field accessType="inputOutput" 
name="g" type="SFFloat" value="5"/>
                                 <field accessType="inputOutput" 
name="h" type="SFFloat" value="5"/>
                                 <field accessType="inputOutput" 
name="resolution" type="SFInt32" value="50"/>
                         <![CDATA[
                         ecmascript:

                         var e = 5;
                         var f = 5;
                         var g = 5;
                         var h = 5;
                         var resolution = 100;

                         function initialize() {
                              generateCoordinates();
                              var localci = [];
                              for (var i = 0; i < resolution-1; i++) {
                                 for (var j = 0; j < resolution-1; j++) {
                                      localci.push(i*resolution+j);
localci.push(i*resolution+j+1);
localci.push((i+1)*resolution+j+1);
localci.push((i+1)*resolution+j);
                                      localci.push(-1);
                                 }
                             }
                             coordIndexes = new MFInt32(localci);
                         }

                         function generateCoordinates() {




More information about the x3d-public mailing list