[x3d-public] [x3dom-users] initializing mesh in initialize()--X3DJSAIL; IFS fields with accessType initializeOnly

John Carlson yottzumm at gmail.com
Thu Jan 21 15:18:46 PST 2021


Another party suggested using set_coordIndex, which works.

Thanks!

On Thu, Jan 21, 2021 at 11:18 AM Don Brutzman <brutzman at nps.edu> wrote:

> Hi John.  The error messages you've included provide diagnostic
> information, for example,
>
> > 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'.
>
> If we look up IndexedFaceSet (IFS) in draft spec, indeed it says that
> coordIndex (and many other fields) have accessType initializeOnly - shown
> as [] rather than [in out] in the following node signature.
>
> ==================================
> 13.3.6 IndexedFaceSet
>
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/components/geometry3D.html#IndexedFaceSet
>
> IndexedFaceSet : X3DComposedGeometryNode {
>    MFInt32 [in]     set_colorIndex
>    MFInt32 [in]     set_coordIndex
>    MFInt32 [in]     set_normalIndex
>    MFInt32 [in]     set_texCoordIndex
>    MFNode  [in,out] attrib            []   [X3DVertexAttributeNode]
>    SFNode  [in,out] color             NULL [X3DColorNode]
>    SFNode  [in,out] coord             NULL [X3DCoordinateNode]
>    SFNode  [in,out] fogCoord          NULL [FogCoordinate]
>    SFNode  [in,out] metadata          NULL [X3DMetadataObject]
>    SFNode  [in,out] normal            NULL [X3DNormalNode]
>    SFNode  [in,out] texCoord          NULL [X3DTextureCoordinateNode]
>    SFBool  []       ccw               TRUE
>    MFInt32 []       colorIndex        []   [0,∞) or -1
>    SFBool  []       colorPerVertex    TRUE
>    SFBool  []       convex            TRUE
>    MFInt32 []       coordIndex        []   [0,∞) or -1
>    SFFloat []       creaseAngle       0    [0,∞)
>    MFInt32 []       normalIndex       []   [0,∞) or -1
>    SFBool  []       normalPerVertex   TRUE
>    SFBool  []       solid             TRUE
>    MFInt32 []       texCoordIndex     []   [-1,∞)
> }
> ==================================
>
> The historic reason for this restriction was concern about computational
> cost at run-time if IFS parameters change.
>
> It is certainly a worthy question now to ask whether X3D4 might relax this
> restriction and allow run-time tesselation in IFS.
>
> To accomplish such a goal in X3D3, you would probably need to have your
> Script create a new IFS and then swap that out.
>
>
> On 1/19/2021 8:24 PM, John Carlson wrote:
> >
> >
> > 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() {
> >
> >
> >
> > _______________________________________________
> > X3dom-users mailing list
> > X3dom-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/x3dom-users
>
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210121/d9f852e1/attachment.html>


More information about the x3d-public mailing list