[x3d-public] Ways to use X3D JSON SAI today! Become a beta tester!

John Carlson yottzumm at gmail.com
Thu Jun 28 14:44:55 PDT 2018


Here’s my “working” test site, for those who doubt 😊!

https://coderextreme.net/X3DJSONLD/src/main/html/prototypes.html

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Thursday, June 28, 2018 5:30 PM
To: X3D Graphics public mailing list; X3D Design Printing and Scanning working group; christophe.mouton at edf.fr; Vincent Marchetti; Vincent Marchetti; Don Brutzman
Subject: Ways to use X3D JSON SAI today! Become a beta tester!

Include https://www.x3dom.org/download/dev/x3dom-full.js.  See documentation on x3dom.Runtime.prototype.createX3DFromJS and x3dom.Runtime.prototype.replaceWorld

Generally, this is done like the following for X3DOM:

var doc = document.querySelector(selector);
if (doc.hasRuntime && doc.runtime.ready) {
                            var x3d = doc.runtime.createX3DFromJS(jsobj, optionalURL)
                            if (x3d != null) {
                                    try {
                                        doc.runtime.replaceWorld(x3d);
                                    } catch (e) {
                                            console.error(e);
                                            alert(e);
                                    }
                            } else {
                                    x3dom.debug.logError("createX3DFromJS: could not fetch or parse " + jsobj);
                            }
}
Include https://cdn.rawgit.com/create3000/x_ite/4.2.2/dist/x_ite.min.js


Then call Browser.importJS and Browser.replaceWorld, for X_ITE, like:

        X3D(function() {
                if (typeof X3D.getBrowser !== 'undefined') {
                        var browser = X3D.getBrowser(selector);
                        if (typeof browser !== 'undefined' && typeof browser.importJS !== 'undefined') {
                                var importedScene = browser.importJS(jsobj);
                                browser.replaceWorld(importedScene);
                        }
                }
        }, function() {
                alert("Failed to render JSON to X_ITE");
        });

While this is close to a common interface, it’s not quite there yet. And if X3DOM and X_ITE are running in the same application, they need to be distinguished somehow.

Note, these have not been tested extensively in current versions, so if you try them and they don’t work, file a bug!  I will be testing them RSN. Join me!

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180628/dd2d28ae/attachment-0001.html>


More information about the x3d-public mailing list