Skip to content

Commit 4839104

Browse files
committed
update stories
1 parent d635dee commit 4839104

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

apps/astro-docs/src/content/docs/core/testing/test-bed.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ngtTestBed.canvas; // the mocked HTMLCanvasElement
1919
ngtTestBed.destroy; // method to destroy the fixture
2020
ngtTestBed.fireEvent; // method to fire events on an element in the scene graph
2121
ngtTestBed.advance; // method to advance the animation loop manually per frame
22+
ngtTestBed.toGraph; // method to convert the scene graph to a simple object
2223
```
2324

2425

libs/soba/src/materials/mesh-refraction-materials.stories.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ import {
1212
import {
1313
NgtsAccumulativeShadows,
1414
NgtsCaustics,
15+
NgtsCausticsOptions,
1516
NgtsEnvironment,
1617
NgtsRandomizedLights,
1718
} from 'angular-three-soba/staging';
1819
import { RGBELoader } from 'three-stdlib';
1920
import { makeDecorators, makeStoryObject } from '../setup-canvas';
2021

22+
injectLoader.preload(
23+
() => RGBELoader,
24+
() => 'https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/aerodynamics_workshop_1k.hdr',
25+
);
26+
2127
@Component({
2228
selector: 'diamond-flat',
2329
standalone: true,
@@ -28,13 +34,13 @@ import { makeDecorators, makeStoryObject } from '../setup-canvas';
2834
@if (gltf(); as gltf) {
2935
<ngts-caustics
3036
[options]="{
31-
backfaces: true,
37+
backside: true,
3238
color: 'white',
3339
position: [0, -0.5, 0],
34-
lightSource: [5, 5, -10],
40+
lightSource: lightSource(),
3541
worldRadius: 0.1,
3642
ior: 1.8,
37-
backfaceIor: 1.1,
43+
backsideIOR: 1.1,
3844
intensity: 0.1,
3945
}"
4046
>
@@ -59,6 +65,7 @@ import { makeDecorators, makeStoryObject } from '../setup-canvas';
5965
class Diamond {
6066
rotation = input([0, 0, 0]);
6167
position = input([0, 0, 0]);
68+
lightSource = input<NgtsCausticsOptions['lightSource']>();
6269
options = input({} as NgtsMeshRefractionMaterialOptions);
6370

6471
gltf = injectGLTF(() => './dflat.glb') as Signal<any | null>;
@@ -75,7 +82,12 @@ class Diamond {
7582
<ngt-spot-light #spotLight [position]="[5, 5, -10]" [angle]="0.15" [penumbra]="1" />
7683
<ngt-point-light [position]="[-10, -10, -10]" />
7784
78-
<diamond-flat [rotation]="[0, 0, 0.715]" [position]="[0, -0.175 + 0.5, 0]" [options]="options()" />
85+
<diamond-flat
86+
[lightSource]="spotLight"
87+
[rotation]="[0, 0, 0.715]"
88+
[position]="[0, -0.175 + 0.5, 0]"
89+
[options]="options()"
90+
/>
7991
8092
<ngts-caustics
8193
[options]="{

libs/soba/src/staging/caustics.stories.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ import { makeDecorators, makeStoryFunction } from '../setup-canvas';
3939
4040
<ngts-caustics
4141
[options]="{
42-
backfaces: true,
42+
backside: true,
4343
color,
4444
focus: [0, -1.2, 0],
4545
lightSource: [-1.2, 3, -2],
4646
intensity: 0.003,
4747
worldRadius: 0.26 / 10,
4848
ior: 0.9,
49-
backfaceIor: 1.26,
49+
backsideIOR: 1.26,
5050
}"
5151
>
5252
<ngt-mesh [castShadow]="true" [receiveShadow]="true" [geometry]="gltf.nodes.glass.geometry">
@@ -94,15 +94,7 @@ class Scene {
9494
selector: 'caustics-env',
9595
standalone: true,
9696
template: `
97-
<ngts-environment
98-
[options]="{
99-
frames: Infinity,
100-
preset: 'city',
101-
resolution: 256,
102-
background: true,
103-
blur: 0.8,
104-
}"
105-
>
97+
<ngts-environment [options]="{ frames: Infinity, preset: 'city', resolution: 256, background: true, blur: 0.8 }">
10698
<ng-template>
10799
<ngts-lightformer
108100
[options]="{ intensity: 4, rotation: [Math.PI / 2, 0, 0], position: [0, 5, -9], scale: [10, 10, 1] }"

0 commit comments

Comments
 (0)