angular-three-soba 1.4.0 → 1.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/abstractions/index.d.ts +4 -0
  2. package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +15 -0
  3. package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +15 -0
  4. package/abstractions/lib/line/line-input.d.ts +19 -0
  5. package/abstractions/lib/line/line.d.ts +21 -0
  6. package/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.d.ts +19 -0
  7. package/abstractions/lib/text/text.d.ts +1 -1
  8. package/esm2020/abstractions/index.mjs +5 -1
  9. package/esm2020/abstractions/lib/billboard/billboard.mjs +6 -5
  10. package/esm2020/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +119 -0
  11. package/esm2020/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +98 -0
  12. package/esm2020/abstractions/lib/gizmo-helper/gizmo-helper.mjs +6 -6
  13. package/esm2020/abstractions/lib/line/line-input.mjs +75 -0
  14. package/esm2020/abstractions/lib/line/line.mjs +136 -0
  15. package/esm2020/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +127 -0
  16. package/esm2020/abstractions/lib/text/text.mjs +28 -26
  17. package/esm2020/cameras/lib/orthographic-camera/orthographic-camera.mjs +6 -6
  18. package/esm2020/cameras/lib/perspective-camera/perspective-camera.mjs +6 -6
  19. package/esm2020/performance/lib/detailed/detailed.mjs +6 -5
  20. package/esm2020/staging/lib/accumulative-shadows/accumulative-shadows.mjs +8 -8
  21. package/esm2020/staging/lib/accumulative-shadows/randomized-lights.mjs +6 -6
  22. package/esm2020/staging/lib/bounds/bounds.mjs +6 -5
  23. package/esm2020/staging/lib/center/center.mjs +10 -9
  24. package/esm2020/staging/lib/cloud/cloud.mjs +6 -6
  25. package/esm2020/staging/lib/contact-shadows/contact-shadows.mjs +14 -10
  26. package/esm2020/staging/lib/environment/environment-portal.mjs +10 -6
  27. package/esm2020/staging/lib/float/float.mjs +6 -5
  28. package/esm2020/staging/lib/sky/sky.mjs +23 -22
  29. package/esm2020/staging/lib/sparkles/sparkles.mjs +8 -8
  30. package/esm2020/staging/lib/stage/stage.mjs +2 -5
  31. package/esm2020/staging/lib/stars/stars.mjs +6 -6
  32. package/fesm2015/angular-three-soba-abstractions.mjs +564 -38
  33. package/fesm2015/angular-three-soba-abstractions.mjs.map +1 -1
  34. package/fesm2015/angular-three-soba-cameras.mjs +9 -9
  35. package/fesm2015/angular-three-soba-cameras.mjs.map +1 -1
  36. package/fesm2015/angular-three-soba-performance.mjs +5 -4
  37. package/fesm2015/angular-three-soba-performance.mjs.map +1 -1
  38. package/fesm2015/angular-three-soba-staging.mjs +83 -74
  39. package/fesm2015/angular-three-soba-staging.mjs.map +1 -1
  40. package/fesm2020/angular-three-soba-abstractions.mjs +564 -38
  41. package/fesm2020/angular-three-soba-abstractions.mjs.map +1 -1
  42. package/fesm2020/angular-three-soba-cameras.mjs +9 -9
  43. package/fesm2020/angular-three-soba-cameras.mjs.map +1 -1
  44. package/fesm2020/angular-three-soba-performance.mjs +5 -4
  45. package/fesm2020/angular-three-soba-performance.mjs.map +1 -1
  46. package/fesm2020/angular-three-soba-staging.mjs +83 -74
  47. package/fesm2020/angular-three-soba-staging.mjs.map +1 -1
  48. package/package.json +3 -3
  49. package/plugin/package.json +1 -1
  50. package/staging/lib/sky/sky.d.ts +2 -3
  51. package/staging/lib/stage/stage.d.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, InjectionToken, inject, Directive, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
- import { extend, NgtRxStore, injectNgtRef, NgtStore, NgtPortal, NgtPortalContent, NgtArgs, NgtRepeat, startWithUndefined, NgtPush } from 'angular-three';
2
+ import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, Directive, inject, InjectionToken, EventEmitter, TemplateRef, Output, ContentChild } from '@angular/core';
3
+ import { extend, NgtRxStore, injectNgtRef, NgtRef, NgtStore, startWithUndefined, NgtArgs, NgtPortal, NgtPortalContent, NgtRepeat, NgtPush } from 'angular-three';
4
4
  import * as THREE from 'three';
5
- import { Group, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
- import { NgTemplateOutlet, DOCUMENT, NgFor, NgIf } from '@angular/common';
5
+ import { Group, CatmullRomCurve3, Vector3, Quaternion, Object3D, Matrix4, Mesh, BoxGeometry, MeshBasicMaterial, MeshLambertMaterial, CanvasTexture, AmbientLight, PointLight, Sprite, SpriteMaterial } from 'three';
6
+ import { combineLatest, map, switchMap, of } from 'rxjs';
7
+ import { LineMaterial, LineSegmentsGeometry, LineGeometry, LineSegments2, Line2, TextGeometry, FontLoader } from 'three-stdlib';
8
+ import { NgIf, NgTemplateOutlet, DOCUMENT, NgFor } from '@angular/common';
7
9
  import { selectSlice } from '@rx-angular/state';
8
10
  import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';
9
- import { combineLatest, map, switchMap, of } from 'rxjs';
10
- import { TextGeometry, FontLoader } from 'three-stdlib';
11
11
  import { RxActionFactory } from '@rx-angular/state/actions';
12
12
  import { Text, preloadFont } from 'troika-three-text';
13
13
 
@@ -52,20 +52,21 @@ class NgtsBillboard extends NgtRxStore {
52
52
  }
53
53
  NgtsBillboard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, deps: null, target: i0.ɵɵFactoryTarget.Component });
54
54
  NgtsBillboard.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsBillboard, isStandalone: true, selector: "ngts-billboard", inputs: { billboardRef: "billboardRef", follow: "follow", lockX: "lockX", lockY: "lockY", lockZ: "lockZ" }, usesInheritance: true, ngImport: i0, template: `
55
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
55
+ <ngt-group ngtCompound *ref="billboardRef" (beforeRender)="onBeforeRender($any($event))">
56
56
  <ng-content />
57
57
  </ngt-group>
58
- `, isInline: true });
58
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
59
59
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsBillboard, decorators: [{
60
60
  type: Component,
61
61
  args: [{
62
62
  selector: 'ngts-billboard',
63
63
  standalone: true,
64
64
  template: `
65
- <ngt-group ngtCompound [ref]="billboardRef" (beforeRender)="onBeforeRender($any($event))">
65
+ <ngt-group ngtCompound *ref="billboardRef" (beforeRender)="onBeforeRender($any($event))">
66
66
  <ng-content />
67
67
  </ngt-group>
68
68
  `,
69
+ imports: [NgtRef],
69
70
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
70
71
  }]
71
72
  }], propDecorators: { billboardRef: [{
@@ -80,6 +81,409 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
80
81
  type: Input
81
82
  }] } });
82
83
 
84
+ class NgtsLineInput extends NgtRxStore {
85
+ set vertexColors(vertexColors) {
86
+ this.set({ vertexColors });
87
+ }
88
+ set lineWidth(lineWidth) {
89
+ this.set({ lineWidth });
90
+ }
91
+ set alphaToCoverage(alphaToCoverage) {
92
+ this.set({ alphaToCoverage });
93
+ }
94
+ set color(color) {
95
+ this.set({ color });
96
+ }
97
+ set dashed(dashed) {
98
+ this.set({ dashed });
99
+ }
100
+ set dashScale(dashScale) {
101
+ this.set({ dashScale });
102
+ }
103
+ set dashSize(dashSize) {
104
+ this.set({ dashSize });
105
+ }
106
+ set dashOffset(dashOffset) {
107
+ this.set({ dashOffset });
108
+ }
109
+ set gapSize(gapSize) {
110
+ this.set({ gapSize });
111
+ }
112
+ set resolution(resolution) {
113
+ this.set({ resolution });
114
+ }
115
+ set wireframe(wireframe) {
116
+ this.set({ wireframe });
117
+ }
118
+ set worldUnits(worldUnits) {
119
+ this.set({ worldUnits });
120
+ }
121
+ initialize() {
122
+ super.initialize();
123
+ this.set({ color: 'black' });
124
+ }
125
+ }
126
+ NgtsLineInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, deps: null, target: i0.ɵɵFactoryTarget.Directive });
127
+ NgtsLineInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLineInput, inputs: { vertexColors: "vertexColors", lineWidth: "lineWidth", alphaToCoverage: "alphaToCoverage", color: "color", dashed: "dashed", dashScale: "dashScale", dashSize: "dashSize", dashOffset: "dashOffset", gapSize: "gapSize", resolution: "resolution", wireframe: "wireframe", worldUnits: "worldUnits" }, usesInheritance: true, ngImport: i0 });
128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLineInput, decorators: [{
129
+ type: Directive
130
+ }], propDecorators: { vertexColors: [{
131
+ type: Input
132
+ }], lineWidth: [{
133
+ type: Input
134
+ }], alphaToCoverage: [{
135
+ type: Input
136
+ }], color: [{
137
+ type: Input
138
+ }], dashed: [{
139
+ type: Input
140
+ }], dashScale: [{
141
+ type: Input
142
+ }], dashSize: [{
143
+ type: Input
144
+ }], dashOffset: [{
145
+ type: Input
146
+ }], gapSize: [{
147
+ type: Input
148
+ }], resolution: [{
149
+ type: Input
150
+ }], wireframe: [{
151
+ type: Input
152
+ }], worldUnits: [{
153
+ type: Input
154
+ }] } });
155
+
156
+ class NgtsLine extends NgtsLineInput {
157
+ constructor() {
158
+ super(...arguments);
159
+ this.Boolean = Boolean;
160
+ this.lineMaterial = new LineMaterial();
161
+ this.store = inject(NgtStore);
162
+ this.line = null;
163
+ this.lineRef = injectNgtRef();
164
+ }
165
+ set points(points) {
166
+ this.set({ points });
167
+ }
168
+ set segments(segments) {
169
+ this.set({ segments });
170
+ }
171
+ onAfterAttach({ parent }) {
172
+ parent.computeLineDistances();
173
+ }
174
+ initialize() {
175
+ super.initialize();
176
+ this.set({ segments: false });
177
+ this.connect('lineGeometry', combineLatest([
178
+ this.select('points'),
179
+ this.select('segments'),
180
+ this.select('vertexColors').pipe(startWithUndefined()),
181
+ ]).pipe(map(([points, segments, vertexColors]) => {
182
+ const geometry = segments ? new LineSegmentsGeometry() : new LineGeometry();
183
+ const pValues = points.map((p) => {
184
+ const isArray = Array.isArray(p);
185
+ return p instanceof THREE.Vector3
186
+ ? [p.x, p.y, p.z]
187
+ : p instanceof THREE.Vector2
188
+ ? [p.x, p.y, 0]
189
+ : isArray && p.length === 3
190
+ ? [p[0], p[1], p[2]]
191
+ : isArray && p.length === 2
192
+ ? [p[0], p[1], 0]
193
+ : p;
194
+ });
195
+ geometry.setPositions(pValues.flat());
196
+ if (vertexColors) {
197
+ const cValues = vertexColors.map((c) => c instanceof THREE.Color ? c.toArray() : c);
198
+ geometry.setColors(cValues.flat());
199
+ }
200
+ return geometry;
201
+ })));
202
+ }
203
+ ngOnInit() {
204
+ this.connect('materialResolution', combineLatest([this.store.select('size'), this.select('resolution').pipe(startWithUndefined())]).pipe(map(([size, resolution]) => resolution ?? [size.width, size.height])));
205
+ this.line = this.get('segments') ? new LineSegments2() : new Line2();
206
+ this.disposeGeometry();
207
+ }
208
+ disposeGeometry() {
209
+ this.effect(this.select('lineGeometry'), (lineGeometry) => {
210
+ return () => lineGeometry.dispose();
211
+ });
212
+ }
213
+ }
214
+ NgtsLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
215
+ NgtsLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsLine, isStandalone: true, selector: "ngts-line[points]", inputs: { lineRef: "lineRef", points: "points", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
216
+ <ng-container *args="[line]">
217
+ <ngt-primitive *ref="lineRef" ngtCompound>
218
+ <ngt-primitive
219
+ *args="[get('lineGeometry')]"
220
+ attach="geometry"
221
+ (afterAttach)="onAfterAttach($any($event))"
222
+ />
223
+ <ngt-primitive
224
+ *args="[lineMaterial]"
225
+ attach="material"
226
+ [color]="get('color')"
227
+ [vertexColors]="Boolean(get('vertexColors'))"
228
+ [resolution]="get('materialResolution')"
229
+ [linewidth]="get('lineWidth')"
230
+ [alphaToCoverage]="get('alphaToCoverage')"
231
+ [dashed]="get('dashed')"
232
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
233
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
234
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
235
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
236
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
237
+ [worldUnits]="get('worldUnits')"
238
+ />
239
+ </ngt-primitive>
240
+ </ng-container>
241
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsLine, decorators: [{
243
+ type: Component,
244
+ args: [{
245
+ selector: 'ngts-line[points]',
246
+ standalone: true,
247
+ template: `
248
+ <ng-container *args="[line]">
249
+ <ngt-primitive *ref="lineRef" ngtCompound>
250
+ <ngt-primitive
251
+ *args="[get('lineGeometry')]"
252
+ attach="geometry"
253
+ (afterAttach)="onAfterAttach($any($event))"
254
+ />
255
+ <ngt-primitive
256
+ *args="[lineMaterial]"
257
+ attach="material"
258
+ [color]="get('color')"
259
+ [vertexColors]="Boolean(get('vertexColors'))"
260
+ [resolution]="get('materialResolution')"
261
+ [linewidth]="get('lineWidth')"
262
+ [alphaToCoverage]="get('alphaToCoverage')"
263
+ [dashed]="get('dashed')"
264
+ [dashScale]="get('dashScale') ?? lineMaterial.dashScale"
265
+ [dashSize]="get('dashSize') ?? lineMaterial.dashSize"
266
+ [dashOffset]="get('dashOffset') ?? lineMaterial.dashOffset"
267
+ [gapSize]="get('gapSize') ?? lineMaterial.gapSize"
268
+ [wireframe]="get('wireframe') ?? lineMaterial.wireframe"
269
+ [worldUnits]="get('worldUnits')"
270
+ />
271
+ </ngt-primitive>
272
+ </ng-container>
273
+ `,
274
+ imports: [NgtArgs, NgtRef],
275
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
276
+ }]
277
+ }], propDecorators: { lineRef: [{
278
+ type: Input
279
+ }], points: [{
280
+ type: Input
281
+ }], segments: [{
282
+ type: Input
283
+ }] } });
284
+
285
+ class NgtsCatmullRomLine extends NgtsLineInput {
286
+ constructor() {
287
+ super(...arguments);
288
+ this.lineRef = injectNgtRef();
289
+ }
290
+ set points(points) {
291
+ this.set({ points });
292
+ }
293
+ set closed(closed) {
294
+ this.set({ closed });
295
+ }
296
+ set curveType(curveType) {
297
+ this.set({ curveType });
298
+ }
299
+ set tension(tension) {
300
+ this.set({ tension });
301
+ }
302
+ set segments(segments) {
303
+ this.set({ segments });
304
+ }
305
+ initialize() {
306
+ super.initialize();
307
+ this.set({ closed: false, curveType: 'centripetal', tension: 0.5, segments: 64 });
308
+ this.connect('curve', combineLatest([
309
+ this.select('points'),
310
+ this.select('closed'),
311
+ this.select('curveType'),
312
+ this.select('tension'),
313
+ ]).pipe(map(([points, closed, curveType, tension]) => {
314
+ const mappedPoints = points.map((p) => p instanceof THREE.Vector3 ? p : new THREE.Vector3(...p));
315
+ return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
316
+ })));
317
+ this.connect('segmentedPoints', combineLatest([this.select('curve'), this.select('segments')]).pipe(map(([curve, segments]) => curve.getPoints(segments))));
318
+ this.connect('interpolatedVertexColors', combineLatest([this.select('vertexColors').pipe(startWithUndefined()), this.select('segments')]).pipe(map(([vertexColors, segments]) => {
319
+ if (!vertexColors || vertexColors.length < 2)
320
+ return undefined;
321
+ if (vertexColors.length === segments + 1)
322
+ return vertexColors;
323
+ const mappedColors = vertexColors.map((color) => color instanceof THREE.Color ? color : new THREE.Color(...color));
324
+ if (this.get('closed'))
325
+ mappedColors.push(mappedColors[0].clone());
326
+ const iColors = [mappedColors[0]];
327
+ const divisions = segments / (mappedColors.length - 1);
328
+ for (let i = 0; i < segments; i++) {
329
+ const alpha = (i % divisions) / divisions;
330
+ const colorIndex = Math.floor(i / divisions);
331
+ iColors.push(mappedColors[colorIndex].clone().lerp(mappedColors[colorIndex + 1], alpha));
332
+ }
333
+ iColors.push(mappedColors[mappedColors.length - 1]);
334
+ })));
335
+ }
336
+ }
337
+ NgtsCatmullRomLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
338
+ NgtsCatmullRomLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCatmullRomLine, isStandalone: true, selector: "ngts-catmull-rom-line[points]", inputs: { lineRef: "lineRef", points: "points", closed: "closed", curveType: "curveType", tension: "tension", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
339
+ <ngts-line
340
+ [lineRef]="lineRef"
341
+ [points]="get('segmentedPoints')"
342
+ [color]="get('color')"
343
+ [vertexColors]="get('interpolatedVertexColors')"
344
+ [resolution]="get('resolution')"
345
+ [lineWidth]="get('lineWidth')"
346
+ [alphaToCoverage]="get('alphaToCoverage')"
347
+ [dashed]="get('dashed')"
348
+ [dashScale]="get('dashScale')"
349
+ [dashOffset]="get('dashOffset')"
350
+ [dashSize]="get('dashSize')"
351
+ [gapSize]="get('gapSize')"
352
+ [wireframe]="get('wireframe')"
353
+ [worldUnits]="get('worldUnits')"
354
+ />
355
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCatmullRomLine, decorators: [{
357
+ type: Component,
358
+ args: [{
359
+ selector: 'ngts-catmull-rom-line[points]',
360
+ standalone: true,
361
+ template: `
362
+ <ngts-line
363
+ [lineRef]="lineRef"
364
+ [points]="get('segmentedPoints')"
365
+ [color]="get('color')"
366
+ [vertexColors]="get('interpolatedVertexColors')"
367
+ [resolution]="get('resolution')"
368
+ [lineWidth]="get('lineWidth')"
369
+ [alphaToCoverage]="get('alphaToCoverage')"
370
+ [dashed]="get('dashed')"
371
+ [dashScale]="get('dashScale')"
372
+ [dashOffset]="get('dashOffset')"
373
+ [dashSize]="get('dashSize')"
374
+ [gapSize]="get('gapSize')"
375
+ [wireframe]="get('wireframe')"
376
+ [worldUnits]="get('worldUnits')"
377
+ />
378
+ `,
379
+ imports: [NgtsLine],
380
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
381
+ }]
382
+ }], propDecorators: { lineRef: [{
383
+ type: Input
384
+ }], points: [{
385
+ type: Input
386
+ }], closed: [{
387
+ type: Input
388
+ }], curveType: [{
389
+ type: Input
390
+ }], tension: [{
391
+ type: Input
392
+ }], segments: [{
393
+ type: Input
394
+ }] } });
395
+
396
+ class NgtsCubicBezierLine extends NgtsLineInput {
397
+ constructor() {
398
+ super(...arguments);
399
+ this.lineRef = injectNgtRef();
400
+ }
401
+ set start(start) {
402
+ this.set({ start });
403
+ }
404
+ set end(end) {
405
+ this.set({ end });
406
+ }
407
+ set midA(midA) {
408
+ this.set({ midA });
409
+ }
410
+ set midB(midB) {
411
+ this.set({ midB });
412
+ }
413
+ set segments(segments) {
414
+ this.set({ segments });
415
+ }
416
+ initialize() {
417
+ super.initialize();
418
+ this.set({ segments: 10 });
419
+ this.connect('points', this.select(['start', 'end', 'midA', 'midB', 'segments'], ({ start, end, midA, midB, segments }) => {
420
+ const startV = start instanceof THREE.Vector3 ? start : new THREE.Vector3(...start);
421
+ const endV = end instanceof THREE.Vector3 ? end : new THREE.Vector3(...end);
422
+ const midAV = midA instanceof THREE.Vector3 ? midA : new THREE.Vector3(...midA);
423
+ const midBV = midB instanceof THREE.Vector3 ? midB : new THREE.Vector3(...midB);
424
+ return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
425
+ }));
426
+ }
427
+ }
428
+ NgtsCubicBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
429
+ NgtsCubicBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsCubicBezierLine, isStandalone: true, selector: "ngts-cubic-bezier-line[start][end][midA][midB]", inputs: { lineRef: "lineRef", start: "start", end: "end", midA: "midA", midB: "midB", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
430
+ <ngts-line
431
+ [lineRef]="lineRef"
432
+ [points]="get('points')"
433
+ [color]="get('color')"
434
+ [vertexColors]="get('vertexColors')"
435
+ [resolution]="get('resolution')"
436
+ [lineWidth]="get('lineWidth')"
437
+ [alphaToCoverage]="get('alphaToCoverage')"
438
+ [dashed]="get('dashed')"
439
+ [dashScale]="get('dashScale')"
440
+ [dashSize]="get('dashSize')"
441
+ [dashOffset]="get('dashOffset')"
442
+ [gapSize]="get('gapSize')"
443
+ [wireframe]="get('wireframe')"
444
+ [worldUnits]="get('worldUnits')"
445
+ />
446
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsCubicBezierLine, decorators: [{
448
+ type: Component,
449
+ args: [{
450
+ selector: 'ngts-cubic-bezier-line[start][end][midA][midB]',
451
+ standalone: true,
452
+ template: `
453
+ <ngts-line
454
+ [lineRef]="lineRef"
455
+ [points]="get('points')"
456
+ [color]="get('color')"
457
+ [vertexColors]="get('vertexColors')"
458
+ [resolution]="get('resolution')"
459
+ [lineWidth]="get('lineWidth')"
460
+ [alphaToCoverage]="get('alphaToCoverage')"
461
+ [dashed]="get('dashed')"
462
+ [dashScale]="get('dashScale')"
463
+ [dashSize]="get('dashSize')"
464
+ [dashOffset]="get('dashOffset')"
465
+ [gapSize]="get('gapSize')"
466
+ [wireframe]="get('wireframe')"
467
+ [worldUnits]="get('worldUnits')"
468
+ />
469
+ `,
470
+ imports: [NgtsLine, NgIf],
471
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
472
+ }]
473
+ }], propDecorators: { lineRef: [{
474
+ type: Input
475
+ }], start: [{
476
+ type: Input
477
+ }], end: [{
478
+ type: Input
479
+ }], midA: [{
480
+ type: Input
481
+ }], midB: [{
482
+ type: Input
483
+ }], segments: [{
484
+ type: Input
485
+ }] } });
486
+
83
487
  const isOrbitControls = (controls) => {
84
488
  return 'minPolarAngle' in controls;
85
489
  };
@@ -227,7 +631,7 @@ NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
227
631
  [position]="[0, 0, 200]"
228
632
  />
229
633
  <ngt-group
230
- [ref]="gizmoRef"
634
+ *ref="gizmoRef"
231
635
  [position]="get('gizmoPosition')"
232
636
  (beforeRender)="onBeforeRender($any($event).state.delta)"
233
637
  >
@@ -235,7 +639,7 @@ NgtsGizmoHelper.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
235
639
  </ngt-group>
236
640
  </ng-template>
237
641
  </ngt-portal>
238
- `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
642
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"], outputs: ["beforeRender"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[ngtPortalContent]" }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }, { kind: "component", type: NgtsOrthographicCamera, selector: "ngts-orthographic-camera", inputs: ["left", "right", "top", "bottom"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
239
643
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsGizmoHelper, decorators: [{
240
644
  type: Component,
241
645
  args: [{
@@ -250,7 +654,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
250
654
  [position]="[0, 0, 200]"
251
655
  />
252
656
  <ngt-group
253
- [ref]="gizmoRef"
657
+ *ref="gizmoRef"
254
658
  [position]="get('gizmoPosition')"
255
659
  (beforeRender)="onBeforeRender($any($event).state.delta)"
256
660
  >
@@ -259,7 +663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
259
663
  </ng-template>
260
664
  </ngt-portal>
261
665
  `,
262
- imports: [NgtPortal, NgtPortalContent, NgtsOrthographicCamera, NgTemplateOutlet],
666
+ imports: [NgtPortal, NgtPortalContent, NgtRef, NgtsOrthographicCamera, NgTemplateOutlet],
263
667
  providers: [{ provide: NGTS_GIZMO_HELPER_API, useFactory: gizmoHelperApiFactory, deps: [NgtsGizmoHelper] }],
264
668
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
265
669
  }]
@@ -1178,6 +1582,126 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1178
1582
  type: Output
1179
1583
  }] } });
1180
1584
 
1585
+ const v = new THREE.Vector3();
1586
+ class NgtsQuadraticBezierLine extends NgtsLineInput {
1587
+ constructor() {
1588
+ super(...arguments);
1589
+ this.curve = new THREE.QuadraticBezierCurve3(undefined, undefined, undefined);
1590
+ this.lineRef = injectNgtRef();
1591
+ }
1592
+ set start(start) {
1593
+ this.set({ start });
1594
+ }
1595
+ set end(end) {
1596
+ this.set({ end });
1597
+ }
1598
+ set mid(mid) {
1599
+ this.set({ mid });
1600
+ }
1601
+ set segments(segments) {
1602
+ this.set({ segments });
1603
+ }
1604
+ initialize() {
1605
+ super.initialize();
1606
+ this.set({ start: [0, 0, 0], end: [0, 0, 0], segments: 20 });
1607
+ }
1608
+ ngOnInit() {
1609
+ this.connect('points', combineLatest([
1610
+ this.select('start'),
1611
+ this.select('end'),
1612
+ this.select('mid').pipe(startWithUndefined()),
1613
+ this.select('segments'),
1614
+ ]).pipe(map(([start, end, mid, segments]) => this.getPoints(start, end, mid, segments))));
1615
+ this.replaceSetPoints();
1616
+ }
1617
+ replaceSetPoints() {
1618
+ this.hold(this.lineRef.$, (line) => {
1619
+ line.setPoints = (start, end, mid) => {
1620
+ const points = this.getPoints(start, end, mid);
1621
+ if (this.lineRef.nativeElement.geometry) {
1622
+ this.lineRef.nativeElement.geometry.setPositions(points.map((p) => p.toArray()).flat());
1623
+ }
1624
+ };
1625
+ });
1626
+ }
1627
+ getPoints(start, end, mid, segments = 20) {
1628
+ if (start instanceof THREE.Vector3)
1629
+ this.curve.v0.copy(start);
1630
+ else
1631
+ this.curve.v0.set(...start);
1632
+ if (end instanceof THREE.Vector3)
1633
+ this.curve.v2.copy(end);
1634
+ else
1635
+ this.curve.v2.set(...end);
1636
+ if (mid instanceof THREE.Vector3) {
1637
+ this.curve.v1.copy(mid);
1638
+ }
1639
+ else {
1640
+ this.curve.v1.copy(this.curve.v0
1641
+ .clone()
1642
+ .add(this.curve.v2.clone().sub(this.curve.v0))
1643
+ .add(v.set(0, this.curve.v0.y - this.curve.v2.y, 0)));
1644
+ }
1645
+ return this.curve.getPoints(segments);
1646
+ }
1647
+ }
1648
+ NgtsQuadraticBezierLine.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, deps: null, target: i0.ɵɵFactoryTarget.Component });
1649
+ NgtsQuadraticBezierLine.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsQuadraticBezierLine, isStandalone: true, selector: "ngts-quadratic-bezier-line", inputs: { lineRef: "lineRef", start: "start", end: "end", mid: "mid", segments: "segments" }, usesInheritance: true, ngImport: i0, template: `
1650
+ <ngts-line
1651
+ [lineRef]="lineRef"
1652
+ [points]="get('points')"
1653
+ [color]="get('color')"
1654
+ [vertexColors]="get('vertexColors')"
1655
+ [resolution]="get('resolution')"
1656
+ [lineWidth]="get('lineWidth')"
1657
+ [alphaToCoverage]="get('alphaToCoverage')"
1658
+ [dashed]="get('dashed')"
1659
+ [dashScale]="get('dashScale')"
1660
+ [dashSize]="get('dashSize')"
1661
+ [dashOffset]="get('dashOffset')"
1662
+ [gapSize]="get('gapSize')"
1663
+ [wireframe]="get('wireframe')"
1664
+ [worldUnits]="get('worldUnits')"
1665
+ />
1666
+ `, isInline: true, dependencies: [{ kind: "component", type: NgtsLine, selector: "ngts-line[points]", inputs: ["lineRef", "points", "segments"] }] });
1667
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsQuadraticBezierLine, decorators: [{
1668
+ type: Component,
1669
+ args: [{
1670
+ selector: 'ngts-quadratic-bezier-line',
1671
+ standalone: true,
1672
+ template: `
1673
+ <ngts-line
1674
+ [lineRef]="lineRef"
1675
+ [points]="get('points')"
1676
+ [color]="get('color')"
1677
+ [vertexColors]="get('vertexColors')"
1678
+ [resolution]="get('resolution')"
1679
+ [lineWidth]="get('lineWidth')"
1680
+ [alphaToCoverage]="get('alphaToCoverage')"
1681
+ [dashed]="get('dashed')"
1682
+ [dashScale]="get('dashScale')"
1683
+ [dashSize]="get('dashSize')"
1684
+ [dashOffset]="get('dashOffset')"
1685
+ [gapSize]="get('gapSize')"
1686
+ [wireframe]="get('wireframe')"
1687
+ [worldUnits]="get('worldUnits')"
1688
+ />
1689
+ `,
1690
+ imports: [NgtsLine],
1691
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
1692
+ }]
1693
+ }], propDecorators: { lineRef: [{
1694
+ type: Input
1695
+ }], start: [{
1696
+ type: Input
1697
+ }], end: [{
1698
+ type: Input
1699
+ }], mid: [{
1700
+ type: Input
1701
+ }], segments: [{
1702
+ type: Input
1703
+ }] } });
1704
+
1181
1705
  extend({ Mesh, TextGeometry });
1182
1706
  class NgtsText3D extends NgtRxStore {
1183
1707
  constructor() {
@@ -1344,8 +1868,6 @@ class NgtsText extends NgtRxStore {
1344
1868
  this.set({ anchorX: 'center', anchorY: 'middle', text: '' });
1345
1869
  }
1346
1870
  ngOnInit() {
1347
- if (!this.textRef.nativeElement)
1348
- this.textRef.nativeElement = this.troikaText;
1349
1871
  this.preloadFont();
1350
1872
  this.syncText();
1351
1873
  }
@@ -1372,35 +1894,39 @@ class NgtsText extends NgtRxStore {
1372
1894
  }
1373
1895
  NgtsText.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, deps: null, target: i0.ɵɵFactoryTarget.Component });
1374
1896
  NgtsText.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtsText, isStandalone: true, selector: "ngts-text[text]", inputs: { textRef: "textRef", text: "text", characters: "characters", font: "font", anchorX: "anchorX", anchorY: "anchorY" }, outputs: { sync: "sync" }, providers: [RxActionFactory], usesInheritance: true, ngImport: i0, template: `
1375
- <ngt-primitive
1376
- ngtCompound
1377
- *args="[textRef.nativeElement]"
1378
- [text]="get('text')"
1379
- [anchorX]="get('anchorX')"
1380
- [anchorY]="get('anchorY')"
1381
- [font]="get('font')"
1382
- >
1383
- <ng-content />
1384
- </ngt-primitive>
1385
- `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] });
1897
+ <ng-container *args="[troikaText]">
1898
+ <ngt-primitive
1899
+ ngtCompound
1900
+ *ref="textRef"
1901
+ [text]="get('text')"
1902
+ [anchorX]="get('anchorX')"
1903
+ [anchorY]="get('anchorY')"
1904
+ [font]="get('font')"
1905
+ >
1906
+ <ng-content />
1907
+ </ngt-primitive>
1908
+ </ng-container>
1909
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }, { kind: "directive", type: NgtRef, selector: "[ref]", inputs: ["ref"] }] });
1386
1910
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtsText, decorators: [{
1387
1911
  type: Component,
1388
1912
  args: [{
1389
1913
  selector: 'ngts-text[text]',
1390
1914
  standalone: true,
1391
1915
  template: `
1392
- <ngt-primitive
1393
- ngtCompound
1394
- *args="[textRef.nativeElement]"
1395
- [text]="get('text')"
1396
- [anchorX]="get('anchorX')"
1397
- [anchorY]="get('anchorY')"
1398
- [font]="get('font')"
1399
- >
1400
- <ng-content />
1401
- </ngt-primitive>
1916
+ <ng-container *args="[troikaText]">
1917
+ <ngt-primitive
1918
+ ngtCompound
1919
+ *ref="textRef"
1920
+ [text]="get('text')"
1921
+ [anchorX]="get('anchorX')"
1922
+ [anchorY]="get('anchorY')"
1923
+ [font]="get('font')"
1924
+ >
1925
+ <ng-content />
1926
+ </ngt-primitive>
1927
+ </ng-container>
1402
1928
  `,
1403
- imports: [NgtArgs],
1929
+ imports: [NgtArgs, NgtRef],
1404
1930
  providers: [RxActionFactory],
1405
1931
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
1406
1932
  }]
@@ -1424,5 +1950,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1424
1950
  * Generated bundle index. Do not edit.
1425
1951
  */
1426
1952
 
1427
- export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsText, NgtsText3D };
1953
+ export { NGTS_GIZMO_HELPER_API, NgtsBillboard, NgtsCatmullRomLine, NgtsCubicBezierLine, NgtsGizmoHelper, NgtsGizmoHelperContent, NgtsGizmoViewcube, NgtsGizmoViewport, NgtsLine, NgtsQuadraticBezierLine, NgtsText, NgtsText3D };
1428
1954
  //# sourceMappingURL=angular-three-soba-abstractions.mjs.map