UNPKG

@realsee/five

Version:

Realsee Renderer SDK

116 lines (115 loc) • 4.97 kB
import * as THREE from 'three'; import { GlTF, TextureInfo, Mesh, MeshPrimitive } from './glTF'; import type { GlTFResult } from './type'; import { BaseExtension } from './extensions/base'; import { Fetcher } from '../../../utils/ajax'; import { PBMMeshMaterial } from '../../materials/pbmMeshMaterial'; import { PBMPointCloudMaterial } from '../../materials/pbmPointCloudMaterial'; import { ImageBitmapLike } from '../../../texture/imageBitmap'; type ParserOptions = { copyUV2: boolean; resourcePath: string; search: string; fetcher: Fetcher; }; type SkinEntry = { joints: number[]; inverseBindMatrices?: THREE.BufferAttribute | THREE.InterleavedBufferAttribute; }; export declare class Parser { json: GlTF; extensions: Record<string, BaseExtension>; options: ParserOptions; cache: Map<string, any>; disposeSet: Set<{ dispose?: () => void; close?: () => void; }>; textureSet: Set<THREE.Texture>; private nodeNamesUsed; constructor(json: GlTF, extensions: Record<string, BaseExtension>, options: ParserOptions); dispose(): void; markDefs(): void; parse(): Promise<GlTFResult>; /** * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras * @param index * @returns */ loadCamera(index: number): Promise<THREE.Camera>; /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins * @param index * @return */ loadSkin(index: number): Promise<SkinEntry>; /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations * @param index */ loadAnimation(index: number): Promise<THREE.AnimationClip>; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views * @param index * @returns */ loadBuffer(index: number): Promise<ArrayBuffer>; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views * @param index * @returns */ loadBufferView(index: number): Promise<ArrayBuffer>; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors * @param index */ loadAccessor(index: number): Promise<THREE.BufferAttribute | THREE.InterleavedBufferAttribute | null>; createPrimitiveKey(primitiveDef: MeshPrimitive): string; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry * @param primitiveDef */ loadGeometry(primitiveDef: MeshPrimitive): Promise<THREE.BufferGeometry>; loadImage(index: number): Promise<ImageBitmapLike>; loadMeshPrimitive(meshDef: Mesh, primitiveDef: MeshPrimitive): Promise<THREE.Points | THREE.Line | THREE.Mesh>; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes * @param index */ loadMesh(index: number): Promise<THREE.Object3D>; /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials * @param primitiveDef */ loadMaterial(primitiveDef: MeshPrimitive): Promise<THREE.Material>; loadMaterialAsPBMPointCloudMaterial(primitiveDef: MeshPrimitive): Promise<PBMPointCloudMaterial>; loadMaterialAsPBMMeshMaterial(primitiveDef: MeshPrimitive): Promise<PBMMeshMaterial>; loadMaterialAsLineBasicMaterial(primitiveDef: MeshPrimitive): Promise<THREE.LineBasicMaterial>; loadTexture(index: number): Promise<THREE.Texture>; /** * 当骨骼权重和不足 1 时,可能出现问题。 * skinnedMesh.normalizeSkinWeights 只能处理非 normalized 的数据。 * 需要对 normalized 也做检测。 */ normalizeSkinWeights(skinnedMesh: THREE.SkinnedMesh): void; assignFinalMaterial(mesh: THREE.Points | THREE.Line | THREE.Mesh): void; loadNodeAttachments(index: number): Promise<THREE.Object3D>[]; /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy * @param index * @returns */ loadNode(index: number): Promise<THREE.Object3D>; /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes * @param index */ loadScene(index: number): Promise<THREE.Group>; createMaterialTexture(mapDef: TextureInfo): Promise<THREE.Texture>; addGeometryPrimitiveAttributes(geometry: THREE.BufferGeometry, primitiveDef: MeshPrimitive): Promise<THREE.BufferGeometry>; buildNodeHierarchy(nodeId: number, parentObject: THREE.Object3D): Promise<THREE.Object3D>; resolveResouce(uri: string): string; toGeometryTrianglesDrawMode(geometry: THREE.BufferGeometry, drawMode: THREE.TrianglesDrawModes): THREE.BufferGeometry; } export {};