Skip to content

Commit f3205dd

Browse files
committed
fix(soba/staging): remove encoding option in injectEnvironment
1 parent cb9b676 commit f3205dd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

libs/soba/staging/src/lib/environment/inject-environment.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { computed, effect, Injector, signal, untracked } from '@angular/core';
22
import { GainMapLoader, HDRJPGLoader } from '@monogrid/gainmap-js';
33
import { injectLoader, injectStore, is, pick } from 'angular-three';
4-
import { LinearEncoding, sRGBEncoding, TextureEncoding } from 'angular-three-soba/misc';
54
import { assertInjector } from 'ngxtension/assert-injector';
65
import * as THREE from 'three';
76
import { EXRLoader, RGBELoader } from 'three-stdlib';
@@ -28,7 +27,7 @@ export interface NgtsInjectEnvironmentOptions {
2827
path: string;
2928
preset?: NgtsEnvironmentPresets;
3029
extensions?: (loader: THREE.Loader) => void;
31-
encoding?: TextureEncoding;
30+
colorSpace?: THREE.ColorSpace;
3231
}
3332

3433
const defaultFiles = ['/px.png', '/nx.png', '/py.png', '/ny.png', '/pz.png', '/nz.png'];
@@ -39,7 +38,7 @@ export function injectEnvironment(
3938
) {
4039
return assertInjector(injectEnvironment, injector, () => {
4140
const adjustedOptions = computed(() => {
42-
const { preset, extensions, encoding, ...rest } = options();
41+
const { preset, extensions, colorSpace, ...rest } = options();
4342
let { files, path } = rest;
4443

4544
if (files == null) {
@@ -56,7 +55,7 @@ export function injectEnvironment(
5655
path = CUBEMAP_ROOT;
5756
}
5857

59-
return { files, preset, encoding, path, extensions };
58+
return { files, preset, colorSpace, path, extensions };
6059
});
6160

6261
const files = pick(adjustedOptions, 'files');
@@ -112,7 +111,7 @@ export function injectEnvironment(
112111

113112
const { extension, isCubeMap } = untracked(resultOptions);
114113
const _multiFile = untracked(multiFile);
115-
const { encoding } = untracked(adjustedOptions);
114+
const { colorSpace } = untracked(adjustedOptions);
116115

117116
// @ts-expect-error - ensure textureResult is a Texture or CubeTexture
118117
let textureResult = (_multiFile ? loaderResult[0] : loaderResult) as Texture | CubeTexture;
@@ -135,10 +134,7 @@ export function injectEnvironment(
135134
}
136135

137136
textureResult.mapping = isCubeMap ? THREE.CubeReflectionMapping : THREE.EquirectangularReflectionMapping;
138-
139-
if ('colorSpace' in textureResult)
140-
(textureResult as any).colorSpace = encoding ?? (isCubeMap ? 'srgb' : 'srgb-linear');
141-
else (textureResult as any).encoding = encoding ?? (isCubeMap ? sRGBEncoding : LinearEncoding);
137+
textureResult.colorSpace = colorSpace ?? (isCubeMap ? 'srgb' : 'srgb-linear');
142138

143139
texture.set(textureResult);
144140
});

0 commit comments

Comments
 (0)