<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 2/24/2016 1:57 PM, Yves Piguet
      wrote:<br>
    </div>
    <blockquote
      cite="mid:C87820C6-5CB1-4EC8-A333-D99E788695DE@gmail.com"
      type="cite">
      <pre wrap="">In the scenes I'm writing now, I find it difficult to use proto fields as parameters without scripts. So my protos often have just a script with an initialize function, without any event or route, to set some child fields with simple calculation or type adjustment. This kind of syntax would be pretty cool:</pre>
    </blockquote>
    <br>
    This seems to be more like a MACRO expansion (simple parameters and
    basic mathematical operations). Something like (using a pseudo-PHP
    syntax):<br>
    <br>
    <br>
    MACRO Pyramid ($height=SFFloat(2), $base=SFFloat(2)) {<br>
        node-definition using $height and $base with +-*/() and
    constants<br>
    }<br>
    <br>
    This would be expanded during parsing to the collection of X3D nodes
    with all operations pre-computed. It would be used something like
    (in HTML-type syntax):<br>
    <br>
    <Pyramid height='4' base='1'><br>
        <br>
    I think using inputOutput (or any variant) on that is misleading
    because (as per the example above), all of the computations are
    carried out during the initial parse and expansion. Any subsequent
    changes to those values would be controlled by what the node allows.<br>
    <br>
    <br>
    Another way to do this for geometry creation, is a file of standard
    shapes. You would change the size of these shapes by using the scale
    field of a Transform node. This is what is done for Box, Sphere,
    Cylinder, and Cone.<br>
    <br>
    <br>
    Leonard Daly<br>
    <br>
    <br>
    <br>
    <blockquote
      cite="mid:C87820C6-5CB1-4EC8-A333-D99E788695DE@gmail.com"
      type="cite">
      <pre wrap="">

PROTO Pyramid [
 inputOutput height 2
 inputOutput base 2
] {
 IndexedFaceSet {
   coord Coordinate {
     point [
       (base/2) (-height/2) (-base/2),
       (-base/2) (-height/2) (-base/2),
       (-base/2) (-height/2) 1,
       (base/2) (-height/2) (base/2),
       0 (height/2) 0
     ]
   }
   coordIndex [
     0 4 3 -1
     1 4 0 -1
     2 4 1 -1
     3 4 2 -1
     0 3 2 1 -1
   ]
 }
}

Yves

On 24 févr. 2016, at 19:02, Leonard Daly wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">I asked this before but I don't think I got any answers. This is a slight rephrase of the question to help make it clearer.

I am looking for examples of PROTOs (either internal or external) that are
1) non-trivial
2) do not use one or more Script nodes


By (1) I mean something that does something useful that is not easy to do without using a PROTO. Something like the Universal Media PROTOs (e.g., <a class="moz-txt-link-freetext" href="http://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/_pages/page02.html">http://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/_pages/page02.html</a>) provide a lot of convenience to the X3D developer, but each one just defines a Material node with specific characteristics.

A PROTO that is used repeated in a scene providing a critical feature might be an example of something that meets (1).


I am asking this to determine if it is necessary or useful to have a PROTO expander (sort-of like a MACRO). The expander would not support Script nodes. If there are no examples to this question, then it indicates that PROTOs need Script node(s). Either way, this has an impact on the design of V4.

-- 
Leonard Daly
3D Systems & Cloud Consultant
X3D Co-Chair on Sabbatical
LA ACM SIGGRAPH Chair
President, Daly Realism - Creating the Future
_______________________________________________
x3d-public mailing list
<a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>
<a class="moz-txt-link-freetext" href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>
</pre>
      </blockquote>
      <pre wrap="">

_______________________________________________
x3d-public mailing list
<a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>
<a class="moz-txt-link-freetext" href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a>

</pre>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <font class="tahoma,arial,helvetica san serif" color="#333366">
        <font size="+1"><b>Leonard Daly</b></font><br>
        3D Systems & Cloud Consultant<br>
        X3D Co-Chair on Sabbatical<br>
        LA ACM SIGGRAPH Chair<br>
        President, Daly Realism - <i>Creating the Future</i>
      </font></div>
  </body>
</html>