MCPcopy Create free account
hub / github.com/beutton/browser-flight-simulator / load

Method load

packages/core/src/EXR3DLoader.ts:12–47  ·  view source on GitHub ↗
(
    url: string,
    onLoad: (data: Data3DTexture) => void,
    onProgress?: (event: ProgressEvent) => void,
    onError?: (error: unknown) => void
  )

Source from the content-addressed store, hash-verified

10 }
11
12 override load(
13 url: string,
14 onLoad: (data: Data3DTexture) => void,
15 onProgress?: (event: ProgressEvent) => void,
16 onError?: (error: unknown) => void
17 ): void {
18 const loader = new EXRLoader(this.manager)
19 loader.setRequestHeader(this.requestHeader)
20 loader.setPath(this.path)
21 loader.setWithCredentials(this.withCredentials)
22 loader.load(
23 url,
24 exr => {
25 const { data, width, height } = exr.image
26 const depth = this.depth ?? Math.sqrt(height)
27 const texture = new Data3DTexture(data, width, height / depth, depth)
28 texture.type = exr.type
29 texture.format = exr.format
30 texture.colorSpace = exr.colorSpace
31 texture.needsUpdate = true
32
33 try {
34 onLoad(texture)
35 } catch (error) {
36 if (onError != null) {
37 onError(error)
38 } else {
39 console.error(error)
40 }
41 this.manager.itemError(url)
42 }
43 },
44 onProgress,
45 onError
46 )
47 }
48}

Callers 2

initFunction · 0.45
loadFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected