MCPcopy
hub / github.com/sparkjsdev/spark / dispose

Method dispose

src/PackedSplats.ts:273–304  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 // Call this when you are finished with the PackedSplats and want to free
272 // any buffers it holds.
273 dispose() {
274 if (this.target) {
275 this.target.dispose();
276 this.target.texture.source.data = null;
277 this.target = null;
278 }
279 if (this.source) {
280 this.source.dispose();
281 this.source.source.data = null;
282 this.source = null;
283 }
284
285 this.packedArray = null;
286
287 for (const key in this.extra) {
288 const dyno = this.extra[key] as DynoUniform<
289 DynoType,
290 string,
291 THREE.Texture
292 >;
293 if (dyno instanceof DynoUniform) {
294 const texture = dyno.value;
295 if (texture?.isTexture) {
296 texture.dispose();
297 texture.source.data = null;
298 }
299 }
300 }
301 this.extra = {};
302
303 this.disposeLodSplats();
304 }
305
306 prepareFetchSplat() {
307 // console.info("PackedSplats.prepareFetchSplat");

Callers

nothing calls this directly

Calls 2

disposeLodSplatsMethod · 0.95
disposeMethod · 0.65

Tested by

no test coverage detected