[x3d-public] ECMAScript

Michalis Kamburelis michalis.kambi at gmail.com
Mon Aug 7 08:08:28 PDT 2023


Our CastleScript is indeed a poorer solution than ECMAScript. And
indeed it's not portable. I don't pretend CastleScript is better than
ECMAScript (it's not) -- but just point that, as of today, this is
what we have. Many simple ECMAScript usage cases can be expressed as
CastleScript.

As said, I'd like to add ECMAScript support at some point, however
time is limited. We support what our users really need, our roadmap is
public on our website.

As for external scripting -- it is a different way of operating and
thinking. The whole API of Castle Game Engine is documented on our
website, it's a big thing independent from X3D SAI. We're looking at
other game engines (like Unity, Unreal, Godot) and what game
developers need. You're welcome to read our manual :)

" I don't want to generate tex stuff for an IFS, even if the spec says
i should. "

-- that seems offtopic here, and also I recall the resolution of that
thread was simple: in some of your test models, you don't provide
enough texture coordinates. I don't recall any CGE/view3dscene bug in
this regard. Please don't add offtopic notes like that, it's hard to
understand what you refer to and address. If you believe there's a bug
in view3dcene/CGE, in that we fail to process some valid X3D content,
you're welcome to submit a bugeport
https://github.com/castle-engine/view3dscene/issues .

"HAnimDisplacer? "

This is again offtopic, and we talked about it. Yes, it's just a
missing feature of view3dcene/CGE. Again, our time is limited, we
don't support it yet.

If any authoring tool will appear that actually generates X3D models
with HAnimDisplacer node (better yet, if that authoring tool would be
popular, like Blender), that would certainly bump our priority to
support this node.

Regards,
Michalis

pon., 7 sie 2023 o 16:48 Joe D Williams <joedwil at earthlink.net> napisał(a):
>
> well, all you have to say is that sorry, I don't support x3d Script node. I've got my own stuff, nana
> This is the same as somebody saying we still like the old EAI and don't want to change to SAI.
> Or. I like the old vrmlscript and don't want change to ecmascript.
> Also same as no, I don't want to generate tex stuff for an IFS, even if the spec says i should.
> HAnimDisplacer?
>
> > So executing scripts within the models is not a commonly needed feature.
>
> How about showing some examples of an external script doing something that could not be done better by internal script, or by internal x3d node? Does this external script operate anything like the x3d SAI?
>
> A commonly needed feature of x3d is portable between tools.
>
> Good Luck,
> Joe
>
> -----Original Message-----
> From: Michalis Kamburelis <michalis.kambi at gmail.com>
> Sent: Aug 7, 2023 6:40 AM
> To: Joseph D Williams <joedwil at earthlink.net>
> Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: Re: [x3d-public] ECMAScript
>
> Indeed, view3dscene / Castle Game Engine is missing ECMAScript.
>
> It is on the roadmap, and certainly possible to do. We could use
> Duktape like FreeWRL; or other JS engines -- whatever is lightweight
> to execute and easy to maintain.
>
> But admittedly implementing JS scripting is not high priority in our
> case. Reason: most of CGE users do programming "outside" of X3D, using
> Castle Game Engine API to manipulate scenes (and X3D nodes too). This
> API is available from Pascal, we think about extending to other
> languages (Python) in the future too. In most cases, people want to
> treat model formats like X3D or glTF (or anything else) as just
> carriers of information between 3D authoring tool and CGE. So
> executing scripts within the models is not a commonly needed feature.
>
> As a solution for now: We support CastleScript, a really simple (very
> simple, much more limited than JS) language for simple things. See
> https://castle-engine.io/castle_script.php . It can express the
> operation you do in your samples :) And in X3D "Script" node, you can
> specify a few alternatives, so you could have both ecmascript and
> castlescript versions for cross-browser support. If you want to
> pursue this option, the "OrientationData" node would look like this:
>
> -----------
> #X3D V3.2 utf8
> PROFILE Interchange
>
> DEF OrientationData Script {
> outputOnly MFString orientation
> inputOnly SFRotation printOrientation
> initializeOnly SFString sep ", "
> url [
> "ecmascript:
> function printOrientation (value,ts) {
> var x = Math.round(value.x*100)/100;
> var y = Math.round(value.y*100)/100;
> var z = Math.round(value.z*100)/100;
> var angle = Math.round(value.angle*100)/100;
> orientation = new MFString ( x + sep + y + sep + z + sep + angle );
> }
> "
> "castlescript:
> function foo(value,ts)
> { Note that we have to hardcode sep value (comma) below, due to
> CastleScript limitations. }
> orientation :=
> string(round(vector_get(value, 0) * 100) / 100) + ',' +
> string(round(vector_get(value, 1) * 100) / 100) + ',' +
> string(round(vector_get(value, 2) * 100) / 100) + ',' +
> string(round(vector_get(value, 3) * 100) / 100) + ','
> "
> ]
> }
> -----------
>
> Regards,
> Michalis
>
> niedz., 6 sie 2023 o 22:31 Joseph D Williams napisał(a):
> >
> >
> >
> > Hi, view3dscene, missing ECMAScript.
> >
> > Near implementation?
> >
> > All I need is some basic stuff. :
> >
> >
> >
> > DEF PositionData Script {
> >
> > outputOnly MFString position
> >
> > inputOnly SFVec3f printPosition
> >
> > initializeOnly SFString sep ", "
> >
> > url "ecmascript:
> >
> > function printPosition (value,ts) {
> >
> > var x = Math.round(value.x*100)/100; // simple 2 decimal digits
> >
> > var y = Math.round(value.y*100)/100;
> >
> > var z = Math.round(value.z*100)/100;
> >
> > position = new MFString ( x + sep + y + sep + z );
> >
> > }
> >
> > "
> >
> > }
> >
> >
> >
> > DEF OrientationData Script {
> >
> > outputOnly MFString orientation
> >
> > inputOnly SFRotation printOrientation
> >
> > initializeOnly SFString sep ", "
> >
> > url "ecmascript:
> >
> > function printOrientation (value,ts) {
> >
> > var x = Math.round(value.x*100)/100;
> >
> > var y = Math.round(value.y*100)/100;
> >
> > var z = Math.round(value.z*100)/100;
> >
> > var angle = Math.round(value.angle*100)/100;
> >
> > orientation = new MFString ( x + sep + y + sep + z + sep + angle );
> >
> > }
> >
> > "
> >
> > }
> >
> >
> >
> > Thanks,
> >
> > Joe
> >
> > _______________________________________________
> > x3d-public mailing list
> > x3d-public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>



More information about the x3d-public mailing list