Skip to content

Commit 54f2a3e

Browse files
committed
feat(tweakpane): tweakpane v1
wip tweakpane
1 parent 16e314c commit 54f2a3e

35 files changed

+974
-241
lines changed
Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,15 @@
11
import { ChangeDetectionStrategy, Component } from '@angular/core';
22
import { NgtCanvas } from 'angular-three/dom';
3-
import { SceneGraph, bloom, glitch, selectedAction } from './scene';
3+
import { SceneGraph } from './scene';
44

55
@Component({
66
template: `
77
<ngt-canvas [camera]="{ fov: 75, position: [0, 0, 3] }" shadows>
88
<app-basic-scene-graph *canvasContent />
99
</ngt-canvas>
10-
<div class="absolute top-0 right-0 flex flex-col">
11-
<select [value]="selectedAction()" #select (change)="selectedAction.set(select.value)">
12-
<option>Strut</option>
13-
<option>Dance</option>
14-
<option>Idle</option>
15-
</select>
16-
17-
<div class="text-white">
18-
<label for="bloom">Bloom</label>
19-
<input
20-
id="bloom"
21-
type="checkbox"
22-
#bloomInput
23-
[checked]="bloom()"
24-
(change)="bloom.set(bloomInput.checked)"
25-
/>
26-
</div>
27-
28-
<div class="text-white">
29-
<label for="glitch">Glitch</label>
30-
<input
31-
id="glitch"
32-
type="checkbox"
33-
#glitchInput
34-
[checked]="glitch()"
35-
(change)="glitch.set(glitchInput.checked)"
36-
/>
37-
</div>
38-
</div>
3910
`,
4011
changeDetection: ChangeDetectionStrategy.OnPush,
4112
imports: [NgtCanvas, SceneGraph],
4213
host: { class: 'basic-soba' },
4314
})
44-
export default class Basic {
45-
protected selectedAction = selectedAction;
46-
protected bloom = bloom;
47-
protected glitch = glitch;
48-
}
15+
export default class Basic {}

apps/examples/src/app/soba/basic/scene.ts

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ import { NgtsOrbitControls } from 'angular-three-soba/controls';
1717
import { injectGLTF } from 'angular-three-soba/loaders';
1818
import { NgtsAnimation, injectAnimations } from 'angular-three-soba/misc';
1919
import { injectMatcapTexture } from 'angular-three-soba/staging';
20+
import {
21+
NgtTweakCheckbox,
22+
NgtTweakColor,
23+
NgtTweakFolder,
24+
NgtTweakList,
25+
NgtTweakNumber,
26+
NgtTweakPane,
27+
} from 'angular-three-tweakpane';
2028
import { Bone, Group, MeshStandardMaterial, Object3D, SRGBColorSpace, SkinnedMesh } from 'three';
2129
import { GLTF } from 'three-stdlib';
2230

@@ -105,7 +113,7 @@ export class Bot {
105113
@Component({
106114
selector: 'app-basic-scene-graph',
107115
template: `
108-
<ngt-color *args="['#303030']" attach="background" />
116+
<ngt-color *args="[backgroundColor()]" attach="background" />
109117
<ngt-ambient-light [intensity]="0.8" />
110118
<ngt-point-light [intensity]="Math.PI" [decay]="0" [position]="[0, 6, 0]" />
111119
@@ -115,7 +123,12 @@ export class Bot {
115123
<ngtp-effect-composer>
116124
@if (bloom()) {
117125
<ngtp-bloom
118-
[options]="{ kernelSize: 3, luminanceThreshold: 0, luminanceSmoothing: 0.4, intensity: 1.5 }"
126+
[options]="{
127+
kernelSize: 3,
128+
luminanceThreshold: luminanceThreshold(),
129+
luminanceSmoothing: luminanceSmoothing(),
130+
intensity: intensity(),
131+
}"
119132
/>
120133
}
121134
@@ -126,8 +139,48 @@ export class Bot {
126139
127140
<ngts-orbit-controls [options]="{ makeDefault: true, autoRotate: true }" />
128141
}
142+
143+
<ngt-tweak-pane title="Soba Basic">
144+
<ngt-tweak-folder title="Bloom">
145+
<ngt-tweak-checkbox [(value)]="bloom" label="Enabled" />
146+
<ngt-tweak-number
147+
[(value)]="luminanceThreshold"
148+
label="luminanceThreshold"
149+
[params]="{ min: 0, max: 1, step: 0.01 }"
150+
/>
151+
<ngt-tweak-number
152+
[(value)]="luminanceSmoothing"
153+
label="luminanceSmoothing"
154+
[params]="{ min: 0, max: 1, step: 0.01 }"
155+
/>
156+
<ngt-tweak-number
157+
[(value)]="intensity"
158+
label="bloomIntensity"
159+
[params]="{ min: 0, max: 10, step: 0.5 }"
160+
/>
161+
</ngt-tweak-folder>
162+
<ngt-tweak-folder title="Glitch">
163+
<ngt-tweak-checkbox [(value)]="glitch" label="Enabled" />
164+
</ngt-tweak-folder>
165+
166+
<ngt-tweak-list [(value)]="selectedAction" [options]="['Strut', 'Dance', 'Idle']" label="Animation" />
167+
<ngt-tweak-color [(value)]="backgroundColor" label="Background" />
168+
</ngt-tweak-pane>
129169
`,
130-
imports: [NgtsOrbitControls, NgtArgs, Bot, NgtpEffectComposer, NgtpBloom, NgtpGlitch],
170+
imports: [
171+
NgtsOrbitControls,
172+
NgtArgs,
173+
Bot,
174+
NgtpEffectComposer,
175+
NgtpBloom,
176+
NgtpGlitch,
177+
NgtTweakPane,
178+
NgtTweakFolder,
179+
NgtTweakCheckbox,
180+
NgtTweakList,
181+
NgtTweakColor,
182+
NgtTweakNumber,
183+
],
131184
changeDetection: ChangeDetectionStrategy.OnPush,
132185
schemas: [CUSTOM_ELEMENTS_SCHEMA],
133186
host: { class: 'soba-experience' },
@@ -136,6 +189,13 @@ export class SceneGraph {
136189
protected Math = Math;
137190
protected bloom = bloom;
138191
protected glitch = glitch;
192+
protected selectedAction = selectedAction;
193+
194+
protected backgroundColor = signal('#303030');
195+
196+
protected luminanceThreshold = signal(0);
197+
protected luminanceSmoothing = signal(0.4);
198+
protected intensity = signal(1.5);
139199

140200
asRenderTexture = input(false);
141201
}

cz.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ module.exports = {
1919
],
2020
scopes: [
2121
{ name: 'core' },
22+
{ name: 'tweakpane' },
2223
{ name: 'soba' },
2324
{ name: 'cannon' },
2425
{ name: 'postprocessing' },
2526
{ name: 'plugin' },
26-
{ name: 'docs' },
27-
{ name: 'testing' },
2827
],
2928
};

0 commit comments

Comments
 (0)