<html><head></head><body>John,<br>
<br>
I'm just looking for a way to update an x3d scene using an x3djson external file (or stream). So, the inline approach is convenient.<br>
<br>
Should I update a main and unique x3d json structure, and update my whole scene reloading the x3d json data?<br>
<br>
Could I exploit the inline feature with your x3djdon loader?<br>
<br>
Or maybe you can suggest me something else?<br>
<br>
Clement.<br>
<br><br><div class="gmail_quote">Le 21 mars 2016 01:37:51 UTC+01:00, John Carlson <yottzumm@gmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Try this (untested):<br /><br />function loadSubscene(selector, url) {<br /> $.getJSON(url, function(json) {<br /> ConvertToX3DOM(json, "", document.querySelector(selector), url);<br /> }).fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus + ' ' + errorThrown); });<br /> }<br /><br />loadSubscene("#mainGroup", "earth.json”);<br /><br />You may need to do a x3dom.reload(); but I doubt it.<br /><br />This may become final API, depending on whether I want to handle multiple returns from querySelector, and whether I want to introduce a dependency on ajax/jquery (I don’t). It will probably appear in a utilities library and not be core. I may need it for core to do inlines.<br /><br /><br />What do people think about this approach to building a scene? It may work, but it seems a bit too imperative. Obviously, I need to support JSON inlines it looks like. I am not
sure about synchronous Ajax though. Do inlines require a DEF?<br /><br />John<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> On Mar 20, 2016, at 7:46 PM, Clement IGONET <clement@igonet.fr> wrote:<br /> <br /> Hi John.<br /> <br /> I'm trying to load a main scene and then, to add some components...<br /> <br /> The main scene:<br /> {<br /> "X3D": {<br /> "@showstat": true,<br /> "@showlog": true,<br /> "@version": "3.0",<br /> "@profile": "Immersive",<br /> "@xmlns:xsd": "<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>",<br /> "@xsd:noNamespaceSchemaLocation":<br /> "<a href="http://www.web3d.org/specifications/x3d-3.0.xsd">http://www.web3d.org/specifications/x3d-3.0.xsd</a>",<br /> "Scene": {<br /> "-children": [{<br /> "NavigationInfo": {<br />
"@type": ["turntable", "fly"],<br /> "@transitionTime": 5<br /> }<br /> }, {<br /> "Background": {<br /> "@groundColor": [0.1, 0.1, 0.8],<br /> "@skyColor": [0.1, 0.1, 0.8]<br /> }<br /> }, {<br /> "GeoViewpoint": {<br /> "@id": "myGeoViewpoint",<br /> "@description": "Initial GeoViewpoint",<br /> "@orientation": [1, 0, 0, -1.57],<br /> "@position": [35.0, 70.0, 30000000]<br /> }<br /> }, {<br /> "Group": {<br /> "@id": "mainGroup",<br /> "@class": "earthPart"<br /> }<br /> }]<br /> }<br /> }<br /> }<br /> <br /> And the element I'd like to add to Group "mainGroup" a json called<br /> "earth.json" containing:<br /> [{<br /> "Shape": {<br />
"-appearance": [{<br /> "Appearance": {<br /> "-texture": [{<br /> "ImageTexture": {<br /> "@url": "images/earth_big_00.png"<br /> }<br /> }]<br /> }<br /> }],<br /> "-geometry": {<br /> "GeoElevationGrid": {<br /> "@geoGridOrigin": [0, -180, 0],<br /> "@height": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br /> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],<br /> "@xDimension": 11,<br /> "@xSpacing": 18,<br /> "@yScale": 200,<br /> "@zDimension": 6,<br /> "@zSpacing": 18<br /> }<br /> }<br /> }<br /> }<br /> <br /> So, I tried to load this laste earth.json with this code:<br /> loadX3DJSON(<br /> '#mainGroup',<br /> 'earth.json'<br /> );<br /> <br /> Unfortunatly, it does not load anything.<br /> Could you help me ?<br /> <br /> Clément.<br /></blockquote><br /></pre></blockquote></div><br>
clement@igonet.fr</body></html>