Vertex constructor

Vertex({
  1. required Vector3 position,
  2. required Vector2 texCoord,
  3. Color color = const Color(0xFFFFFFFF),
  4. Vector3? normal,
  5. Vector4? joints,
  6. Vector4? weights,
})

Represents a vertex in 3D space.

A vertex consists out of space coordinates, UV/texture coordinates and a color.

Implementation

Vertex({
  required Vector3 position,
  required Vector2 texCoord,
  this.color = const Color(0xFFFFFFFF),
  Vector3? normal,
  Vector4? joints,
  Vector4? weights,
}) : position = position.immutable,
     texCoord = texCoord.immutable,
     normal = normal?.immutable,
     joints = joints?.immutable,
     weights = weights?.immutable,
     _storage = Float32List.fromList([
       ...position.storage, // 1, 2, 3
       ...texCoord.storage, // 4, 5
       ...[color.r, color.g, color.b, color.a], // 6, 7, 8, 9
       ...(normal ?? Vector3.zero()).storage, // 10, 11, 12
       ...(joints ?? Vector4.zero()).storage, // 13, 14, 15, 16
       ...(weights ?? Vector4.zero()).storage, // 17, 18, 19, 20
     ]);