Skip to content

Commit fb7f24b

Browse files
committed
docs(soba): adjust lightings on some stories
1 parent 3f847ef commit fb7f24b

5 files changed

+15
-9
lines changed

Diff for: libs/soba/src/setup-canvas.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export function makeCanvasOptions(options: DeepPartial<CanvasOptions> = {}) {
222222
export function makeStoryFunction(story: Type<unknown>, canvasOptions: DeepPartial<CanvasOptions> = {}) {
223223
return (args: Args) => ({
224224
props: { options: makeCanvasOptions(canvasOptions), inputs: args || {}, story },
225-
template: `<storybook-setup [story]="story" [inputs]="inputs" [options]="options" />`,
225+
template: `<storybook-setup [story]="story" [inputs]="inputs" [options]="options" />`,
226226
});
227227
}
228228

Diff for: libs/soba/src/shaders/mesh-distort-material.stories.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { injectBeforeRender, injectNgtRef, NgtArgs } from 'angular-three';
55
import distortShader from 'angular-three-soba/assets/distort.vert.glsl';
66
import { NgtsMeshDistortMaterial } from 'angular-three-soba/materials';
77
import { provideNgtsMeshDistortMaterialShader, type MeshDistortMaterial } from 'angular-three-soba/shaders';
8-
import { makeDecorators, makeStoryFunction, makeStoryObject, number } from '../setup-canvas';
8+
import { makeCanvasOptions, makeDecorators, makeStoryFunction, makeStoryObject, number } from '../setup-canvas';
99

1010
@Component({
1111
standalone: true,
@@ -52,12 +52,15 @@ export default {
5252
decorators: makeDecorators([provideNgtsMeshDistortMaterialShader(distortShader)]),
5353
};
5454

55+
const canvasOptions = makeCanvasOptions({ useLegacyLights: true });
56+
5557
export const Default = makeStoryObject(DefaultMeshDistortMaterialStory, {
58+
canvasOptions,
5659
argsOptions: {
5760
speed: number(1, { range: true, max: 10, step: 0.1 }),
5861
distort: number(0.6, { range: true, max: 1, step: 0.1 }),
5962
radius: number(1, { range: true, max: 1, step: 0.1 }),
6063
},
6164
});
6265

63-
export const Ref = makeStoryFunction(RefMeshDistortMaterialStory);
66+
export const Ref = makeStoryFunction(RefMeshDistortMaterialStory, canvasOptions);

Diff for: libs/soba/src/shaders/mesh-reflector-material.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { injectNgtsTextureLoader } from 'angular-three-soba/loaders';
55
import { NgtsMeshReflectorMaterial } from 'angular-three-soba/materials';
66
import { NgtsEnvironment } from 'angular-three-soba/staging';
77
import * as THREE from 'three';
8-
import { makeDecorators, makeStoryFunction } from '../setup-canvas';
8+
import { makeCanvasOptions, makeDecorators, makeStoryFunction } from '../setup-canvas';
99

1010
interface State {
1111
blur: [number, number];
@@ -180,7 +180,7 @@ export default {
180180
decorators: makeDecorators(),
181181
};
182182

183-
const canvasOptions = { camera: { fov: 20, position: [-6, 6, 15] } };
183+
const canvasOptions = makeCanvasOptions({ camera: { fov: 20, position: [-6, 6, 15] }, useLegacyLights: true });
184184

185185
export const Default = makeStoryFunction(DefaultMeshReflectorMaterialStory, canvasOptions);
186186
export const Plain = makeStoryFunction(PlainMeshReflectorMaterialStory, canvasOptions);

Diff for: libs/soba/src/shaders/mesh-wobble-material.stories.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';
22
import { injectBeforeRender, injectNgtRef, NgtArgs } from 'angular-three';
33
import { NgtsMeshWobbleMaterial } from 'angular-three-soba/materials';
44
import { MeshWobbleMaterial } from 'angular-three-soba/shaders';
5-
import { makeDecorators, makeStoryFunction, makeStoryObject, number } from '../setup-canvas';
5+
import { makeCanvasOptions, makeDecorators, makeStoryFunction, makeStoryObject, number } from '../setup-canvas';
66

77
@Component({
88
standalone: true,
@@ -50,11 +50,14 @@ export default {
5050
decorators: makeDecorators(),
5151
};
5252

53+
const canvasOptions = makeCanvasOptions({ useLegacyLights: true });
54+
5355
export const Default = makeStoryObject(DefaultMeshWobbleMaterialStory, {
56+
canvasOptions,
5457
argsOptions: {
5558
speed: number(1, { range: true, max: 10, step: 0.1 }),
5659
factor: number(0.6, { range: true, max: 1, step: 0.1 }),
5760
},
5861
});
5962

60-
export const Ref = makeStoryFunction(RefMeshWobbleMaterialStory);
63+
export const Ref = makeStoryFunction(RefMeshWobbleMaterialStory, canvasOptions);

Diff for: libs/soba/src/staging/bounds.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class Models {
7373
template: `
7474
<ngt-color *args="['pink']" attach="background" />
7575
76-
<ngt-spot-light [position]="-100" [intensity]="0.2" [angle]="0.3" [penumbra]="1" />
77-
<ngt-hemisphere-light color="white" groundColor="#ff0f00" [position]="[-7, 25, 13]" [intensity]="1" />
76+
<ngt-spot-light [position]="-100" [intensity]="0.2 * Math.PI" [angle]="0.3" [penumbra]="1" />
77+
<ngt-hemisphere-light color="white" groundColor="#ff0f00" [position]="[-7, 25, 13]" [intensity]="Math.PI" />
7878
7979
<ngts-bounds>
8080
<bounds-models />

0 commit comments

Comments
 (0)