Skip to content

Commit 0964536

Browse files
committed
docs(soba): adjust matcap and normal texture stories
1 parent 698e275 commit 0964536

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

libs/soba/src/staging/matcap-texture.stories.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Meta } from '@storybook/angular';
33
import { NgtArgs } from 'angular-three';
44
import { injectGLTF } from 'angular-three-soba/loaders';
55
import { NgtsMatcapTexture, NgtsMatcapTextureOptions } from 'angular-three-soba/staging';
6-
import { Mesh } from 'three';
6+
import { Mesh, SRGBColorSpace, Texture } from 'three';
77
import { GLTF } from 'three-stdlib';
88
import { number, storyDecorators, storyObject } from '../setup-canvas';
99

@@ -18,7 +18,9 @@ interface SuzyGLTF extends GLTF {
1818
1919
@if (gltf(); as gltf) {
2020
<ngt-mesh [geometry]="gltf.nodes.Suzanne.geometry">
21-
<ngt-mesh-matcap-material *matcapTexture="options(); let texture" [matcap]="texture()" />
21+
<ng-template [matcapTexture]="options()" (matcapTextureLoaded)="onLoaded($event[0])" let-texture>
22+
<ngt-mesh-matcap-material [matcap]="texture()" />
23+
</ng-template>
2224
</ngt-mesh>
2325
}
2426
`,
@@ -29,6 +31,10 @@ interface SuzyGLTF extends GLTF {
2931
class DefaultMatcapTextureStory {
3032
options = input<NgtsMatcapTextureOptions>();
3133
gltf = injectGLTF<SuzyGLTF>(() => './suzanne.glb', { useDraco: true });
34+
35+
onLoaded(texture: Texture) {
36+
texture.colorSpace = SRGBColorSpace;
37+
}
3238
}
3339

3440
export default {

libs/soba/src/staging/normal-texture.stories.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component, computed, i
22
import { Meta } from '@storybook/angular';
33
import { injectGLTF } from 'angular-three-soba/loaders';
44
import { NgtsNormalTexture, NgtsNormalTextureOptions } from 'angular-three-soba/staging';
5-
import { Mesh, Vector2 } from 'three';
5+
import { Mesh, SRGBColorSpace, Texture, Vector2 } from 'three';
66
import { GLTF } from 'three-stdlib';
77
import { storyDecorators, storyObject } from '../setup-canvas';
88

@@ -15,14 +15,15 @@ interface SuzyGLTF extends GLTF {
1515
template: `
1616
@if (gltf(); as gltf) {
1717
<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>
2627
</ngt-mesh>
2728
}
2829
`,
@@ -39,6 +40,10 @@ class DefaultNormalTextureStory {
3940
if (!repeat) return undefined;
4041
return new Vector2().fromArray(repeat);
4142
});
43+
44+
onLoaded(texture: Texture) {
45+
texture.colorSpace = SRGBColorSpace;
46+
}
4247
}
4348

4449
export default {

0 commit comments

Comments
 (0)