XML3D - Hello Cube
Basic description
As it is appropriate for a format that aims to be used in the web, XML3D
is based on and takes advantage of several W3C standards and
recommendations. This includes amongst others XML, XML Events, DOM, CSS
and (hopefully at some point) XBL.
XML3D is also designed to integrate and interoperate well with ubiquituous
W3C standards such as HTML, DOM, CSS, and others. Embedding XML3D into
this family of standards brings many benefits: It allows millions of
existing web programmers to directly apply their existing knowledge also
to interactive 3D graphics (ref).
Code
<mesh type="triangles">
<int name="index">
0 1 2 0 2 3 <!-- front -->
4 5 6 4 6 7 <!-- back -->
8 9 10 8 10 11 <!-- top -->
12 13 14 12 14 15 <!-- bottom -->
16 17 18 16 18 19 <!-- right -->
20 21 22 20 22 23 <!-- left -->
</int>
<float3 name="position">
<!-- Front face -->
-1.0 -1.0 1.0
1.0 -1.0 1.0
1.0 1.0 1.0
-1.0 1.0 1.0
<!-- Back face -->
-1.0 -1.0 -1.0
-1.0 1.0 -1.0
1.0 1.0 -1.0
1.0 -1.0 -1.0
<!-- Top face -->
-1.0 1.0 -1.0
-1.0 1.0 1.0
1.0 1.0 1.0
1.0 1.0 -1.0
<!-- Bottom face -->
-1.0 -1.0 -1.0
1.0 -1.0 -1.0
1.0 -1.0 1.0
-1.0 -1.0 1.0
<!-- Right face -->
1.0 -1.0 -1.0
1.0 1.0 -1.0
1.0 1.0 1.0
1.0 -1.0 1.0
<!-- Left face -->
-1.0 -1.0 -1.0
-1.0 -1.0 1.0
-1.0 1.0 1.0
-1.0 1.0 -1.0
</float3>
<float2 name="texcoord">
<!-- Front -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
<!-- Back -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
<!-- Top -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
<!-- Bottom -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
<!-- Right -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
<!-- Left -->
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
</float2>
<float3 name="normal">
<!-- Front -->
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
<!-- Back -->
0.0 0.0 -1.0
0.0 0.0 -1.0
0.0 0.0 -1.0
0.0 0.0 -1.0
<!-- Top -->
0.0 1.0 0.0
0.0 1.0 0.0
0.0 1.0 0.0
0.0 1.0 0.0
<!-- Bottom -->
0.0 -1.0 0.0
0.0 -1.0 0.0
0.0 -1.0 0.0
0.0 -1.0 0.0
<!-- Right -->
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
<!-- Left -->
-1.0 0.0 0.0
-1.0 0.0 0.0
-1.0 0.0 0.0
-1.0 0.0 0.0
</float3>
</mesh>