@itwin/core-frontend
Version:
iTwin.js frontend components
91 lines • 2.82 kB
TypeScript
/** @packageDocumentation
* @module Rendering
*/
import { Transform, XAndY, XYAndZ } from "@itwin/core-geometry";
import { GltfAlphaMode } from "./GltfSchema";
/** Types describing the in-memory representation of a glTF model as parsed from a [[GltfDocument]].
* This API is incomplete.
* @internal
*/
export declare namespace Gltf {
interface Buffer {
data: Uint8Array;
}
interface PositionQuantization {
origin: XYAndZ;
scale: XYAndZ;
}
interface Attribute {
buffer: Buffer;
byteStride?: number;
}
interface PositionAttribute extends Attribute {
componentType: "f32" | "u8" | "i8" | "u16" | "i16";
quantization?: PositionQuantization;
decodedMin: XYAndZ;
decodedMax: XYAndZ;
}
interface ColorAttribute extends Attribute {
componentType: "f32" | "u8" | "u16";
}
interface Indices {
dataType: "u8" | "u16" | "u32";
count: number;
buffer: Buffer;
}
type PrimitiveType = "triangles";
interface Primitive {
indices: Indices;
attributeCount: number;
position: PositionAttribute;
color?: ColorAttribute;
}
interface TextureUVQuantization {
origin: XAndY;
scale: XAndY;
}
interface NormalAttribute extends Attribute {
componentType: "f32" | "i8" | "i16";
}
interface TextureUVAttribute extends Attribute {
componentType: "f32" | "u8" | "u16" | "i8" | "i16";
quantization?: TextureUVQuantization;
}
interface Rgba {
r: number;
g: number;
b: number;
a: number;
}
interface MetallicRoughness {
baseColorFactor: Rgba;
metallicFactor: number;
roughnessFactor: number;
}
interface Material {
metallicRoughness: MetallicRoughness;
alphaMode: GltfAlphaMode;
alphaCutoff: number;
doubleSided: boolean;
unlit: boolean;
}
interface TrianglesPrimitive extends Primitive {
type: "triangles";
material: Material;
normal?: NormalAttribute;
textureUV?: TextureUVAttribute;
}
type AnyPrimitive = TrianglesPrimitive;
interface Node {
/** Transform from this node's local coordinate system to its parent node's coordinate system (or the model's coordinate system, if no parent node). */
toParent?: Transform;
/** The primitives drawn by this node. For glTF 2.0, there is exactly one primitive per node; glTF 1.0 permits any number of primitives per node. */
primitives: AnyPrimitive[];
}
interface Model {
/** Transform from model coordinates to world coordinates. */
toWorld?: Transform;
nodes: Node[];
}
}
//# sourceMappingURL=GltfModel.d.ts.map