xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Interfacing assets #135

Open stlemme opened 9 years ago

stlemme commented 9 years ago

When using assets it is desired to define some kind of an interface to allow adopting them. Currently, using such assets relates to unnecessary boilerplate DOM nodes to rebuild the internal structure of the assets.

<!-- current interface -->
<model src="geom.xml#sphere">
  <assetdata name="config">
    <float name="radius">2.0</float>
    <int name="segments">12 20</int>
  </assetdata>
</model>

<!-- desired interface -->
<model src="geom.xml#sphere">
  <float name="radius">2.0</float>
  <int name="segments">12 20</int>
</model>

A proposed solutions could be the "export" of one assetdata with a unique name that can be overwritten directly below the <model> tag.

<asset id="sphere">
  <assetdata name="export">
    <float name="radius">1.0</float>
    <int name="segments">4 6</int>
  </assetdata>
  <assetmesh compute="xflow.sphere()" includes="config">
  </assetmesh>
</model>