[x3d-public] Type-checking progress on ES6 server-side SAI.

John Carlson yottzumm at gmail.com
Mon Jul 13 17:33:42 PDT 2020


I don't think that this SAI is like anyone else's.  That's an issue. Here's
a sample that is currenting producing pretty good XML (missing X3D element
attributes, I know).

The main feature I've added is parameter type-checking.

That helps a lot, but requires addition of shim field objects.

Suggestions on how to remove shim objects welcome.  My guess is mixins, but
I've never done mixins.

John
============================================
"use strict"

import fs from 'fs'

import { meta, head, Scene, X3D,  Transform, Group, Material, Shape, Box,
Appearance } from './x3d.js';
import { MFNode, SFColor, SFVec3f, SFString, SFNode, SFRotation } from
'./x3d.js';


var x3d = new X3D({
        head : new SFNode(new head({
                meta : new MFNode([
                        new meta({
                                name : new SFString("John W"),
                                content : new SFString("Carlson, I")
                        }),
                        new meta({
                                name : new SFString("John A"),
                                content : new SFString("Carlson, II")
                        }),
                        new meta({
                                name : new SFString("John R"),
                                content : new SFString("Carlson, III")
                        })
                ])
        })),
        Scene : new SFNode(new Scene({
                children : new MFNode([
                        new Shape({
                                appearance : new SFNode(new Appearance({
                                        material : new SFNode(new Material({
                                                diffuseColor : new
SFColor([1, 0, 0])
                                        }))
                                })),
                                geometry : new SFNode(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());

==========================================

The x3d.js ES6 library is required:

https://github.com/coderextreme/es6x3d/blob/master/x3d.js

(download it)

Maybe someone can suggest how to serve this file from github in the above
app.

Thanks,

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200713/520fac66/attachment.html>


More information about the x3d-public mailing list