[x3d-public] Feedback? Headed in right direction with ES6 SAI?

John Carlson yottzumm at gmail.com
Sun May 3 20:12:16 PDT 2020


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/20200503/548cdbe4/attachment.html>


More information about the x3d-public mailing list