1
- import { ChangeDetectionStrategy , Component , computed , CUSTOM_ELEMENTS_SCHEMA , input , signal } from '@angular/core' ;
1
+ import { ChangeDetectionStrategy , Component , computed , CUSTOM_ELEMENTS_SCHEMA , input } from '@angular/core' ;
2
2
import { injectLoader , NgtArgs } from 'angular-three' ;
3
3
import { NgtsText3D } from 'angular-three-soba/abstractions' ;
4
4
import { NgtsOrbitControls } from 'angular-three-soba/controls' ;
@@ -13,15 +13,8 @@ import {
13
13
NgtsRandomizedLights ,
14
14
} from 'angular-three-soba/staging' ;
15
15
import { RGBELoader } from 'three-stdlib' ;
16
+ import { Tweaks } from './tweaks' ;
16
17
17
- import {
18
- NgtTweakCheckbox ,
19
- NgtTweakColor ,
20
- NgtTweakFolder ,
21
- NgtTweakNumber ,
22
- NgtTweakPane ,
23
- NgtTweakText ,
24
- } from 'angular-three-tweakpane' ;
25
18
import fontGlyphs from './inter_medium.json' ;
26
19
27
20
@Component ( {
@@ -107,10 +100,7 @@ export class TextAndGrid {
107
100
( ) => 'https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/aerodynamics_workshop_1k.hdr' ,
108
101
) ;
109
102
110
- protected materialOptions = computed ( ( ) => ( {
111
- ...this . config ( ) ,
112
- background : this . texture ( ) ,
113
- } ) ) ;
103
+ protected materialOptions = computed ( ( ) => ( { ...this . config ( ) , background : this . texture ( ) } ) ) ;
114
104
115
105
protected readonly Math = Math ;
116
106
}
@@ -119,11 +109,11 @@ export class TextAndGrid {
119
109
selector : 'app-scene-graph' ,
120
110
template : `
121
111
<ngt-color *args="['#f0f0f0']" attach="background" />
122
- <app-text-and-grid [text]="text()" [config]="materialConfig()" />
112
+ <app-text-and-grid [text]="tweaks. text()" [config]="tweaks. materialConfig()" />
123
113
124
114
<ngts-orbit-controls
125
115
[options]="{
126
- autoRotate: autoRotate(),
116
+ autoRotate: tweaks. autoRotate(),
127
117
autoRotateSpeed: -0.1,
128
118
zoomSpeed: 0.25,
129
119
minZoom: 40,
@@ -184,7 +174,7 @@ export class TextAndGrid {
184
174
[options]="{
185
175
temporal: false,
186
176
frames: 100,
187
- color: shadow(),
177
+ color: tweaks. shadow(),
188
178
colorBlend: 5,
189
179
toneMapped: true,
190
180
alphaTest: 0.9,
@@ -207,53 +197,7 @@ export class TextAndGrid {
207
197
/>
208
198
</ngts-accumulative-shadows>
209
199
210
- <ngt-tweak-pane title="Epoxy Resin" left="8px">
211
- <ngt-tweak-text [(value)]="text" label="text" />
212
- <ngt-tweak-color [(value)]="shadow" label="Shadow Color" />
213
- <ngt-tweak-checkbox [(value)]="autoRotate" label="Auto Rotate" />
214
- <ngt-tweak-folder title="Text Material">
215
- <ngt-tweak-checkbox [(value)]="backside" label="Backside" />
216
- <ngt-tweak-number
217
- [(value)]="backsideThickness"
218
- label="Backside Thickness"
219
- [params]="{ min: 0, max: 2 }"
220
- />
221
- <ngt-tweak-number [(value)]="samples" label="Samples" [params]="{ min: 1, max: 32, step: 1 }" />
222
- <ngt-tweak-number
223
- [(value)]="resolution"
224
- label="Resolution"
225
- [params]="{ min: 64, max: 2048, step: 64 }"
226
- />
227
- <ngt-tweak-number [(value)]="transmission" label="Transmission" [params]="{ min: 0, max: 1 }" />
228
- <ngt-tweak-number [(value)]="clearcoat" label="Clearcoat" [params]="{ min: 0.1, max: 1 }" />
229
- <ngt-tweak-number
230
- [(value)]="clearcoatRoughness"
231
- label="Clearcoat Roughness"
232
- [params]="{ min: 0, max: 1 }"
233
- />
234
- <ngt-tweak-number [(value)]="thickness" label="Thickness" [params]="{ min: 0, max: 5 }" />
235
- <ngt-tweak-number
236
- [(value)]="chromaticAberration"
237
- label="Chromatic Aberration"
238
- [params]="{ min: 0, max: 5 }"
239
- />
240
- <ngt-tweak-number [(value)]="anisotropy" label="Anisotropy" [params]="{ min: 0, max: 1, step: 0.01 }" />
241
- <ngt-tweak-number [(value)]="roughness" label="Roughness" [params]="{ min: 0, max: 1, step: 0.01 }" />
242
- <ngt-tweak-number [(value)]="distortion" label="Distortion" [params]="{ min: 0, max: 4, step: 0.01 }" />
243
- <ngt-tweak-number
244
- [(value)]="distortionScale"
245
- label="Distortion Scale"
246
- [params]="{ min: 0.01, max: 1, step: 0.01 }"
247
- />
248
- <ngt-tweak-number
249
- [(value)]="temporalDistortion"
250
- label="Temporal Distortion"
251
- [params]="{ min: 0, max: 1, step: 0.01 }"
252
- />
253
- <ngt-tweak-number [(value)]="ior" label="IOR" [params]="{ min: 0, max: 2, step: 0.01 }" />
254
- <ngt-tweak-color [(value)]="color" label="Color" />
255
- </ngt-tweak-folder>
256
- </ngt-tweak-pane>
200
+ <app-tweaks #tweaks />
257
201
` ,
258
202
schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
259
203
changeDetection : ChangeDetectionStrategy . OnPush ,
@@ -265,53 +209,9 @@ export class TextAndGrid {
265
209
NgtsLightformer ,
266
210
NgtsAccumulativeShadows ,
267
211
NgtsRandomizedLights ,
268
- NgtTweakPane ,
269
- NgtTweakText ,
270
- NgtTweakFolder ,
271
- NgtTweakCheckbox ,
272
- NgtTweakNumber ,
273
- NgtTweakColor ,
212
+ Tweaks ,
274
213
] ,
275
214
} )
276
215
export class SceneGraph {
277
216
protected readonly Math = Math ;
278
-
279
- protected text = signal ( 'Angular' ) ;
280
- protected backside = signal ( true ) ;
281
- protected backsideThickness = signal ( 0.3 ) ;
282
- protected samples = signal ( 16 ) ;
283
- protected resolution = signal ( 1024 ) ;
284
- protected transmission = signal ( 1 ) ;
285
- protected clearcoat = signal ( 0 ) ;
286
- protected clearcoatRoughness = signal ( 0.0 ) ;
287
- protected thickness = signal ( 0.3 ) ;
288
- protected chromaticAberration = signal ( 5 ) ;
289
- protected anisotropy = signal ( 0.3 ) ;
290
- protected roughness = signal ( 0 ) ;
291
- protected distortion = signal ( 0.5 ) ;
292
- protected distortionScale = signal ( 0.1 ) ;
293
- protected temporalDistortion = signal ( 0 ) ;
294
- protected ior = signal ( 1.5 ) ;
295
- protected color = signal ( '#ff9cf5' ) ;
296
- protected shadow = signal ( '#750d57' ) ;
297
- protected autoRotate = signal ( false ) ;
298
-
299
- protected materialConfig = computed ( ( ) => ( {
300
- color : this . color ( ) ,
301
- roughness : this . roughness ( ) ,
302
- transmission : this . transmission ( ) ,
303
- thickness : this . thickness ( ) ,
304
- ior : this . ior ( ) ,
305
- clearcoat : this . clearcoat ( ) ,
306
- clearcoatRoughness : this . clearcoatRoughness ( ) ,
307
- anisotropy : this . anisotropy ( ) ,
308
- chromaticAberration : this . chromaticAberration ( ) ,
309
- distortion : this . distortion ( ) ,
310
- distortionScale : this . distortionScale ( ) ,
311
- temporalDistortion : this . temporalDistortion ( ) ,
312
- backside : this . backside ( ) ,
313
- backsideThickness : this . backsideThickness ( ) ,
314
- samples : this . samples ( ) ,
315
- resolution : this . resolution ( ) ,
316
- } ) ) ;
317
217
}
0 commit comments