[x3d-public] Note: new effort to construct ES6 SAI

John Carlson yottzumm at gmail.com
Wed May 6 07:56:12 PDT 2020


Note:  I do not implement any Browser functions at this time.

Requests for features welcome!

John

On Sun, May 3, 2020 at 10:12 PM John Carlson <yottzumm at gmail.com> wrote:

> Below I am wondering if I am heading in the right direction
> with an ES6 SAI.  Obviously, I could replace various arrays with
> addChildren() and other various addFoo(), which the library supports.
>
> What do you think?  Can someone provide an example that they would like?
>
> John
> -------------------------------------------------------------------
>
> $  cat app.mjs
> "use strict"
>
> import X3D from './x3d.mjs';
> import { head, meta, Scene, Transform, Group, Material, Shape, Box,
> Appearance } from './x3d.mjs';
> import { MFNode, SFColor, SFVec3f, SFRotation } from './x3d.mjs';
>
> var x3d = new X3D({
>         head : new head({
>                 meta : [
>                         new meta({
>                                 name : "John W",
>                                 content : "Carlson, I"
>                         }),
>                         new meta({
>                                 name : "John A",
>                                 content : "Carlson, II"
>                         }),
>                         new meta({
>                                 name : "John R",
>                                 content : "Carlson, III"
>                         })
>                 ]
>         }),
>         Scene : new Scene({
>                 children : new MFNode([
>                         new Group({
>                                 children : new MFNode([
>                                         new Shape({
>                                                 appearance : new
> Appearance({
>                                                         material : new
> Material({
>
> diffuseColor : new SFColor([1, 0, 0])
>                                                         })
>                                                 }),
>                                                 geometry : new Box()
>                                         })
>                                 ])
>                         }),
>                         new Transform({
>                                 translation : new SFVec3f([1, 2, 3]),
>                                 scale: new SFVec3f([4, 5, 6]),
>                                 rotation: new SFRotation([7, 8, 9, 3.14])
>                         })
>                 ])
>         })
> })
>
> console.log(x3d.toXMLNode());
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200506/5f86cc7c/attachment.html>


More information about the x3d-public mailing list