[x3d-public] [x3dom-users] initializing mesh in initialize()--X3DJSAIL; IFS fields with accessType initializeOnly
John Carlson
yottzumm at gmail.com
Thu Jan 21 18:22:41 PST 2021
Perhaps we could add a SFBool field to ROUTE, "runOnce" which would
achieve the results I want.
I will file a report.
John
On 1/21/21 8:08 PM, John Carlson wrote:
> I was stumbling over this for quite a while. flowers2.x3d was not
> displaying in X_ITE, but was in X3DOM, when it had before. Thanks for
> X3DJSAIL for reporting these, we finally tracked down many warnings
> (not only coordIndex) in my regression test suite, so I am more
> confident about my data files!
>
> The point is, I don't want to change my set_coordIndex once it's been
> set up--I only want to modify coordinates. I want to achieve as much
> speed as I can, so doing a ROUTE at initialization might be
> appropriate for me. What I think I should do is delete the ROUTE or
> the script field, perhaps?
>
> Is there a portable way to delete ROUTEs?
>
> John
>
> On 1/21/21 7:16 PM, Don Brutzman wrote:
>> Yes I completely overlooked that, good call. The set_* fields lets
>> an author change many things.
>>
>> The rationale for this approach is that browsers might do geometry
>> decimation and not want to send gigantic piles of values at output
>> events. Seems smart to keep it like that.
>>
>> Still wondering if convex field (for single- or double-sided
>> rendering) and perhaps other boolean fields could be modifiable.
>> Useful animation techniques.
>>
>>
>>
>> On 1/21/2021 3:18 PM, John Carlson wrote:
>>>
>>> Another party suggested using set_coordIndex, which works.
>>>
>>> Thanks!
>>>
>>> On Thu, Jan 21, 2021 at 11:18 AM Don Brutzman <brutzman at nps.edu
>>> <mailto: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
>>> <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
>>> <mailto:X3dom-users at lists.sourceforge.net>
>>> > https://lists.sourceforge.net/lists/listinfo/x3dom-users
>>> <https://lists.sourceforge.net/lists/listinfo/x3dom-users>
>>>
>>> all the best, Don
>>> -- Don Brutzman Naval Postgraduate School, Code USW/Br
>>> brutzman at nps.edu <mailto: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 <http://faculty.nps.edu/brutzman>
>>>
>>
>> all the best, Don
More information about the x3d-public
mailing list