-
Notifications
You must be signed in to change notification settings - Fork 25
Geometry Definition
ksons edited this page Dec 18, 2014
·
7 revisions
The <mesh> or the <assetmesh> are the two elements that lead to rendered geometry in a XML3D scene. The <assetmesh> has additional functionality for scope, for details refer to Assets. Otherwise, the definition of geometry is exactly the same as for the <mesh>, that is explained in more detail below:
The <mesh> element defines a geometry in the transformation hierarchy. The mesh has a type attribute, which specifies the primitive the mesh attribute defines. Depending on the type attribute, the mesh has mandatory and optional data entries.
A mesh of type triangle describes a triangle mesh (surprise!). It has a mandatory field positions that describes the positions of the vertices in object space.
| name | type | mandatory | description |
|---|---|---|---|
| position | float3 | X | The positions of the vertices of the mesh |
| index | int | If provided, one triangle is defined for each three entries in the index. Allows sharing vertices between multiple triangles. | |
| vertexCount | int | If provided, the first vertexCount vertices are considered for rendering (should be a multiple of 3 for triangle meshes) |
|
| boundingBox | float3 | Two positions in object space that define the min and max vertices of an axis-aligned bounding box. If provided, this annotated bounding box is used for all calculations where a bounding box is required (e.g. frustum culling). If not, the boundingBox is derived from the mesh's positions. For dynamic meshes (e.g. skinned virtual characters) annotating the bounding box avoids xml3d.js has to perform the bounding box calculation per frame. |