Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GltfWriter

Utility class for serializing parsed 3D content to local file system as glTF (2.0).

Hierarchy

  • GltfWriter

Index

Constructors

  • new GltfWriter(options?: IWriterOptions): GltfWriter

Properties

accessorHashes: Map<string, number> = ...
activeSvfMaterials: number[]
baseDir: string
bufferSize: number
bufferStream: null | WriteStream
bufferViewCache: Map<string, BufferView> = ...
bufferViewHashes: Map<string, number> = ...
manifest: GlTf
meshHashes: Map<string, number> = ...
options: Required<IWriterOptions>
pendingTasks: Promise<void>[] = []
stats: IWriterStats = ...

Methods

  • addAccessor(accessor: Accessor): number
  • addBufferView(bufferView: BufferView): number
  • addMesh(mesh: Mesh): number
  • computeAccessorHash(accessor: Accessor): string
  • computeBoundsVec3(array: Float32Array): { max: number[]; min: number[] }
  • Parameters

    • array: Float32Array

    Returns { max: number[]; min: number[] }

    • max: number[]
    • min: number[]
  • computeBufferHash(buffer: Buffer): string
  • computeBufferViewHash(bufferView: BufferView): string
  • computeMaterialHash(material: null | IPhysicalMaterial): string
  • computeMeshHash(mesh: Mesh): string
  • createAccessor(bufferViewID: number, componentType: number, count: number, type: string, min?: number[], max?: number[]): Accessor
  • Parameters

    • bufferViewID: number
    • componentType: number
    • count: number
    • type: string
    • Optional min: number[]
    • Optional max: number[]

    Returns Accessor

  • createBufferView(data: Buffer): BufferView
  • createLineGeometry(geometry: ILineGeometry, imf: IScene): Mesh
  • createMaterial(mat: null | IPhysicalMaterial, imf: IScene): MaterialPbrMetallicRoughness
  • Parameters

    • mat: null | IPhysicalMaterial
    • imf: IScene

    Returns MaterialPbrMetallicRoughness

  • createMeshGeometry(geometry: IMeshGeometry, imf: IScene, outputUvs: boolean): Mesh
  • Parameters

    • geometry: IMeshGeometry
    • imf: IScene
    • outputUvs: boolean

    Returns Mesh

  • createNode(fragment: IObjectNode, imf: IScene, outputUvs: boolean): Node
  • Parameters

    • fragment: IObjectNode
    • imf: IScene
    • outputUvs: boolean

    Returns Node

  • createPointGeometry(geometry: IPointGeometry, imf: IScene): Mesh
  • createScene(imf: IScene): Scene
  • createTexture(uri: string, imf: IScene): Texture
  • postprocess(imf: IScene, gltfPath: string): Promise<void>
  • reset(outputDir: string): void
  • serializeManifest(manifest: GlTf, outputPath: string): void
  • write(imf: IScene, outputDir: string): Promise<void>
  • Outputs scene into glTF.

    async

    Parameters

    • imf: IScene

      Complete scene in intermediate, in-memory format.

    • outputDir: string

      Path to output folder.

    Returns Promise<void>

Generated using TypeDoc