123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- /// <reference path="../../../../dist/preview release/babylon.d.ts"/>
- module BABYLON.GLTF2 {
- /**
- * Enums
- */
- export enum EComponentType {
- BYTE = 5120,
- UNSIGNED_BYTE = 5121,
- SHORT = 5122,
- UNSIGNED_SHORT = 5123,
- UNSIGNED_INT = 5125,
- FLOAT = 5126
- }
- export enum EMeshPrimitiveMode {
- POINTS = 0,
- LINES = 1,
- LINE_LOOP = 2,
- LINE_STRIP = 3,
- TRIANGLES = 4,
- TRIANGLE_STRIP = 5,
- TRIANGLE_FAN = 6
- }
- export enum ETextureMagFilter {
- NEAREST = 9728,
- LINEAR = 9729,
- }
- export enum ETextureMinFilter {
- NEAREST = 9728,
- LINEAR = 9729,
- NEAREST_MIPMAP_NEAREST = 9984,
- LINEAR_MIPMAP_NEAREST = 9985,
- NEAREST_MIPMAP_LINEAR = 9986,
- LINEAR_MIPMAP_LINEAR = 9987
- }
- export enum ETextureWrapMode {
- CLAMP_TO_EDGE = 33071,
- MIRRORED_REPEAT = 33648,
- REPEAT = 10497
- }
- /**
- * Interfaces
- */
- export interface IGLTFProperty {
- extensions?: Object;
- extras?: any;
- }
- export interface IGLTFChildRootProperty extends IGLTFProperty {
- name?: string;
- }
- export interface IGLTFAccessorSparseIndices extends IGLTFProperty {
- bufferView: number;
- byteOffset?: number;
- componentType: EComponentType;
- }
- export interface IGLTFAccessorSparseValues extends IGLTFProperty {
- bufferView: number;
- byteOffset?: number;
- }
- export interface IGLTFAccessorSparse extends IGLTFProperty {
- count: number;
- indices: IGLTFAccessorSparseIndices;
- values: IGLTFAccessorSparseValues;
- }
- export interface IGLTFAccessor extends IGLTFChildRootProperty {
- bufferView?: number;
- byteOffset?: number;
- componentType: EComponentType;
- normalized?: boolean;
- count: number;
- type: string;
- max: number[];
- min: number[];
- sparse?: IGLTFAccessorSparse;
- }
- export interface IGLTFAnimationChannel extends IGLTFProperty {
- sampler: number;
- target: IGLTFAnimationChannelTarget;
- }
- export interface IGLTFAnimationChannelTarget extends IGLTFProperty {
- node: number;
- path: string;
- }
- export interface IGLTFAnimationSampler extends IGLTFProperty {
- input: number;
- interpolation?: string;
- output: number;
- }
- export interface IGLTFAnimation extends IGLTFChildRootProperty {
- channels: IGLTFAnimationChannel[];
- samplers: IGLTFAnimationSampler[];
- }
- export interface IGLTFAssetProfile extends IGLTFProperty {
- api?: string;
- version?: string;
- }
- export interface IGLTFAsset extends IGLTFChildRootProperty {
- copyright?: string;
- generator?: string;
- profile?: IGLTFAssetProfile;
- version: string;
- }
- export interface IGLTFBuffer extends IGLTFChildRootProperty {
- uri?: string;
- byteLength: number;
- // Loaded buffer (optimize)
- loadedBufferView: ArrayBufferView
- }
- export interface IGLTFBufferView extends IGLTFChildRootProperty {
- buffer: number;
- byteOffset?: number;
- byteLength: number;
- byteStride?: number;
- }
- export interface IGLTFCameraOrthographic extends IGLTFProperty {
- xmag: number;
- ymag: number;
- zfar: number;
- znear: number;
- }
- export interface IGLTFCameraPerspective extends IGLTFProperty {
- aspectRatio: number;
- yfov: number;
- zfar: number;
- znear: number;
- }
- export interface IGLTFCamera extends IGLTFChildRootProperty {
- orthographic?: IGLTFCameraOrthographic;
- perspective?: IGLTFCameraPerspective;
- type: string;
- }
- export interface IGLTFImage extends IGLTFChildRootProperty {
- uri?: string;
- mimeType?: string;
- bufferView?: number;
- }
- export interface IGLTFMaterialNormalTextureInfo extends IGLTFTextureInfo {
- scale: number;
- }
- export interface IGLTFMaterialOcclusionTextureInfo extends IGLTFTextureInfo {
- strength: number;
- }
- export interface IGLTFMaterialPbrMetallicRoughness {
- baseColorFactor: number[];
- baseColorTexture: IGLTFTextureInfo;
- metallicFactor: number;
- roughnessFactor: number;
- metallicRoughnessTexture: IGLTFTextureInfo;
- }
- export interface IGLTFMaterial extends IGLTFChildRootProperty {
- pbrMetallicRoughness?: IGLTFMaterialPbrMetallicRoughness;
- normalTexture?: IGLTFMaterialNormalTextureInfo;
- occlusionTexture?: IGLTFMaterialOcclusionTextureInfo;
- emissiveTexture?: IGLTFTextureInfo;
- emissiveFactor?: number[];
- alphaMode?: string;
- alphaCutoff: number;
- doubleSided?: boolean;
- // Babylon.js values (optimize)
- babylonMaterial?: PBRMaterial;
- }
- export interface IGLTFMeshPrimitive extends IGLTFProperty {
- attributes: { [name: string]: number };
- indices?: number;
- material?: number;
- mode?: EMeshPrimitiveMode;
- targets?: [ { [name: string]: number } ];
- }
- export interface IGLTFMesh extends IGLTFChildRootProperty {
- primitives: IGLTFMeshPrimitive[];
- weights?: number[];
- }
- export interface IGLTFNode extends IGLTFChildRootProperty {
- camera?: number;
- children?: number[];
- skin?: number;
- matrix?: number[];
- mesh?: number;
- rotation?: number[];
- scale?: number[];
- translation?: number[];
- weights?: number[];
- // Babylon.js values (optimize)
- babylonNode?: Node;
- }
- export interface IGLTFSampler extends IGLTFChildRootProperty {
- magFilter?: ETextureMagFilter;
- minFilter?: ETextureMinFilter;
- wrapS?: ETextureWrapMode;
- wrapT?: ETextureWrapMode;
- }
- export interface IGLTFScene extends IGLTFChildRootProperty {
- nodes: number[];
- }
- export interface IGLTFSkin extends IGLTFChildRootProperty {
- inverseBindMatrices?: number;
- skeleton?: number;
- joints: number[];
- // Babylon.js values (optimize)
- babylonSkeleton?: Skeleton;
- }
- export interface IGLTFTexture extends IGLTFChildRootProperty {
- sampler?: number;
- source: number;
- // Babylon.js values (optimize, one per coordinate index)
- babylonTextures: Texture[];
- blobURL: string;
- }
- export interface IGLTFTextureInfo {
- index: number;
- texCoord?: number;
- }
- export interface IGLTF extends IGLTFProperty {
- accessors?: IGLTFAccessor[];
- animations?: IGLTFAnimation[];
- asset: IGLTFAsset;
- buffers?: IGLTFBuffer[];
- bufferViews?: IGLTFBufferView[];
- cameras?: IGLTFCamera[];
- extensionsUsed?: string[];
- extensionsRequired?: string[];
- glExtensionsUsed?: string[];
- images?: IGLTFImage[];
- materials?: IGLTFMaterial[];
- meshes?: IGLTFMesh[];
- nodes?: IGLTFNode[];
- samplers?: IGLTFSampler[];
- scene?: number;
- scenes?: IGLTFScene[];
- skins?: IGLTFSkin[];
- textures?: IGLTFTexture[];
- }
- export interface IGLTFRuntime {
- gltf: IGLTF;
- babylonScene: Scene;
- rootUrl: string;
- importOnlyMeshes: boolean;
- importMeshesNames?: string[];
- defaultMaterial?: PBRMaterial;
- }
- /**
- * Bones
- */
- export interface INodeToRoot {
- bone: Bone;
- node: IGLTFNode;
- index: number;
- }
- export interface IJointNode {
- node: IGLTFNode;
- index: number;
- }
- }
|