<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;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        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;
        margin-bottom:.0001pt;
        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:1242908567;
        mso-list-type:hybrid;
        mso-list-template-ids:1351003108 -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"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><ul style='margin-top:0in' type=disc><li class=MsoListParagraph style='margin-left:0in;mso-list:l0 level1 lfo1'>A conceptual scene graph structure may look like this:<o:p></o:p></li></ul><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>group1<o:p></o:p></p><p class=MsoNormal>  node 1: DEF "original"<o:p></o:p></p><p class=MsoNormal>group2<o:p></o:p></p><p class=MsoNormal>  node 2: USE "original"</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>then if you want to specifically identify between node 1 and node 2, don’t do that. In this, node 1 and node 2 are the same node with no way to distinguish between the two or method to make them different. Nor should there be. To be different, they must be not the same. </p><p class=MsoNormal>Thanks, </p><p class=MsoNormal>Joe <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</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:andreasplesch@gmail.com">Andreas Plesch</a><br><b>Sent: </b>Wednesday, December 20, 2017 11:18 AM<br><b>To: </b><a href="mailto:michalis.kambi@gmail.com">Michalis Kamburelis</a><br><b>Cc: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a><br><b>Subject: </b>Re: [x3d-public] review of various X3D statement implementationsfor X3DOM</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi Michalis,</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>yes, that is how DEF/USE should be implemented. The point I am trying</p><p class=MsoNormal>to understand is if there is absolutely no distinction between the</p><p class=MsoNormal>original DEF node and a USE node which references the DEF node, how</p><p class=MsoNormal>can the USE node be identified, for example during picking ? The USE</p><p class=MsoNormal>node still needs to have at least a distinct ID, right ?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>A conceptual scene graph structure may look like this:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>group1</p><p class=MsoNormal>  node 1: DEF "original"</p><p class=MsoNormal>group2</p><p class=MsoNormal>  node 2: USE "original"</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>There are still two nodes. node 2 is not a copy of node 1 but is still</p><p class=MsoNormal>a separate node which happens to reference node 1.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Or</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>group1</p><p class=MsoNormal> node 1: DEF "orginal"</p><p class=MsoNormal>group2</p><p class=MsoNormal> node 1 (inserted a second time during scene graph construction)</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Closer to spec. but makes it hard (impossible?) to distinguish the two</p><p class=MsoNormal>node 1 instances from each other.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So I was thinking something like an additional ID may have to exist:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>1. group1</p><p class=MsoNormal>2.  node 1: DEF "orginal"</p><p class=MsoNormal>3. group2</p><p class=MsoNormal>4.  node 1 (inserted during scene graph construction)</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>-Andreas</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On Wed, Dec 20, 2017 at 11:03 AM, Michalis Kamburelis</p><p class=MsoNormal><michalis.kambi@gmail.com> wrote:</p><p class=MsoNormal>> 2017-12-20 15:51 GMT+01:00 Andreas Plesch <andreasplesch@gmail.com>:</p><p class=MsoNormal>>> (DEF/USE in x3dom: There are a several x3dom issues about picking a</p><p class=MsoNormal>>> USE Shape. Since x3dom literally places the referenced DEF Shape in</p><p class=MsoNormal>>> the scene graph, the picking actually reports the node of the</p><p class=MsoNormal>>> referenced DEF Shape when the USE Shape is picked. This is because</p><p class=MsoNormal>>> x3dom actually does not keep a distinct representation of the USE node</p><p class=MsoNormal>>> at all. Except for the fact that the DEF node now has two parents.</p><p class=MsoNormal>>> This may be too literal an interpretation of the DEF/USE concept, and</p><p class=MsoNormal>>> I wonder if in the spec. there is a section which explains how the</p><p class=MsoNormal>>> node which has a USE reference is still a distinct node. I suspect</p><p class=MsoNormal>>> that keeping such a distinct node around is how most x3d browsers work</p><p class=MsoNormal>>> ?</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> This DEF / USE (in x3dom) treatment is required by the X3D</p><p class=MsoNormal>> specification, and it (should) be the same in all VRML / X3D browsers.</p><p class=MsoNormal>> I know it is the same in view3dscene and Castle Game Engine. When we</p><p class=MsoNormal>> encounter a "USE Xxx" then internally we *do not* make a copy of the</p><p class=MsoNormal>> "Xxx" node, instead we make an additional link to the "Xxx" node that</p><p class=MsoNormal>> in effect has 2 parents. This implementation is most natural and</p><p class=MsoNormal>> practically required by the X3D specification:</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> http://www.web3d.org/documents/specifications/19775-1/V3.2/Part01/concepts.html#DEFL_USESemantics</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> """</p><p class=MsoNormal>> The USE statement does not create a copy of the node. Instead, the</p><p class=MsoNormal>> same node is inserted into the scene graph a second time, resulting in</p><p class=MsoNormal>> the node having multiple parents (see 4.3.5 Transformation hierarchy,</p><p class=MsoNormal>> for restrictions on self-referential nodes).</p><p class=MsoNormal>> """</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> And that's a very good concept, in my opinion: it allows to use DEF /</p><p class=MsoNormal>> USE mechanism for various optimizations. Since you have only one copy</p><p class=MsoNormal>> of the node, you should also be able to have only one copy of various</p><p class=MsoNormal>> internal things (like OpenGL VBO data) associated e.g. with Shape that</p><p class=MsoNormal>> is USEd multiple times. This is really powerful, you can construct a</p><p class=MsoNormal>> large scene by USEing the same shapes multiple times, and it will</p><p class=MsoNormal>> still render fast and not eat too much memory:)</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> In contrast, expanding the PROTOtypes makes a copy on the contents.</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>> Regards,</p><p class=MsoNormal>> Michalis</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>-- </p><p class=MsoNormal>Andreas Plesch</p><p class=MsoNormal>Waltham, MA 02453</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>_______________________________________________</p><p class=MsoNormal>x3d-public mailing list</p><p class=MsoNormal>x3d-public@web3d.org</p><p class=MsoNormal>http://web3d.org/mailman/listinfo/x3d-public_web3d.org</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>