angular-three-soba 3.6.1 → 4.0.0-next.1
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.
- package/abstractions/lib/billboard.d.ts +6 -6
- package/abstractions/lib/catmull-rom-line.d.ts +173 -563
- package/abstractions/lib/cubic-bezier-line.d.ts +7 -7
- package/abstractions/lib/edges.d.ts +171 -747
- package/abstractions/lib/gradient-texture.d.ts +8 -8
- package/abstractions/lib/grid.d.ts +24 -292
- package/abstractions/lib/helper.d.ts +5 -5
- package/abstractions/lib/line.d.ts +11 -12
- package/abstractions/lib/prism-geometry.d.ts +12 -12
- package/abstractions/lib/quadratic-bezier-line.d.ts +7 -7
- package/abstractions/lib/rounded-box.d.ts +8 -8
- package/abstractions/lib/text-3d.d.ts +14 -293
- package/abstractions/lib/text.d.ts +12 -13
- package/cameras/lib/camera-content.d.ts +2 -2
- package/cameras/lib/cube-camera.d.ts +12 -12
- package/cameras/lib/orthographic-camera.d.ts +11 -11
- package/cameras/lib/perspective-camera.d.ts +10 -10
- package/controls/lib/camera-controls.d.ts +1 -6
- package/controls/lib/orbit-controls.d.ts +6 -10
- package/controls/lib/scroll-controls.d.ts +8 -14
- package/fesm2022/angular-three-soba-abstractions.mjs +75 -52
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +18 -20
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +65 -65
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-gizmos.mjs +185 -194
- package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -1
- package/fesm2022/angular-three-soba-loaders.mjs +21 -16
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +90 -93
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +282 -279
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-performances.mjs +51 -56
- package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
- package/fesm2022/angular-three-soba-shaders.mjs +5 -6
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +253 -277
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- package/fesm2022/angular-three-soba-stats.mjs +3 -4
- package/fesm2022/angular-three-soba-stats.mjs.map +1 -1
- package/gizmos/lib/gizmo-helper/gizmo-helper.d.ts +12 -15
- package/gizmos/lib/gizmo-helper/gizmo-viewcube.d.ts +5 -6
- package/gizmos/lib/gizmo-helper/gizmo-viewport.d.ts +8 -9
- package/gizmos/lib/pivot-controls/axis-arrow.d.ts +11 -13
- package/gizmos/lib/pivot-controls/axis-rotator.d.ts +11 -12
- package/gizmos/lib/pivot-controls/pivot-controls.d.ts +28 -29
- package/gizmos/lib/pivot-controls/plane-slider.d.ts +12 -13
- package/gizmos/lib/pivot-controls/scaling-sphere.d.ts +12 -14
- package/gizmos/lib/transform-controls.d.ts +15 -20
- package/loaders/lib/loader.d.ts +10 -11
- package/loaders/lib/texture-loader.d.ts +3 -3
- package/materials/lib/custom-shader-material.d.ts +3 -3
- package/materials/lib/mesh-distort-material.d.ts +3 -3
- package/materials/lib/mesh-portal-material.d.ts +19 -118
- package/materials/lib/mesh-reflector-material.d.ts +4 -5
- package/materials/lib/mesh-refraction-material.d.ts +13 -14
- package/materials/lib/mesh-transmission-material.d.ts +14 -14
- package/materials/lib/mesh-wobble-material.d.ts +4 -4
- package/materials/lib/point-material.d.ts +3 -3
- package/misc/lib/animations.d.ts +12 -12
- package/misc/lib/computed-attribute.d.ts +5 -48
- package/misc/lib/decal.d.ts +9 -9
- package/misc/lib/deprecated.d.ts +2 -2
- package/misc/lib/depth-buffer.d.ts +2 -2
- package/misc/lib/fbo.d.ts +9 -9
- package/misc/lib/html/html-content.d.ts +5 -7
- package/misc/lib/html/html.d.ts +15 -14
- package/misc/lib/html/utils.d.ts +9 -9
- package/misc/lib/intersect.d.ts +2 -2
- package/misc/lib/preload.d.ts +3 -6
- package/misc/lib/sampler.d.ts +22 -21
- package/misc/lib/scale-factor.d.ts +2 -2
- package/package.json +141 -141
- package/performances/lib/detailed.d.ts +5 -5
- package/performances/lib/instances/instances.d.ts +8 -96
- package/performances/lib/instances/position-mesh.d.ts +8 -8
- package/performances/lib/points/points.d.ts +10 -188
- package/performances/lib/points/position-point.d.ts +8 -8
- package/performances/lib/segments/segment-object.d.ts +6 -6
- package/performances/lib/segments/segments.d.ts +34 -35
- package/shaders/lib/grid-material.d.ts +16 -16
- package/shaders/lib/mesh-refraction-material.d.ts +2 -2
- package/shaders/lib/point-material.d.ts +5 -5
- package/staging/lib/accumulative-shadows.d.ts +21 -25
- package/staging/lib/backdrop.d.ts +8 -8
- package/staging/lib/bb-anchor.d.ts +5 -5
- package/staging/lib/bounds.d.ts +13 -17
- package/staging/lib/camera-shake.d.ts +0 -2
- package/staging/lib/caustics.d.ts +11 -11
- package/staging/lib/center.d.ts +10 -350
- package/staging/lib/contact-shadows.d.ts +17 -16
- package/staging/lib/environment/environment.d.ts +13 -15
- package/staging/lib/environment/inject-environment.d.ts +3 -3
- package/staging/lib/float.d.ts +5 -5
- package/staging/lib/lightformer.d.ts +11 -290
- package/staging/lib/mask.d.ts +8 -10
- package/staging/lib/matcap-texture.d.ts +5 -5
- package/staging/lib/normal-texture.d.ts +5 -5
- package/staging/lib/randomized-lights.d.ts +13 -13
- package/staging/lib/render-texture.d.ts +21 -17
- package/staging/lib/sky.d.ts +13 -13
- package/staging/lib/spot-light.d.ts +39 -39
- package/staging/lib/stage.d.ts +108 -278
- package/vanilla-exports/index.d.ts +6 -7
- package/LICENSE +0 -21
- package/metadata.json +0 -1
- package/web-types.json +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NgtVector3 } from 'angular-three';
|
|
2
|
-
import
|
|
2
|
+
import * as THREE from 'three';
|
|
3
3
|
import { OrbitControls } from 'three-stdlib';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export interface NgtsOrbitControlsOptions {
|
|
6
|
-
camera?: Camera;
|
|
6
|
+
camera?: THREE.Camera;
|
|
7
7
|
domElement?: HTMLElement;
|
|
8
8
|
target?: NgtVector3;
|
|
9
9
|
makeDefault: boolean;
|
|
@@ -13,15 +13,11 @@ export interface NgtsOrbitControlsOptions {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class NgtsOrbitControls {
|
|
15
15
|
options: import("@angular/core").InputSignalWithTransform<Partial<OrbitControls> & NgtsOrbitControlsOptions, "" | Partial<Partial<OrbitControls> & NgtsOrbitControlsOptions>>;
|
|
16
|
-
parameters: import("@angular/core").Signal<Omit<Partial<OrbitControls> & NgtsOrbitControlsOptions, "
|
|
17
|
-
changed: import("@angular/core").OutputEmitterRef<Event<string, unknown>>;
|
|
18
|
-
started: import("@angular/core").OutputEmitterRef<Event<string, unknown>>;
|
|
19
|
-
ended: import("@angular/core").OutputEmitterRef<Event<string, unknown>>;
|
|
16
|
+
protected parameters: import("@angular/core").Signal<Omit<Partial<OrbitControls> & NgtsOrbitControlsOptions, "domElement" | "enableDamping" | "makeDefault" | "camera" | "regress" | "keyEvents">>;
|
|
17
|
+
changed: import("@angular/core").OutputEmitterRef<THREE.Event<string, unknown>>;
|
|
18
|
+
started: import("@angular/core").OutputEmitterRef<THREE.Event<string, unknown>>;
|
|
19
|
+
ended: import("@angular/core").OutputEmitterRef<THREE.Event<string, unknown>>;
|
|
20
20
|
private store;
|
|
21
|
-
private invalidate;
|
|
22
|
-
private performanceRegress;
|
|
23
|
-
private defaultCamera;
|
|
24
|
-
private glDomElement;
|
|
25
21
|
private camera;
|
|
26
22
|
private regress;
|
|
27
23
|
private keyEvents;
|
|
@@ -28,12 +28,6 @@ export declare class NgtsScrollControls {
|
|
|
28
28
|
options: import("@angular/core").InputSignalWithTransform<NgtsScrollControlsOptions, "" | Partial<NgtsScrollControlsOptions>>;
|
|
29
29
|
private document;
|
|
30
30
|
private store;
|
|
31
|
-
private gl;
|
|
32
|
-
private events;
|
|
33
|
-
private invalidate;
|
|
34
|
-
private size;
|
|
35
|
-
private domElement;
|
|
36
|
-
private target;
|
|
37
31
|
private _el;
|
|
38
32
|
private _fill;
|
|
39
33
|
private _fixed;
|
|
@@ -60,19 +54,19 @@ export declare class NgtsScrollControls {
|
|
|
60
54
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgtsScrollControls, never>;
|
|
61
55
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgtsScrollControls, "ngts-scroll-controls", never, { "progress": { "alias": "progress"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "progress": "progressChange"; }, never, ["*"], true, never>;
|
|
62
56
|
}
|
|
63
|
-
export declare class
|
|
57
|
+
export declare class NgtsCanvasScrollContent {
|
|
64
58
|
private host;
|
|
65
59
|
private scrollControls;
|
|
66
60
|
private store;
|
|
67
|
-
private viewport;
|
|
68
61
|
constructor();
|
|
69
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
70
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<
|
|
62
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgtsCanvasScrollContent, never>;
|
|
63
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgtsCanvasScrollContent, "ngt-group[canvasScrollContent]", never, {}, {}, never, never, true, never>;
|
|
71
64
|
}
|
|
72
|
-
export declare class
|
|
65
|
+
export declare class NgtsHTMLScrollContent extends NgtHTML {
|
|
73
66
|
private scrollControls;
|
|
74
|
-
private
|
|
67
|
+
private store;
|
|
68
|
+
private host;
|
|
75
69
|
constructor();
|
|
76
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
77
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<
|
|
70
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgtsHTMLScrollContent, never>;
|
|
71
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgtsHTMLScrollContent, "div[htmlScrollContent]", never, {}, {}, never, never, true, never>;
|
|
78
72
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, viewChild, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, computed, effect, untracked, inject, output, DestroyRef } from '@angular/core';
|
|
3
3
|
import * as i1 from 'angular-three';
|
|
4
|
-
import { omit, extend, injectBeforeRender, injectStore, pick, checkNeedsUpdate, NgtArgs,
|
|
4
|
+
import { omit, extend, injectBeforeRender, injectStore, pick, is, checkNeedsUpdate, NgtArgs, getInstanceState, resolveRef, NgtObjectEvents } from 'angular-three';
|
|
5
5
|
import { mergeInputs } from 'ngxtension/inject-inputs';
|
|
6
|
-
import
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
import { Group, CanvasTexture, Mesh, PlaneGeometry, Object3D, ExtrudeGeometry } from 'three';
|
|
7
8
|
import { LineSegments2, Line2, LineMaterial, LineSegmentsGeometry, LineGeometry, toCreasedNormals, TextGeometry, mergeVertices } from 'three-stdlib';
|
|
8
9
|
import { DOCUMENT } from '@angular/common';
|
|
9
10
|
import { GridMaterial } from 'angular-three-soba/shaders';
|
|
@@ -24,7 +25,7 @@ class NgtsBillboard {
|
|
|
24
25
|
this.groupRef = viewChild.required('group');
|
|
25
26
|
this.innerRef = viewChild.required('inner');
|
|
26
27
|
extend({ Group });
|
|
27
|
-
const q = new Quaternion();
|
|
28
|
+
const q = new THREE.Quaternion();
|
|
28
29
|
injectBeforeRender(({ camera }) => {
|
|
29
30
|
const [{ follow, lockX, lockY, lockZ }, group, inner] = [
|
|
30
31
|
this.options(),
|
|
@@ -90,26 +91,29 @@ class NgtsLine {
|
|
|
90
91
|
this.parameters = omit(this.options, ['color', 'vertexColors', 'lineWidth', 'segments', 'linewidth', 'dashed']);
|
|
91
92
|
this.lineRef = viewChild('line');
|
|
92
93
|
this.store = injectStore();
|
|
93
|
-
this.size = this.store.select('size');
|
|
94
94
|
this.segments = pick(this.options, 'segments');
|
|
95
95
|
this.vertexColors = pick(this.options, 'vertexColors');
|
|
96
96
|
this.dashed = pick(this.options, 'dashed');
|
|
97
97
|
this.color = pick(this.options, 'color');
|
|
98
98
|
this.vertex = computed(() => Boolean(this.vertexColors()));
|
|
99
|
-
this.resolution = computed(() => [this.size()
|
|
99
|
+
this.resolution = computed(() => [this.store.size.width(), this.store.size.height()]);
|
|
100
100
|
this.lineWidth = pick(this.options, 'lineWidth');
|
|
101
101
|
this.linewidth = pick(this.options, 'linewidth');
|
|
102
102
|
this.line2 = computed(() => (this.segments() ? new LineSegments2() : new Line2()));
|
|
103
103
|
this.lineMaterial = new LineMaterial();
|
|
104
104
|
this.actualLineWidth = computed(() => this.linewidth() ?? this.lineWidth() ?? 1);
|
|
105
105
|
this.itemSize = computed(() => (this.vertexColors()?.[0]?.length === 4 ? 4 : 3));
|
|
106
|
+
// other Line components access this
|
|
106
107
|
this.lineGeometry = computed(() => {
|
|
107
108
|
const geom = this.segments() ? new LineSegmentsGeometry() : new LineGeometry();
|
|
108
109
|
const pValues = this.points().map((p) => {
|
|
109
110
|
const isArray = Array.isArray(p);
|
|
110
|
-
|
|
111
|
+
if (is.three(p, 'isVector3')) {
|
|
112
|
+
return [p.x, p.y, p.z];
|
|
113
|
+
}
|
|
114
|
+
return is.three(p, 'isVector3') || is.three(p, 'isVector4')
|
|
111
115
|
? [p.x, p.y, p.z]
|
|
112
|
-
: p
|
|
116
|
+
: is.three(p, 'isVector2')
|
|
113
117
|
? [p.x, p.y, 0]
|
|
114
118
|
: isArray && p.length === 3
|
|
115
119
|
? [p[0], p[1], p[2]]
|
|
@@ -120,7 +124,7 @@ class NgtsLine {
|
|
|
120
124
|
geom.setPositions(pValues.flat());
|
|
121
125
|
const vertexColors = this.vertexColors();
|
|
122
126
|
if (vertexColors) {
|
|
123
|
-
const cValues = vertexColors.map((c) => (c
|
|
127
|
+
const cValues = vertexColors.map((c) => (is.three(c, 'isColor') ? c.toArray() : c));
|
|
124
128
|
// @ts-expect-error - flat() isn't defined
|
|
125
129
|
geom.setColors(cValues.flat(), this.itemSize());
|
|
126
130
|
}
|
|
@@ -210,8 +214,8 @@ class NgtsCatmullRomLine {
|
|
|
210
214
|
this.vertexColors = pick(this.options, 'vertexColors');
|
|
211
215
|
this.curve = computed(() => {
|
|
212
216
|
const [points, closed, curveType, tension] = [this.points(), this.closed(), this.curveType(), this.tension()];
|
|
213
|
-
const mappedPoints = points.map((pt) => pt
|
|
214
|
-
return new CatmullRomCurve3(mappedPoints, closed, curveType, tension);
|
|
217
|
+
const mappedPoints = points.map((pt) => is.three(pt, 'isVector3') ? pt : new THREE.Vector3(...pt));
|
|
218
|
+
return new THREE.CatmullRomCurve3(mappedPoints, closed, curveType, tension);
|
|
215
219
|
});
|
|
216
220
|
this.segmentedPoints = computed(() => {
|
|
217
221
|
const [curve, segments] = [this.curve(), this.segments()];
|
|
@@ -223,7 +227,7 @@ class NgtsCatmullRomLine {
|
|
|
223
227
|
return undefined;
|
|
224
228
|
if (vertexColors.length === segments + 1)
|
|
225
229
|
return vertexColors;
|
|
226
|
-
const mappedColors = vertexColors.map((color) => color
|
|
230
|
+
const mappedColors = vertexColors.map((color) => is.three(color, 'isColor') ? color : new THREE.Color(...color));
|
|
227
231
|
if (untracked(this.closed))
|
|
228
232
|
mappedColors.push(mappedColors[0].clone());
|
|
229
233
|
const iColors = [mappedColors[0]];
|
|
@@ -275,11 +279,11 @@ class NgtsCubicBezierLine {
|
|
|
275
279
|
this.segments = pick(this.options, 'segments');
|
|
276
280
|
this.points = computed(() => {
|
|
277
281
|
const [start, end, midA, midB, segments] = [this.start(), this.end(), this.midA(), this.midB(), this.segments()];
|
|
278
|
-
const startV = start
|
|
279
|
-
const endV = end
|
|
280
|
-
const midAV = midA
|
|
281
|
-
const midBV = midB
|
|
282
|
-
return new CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
|
|
282
|
+
const startV = is.three(start, 'isVector3') ? start : new THREE.Vector3(...start);
|
|
283
|
+
const endV = is.three(end, 'isVector3') ? end : new THREE.Vector3(...end);
|
|
284
|
+
const midAV = is.three(midA, 'isVector3') ? midA : new THREE.Vector3(...midA);
|
|
285
|
+
const midBV = is.three(midB, 'isVector3') ? midB : new THREE.Vector3(...midB);
|
|
286
|
+
return new THREE.CubicBezierCurve3(startV, midAV, midBV, endV).getPoints(segments);
|
|
283
287
|
});
|
|
284
288
|
}
|
|
285
289
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsCubicBezierLine, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -318,7 +322,7 @@ class NgtsEdges {
|
|
|
318
322
|
const line = this.line().lineRef()?.nativeElement;
|
|
319
323
|
if (!line)
|
|
320
324
|
return;
|
|
321
|
-
const lS =
|
|
325
|
+
const lS = getInstanceState(line);
|
|
322
326
|
if (!lS)
|
|
323
327
|
return;
|
|
324
328
|
const parent = lS.parent();
|
|
@@ -333,7 +337,7 @@ class NgtsEdges {
|
|
|
333
337
|
return;
|
|
334
338
|
this.memoizedGeometry = geometry;
|
|
335
339
|
this.memoizedThreshold = threshold;
|
|
336
|
-
const points = new EdgesGeometry(geometry, threshold).attributes['position']
|
|
340
|
+
const points = new THREE.EdgesGeometry(geometry, threshold).attributes['position']
|
|
337
341
|
.array;
|
|
338
342
|
line.geometry.setPositions(points);
|
|
339
343
|
checkNeedsUpdate(line.geometry.attributes['instanceStart']);
|
|
@@ -376,9 +380,9 @@ class NgtsGradientTexture {
|
|
|
376
380
|
this.colors = input.required();
|
|
377
381
|
this.options = input(defaultOptions$6, { transform: mergeInputs(defaultOptions$6) });
|
|
378
382
|
this.parameters = omit(this.options, ['size', 'width', 'type', 'innerCircleRadius', 'outerCircleRadius']);
|
|
379
|
-
this.store = injectStore();
|
|
380
|
-
this.outputColorSpace = this.store.select('gl', 'outputColorSpace');
|
|
381
383
|
this.document = inject(DOCUMENT);
|
|
384
|
+
this.store = injectStore();
|
|
385
|
+
this.outputColorSpace = this.store.gl.outputColorSpace;
|
|
382
386
|
this.canvas = computed(() => {
|
|
383
387
|
const canvas = this.document.createElement('canvas');
|
|
384
388
|
const context = canvas.getContext('2d');
|
|
@@ -401,7 +405,7 @@ class NgtsGradientTexture {
|
|
|
401
405
|
: Math.sqrt(canvasCenterX ** 2 + canvasCenterY ** 2);
|
|
402
406
|
gradient = context.createRadialGradient(canvasCenterX, canvasCenterY, Math.abs(innerCircleRadius), canvasCenterX, canvasCenterY, radius);
|
|
403
407
|
}
|
|
404
|
-
const tempColor = new Color(); // reuse instance for performance
|
|
408
|
+
const tempColor = new THREE.Color(); // reuse instance for performance
|
|
405
409
|
let i = stops.length;
|
|
406
410
|
while (i--) {
|
|
407
411
|
gradient.addColorStop(stops[i], tempColor.set(colors[i]).getStyle());
|
|
@@ -459,7 +463,7 @@ const defaultOptions$5 = {
|
|
|
459
463
|
fadeDistance: 100,
|
|
460
464
|
fadeStrength: 1,
|
|
461
465
|
fadeFrom: 1,
|
|
462
|
-
side: BackSide,
|
|
466
|
+
side: THREE.BackSide,
|
|
463
467
|
};
|
|
464
468
|
class NgtsGrid {
|
|
465
469
|
constructor() {
|
|
@@ -480,13 +484,36 @@ class NgtsGrid {
|
|
|
480
484
|
'side',
|
|
481
485
|
]);
|
|
482
486
|
this.meshRef = viewChild.required('mesh');
|
|
483
|
-
this.plane = new Plane();
|
|
484
|
-
this.upVector = new Vector3(0, 1, 0);
|
|
485
|
-
this.zeroVector = new Vector3(0, 0, 0);
|
|
487
|
+
this.plane = new THREE.Plane();
|
|
488
|
+
this.upVector = new THREE.Vector3(0, 1, 0);
|
|
489
|
+
this.zeroVector = new THREE.Vector3(0, 0, 0);
|
|
486
490
|
this.planeArgs = pick(this.options, 'planeArgs');
|
|
487
491
|
this.side = pick(this.options, 'side');
|
|
492
|
+
this.cellSize = pick(this.options, 'cellSize');
|
|
493
|
+
this.sectionSize = pick(this.options, 'sectionSize');
|
|
494
|
+
this.cellColor = pick(this.options, 'cellColor');
|
|
495
|
+
this.sectionColor = pick(this.options, 'sectionColor');
|
|
496
|
+
this.cellThickness = pick(this.options, 'cellThickness');
|
|
497
|
+
this.sectionThickness = pick(this.options, 'sectionThickness');
|
|
498
|
+
this.fadeDistance = pick(this.options, 'fadeDistance');
|
|
499
|
+
this.fadeStrength = pick(this.options, 'fadeStrength');
|
|
500
|
+
this.fadeFrom = pick(this.options, 'fadeFrom');
|
|
501
|
+
this.infiniteGrid = pick(this.options, 'infiniteGrid');
|
|
502
|
+
this.followCamera = pick(this.options, 'followCamera');
|
|
488
503
|
this.uniforms = computed(() => {
|
|
489
|
-
const
|
|
504
|
+
const [cellSize, sectionSize, cellColor, sectionColor, cellThickness, sectionThickness, fadeDistance, fadeStrength, fadeFrom, infiniteGrid, followCamera,] = [
|
|
505
|
+
this.cellSize(),
|
|
506
|
+
this.sectionSize(),
|
|
507
|
+
this.cellColor(),
|
|
508
|
+
this.sectionColor(),
|
|
509
|
+
this.cellThickness(),
|
|
510
|
+
this.sectionThickness(),
|
|
511
|
+
this.fadeDistance(),
|
|
512
|
+
this.fadeStrength(),
|
|
513
|
+
this.fadeFrom(),
|
|
514
|
+
this.infiniteGrid(),
|
|
515
|
+
this.followCamera(),
|
|
516
|
+
];
|
|
490
517
|
return {
|
|
491
518
|
cellSize,
|
|
492
519
|
sectionSize,
|
|
@@ -545,7 +572,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
545
572
|
function injectHelper(object, helperConstructor, { injector, args = () => [], } = {}) {
|
|
546
573
|
return assertInjector(injectHelper, injector, () => {
|
|
547
574
|
const store = injectStore();
|
|
548
|
-
const scene = store.select('scene');
|
|
549
575
|
const helper = computed(() => {
|
|
550
576
|
const maybeObject3D = object();
|
|
551
577
|
if (!maybeObject3D)
|
|
@@ -561,10 +587,10 @@ function injectHelper(object, helperConstructor, { injector, args = () => [], }
|
|
|
561
587
|
const currentHelper = helper();
|
|
562
588
|
if (!currentHelper)
|
|
563
589
|
return;
|
|
564
|
-
const
|
|
565
|
-
|
|
590
|
+
const scene = store.scene();
|
|
591
|
+
scene.add(currentHelper);
|
|
566
592
|
onCleanup(() => {
|
|
567
|
-
|
|
593
|
+
scene.remove(currentHelper);
|
|
568
594
|
currentHelper.dispose?.();
|
|
569
595
|
});
|
|
570
596
|
});
|
|
@@ -585,10 +611,10 @@ class NgtsHelper {
|
|
|
585
611
|
const helper = this.helperRef().nativeElement;
|
|
586
612
|
if (!helper)
|
|
587
613
|
return;
|
|
588
|
-
const
|
|
589
|
-
if (!
|
|
614
|
+
const instanceState = getInstanceState(helper);
|
|
615
|
+
if (!instanceState)
|
|
590
616
|
return;
|
|
591
|
-
return
|
|
617
|
+
return instanceState.parent();
|
|
592
618
|
});
|
|
593
619
|
this.helper = injectHelper(this.parent, this.type, { args: this.options });
|
|
594
620
|
extend({ Object3D });
|
|
@@ -622,8 +648,8 @@ class NgtsPrismGeometry {
|
|
|
622
648
|
this.parameters = computed(() => ({ ...this.options(), depth: this.options().height }));
|
|
623
649
|
this.shape = computed(() => {
|
|
624
650
|
const vertices = this.vertices();
|
|
625
|
-
const interpolatedVertices = vertices.map((v) => (v
|
|
626
|
-
return new Shape(interpolatedVertices);
|
|
651
|
+
const interpolatedVertices = vertices.map((v) => is.three(v, 'isVector2') ? v : new THREE.Vector2(...v));
|
|
652
|
+
return new THREE.Shape(interpolatedVertices);
|
|
627
653
|
});
|
|
628
654
|
this.geometryRef = viewChild('geometry');
|
|
629
655
|
extend({ ExtrudeGeometry });
|
|
@@ -664,7 +690,7 @@ class NgtsQuadraticBezierLine {
|
|
|
664
690
|
this.segments = pick(this.options, 'segments');
|
|
665
691
|
this.line = viewChild.required(NgtsLine);
|
|
666
692
|
this.points = computed(() => this.getPoints(this.start(), this.end(), this.mid(), this.segments()));
|
|
667
|
-
this.curve = new QuadraticBezierCurve3();
|
|
693
|
+
this.curve = new THREE.QuadraticBezierCurve3();
|
|
668
694
|
}
|
|
669
695
|
setPoints(start, end, mid) {
|
|
670
696
|
const points = this.getPoints(start, end, mid);
|
|
@@ -673,15 +699,15 @@ class NgtsQuadraticBezierLine {
|
|
|
673
699
|
geometry.setPositions(points.map((p) => p.toArray()).flat());
|
|
674
700
|
}
|
|
675
701
|
getPoints(start, end, mid, segments = 20) {
|
|
676
|
-
if (start
|
|
702
|
+
if (is.three(start, 'isVector3'))
|
|
677
703
|
this.curve.v0.copy(start);
|
|
678
704
|
else
|
|
679
705
|
this.curve.v0.set(...start);
|
|
680
|
-
if (end
|
|
706
|
+
if (is.three(end, 'isVector3'))
|
|
681
707
|
this.curve.v2.copy(end);
|
|
682
708
|
else
|
|
683
709
|
this.curve.v2.set(...end);
|
|
684
|
-
if (mid
|
|
710
|
+
if (is.three(mid, 'isVector3')) {
|
|
685
711
|
this.curve.v1.copy(mid);
|
|
686
712
|
}
|
|
687
713
|
else if (Array.isArray(mid)) {
|
|
@@ -691,7 +717,7 @@ class NgtsQuadraticBezierLine {
|
|
|
691
717
|
this.curve.v1.copy(this.curve.v0
|
|
692
718
|
.clone()
|
|
693
719
|
.add(this.curve.v2.clone().sub(this.curve.v0))
|
|
694
|
-
.add(new Vector3(0, this.curve.v0.y - this.curve.v2.y, 0)));
|
|
720
|
+
.add(new THREE.Vector3(0, this.curve.v0.y - this.curve.v2.y, 0)));
|
|
695
721
|
}
|
|
696
722
|
return this.curve.getPoints(segments);
|
|
697
723
|
}
|
|
@@ -718,7 +744,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
718
744
|
|
|
719
745
|
const eps = 0.00001;
|
|
720
746
|
function createShape(width, height, radius0) {
|
|
721
|
-
const shape = new Shape();
|
|
747
|
+
const shape = new THREE.Shape();
|
|
722
748
|
const radius = radius0 - eps;
|
|
723
749
|
shape.absarc(eps, eps, eps, -Math.PI / 2, -Math.PI, true);
|
|
724
750
|
shape.absarc(eps, height - radius * 2, eps, Math.PI, Math.PI / 2, true);
|
|
@@ -763,7 +789,7 @@ class NgtsRoundedBox {
|
|
|
763
789
|
const [width, height, radius] = [this.width(), this.height(), this.radius()];
|
|
764
790
|
return createShape(width, height, radius);
|
|
765
791
|
});
|
|
766
|
-
this.
|
|
792
|
+
this.geometryParameters = computed(() => {
|
|
767
793
|
const [depth, radius, smoothness, bevelSegments, steps] = [
|
|
768
794
|
this.depth(),
|
|
769
795
|
this.radius(),
|
|
@@ -783,10 +809,7 @@ class NgtsRoundedBox {
|
|
|
783
809
|
});
|
|
784
810
|
extend({ ExtrudeGeometry, Mesh });
|
|
785
811
|
const objectEvents = inject(NgtObjectEvents, { host: true });
|
|
786
|
-
|
|
787
|
-
const mesh = this.meshRef().nativeElement;
|
|
788
|
-
objectEvents.ngtObjectEvents.set(mesh);
|
|
789
|
-
});
|
|
812
|
+
objectEvents.ngtObjectEvents.set(this.meshRef);
|
|
790
813
|
effect(() => {
|
|
791
814
|
const geometry = this.geometryRef()?.nativeElement;
|
|
792
815
|
if (!geometry)
|
|
@@ -798,7 +821,7 @@ class NgtsRoundedBox {
|
|
|
798
821
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtsRoundedBox, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
799
822
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.6", type: NgtsRoundedBox, isStandalone: true, selector: "ngts-rounded-box", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }, { propertyName: "geometryRef", first: true, predicate: ["geometry"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.NgtObjectEvents, outputs: ["click", "click", "dblclick", "dblclick", "contextmenu", "contextmenu", "pointerup", "pointerup", "pointerdown", "pointerdown", "pointerover", "pointerover", "pointerout", "pointerout", "pointerenter", "pointerenter", "pointerleave", "pointerleave", "pointermove", "pointermove", "pointermissed", "pointermissed", "pointercancel", "pointercancel", "wheel", "wheel"] }], ngImport: i0, template: `
|
|
800
823
|
<ngt-mesh #mesh [parameters]="parameters()">
|
|
801
|
-
<ngt-extrude-geometry #geometry *args="[shape(),
|
|
824
|
+
<ngt-extrude-geometry #geometry *args="[shape(), geometryParameters()]" />
|
|
802
825
|
<ng-content />
|
|
803
826
|
</ngt-mesh>
|
|
804
827
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
@@ -809,7 +832,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
809
832
|
selector: 'ngts-rounded-box',
|
|
810
833
|
template: `
|
|
811
834
|
<ngt-mesh #mesh [parameters]="parameters()">
|
|
812
|
-
<ngt-extrude-geometry #geometry *args="[shape(),
|
|
835
|
+
<ngt-extrude-geometry #geometry *args="[shape(), geometryParameters()]" />
|
|
813
836
|
<ng-content />
|
|
814
837
|
</ngt-mesh>
|
|
815
838
|
`,
|
|
@@ -852,7 +875,6 @@ class NgtsText {
|
|
|
852
875
|
this.parameters = omit(this.options, ['font', 'fontSize', 'sdfGlyphSize', 'anchorX', 'anchorY', 'characters']);
|
|
853
876
|
this.synced = output();
|
|
854
877
|
this.store = injectStore();
|
|
855
|
-
this.invalidate = this.store.select('invalidate');
|
|
856
878
|
this.characters = pick(this.options, 'characters');
|
|
857
879
|
this.font = pick(this.options, 'font');
|
|
858
880
|
this.anchorX = pick(this.options, 'anchorX');
|
|
@@ -864,13 +886,13 @@ class NgtsText {
|
|
|
864
886
|
this.troikaMesh.dispose();
|
|
865
887
|
});
|
|
866
888
|
effect(() => {
|
|
867
|
-
const [font, characters, invalidate] = [this.font(), this.characters(), this.invalidate()];
|
|
889
|
+
const [font, characters, invalidate] = [this.font(), this.characters(), this.store.invalidate()];
|
|
868
890
|
if (font) {
|
|
869
891
|
preloadFont({ font, characters }, () => invalidate());
|
|
870
892
|
}
|
|
871
893
|
});
|
|
872
894
|
effect(() => {
|
|
873
|
-
const [invalidate] = [this.invalidate(), this.text(), this.options()];
|
|
895
|
+
const [invalidate] = [this.store.invalidate(), this.text(), this.options()];
|
|
874
896
|
this.troikaMesh.sync(() => {
|
|
875
897
|
invalidate();
|
|
876
898
|
this.synced.emit(this.troikaMesh);
|
|
@@ -964,9 +986,10 @@ class NgtsText3D {
|
|
|
964
986
|
'curveSegments',
|
|
965
987
|
]);
|
|
966
988
|
this.textArgs = computed(() => {
|
|
967
|
-
const
|
|
989
|
+
const font = this.loadedFont();
|
|
968
990
|
if (!font)
|
|
969
991
|
return null;
|
|
992
|
+
const [text, textOptions] = [this.text(), this.textOptions()];
|
|
970
993
|
return [text, { font, ...textOptions }];
|
|
971
994
|
});
|
|
972
995
|
extend({ Mesh, TextGeometry });
|