Repository: playcanvas/engine
File: src/framework/parsers/sog-bundle.js (JavaScript)

Code before:
                });

                this.app.assets.add(texture);
                textures[filename] = texture;
                promises.push(promise);
            }

            Object.values(textures).forEach(t => this.app.assets.load(t));

            await Promise.allSettled(promises);

            const { assets } = this.app;

            asset.once('unload', () => {
                Object.values(textures).forEach((t) => {
                    // remove from registry
                    assets.remove(t);

                    // destroy texture resource
                    t.unload();
                });
            });

            // construct the gsplat resource
            const data = new GSplatSogsData();
            data.meta = meta;
            data.numSplats = meta.count;
            data.means_l = textures[meta.means.files[0]].resource;
            data.means_u = textures[meta.means.files[1]].resource;
            data.quats = textures[meta.quats.files[0]].resource;
            data.scales = textures[meta.scales.files[0]].resource;
            data.sh0 = textures[meta.sh0.files[0]].resource;
            data.sh_centroids = textures[meta.shN?.files[0]]?.resource;
            data.sh_labels = textures[meta.shN?.files[1]]?.resource;

            const decompress = asset.data?.decompress;

            if (!decompress) {
                // no need to prepare gpu data if decompressing
                await data.prepareGpuData();
            }

            const resource = decompress ?
                new GSplatResource(this.app.graphicsDevice, await data.decompress()) :
                new GSplatSogsResource(this.app.graphicsDevice, data);

            callback(null, resource);
        } catch (err) {
            callback(err);
        }
    }

Review comment (suggestion):
Passing `minimalMemory` in `asset.options` doesn't match the existing flags `decompress` and `reorder` which are passed in `asset.data`.

I think the two existing flags should probably have used `asset.options`, not sure why I didn't - my bad.

Anyway it means things are now pretty confusing and I think we should move `decompress` and `reorder` flags to `asset.options` as well.

Code after:
                });

                this.app.assets.add(texture);
                textures[filename] = texture;
                promises.push(promise);
            }

            Object.values(textures).forEach(t => this.app.assets.load(t));

            await Promise.allSettled(promises);

            const { assets } = this.app;

            asset.once('unload', () => {
                Object.values(textures).forEach((t) => {
                    // remove from registry
                    assets.remove(t);

                    // destroy texture resource
                    t.unload();
                });
            });

            // construct the gsplat resource
            const decompress = asset.data?.decompress;
            const minimalMemory = asset.options?.minimalMemory ?? false;

            const data = new GSplatSogsData();
            data.minimalMemory = minimalMemory;
            data.meta = meta;
            data.numSplats = meta.count;
            data.means_l = textures[meta.means.files[0]].resource;
            data.means_u = textures[meta.means.files[1]].resource;
            data.quats = textures[meta.quats.files[0]].resource;
            data.scales = textures[meta.scales.files[0]].resource;
            data.sh0 = textures[meta.sh0.files[0]].resource;
            data.sh_centroids = textures[meta.shN?.files[0]]?.resource;
            data.sh_labels = textures[meta.shN?.files[1]]?.resource;

            if (!decompress) {
                // no need to prepare gpu data if decompressing
                await data.prepareGpuData();
            }

            const resource = decompress ?
                new GSplatResource(this.app.graphicsDevice, await data.decompress()) :
                new GSplatSogsResource(this.app.graphicsDevice, data);

            callback(null, resource);
        } catch (err) {
            callback(err);