[x3d-public] Dynamic PROTOs [was: Modifying HTML5 and X3DOM attributes. Templating]

Leonard Daly web3d at realism.com
Sun Feb 7 19:32:44 PST 2016


John,

> If we can figure out how to hook up Proto’s with HTML5 script, perhaps 
> through a class attribute or other attribute, that might work.  I 
> agree that converting ecmascript to JavaScript is not an idea 
> solution, and solutions already exist for VRMLscript (Cobweb). I am 
> not that familiar with Inline, i will have to investigate more.

Inline is like reading the external file and sticking it in the existing 
X3D code stream. There are other name-scope items to manage, but that is 
the basic idea.


> Can you show me how to model a graph with 4 nodes and 3 edges with 
> HTML5 and Inline? (pseudocode is fine).  Then scale it to 200 nodes 
> and 199 edges without much typing (a loop or two is fine)?  I would 
> need to know how to keep the node positions up to date with the edge 
> end positions in particular. I am working on converting the X3D JSON 
> Schema to an X3D diagram.  I would use Protos, but they are not 
> available on the web.  I did not say this was simple, and I can help 
> with X3D examples that I have created.

Does each entry consist of a node object (perhaps depicted as a sphere) 
and N connection objects/edges (perhaps depicted as cylinders)?

A node and its connections need to be inserted into the scene (perhaps 
on-demand). One end of each connection is the node, and the other end is 
specified as some other node. So the inputs are the node information 
(including position) and N other nodes. This requires the creation of 
N+1 geometric objects, One is placed at the location provided, and the 
other N connect the new object to existing other nodes.

In X3DOM, the object creation is easy by adding the appropriate Shape 
structure to a Transform node in the DOM (addChild). It would be 
necessary to obtain the global coordinates for each of the N remote 
objects to be able to construct a connection object between the two. I 
would need to research how to do this in X3DOM, but I have seen the 
methods that return the coordinate in absolute space.

The work could be done in JavaScript and X3DOM as it exists now. I am 
not sure this is appropriate for a standard. Perhaps a best-practices or 
tutorial document that describes how to do this. It might be for this 
case to use sprintf.js and a format string with placeholders for the 
replacements. https://github.com/alexei/sprintf.js


Leonard Daly




>
> John
>> On Feb 5, 2016, at 7:37 PM, Leonard Daly <web3d at realism.com 
>> <mailto:web3d at realism.com>> wrote:
>>
>> John,
>>
>>> So there’s a current going on where we are trying to modify HTML5 and X3DOM attributes, either with straight JavaScript or Templating (via AngularJS).  While the X3D JSON loader does not support modifying attributes that I know of after the fact (well, it *may*), it dos support specifying @class and @id attribute names for later modification with your favorite JavaScript framework.   Templating is likely another issue we need to face.  Who has used templating with X3DOM and what success have they had?  Should X3DOM support templating as part of its core, or should it be done with web components or a framework like Meteor, Angular.js, handlebars, mustache, etc.?
>>
>> I am not sure I understand exactly what you mean by templating. I 
>> don't want to make any assumptions and start going down a completely 
>> wrong path. Can you provide a foundation for the discussion?
>>
>>> We need to decide pretty quick whether Protos will be supported in X3DOM (perhaps through a prototype expander on the client and/or server side), otherwise, there will be a massive bifurcation of technology (which may be good) and struggle possibly as people attempt to merge various templating frameworks with X3DOM.
>>
>> In my experience, all of the interesting X3D PROTOs contain a Script 
>> node. Without a Script node, I have not seen or been able to 
>> construct something that is any different than an Inline. If one 
>> exists, I would like to know about it.
>>
>> I do not see why there should be a Script node in an html-type 
>> profile for X3D. Having JavaScript (meaning code to manipulate the 
>> DOM) and ECMAScript (meaning code to manipulate X3D's SAI) is 
>> dangerous as people will quickly be confused. The SAI api cannot 
>> replace the DOM api as there are things that can to be done to the 
>> DOM that do not make sense to handle with the SAI. There are also a 
>> lot (meaning >>1,000x) more DOM programmers than SAI programmers.
>>
>> So without Script node, I do not see the need for PROTO. I am willing 
>> to reconsider if you can provide me useful examples that are doable 
>> in PROTO and not Inline or some other means.
>>
>> Perhaps a better concept might be a MACRO where the contained 
>> (declarative) code is expanded and parameter values from the parent 
>> are substituted to equivalent parameters in the expanded code. That 
>> probably has lots of applications and would be straight-forward to 
>> code. It would be sort-of like an Inline with pre-defined parameters. 
>> If that is the case. it would be necessary to define any name-scoping 
>> limitations and parameter updates. Perhaps an extended Inline 
>> definition would be sufficient.
>>
>>
>> Leonard Daly
>>
>>
>>> I think we need to provide an answer which *isn’t* straight JavaScript, and that can be declarative.
>>>
>>> John
>>> ------------------------------------------------------------------------------
>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>> Monitor end-to-end web transactions and take corrective actions now
>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>>> _______________________________________________
>>> X3dom-users mailing list
>>> X3dom-users at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/x3dom-users
>>
>>
>>
>> -- 
>> *Leonard Daly*
>> X3D Co-Chair
>> Cloud Consultant
>> President, Daly Realism - /Creating the Future/
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________
>> X3dom-users mailing list
>> X3dom-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/x3dom-users
>


-- 
*Leonard Daly*
X3D Co-Chair
Cloud Consultant
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160207/d1d7ce3a/attachment.html>


More information about the x3d-public mailing list