Geometry element
- Last UpdatedDec 06, 2023
- 2 minute read
The Geometry element defines a mesh by providing either a .geom file link or textual vertices and faces of data.
Reference to .geom file
In the first case, within the <Geometry> element you find a file attribute, like this:
<Geometry name="graphic_context|itemName" file="graphic_context\graphic_context_itemName.geom" version="1"/>
Providing details of vertices and faces
In the second case, no file attribute is defined but both <vertices> and <faces> child elements are defined with the attribute num defining their child elements number.
Code example
This is a code example for the <Geometry> element.
<Geometry name="graphic_context|itemName" version="1">
<vertices num="3">
<vertex position="0.5 0.0 0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="0.0 0.0" uv2="0.0 0.0" />
<vertex position="-0.5 0.0 0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="1.0 0.0" uv2="1.0 0.0" />
<vertex position="-0.5 0.0 -0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="1.0 1.0" uv2="1.0 1.0" />
</vertices>
<faces num="1">
<face indices="0 1 2"/>
</faces>
</Geometry>
Note: The .geom binary file is strictly recommended while the textual geometry can be very handy for test/debug purposes.
<vertex>
The Vertex element provides a single vertex data.
|
Attribute |
Description |
|---|---|
|
position |
X Y Z position. |
|
normal |
Normal vector |
|
tangent |
Tangent vector |
|
binormal |
Binormal vector |
|
uvN |
Texture coordinates at vertex position, N is the UV channel number. Note that uv0 corresponds to UV channel 1 in 3D Studio Max. |
<face>
The Face element has an indices attribute.
|
Attribute |
Description |
|
indices |
Connects the previously defined vertices. |
Code example
The code example below creates a triangle connecting the first, the second, and the third previously defined vertices and in that exact order (first to second, second to third, third to first). Only polygons are allowed.
<face indices="0 1 2"/>