[x3d-public] PROTO Usefulness Question

Yves Piguet yves.piguet at gmail.com
Wed Feb 24 13:57:33 PST 2016


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:

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:

> 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., http://www.web3d.org/x3d/content/examples/Basic/UniversalMediaMaterials/_pages/page02.html) 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
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org




More information about the x3d-public mailing list