Class: DRACOLoader2
Asset-Management.DRACOLoader2
Hierarchy
DRACOLoader
↳
DRACOLoader2
Implements
ILoader
<BufferGeometry
,Mesh
|undefined
>
Properties
LIB_CDN_PATH
▪ Static
LIB_CDN_PATH: string
= 'https://cdn.jsdelivr.net/gh/google/[email protected]/javascript/'
LibraryValueMap
▪ Static
LibraryValueMap: Record
<string
, any
> = {}
This is a hack to allow bundling the draco decoder js file with your app source See DRACOLoader2.SetDecoderJsString for example
encoderPending
• encoderPending: null
| Promise
<any
> = null
encoderConfig
• encoderConfig: any
isDRACOLoader2
• Readonly
isDRACOLoader2: true
Methods
SetDecoderJsString
▸ Static
SetDecoderJsString(jsString
): void
Set the decoder js string Sample for how to set LibraryValueMap This is useful for bundling the draco decoder js file with your app source
example
First put the draco_decoder.js file in your src folder, then import it in js/ts as a string
import draco_decoder from './libs/draco_decoder.1.5.6.js?raw' // vite will load this as a string
// console.log(draco_decoder) // this should be a string with js content
DRACOLoader2.SetDecoderJsString(draco_decoder)
Parameters
Name | Type | Description |
---|---|---|
jsString | string | the contents of draco_decoder.js file |
Returns
void
transform
▸ transform(res
, _
): undefined
| Mesh
<BufferGeometry
<NormalBufferAttributes
, BufferGeometryEventMap
>, Material
<MaterialEventMap
> | Material
<MaterialEventMap
>[], Object3DEventMap
>
Transform after load, like convert geometry to mesh, etc. for reference see DRACOLoader2
Parameters
Name | Type |
---|---|
res | BufferGeometry <NormalBufferAttributes , BufferGeometryEventMap > |
_ | AnyOptions |
Returns
undefined
| Mesh
<BufferGeometry
<NormalBufferAttributes
, BufferGeometryEventMap
>, Material
<MaterialEventMap
> | Material
<MaterialEventMap
>[], Object3DEventMap
>
Implementation of
preload
▸ preload(decoder?
, encoder?
): DRACOLoader
Parameters
Name | Type | Default value |
---|---|---|
decoder | boolean | true |
encoder | boolean | false |
Returns
DRACOLoader
Overrides
DRACOLoader.preload
initEncoder
▸ initEncoder(): Promise
<any
>
Returns
Promise
<any
>
initDecoder
▸ initDecoder(): Promise
<any
>
Returns
Promise
<any
>
_loadLibrary
▸ _loadLibrary(url
, responseType
): Promise
<any
>
Parameters
Name | Type |
---|---|
url | string |
responseType | string |
Returns
Promise
<any
>
Overrides
DRACOLoader._loadLibrary
Constructors
constructor
• new DRACOLoader2(manager?
)
Parameters
Name | Type |
---|---|
manager? | LoadingManager |
Overrides
DRACOLoader.constructor