semicongine/gltf

Types

GltfData[TMesh; TMaterial] = object
  scenes*: seq[seq[int]]
  nodes*: seq[GltfNode]
  meshes*: seq[seq[(TMesh, VkPrimitiveTopology)]]
  materials*: seq[TMaterial]
  textures*: seq[Image[BGRA]]
GltfNode = object
  children*: seq[int]
  mesh*: int = -1
  transform*: Mat4 = (data: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
                             1.0, 0.0, 0.0, 0.0, 0.0, 1.0])
MaterialAttributeNames = object
  baseColorTexture*: string
  baseColorTextureUv*: string
  baseColorFactor*: string
  metallicRoughnessTexture*: string
  metallicRoughnessTextureUv*: string
  metallicFactor*: string
  roughnessFactor*: string
  normalTexture*: string
  normalTextureUv*: string
  occlusionTexture*: string
  occlusionTextureUv*: string
  emissiveTexture*: string
  emissiveTextureUv*: string
  emissiveFactor*: string
MeshAttributeNames = object
  POSITION*: string
  NORMAL*: string
  TANGENT*: string
  TEXCOORD*: seq[string]
  COLOR*: seq[string]
  JOINTS*: seq[string]
  WEIGHTS*: seq[string]
  indices*: string
  material*: string

Procs

proc ReadglTF[TMesh, TMaterial](stream: Stream; meshAttributesMapping: static
    MeshAttributeNames; materialAttributesMapping: static MaterialAttributeNames): GltfData[
    TMesh, TMaterial]