<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1273443034;
        mso-list-type:hybrid;
        mso-list-template-ids:838212132 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:\F0D8;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style></head><body lang=EN-US link=blue vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><ul style='margin-top:0in' type=disc><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>Shape { url='library.gltf#name }</li></ul><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Great, just so amazing that it looks so direct to import, a set of data. The critical part is that this needs to be carefully defined. This can be used only where it can be shown that the gltf file contains only data exactly equivalent to the content defined by the x3d standard for some Shape. Why not more like:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><IndexedFaceSet DEF='sternum_Geo' url='library.gltf#joe_sternum’ /></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>That would be easier to map the named fields from the gltf file to the equivalent fields of an x3d node in x3d user code. In the end the standard will (I think) have to state that x3d can use certain ‘standard’ json-encoded gltf files that conform to Standard gltf JSON-Schema documentation. And, importantly, defining which of the gltf named fields are used directly, or converted, to construct the equivalent x3d nodes and fields. </p><p class=MsoNormal>Even better, in terms of validation, by requiring the naming of the top level gltf asset schema directly. For example </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><IndexedFaceSet DEF='sternum_Geo' url='node.library.gltf#joe_sternum’ /></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So in this case it could be verified that the gltf node asset contains specific data to produce the IFS. </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Is it possible to deal with how to for general use author-defined json-encoded files for any field of any node?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><IndexedFaceSet DEF='sternum_Geo' … <o:p></o:p></p><p class=MsoNormal>   <Coordinate DEF='lfemur_Coord' point=”url-<o:p></o:p></p><p class=MsoNormal>url=’point.json’ <o:p></o:p></p><p class=MsoNormal>,,, /><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks for these breakthrough implementation steps for using gltf standard stuffs in x3d.</p><p class=MsoNormal>Joe</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:gpugroup@gmail.com">GPU Group</a><br><b>Sent: </b>Tuesday, April 5, 2022 7:45 AM<br><b>To: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a><br><b>Subject: </b>Re: [x3d-public] Using IMPORT / EXPORT to selectively include partsof glTF file in X3D, and multiply them as much as necessary</p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Looks good - I like it. -Doug</p><div><p class=MsoNormal>(PS the ExternProto was an analogy. The syntax looks like this:</p></div><div><p class=MsoNormal>Shape { url='library.gltf#name }</p></div><div><p class=MsoNormal>)</p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Mon, Apr 4, 2022 at 8:23 PM Michalis Kamburelis <<a href="mailto:michalis.kambi@gmail.com">michalis.kambi@gmail.com</a>> wrote:</p></div></div><p class=MsoNormal style='margin-left:4.8pt'>( No real avocados were hurt while generating screenshots for this email :) )<br><br>I started to write an answer to Doug email "Other ways to use gltf ><br>like ExternProto" and then I realized that I just pursue a different<br>approach, so I may as well create a new thread. The goal is similar:<br>how to get *part* of glTF scene into X3D file? But here I decided to<br>do it using IMPORT / EXPORT + Inline, not ExternProto.<br><br>I thought that IMPORT / EXPORT may be nice, as IMPORT / EXPORT have an<br>explicit purpose "make something available to the outer scene".<br><br>So I tried how far can I take it. And  implemented it in<br>CGE/view3dscene, and made demos :) You can now use IMPORT / EXPORT to<br>selectively take (and reuse as many times as you wish) parts of inner<br>glTF models inside outer X3D file.<br><br>1. Older demo: I have already used this approach for animations in<br>glTF in CGE/view3dsdcene, i.e. I export them from glTF and you can<br>IMPORT and control them. See<br><a href="https://github.com/castle-engine/demo-models/tree/master/blender/skinned_animation" target="_blank">https://github.com/castle-engine/demo-models/tree/master/blender/skinned_animation</a><br>, file skinned_anim_run_animations_from_x3d.x3dv does<br><br>"""<br>DEF InlinedAnimations Inline {<br>   url "skinned_anim.glb"<br>}<br>IMPORT InlinedAnimations.jump AS jump<br>IMPORT InlinedAnimations.walk AS walk<br>"""<br><br>and then it can start  animations jump, walk. They are just TimeSensor<br>nodes in X3D. I can ROUTE events to them.<br><br>2. I have now extended this approach to glTF materials (X3D Appearance<br>nodes) and transformation groups and cameras (X3D Viewpoint /<br>OrthoViewpoint nodes). I can export anything named from glTF this way.<br><br>See <a href="https://github.com/michaliskambi/x3d-tests/tree/master/gltf/avocado_and_exports" target="_blank">https://github.com/michaliskambi/x3d-tests/tree/master/gltf/avocado_and_exports</a><br>and attached screenshot with scene that can reuse Avocado appearance,<br>or transformation, or mesh.<br><br>It looks like this:<br><br>"""<br>Switch {<br>  children DEF InlinedAvocado Inline {<br>    url "glTF/Avocado.gltf"<br>  }<br>}<br>IMPORT InlinedAvocado.Avocado_2 AS AvocadoMeshes<br>IMPORT InlinedAvocado.CastleEncoded_2256_Avocado_d AS AvocadoAppearance<br>IMPORT InlinedAvocado.Avocado AS AvocadoTransform<br><br>Shape {<br>  appearance USE AvocadoAppearance<br>  geometry IndexedFaceSet { ... }<br>}<br>...<br>"""<br><br>3. Why IMPORT / EXPORT? I felt this way there's less extra concepts.<br><br>  A. Do not want to see original glTF? Then place "Inline" inside "Switch".<br><br>  B. Writing "IMPORT" is simpler than ExternProto, no need to repeat<br>the node declaration.<br><br>4. To make this work:<br><br>  A. The browser must make sure to generate EXPORT for all named<br>things when importing glTF file.<br><br>  B. The browser must be more tolerant for USE clauses than spec.<br><br>    X3D spec says (<br><a href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/networking.html#IMPORTStatement" target="_blank">https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/networking.html#IMPORTStatement</a><br>) """Nodes imported into an X3D scene using the IMPORT statement may<br>not be instanced via the USE statement. """. I decided to ignore this<br>limit now in CGE/view3dscene, you can reUSE nodes you get with IMPORT.<br><br>    There seems to be no drawback from this. We only resolve USE<br>looking at IMPORTed names if the name cannot be found in non-imported<br>nodes. And it makes IMPORT / EXPORT much more powerful, also for<br>X3D<->X3D interaction.<br><br>5. Note: I'm not really trying to make a case that "IMPORT / EXPORT is<br>a better approach than ExternProto". They both seem reasonable<br>approaches. I just decided to test IMPORT / EXPORT approach to the<br>fullest, and I dabbled with it already in the demo with<br>skinned_anim_run_animations_from_x3d.x3dv .<br><br>Regards,<br>Michalis<br>_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>