| export class DRACOLoader2 extends DRACOLoader implements ILoader<BufferGeometry, Mesh|undefined> { | export class DRACOLoader2 extends DRACOLoader implements ILoader<BufferGeometry, Mesh|undefined> { | ||||
| public encoderPending: Promise<any>|null = null | public encoderPending: Promise<any>|null = null | ||||
| public encoderConfig: any = {type: 'js'} | public encoderConfig: any = {type: 'js'} | ||||
| readonly isDRACOLoader2 = true | |||||
| public static DRACO_LIBRARY_PATH = 'https://cdn.jsdelivr.net/gh/google/draco@1.5.6/javascript/' // https://github.com/google/draco | public static DRACO_LIBRARY_PATH = 'https://cdn.jsdelivr.net/gh/google/draco@1.5.6/javascript/' // https://github.com/google/draco | ||||
| // public static DRACO_LIBRARY_PATH = 'https://www.gstatic.com/draco/versioned/decoders/1.4.1/' | // public static DRACO_LIBRARY_PATH = 'https://www.gstatic.com/draco/versioned/decoders/1.4.1/' |
| // loads the viewer config and handles loading the draco loader for extension | // loads the viewer config and handles loading the draco loader for extension | ||||
| gltfViewerParser = (viewer: ThreeViewer): (p: GLTFParser)=>GLTFLoaderPlugin => { | gltfViewerParser = (viewer: ThreeViewer): (p: GLTFParser)=>GLTFLoaderPlugin => { | ||||
| return (parser: GLTFParser) => { | return (parser: GLTFParser) => { | ||||
| parser.importOptions = this.importOptions || undefined | |||||
| const getDependency = parser.getDependency | const getDependency = parser.getDependency | ||||
| parser.getDependency = async(type: string, index: number) => { | parser.getDependency = async(type: string, index: number) => { | ||||
| const res = await getDependency.call(parser, type, index) | const res = await getDependency.call(parser, type, index) | ||||
| parent.children.splice(index, 0, line2) | parent.children.splice(index, 0, line2) | ||||
| } | } | ||||
| } | } | ||||
| declare module 'three/examples/jsm/loaders/GLTFLoader.js'{ | |||||
| export interface GLTFParser { | |||||
| importOptions?: ImportAddOptions | |||||
| // getDependency(type: string, index: number): Promise<Object3D|Texture|Line|LineSegments|LineLoop> | |||||
| } | |||||
| } |
| if (clearCurrentUserData === undefined) clearCurrentUserData = (<Material>parameters).isMaterial | if (clearCurrentUserData === undefined) clearCurrentUserData = (<Material>parameters).isMaterial | ||||
| if (clearCurrentUserData) this.userData = {} | if (clearCurrentUserData) this.userData = {} | ||||
| if ((parameters as any).ior !== undefined) this.ior = (parameters as any).ior // ior is not serialized in MeshPhysicalMaterial.toJSON, so we need to set it here | |||||
| iMaterialCommons.setValues(super.setValues).call(this, parameters) | iMaterialCommons.setValues(super.setValues).call(this, parameters) | ||||
| if (!isFinite(this.attenuationDistance)) this.attenuationDistance = 0 // hack for ui | if (!isFinite(this.attenuationDistance)) this.attenuationDistance = 0 // hack for ui |