Skip to content
lachsen edited this page Dec 5, 2012 · 15 revisions

Table of Contents

Data Compositing

First we will describe how data is declared and connected to the scene graph.

Declaring generic data nodes

Several elements inside the scene graph, including <mesh>, <shader> and <lightshader> use generic data content, e.g. like this:

<mesh type="triangles">
  <int name="index">0 1 2 2 3 0 4 ... </int>
  <float3 name="position">-1.0 -1.0 -1.0 ... </float3>
  <float3 name="normal">0.0 0.0 -1.0 0.0 0.0 ... </float3>
  <float2 name="texcoord">1.0 0.0 ... </float2>
</mesh>

Generic data is declared with a list of typed Value Elements, e.g. <float>, <float3>, <int> and so on. Each Value Element is assigned with a name via its name attribute.

In XML3D, it is also possible to declare generic data that is not directly used inside the scene graph. For this, we use the <data> element:

<data id="cubeMeshData" >
  <int name="index">0 1 2 2 3 0 4 ... </int>
  <float3 name="position">-1.0 -1.0 -1.0 ... </float3>
  <float3 name="normal">0.0 0.0 -1.0 0.0 0.0 ... </float3>
  <float2 name="texcoord">1.0 0.0 ... </float2>
</data>

...

<group style="transform: translateX(-5px)" >
   <mesh type="triangle" src="#cubeMeshData" />
</group>
<group style="transform: translateX(5px)" >
   <mesh type="triangle" src="#cubeMeshData" />
</group>

Here, we declared the generic data inside a <data> element and reused it for two meshes, by referring the <data> node via its document id cubeMeshData inside the src attribute of <mesh>.

Combination of data containers

Renaming/filtering of values

Declaring data sequences

Data Processing

Prototyping

Clone this wiki locally