[x3d-public] X3DJSONLD JavaScript SAI based on X3DJSAIL

John Carlson yottzumm at gmail.com
Thu Feb 29 20:06:26 PST 2024


Okay, everything is checked in now.

Here's an example GraalJS file that multiplies out HAnimHumanoid scale and
Transforms within the Humanoid (maybe more).  So far tested with
JinLOA4.js:

X3DJSONLD/src/main/graaljs/net/coderextreme/jin2.js at master ·
coderextreme/X3DJSONLD (github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/net/coderextreme/jin2.js>

X3DJSONLD/src/main/graaljs/net/coderextreme/data/JinLOA4.js at master ·
coderextreme/X3DJSONLD (github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/net/coderextreme/data/JinLOA4.js>

Scripts to test with GraalVM here:

X3DJSONLD/src/main/graaljs/jin.bat at master · coderextreme/X3DJSONLD
(github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/jin.bat>

X3DJSONLD/src/main/graaljs/jin.sh at master · coderextreme/X3DJSONLD
(github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/jin.sh>

You'll have to modify the classpaths in the script to point to right
X3DJSAIL jar.

Here's another GraalJS file that applies negations to
OrientationInterpolator keyValues, to reorient animations.

X3DJSONLD/src/main/graaljs/net/coderextreme/reorient.js at master ·
coderextreme/X3DJSONLD (github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/net/coderextreme/reorient.js>

And the shell driver which calls js.exe:

X3DJSONLD/src/main/graaljs/reorient.sh at master · coderextreme/X3DJSONLD
(github.com)
<https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/reorient.sh>

You can see how I chain JavaScript files together in the js.exe call.  This
is currently a way to transfer the scenegraph, X3D0 to the scenegraph
modification script file following it.  I guess one can chain some number
of JavaScript files in a similar way?  Obviously, one will reach a limit at
some point!

Here's one of the scripts:

C:/graaljs-community-jvm-23.1.2-windows-amd64/graaljs-community-23.1.2-windows-amd64/bin/js.exe
--experimental-options --polyglot --vm.Djs.allowAllAccess=true --vm.Xss1g
--vm.Xmx4g --jvm
--vm.classpath="C:/Users/john/pythonSAI/X3DJSAIL.4.0.full.jar;." -f
net/coderextreme/data/Gramps8Final.js -f net/coderextreme/reorient.js

--experimental-options enables the obvious.  Perhaps not needed.

--polyglot enabled JavaScript.  Perhaps not needed

--vm.Djs.allowAllAccess=true turns on getters.

 --vm.Xss1g set stack space. 1GB

--vm.Xmx4g sets heap space 4GB

--jvm look this one up yourself

--vm.classpath="C:/Users/john/pythonSAI/X3DJSAIL.4.0.full.jar;." sets the
classpath on windows.

 -f net/coderextreme/data/Gramps8Final.js -f net/coderextreme/reorient.js
these are the scripts to run

Enjoy ECMAScript SAI built on GraalJS and X3DJSAIL!

John

On Thu, Feb 29, 2024 at 8:25 PM John Carlson <yottzumm at gmail.com> wrote:

> I’ll be checking in my X3DJSONLD JavaScript SAI based on X3DJSAIL and
> GraalJS later tonight.  I left before ensuring the code was checked in.
>
> https://github.com/coderextreme/X3DJSONLD/tree/master/src/main/graaljs
>
> Here’s the primary interface file:
>
>
> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/graaljs/net/coderextreme/data/X3Dautoclass.js
>
>
> This works with GraalVM/GraalJS js.exe (found in the bin folder of the
> distribution.  If you found js.cmd, it’s old.)
>
> I will be checking in SAI code that works with example models, and shell
> and bat scripts with appropriate parameters.
>
> Note at the bottom of the examples where it writes output files.
>
> If anyone wants an updated X3DSAIL interface, let me know, but it’s easy
> to extend!
>
> Note while it’s easy to build a scene, it’s more difficult to update a
> scene!  I’ll try to get modification examples checked in soon!  I’m
> guessing the push failed due to large files or folders were not checked
> in.  Movie night!
>
>
> Primary benefits over Java:  fewer class files to manage, larger source
> code capabilities.
>
> Primary disadvantages:  slower than Java, not compatible with other
> JavaScript SAI (hopefully, we’ll address this).
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240229/5266b4f6/attachment.html>


More information about the x3d-public mailing list