@@ -2,7 +2,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component, computed, i
2
2
import { Meta } from '@storybook/angular' ;
3
3
import { injectGLTF } from 'angular-three-soba/loaders' ;
4
4
import { NgtsNormalTexture , NgtsNormalTextureOptions } from 'angular-three-soba/staging' ;
5
- import { Mesh , Vector2 } from 'three' ;
5
+ import { Mesh , SRGBColorSpace , Texture , Vector2 } from 'three' ;
6
6
import { GLTF } from 'three-stdlib' ;
7
7
import { storyDecorators , storyObject } from '../setup-canvas' ;
8
8
@@ -15,14 +15,15 @@ interface SuzyGLTF extends GLTF {
15
15
template : `
16
16
@if (gltf(); as gltf) {
17
17
<ngt-mesh [geometry]="gltf.nodes.Suzanne.geometry">
18
- <ngt-mesh-standard-material
19
- *normalTexture="options(); let texture"
20
- color="darkmagenta"
21
- [normalMap]="texture()"
22
- [normalScale]="normalScale()"
23
- [roughness]="0.9"
24
- [metalness]="0.1"
25
- />
18
+ <ng-template [normalTexture]="options()" (normalTextureLoaded)="onLoaded($event[0])" let-texture>
19
+ <ngt-mesh-standard-material
20
+ color="darkmagenta"
21
+ [normalMap]="texture()"
22
+ [normalScale]="normalScale()"
23
+ [roughness]="0.9"
24
+ [metalness]="0.1"
25
+ />
26
+ </ng-template>
26
27
</ngt-mesh>
27
28
}
28
29
` ,
@@ -39,6 +40,10 @@ class DefaultNormalTextureStory {
39
40
if ( ! repeat ) return undefined ;
40
41
return new Vector2 ( ) . fromArray ( repeat ) ;
41
42
} ) ;
43
+
44
+ onLoaded ( texture : Texture ) {
45
+ texture . colorSpace = SRGBColorSpace ;
46
+ }
42
47
}
43
48
44
49
export default {
0 commit comments