mikaxyz/elm-gltf/3.0.1

NOTE: the latest version is 5.0.0

Gltf.Mesh

A mesh contains the geometry (vertices) and the material of a 3D object. One Node can hold a multiple of meshes.

NOTE: This package supplies meshes with a "concrete" type of attribute named Vertex. The thinking here is that your application will map these into your own type depending of needs. Storing meshes with this Vertex type will mean storing a lot of redundant data and is not recommended if goal is optimization.

type Mesh
= Points (Maybe Material) (List Vertex)
| Lines (Maybe Material) (List ( Vertex, Vertex ))
| LineLoop (Maybe Material) (List Vertex)
| LineStrip (Maybe Material) (List Vertex)
| TriangleStrip (Maybe Material) (List Vertex)
| TriangleFan (Maybe Material) (List Vertex)
| TriangularMesh
(Maybe Material)
(List ( Vertex, Vertex, Vertex ))
| IndexedTriangularMesh
(Maybe Material)
( List Vertex, List ( Int, Int, Int ) )

The types of meshes as you will find in elm-explorations/webgl

type alias Vertex =
{ position : Vec3
, normal : Maybe Vec3
, tangent : Maybe Vec4
, color : Maybe Vec4
, weights : Maybe Vec4
, joints : Maybe Joints
, texCoords : Maybe Vec2
}

The "attributes" of the Mesh. Map these into the attribute your shader(s) use.

type alias Joints =
{ j1 : Int
, j2 : Int
, j3 : Int
, j4 : Int
}

The indices of the joints in the skeleton the vertex is effected by.