angular-three-soba 2.2.0 → 2.2.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.
Files changed (137) hide show
  1. package/abstractions/lib/catmull-rom-line.d.ts +117 -117
  2. package/abstractions/lib/edges.d.ts +126 -126
  3. package/abstractions/lib/grid.d.ts +15 -15
  4. package/abstractions/lib/line.d.ts +9 -8
  5. package/abstractions/lib/prism-geometry.d.ts +2 -2
  6. package/abstractions/lib/rounded-box.d.ts +3 -3
  7. package/abstractions/lib/text-3d.d.ts +22 -22
  8. package/abstractions/lib/text.d.ts +0 -1
  9. package/cameras/lib/cube-camera.d.ts +2 -2
  10. package/cameras/lib/orthographic-camera.d.ts +7 -8
  11. package/cameras/lib/perspective-camera.d.ts +2 -3
  12. package/controls/lib/camera-controls.d.ts +1 -1
  13. package/controls/lib/orbit-controls.d.ts +1 -1
  14. package/esm2022/abstractions/lib/billboard.mjs +3 -3
  15. package/esm2022/abstractions/lib/catmull-rom-line.mjs +3 -3
  16. package/esm2022/abstractions/lib/cubic-bezier-line.mjs +3 -3
  17. package/esm2022/abstractions/lib/edges.mjs +30 -34
  18. package/esm2022/abstractions/lib/gradient-texture.mjs +3 -3
  19. package/esm2022/abstractions/lib/grid.mjs +3 -3
  20. package/esm2022/abstractions/lib/helper.mjs +18 -20
  21. package/esm2022/abstractions/lib/line.mjs +25 -28
  22. package/esm2022/abstractions/lib/prism-geometry.mjs +3 -3
  23. package/esm2022/abstractions/lib/quadratic-bezier-line.mjs +3 -3
  24. package/esm2022/abstractions/lib/rounded-box.mjs +11 -17
  25. package/esm2022/abstractions/lib/text-3d.mjs +14 -17
  26. package/esm2022/abstractions/lib/text.mjs +11 -16
  27. package/esm2022/cameras/lib/camera-content.mjs +3 -3
  28. package/esm2022/cameras/lib/cube-camera.mjs +18 -27
  29. package/esm2022/cameras/lib/orthographic-camera.mjs +20 -20
  30. package/esm2022/cameras/lib/perspective-camera.mjs +21 -21
  31. package/esm2022/controls/lib/camera-controls.mjs +3 -3
  32. package/esm2022/controls/lib/orbit-controls.mjs +3 -3
  33. package/esm2022/controls/lib/scroll-controls.mjs +124 -130
  34. package/esm2022/gizmos/lib/gizmo-helper/gizmo-helper.mjs +6 -6
  35. package/esm2022/gizmos/lib/gizmo-helper/gizmo-viewcube.mjs +12 -12
  36. package/esm2022/gizmos/lib/gizmo-helper/gizmo-viewport.mjs +9 -9
  37. package/esm2022/gizmos/lib/pivot-controls/axis-arrow.mjs +6 -4
  38. package/esm2022/gizmos/lib/pivot-controls/axis-rotator.mjs +3 -3
  39. package/esm2022/gizmos/lib/pivot-controls/pivot-controls.mjs +44 -47
  40. package/esm2022/gizmos/lib/pivot-controls/plane-slider.mjs +3 -3
  41. package/esm2022/gizmos/lib/pivot-controls/scaling-sphere.mjs +3 -3
  42. package/esm2022/gizmos/lib/transform-controls.mjs +3 -3
  43. package/esm2022/loaders/lib/loader.mjs +3 -3
  44. package/esm2022/materials/lib/custom-shader-material.mjs +8 -12
  45. package/esm2022/materials/lib/mesh-distort-material.mjs +3 -3
  46. package/esm2022/materials/lib/mesh-reflector-material.mjs +11 -15
  47. package/esm2022/materials/lib/mesh-refraction-material.mjs +26 -30
  48. package/esm2022/materials/lib/mesh-transmission-material.mjs +3 -3
  49. package/esm2022/materials/lib/mesh-wobble-material.mjs +3 -3
  50. package/esm2022/materials/lib/point-material.mjs +3 -3
  51. package/esm2022/misc/lib/bake-shadows.mjs +8 -10
  52. package/esm2022/misc/lib/computed-attribute.mjs +15 -19
  53. package/esm2022/misc/lib/decal.mjs +56 -53
  54. package/esm2022/misc/lib/fbo.mjs +10 -10
  55. package/esm2022/misc/lib/html/html-content.mjs +62 -67
  56. package/esm2022/misc/lib/html/html.mjs +3 -3
  57. package/esm2022/misc/lib/intersect.mjs +6 -9
  58. package/esm2022/misc/lib/sampler.mjs +48 -42
  59. package/esm2022/performances/lib/adaptive-dpr.mjs +29 -35
  60. package/esm2022/performances/lib/adaptive-events.mjs +12 -16
  61. package/esm2022/performances/lib/detailed.mjs +14 -18
  62. package/esm2022/performances/lib/instances/instances.mjs +16 -22
  63. package/esm2022/performances/lib/points/points.mjs +19 -25
  64. package/esm2022/performances/lib/segments/segments.mjs +11 -14
  65. package/esm2022/shaders/lib/mesh-refraction-material.mjs +1 -1
  66. package/esm2022/staging/index.mjs +3 -2
  67. package/esm2022/staging/lib/accumulative-shadows.mjs +19 -21
  68. package/esm2022/staging/lib/backdrop.mjs +19 -23
  69. package/esm2022/staging/lib/bb-anchor.mjs +3 -3
  70. package/esm2022/staging/lib/bounds.mjs +39 -43
  71. package/esm2022/staging/lib/camera-shake.mjs +14 -18
  72. package/esm2022/staging/lib/caustics.mjs +24 -28
  73. package/esm2022/staging/lib/center.mjs +28 -32
  74. package/esm2022/staging/lib/contact-shadows.mjs +3 -3
  75. package/esm2022/staging/lib/environment/environment.mjs +338 -0
  76. package/esm2022/staging/lib/environment/inject-environment.mjs +184 -0
  77. package/esm2022/staging/lib/float.mjs +3 -3
  78. package/esm2022/staging/lib/lightformer.mjs +18 -22
  79. package/esm2022/staging/lib/mask.mjs +8 -12
  80. package/esm2022/staging/lib/matcap-texture.mjs +9 -11
  81. package/esm2022/staging/lib/normal-texture.mjs +9 -11
  82. package/esm2022/staging/lib/randomized-lights.mjs +9 -13
  83. package/esm2022/staging/lib/render-texture.mjs +19 -20
  84. package/esm2022/staging/lib/sky.mjs +3 -3
  85. package/esm2022/staging/lib/spot-light.mjs +32 -40
  86. package/esm2022/staging/lib/stage.mjs +13 -17
  87. package/esm2022/stats/lib/stats.mjs +21 -27
  88. package/fesm2022/angular-three-soba-abstractions.mjs +119 -138
  89. package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
  90. package/fesm2022/angular-three-soba-cameras.mjs +57 -64
  91. package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
  92. package/fesm2022/angular-three-soba-controls.mjs +129 -135
  93. package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
  94. package/fesm2022/angular-three-soba-gizmos.mjs +87 -88
  95. package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -1
  96. package/fesm2022/angular-three-soba-loaders.mjs +3 -3
  97. package/fesm2022/angular-three-soba-materials.mjs +52 -62
  98. package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
  99. package/fesm2022/angular-three-soba-misc.mjs +194 -195
  100. package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
  101. package/fesm2022/angular-three-soba-performances.mjs +90 -114
  102. package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
  103. package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
  104. package/fesm2022/angular-three-soba-staging.mjs +427 -430
  105. package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
  106. package/fesm2022/angular-three-soba-stats.mjs +20 -26
  107. package/fesm2022/angular-three-soba-stats.mjs.map +1 -1
  108. package/gizmos/lib/gizmo-helper/gizmo-viewport.d.ts +1 -1
  109. package/gizmos/lib/pivot-controls/pivot-controls.d.ts +1 -1
  110. package/gizmos/lib/transform-controls.d.ts +2 -2
  111. package/materials/lib/custom-shader-material.d.ts +3 -3
  112. package/materials/lib/mesh-refraction-material.d.ts +2 -2
  113. package/materials/lib/mesh-transmission-material.d.ts +1 -1
  114. package/misc/lib/computed-attribute.d.ts +6 -6
  115. package/misc/lib/decal.d.ts +4 -4
  116. package/misc/lib/html/html-content.d.ts +6 -6
  117. package/misc/lib/sampler.d.ts +2 -4
  118. package/package.json +8 -8
  119. package/performances/lib/instances/instances.d.ts +11 -11
  120. package/performances/lib/points/points.d.ts +19 -19
  121. package/performances/lib/segments/segments.d.ts +4 -4
  122. package/shaders/lib/mesh-refraction-material.d.ts +2 -5
  123. package/staging/index.d.ts +2 -1
  124. package/staging/lib/accumulative-shadows.d.ts +1 -1
  125. package/staging/lib/camera-shake.d.ts +0 -1
  126. package/staging/lib/caustics.d.ts +1 -1
  127. package/staging/lib/contact-shadows.d.ts +1 -1
  128. package/staging/lib/{environment.d.ts → environment/environment.d.ts} +20 -49
  129. package/staging/lib/environment/inject-environment.d.ts +33 -0
  130. package/staging/lib/lightformer.d.ts +1 -1
  131. package/staging/lib/matcap-texture.d.ts +0 -1
  132. package/staging/lib/normal-texture.d.ts +0 -1
  133. package/staging/lib/render-texture.d.ts +1 -1
  134. package/staging/lib/sky.d.ts +1 -1
  135. package/staging/lib/spot-light.d.ts +2 -2
  136. package/staging/lib/stage.d.ts +2 -1
  137. package/esm2022/staging/lib/environment.mjs +0 -481
@@ -1,10 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, viewChild, computed, afterNextRender, inject, DestroyRef, untracked, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, signal, Directive, output, effect, Injector, contentChild, TemplateRef, numberAttribute, ViewContainerRef } from '@angular/core';
3
- import { omit, injectStore, pick, extend, getLocalState, injectBeforeRender, checkUpdate, NgtArgs, vector3, is, resolveRef, applyProps, injectLoader, prepare, NgtPortal, NgtPortalContent } from 'angular-three';
2
+ import { input, viewChild, computed, afterNextRender, effect, inject, DestroyRef, untracked, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, signal, Directive, output, Injector, contentChild, TemplateRef, numberAttribute, ViewContainerRef } from '@angular/core';
3
+ import { omit, injectStore, pick, extend, getLocalState, injectBeforeRender, checkUpdate, NgtArgs, vector3, is, resolveRef, injectLoader, applyProps, prepare, NgtPortal, NgtPortalContent } from 'angular-three';
4
4
  import { ProgressiveLightMap, SoftShadowMaterial, CausticsProjectionMaterial, createCausticsUpdate, SpotLightMaterial } from 'angular-three-soba/vanilla-exports';
5
- import { injectAutoEffect } from 'ngxtension/auto-effect';
6
5
  import { mergeInputs } from 'ngxtension/inject-inputs';
7
- import { Group, Mesh, PlaneGeometry, Box3, Vector3, Quaternion, Matrix4, LinearFilter, UnsignedByteType, LinearMipmapLinearFilter, FloatType, CustomBlending, OneFactor, SrcAlphaFactor, CameraHelper, Scene, LineBasicMaterial, OrthographicCamera, Sphere, Color, MeshDepthMaterial, ShaderMaterial, MeshBasicMaterial, WebGLRenderTarget, CubeTextureLoader, CubeTexture, CubeReflectionMapping, EquirectangularReflectionMapping, WebGLCubeRenderTarget, HalfFloatType, CubeCamera, MathUtils, DoubleSide, RingGeometry, AlwaysStencilFunc, ReplaceStencilOp, NotEqualStencilFunc, EqualStencilFunc, KeepStencilOp, RepeatWrapping, Vector2, DirectionalLight, Object3D, CylinderGeometry, RGBAFormat, SpotLightHelper, SpotLight, AmbientLight, PointLight } from 'three';
6
+ import { Group, Mesh, PlaneGeometry, Box3, Vector3, Quaternion, Matrix4, LinearFilter, UnsignedByteType, LinearMipmapLinearFilter, FloatType, CustomBlending, OneFactor, SrcAlphaFactor, CameraHelper, Scene, LineBasicMaterial, OrthographicCamera, Sphere, Color, MeshDepthMaterial, ShaderMaterial, MeshBasicMaterial, WebGLRenderTarget, CubeTexture, CubeReflectionMapping, EquirectangularReflectionMapping, CubeTextureLoader, WebGLCubeRenderTarget, HalfFloatType, CubeCamera, MathUtils, DoubleSide, RingGeometry, AlwaysStencilFunc, ReplaceStencilOp, NotEqualStencilFunc, EqualStencilFunc, KeepStencilOp, RepeatWrapping, Vector2, DirectionalLight, Object3D, CylinderGeometry, RGBAFormat, SpotLightHelper, SpotLight, AmbientLight, PointLight } from 'three';
8
7
  import { SimplexNoise, HorizontalBlurShader, VerticalBlurShader, RGBELoader, EXRLoader, GroundProjectedEnv, Sky, FullScreenQuad } from 'three-stdlib';
9
8
  import { injectHelper, NgtsEdges, NgtsHelper } from 'angular-three-soba/abstractions';
10
9
  import { injectFBO, sRGBEncoding, LinearEncoding, getVersion } from 'angular-three-soba/misc';
@@ -72,23 +71,22 @@ class NgtsAccumulativeShadows {
72
71
  this.blend = computed(() => Math.max(2, this.options().frames === Infinity ? this.options().blend : this.options().frames));
73
72
  this.count = 0;
74
73
  extend({ Group, SoftShadowMaterial, Mesh, PlaneGeometry });
75
- const autoEffect = injectAutoEffect();
76
74
  afterNextRender(() => {
77
75
  this.pLM().configure(this.planeRef().nativeElement);
78
- autoEffect(() => {
79
- const sceneLS = getLocalState(this.scene());
80
- if (!sceneLS)
81
- return;
82
- // track deps
83
- this.planeRef();
84
- this.options();
85
- sceneLS.objects();
86
- // Reset internals, buffers, ...
87
- this.reset();
88
- // Update lightmap
89
- if (!this.temporal() && this.frames() !== Infinity)
90
- this.update(this.blend());
91
- });
76
+ });
77
+ effect(() => {
78
+ const sceneLS = getLocalState(this.scene());
79
+ if (!sceneLS)
80
+ return;
81
+ // track deps
82
+ this.planeRef();
83
+ this.options();
84
+ sceneLS.objects();
85
+ // Reset internals, buffers, ...
86
+ this.reset();
87
+ // Update lightmap
88
+ if (!this.temporal() && this.frames() !== Infinity)
89
+ this.update(this.blend());
92
90
  });
93
91
  injectBeforeRender(() => {
94
92
  const [frames, temporal, invalidate, limit] = [this.frames(), !!this.temporal(), this.invalidate(), this.limit()];
@@ -138,8 +136,8 @@ class NgtsAccumulativeShadows {
138
136
  // Restore lights and meshes
139
137
  this.pLM().finish();
140
138
  }
141
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAccumulativeShadows, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
142
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsAccumulativeShadows, isStandalone: true, selector: "ngts-accumulative-shadows", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "lightsRef", first: true, predicate: ["lights"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsAccumulativeShadows, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
140
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsAccumulativeShadows, isStandalone: true, selector: "ngts-accumulative-shadows", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "lightsRef", first: true, predicate: ["lights"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
143
141
  <ngt-group [parameters]="parameters()">
144
142
  <ngt-group #lights [traverse]="nullTraversal">
145
143
  <ng-content />
@@ -159,7 +157,7 @@ class NgtsAccumulativeShadows {
159
157
  </ngt-group>
160
158
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
161
159
  }
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsAccumulativeShadows, decorators: [{
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsAccumulativeShadows, decorators: [{
163
161
  type: Component,
164
162
  args: [{
165
163
  selector: 'ngts-accumulative-shadows',
@@ -206,28 +204,25 @@ class NgtsBackdrop {
206
204
  this.segments = pick(this.options, 'segments');
207
205
  this.floor = pick(this.options, 'floor');
208
206
  extend({ Group, Mesh, PlaneGeometry });
209
- const autoEffect = injectAutoEffect();
210
- afterNextRender(() => {
211
- autoEffect(() => {
212
- const plane = this.planeRef()?.nativeElement;
213
- if (!plane)
214
- return;
215
- const [segments, floor] = [this.segments(), this.floor()];
216
- let i = 0;
217
- const offset = segments / segments / 2;
218
- const position = plane.attributes['position'];
219
- for (let x = 0; x < segments + 1; x++) {
220
- for (let y = 0; y < segments + 1; y++) {
221
- position.setXYZ(i++, x / segments - offset + (x === 0 ? -floor : 0), y / segments - offset, easeInExpo(x / segments));
222
- }
207
+ effect(() => {
208
+ const plane = this.planeRef()?.nativeElement;
209
+ if (!plane)
210
+ return;
211
+ const [segments, floor] = [this.segments(), this.floor()];
212
+ let i = 0;
213
+ const offset = segments / segments / 2;
214
+ const position = plane.attributes['position'];
215
+ for (let x = 0; x < segments + 1; x++) {
216
+ for (let y = 0; y < segments + 1; y++) {
217
+ position.setXYZ(i++, x / segments - offset + (x === 0 ? -floor : 0), y / segments - offset, easeInExpo(x / segments));
223
218
  }
224
- checkUpdate(position);
225
- plane.computeVertexNormals();
226
- });
219
+ }
220
+ checkUpdate(position);
221
+ plane.computeVertexNormals();
227
222
  });
228
223
  }
229
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBackdrop, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
230
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsBackdrop, isStandalone: true, selector: "ngts-backdrop", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
224
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBackdrop, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
225
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsBackdrop, isStandalone: true, selector: "ngts-backdrop", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
231
226
  <ngt-group #group [parameters]="parameters()">
232
227
  <ngt-mesh [receiveShadow]="receiveShadow()" [rotation]="[-Math.PI / 2, 0, Math.PI / 2]">
233
228
  <ngt-plane-geometry #plane *args="[1, 1, segments(), segments()]" />
@@ -236,7 +231,7 @@ class NgtsBackdrop {
236
231
  </ngt-group>
237
232
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
238
233
  }
239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBackdrop, decorators: [{
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBackdrop, decorators: [{
240
235
  type: Component,
241
236
  args: [{
242
237
  selector: 'ngts-backdrop',
@@ -287,14 +282,14 @@ class NgtsBBAnchor {
287
282
  }
288
283
  });
289
284
  }
290
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBBAnchor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
291
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsBBAnchor, isStandalone: true, selector: "ngts-bb-anchor", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "bbAnchorRef", first: true, predicate: ["bbAnchor"], descendants: true, isSignal: true }], ngImport: i0, template: `
285
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBBAnchor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
286
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsBBAnchor, isStandalone: true, selector: "ngts-bb-anchor", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "bbAnchorRef", first: true, predicate: ["bbAnchor"], descendants: true, isSignal: true }], ngImport: i0, template: `
292
287
  <ngt-group #bbAnchor [parameters]="parameters()">
293
288
  <ng-content />
294
289
  </ngt-group>
295
290
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
296
291
  }
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBBAnchor, decorators: [{
292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBBAnchor, decorators: [{
298
293
  type: Component,
299
294
  args: [{
300
295
  selector: 'ngts-bb-anchor',
@@ -359,44 +354,41 @@ class NgtsBounds {
359
354
  this.t = 0;
360
355
  this.box = new Box3();
361
356
  extend({ Group });
362
- const autoEffect = injectAutoEffect();
363
- afterNextRender(() => {
364
- autoEffect(() => {
365
- const [controls, camera] = [this.controls(), untracked(this.camera)];
366
- if (!controls)
367
- return;
368
- const callback = () => {
369
- if (controls && this.goal.target && this.animationState !== AnimationState.NONE) {
370
- const front = new Vector3().setFromMatrixColumn(camera.matrix, 2);
371
- const d0 = this.origin.camPos.distanceTo(controls.target);
372
- const d1 = (this.goal.camPos || this.origin.camPos).distanceTo(this.goal.target);
373
- const d = (1 - this.t) * d0 + this.t * d1;
374
- controls.target.copy(camera.position).addScaledVector(front, -d);
375
- controls.update();
376
- }
377
- this.animationState = AnimationState.NONE;
378
- };
379
- controls.addEventListener('start', callback);
380
- return () => controls.removeEventListener('start', callback);
381
- });
382
- let count = 0;
383
- autoEffect(() => {
384
- const [clip, fit, observe] = [
385
- this.clipOption(),
386
- this.fitOption(),
387
- this.observe(),
388
- this.size(),
389
- this.camera(),
390
- this.controls(),
391
- ];
392
- if (observe || count++ === 0) {
393
- this.refresh();
394
- if (fit)
395
- this.reset().fit();
396
- if (clip)
397
- this.clip();
357
+ effect((onCleanup) => {
358
+ const [controls, camera] = [this.controls(), untracked(this.camera)];
359
+ if (!controls)
360
+ return;
361
+ const callback = () => {
362
+ if (controls && this.goal.target && this.animationState !== AnimationState.NONE) {
363
+ const front = new Vector3().setFromMatrixColumn(camera.matrix, 2);
364
+ const d0 = this.origin.camPos.distanceTo(controls.target);
365
+ const d1 = (this.goal.camPos || this.origin.camPos).distanceTo(this.goal.target);
366
+ const d = (1 - this.t) * d0 + this.t * d1;
367
+ controls.target.copy(camera.position).addScaledVector(front, -d);
368
+ controls.update();
398
369
  }
399
- });
370
+ this.animationState = AnimationState.NONE;
371
+ };
372
+ controls.addEventListener('start', callback);
373
+ onCleanup(() => controls.removeEventListener('start', callback));
374
+ });
375
+ let count = 0;
376
+ effect(() => {
377
+ const [clip, fit, observe] = [
378
+ this.clipOption(),
379
+ this.fitOption(),
380
+ this.observe(),
381
+ this.size(),
382
+ this.camera(),
383
+ this.controls(),
384
+ ];
385
+ if (observe || count++ === 0) {
386
+ this.refresh();
387
+ if (fit)
388
+ this.reset().fit();
389
+ if (clip)
390
+ this.clip();
391
+ }
400
392
  });
401
393
  injectBeforeRender(({ delta }) => {
402
394
  // This [additional animation step START] is needed to guarantee that delta used in animation isn't absurdly high (2-3 seconds) which is actually possible if rendering happens on demand...
@@ -567,14 +559,14 @@ class NgtsBounds {
567
559
  invalidate();
568
560
  return this;
569
561
  }
570
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBounds, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
571
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsBounds, isStandalone: true, selector: "ngts-bounds", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }], ngImport: i0, template: `
562
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBounds, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
563
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsBounds, isStandalone: true, selector: "ngts-bounds", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }], ngImport: i0, template: `
572
564
  <ngt-group #group>
573
565
  <ng-content />
574
566
  </ngt-group>
575
567
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
576
568
  }
577
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsBounds, decorators: [{
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsBounds, decorators: [{
578
570
  type: Component,
579
571
  args: [{
580
572
  selector: 'ngts-bounds',
@@ -608,7 +600,6 @@ class NgtsCameraShake {
608
600
  }
609
601
  constructor() {
610
602
  this.options = input(defaultOptions$b, { transform: mergeInputs(defaultOptions$b) });
611
- this.autoEffect = injectAutoEffect();
612
603
  this.store = injectStore();
613
604
  this.camera = this.store.select('camera');
614
605
  this.defaultControls = this.store.select('controls');
@@ -617,17 +608,15 @@ class NgtsCameraShake {
617
608
  this.yawNoise = new SimplexNoise();
618
609
  this.pitchNoise = new SimplexNoise();
619
610
  this.rollNoise = new SimplexNoise();
620
- afterNextRender(() => {
621
- this.autoEffect(() => {
622
- const defaultControls = this.defaultControls();
623
- if (!defaultControls)
624
- return;
625
- const camera = this.camera();
626
- const callback = () => void (this.initialRotation = camera.rotation.clone());
627
- defaultControls.addEventListener('change', callback);
628
- callback();
629
- return () => void defaultControls.removeEventListener('change', callback);
630
- });
611
+ effect((onCleanup) => {
612
+ const defaultControls = this.defaultControls();
613
+ if (!defaultControls)
614
+ return;
615
+ const camera = this.camera();
616
+ const callback = () => void (this.initialRotation = camera.rotation.clone());
617
+ defaultControls.addEventListener('change', callback);
618
+ callback();
619
+ onCleanup(() => void defaultControls.removeEventListener('change', callback));
631
620
  });
632
621
  injectBeforeRender(({ delta, clock }) => {
633
622
  const [{ maxYaw, yawFrequency, maxPitch, pitchFrequency, maxRoll, rollFrequency, decay, decayRate }, camera] = [
@@ -644,10 +633,10 @@ class NgtsCameraShake {
644
633
  }
645
634
  });
646
635
  }
647
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCameraShake, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
648
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsCameraShake, isStandalone: true, selector: "ngts-camera-shake", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
636
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCameraShake, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
637
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsCameraShake, isStandalone: true, selector: "ngts-camera-shake", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
649
638
  }
650
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCameraShake, decorators: [{
639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCameraShake, decorators: [{
651
640
  type: Directive,
652
641
  args: [{ selector: 'ngts-camera-shake', standalone: true }]
653
642
  }], ctorParameters: () => [] });
@@ -721,7 +710,25 @@ class NgtsCaustics {
721
710
  this.causticsTargetB = injectFBO(this.causticsTargetParams);
722
711
  this.cameraHelper = injectHelper(() => (this.debug() ? this.cameraRef().nativeElement : null), () => CameraHelper);
723
712
  extend({ CausticsProjectionMaterial, Group, Scene, Mesh, PlaneGeometry, LineBasicMaterial, OrthographicCamera });
724
- const autoEffect = injectAutoEffect();
713
+ effect(() => {
714
+ // track all changes
715
+ const [group, scene, plane] = [
716
+ this.groupRef().nativeElement,
717
+ this.sceneRef().nativeElement,
718
+ this.planeRef().nativeElement,
719
+ this.options(),
720
+ ];
721
+ const groupLocalState = getLocalState(group);
722
+ const sceneLocalState = getLocalState(scene);
723
+ const planeLocalState = getLocalState(plane);
724
+ if (!groupLocalState || !sceneLocalState || !planeLocalState)
725
+ return;
726
+ groupLocalState.objects();
727
+ sceneLocalState.objects();
728
+ planeLocalState.objects();
729
+ planeLocalState.nonObjects();
730
+ group.updateWorldMatrix(false, true);
731
+ });
725
732
  const update = createCausticsUpdate(() => {
726
733
  const { lightSource, ...rest } = this.options();
727
734
  return {
@@ -740,30 +747,9 @@ class NgtsCaustics {
740
747
  };
741
748
  });
742
749
  injectBeforeRender(({ gl }) => update(gl));
743
- afterNextRender(() => {
744
- autoEffect(() => {
745
- // track all changes
746
- this.options();
747
- const [group, scene, plane] = [
748
- this.groupRef().nativeElement,
749
- this.sceneRef().nativeElement,
750
- this.planeRef().nativeElement,
751
- ];
752
- const groupLocalState = getLocalState(group);
753
- const sceneLocalState = getLocalState(scene);
754
- const planeLocalState = getLocalState(plane);
755
- if (!groupLocalState || !sceneLocalState || !planeLocalState)
756
- return;
757
- groupLocalState.objects();
758
- sceneLocalState.objects();
759
- planeLocalState.objects();
760
- planeLocalState.nonObjects();
761
- group.updateWorldMatrix(false, true);
762
- });
763
- });
764
750
  }
765
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCaustics, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
766
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsCaustics, isStandalone: true, selector: "ngts-caustics", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "sceneRef", first: true, predicate: ["scene"], descendants: true, isSignal: true }, { propertyName: "cameraRef", first: true, predicate: ["camera"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
751
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCaustics, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
752
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsCaustics, isStandalone: true, selector: "ngts-caustics", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "sceneRef", first: true, predicate: ["scene"], descendants: true, isSignal: true }, { propertyName: "cameraRef", first: true, predicate: ["camera"], descendants: true, isSignal: true }, { propertyName: "planeRef", first: true, predicate: ["plane"], descendants: true, isSignal: true }], ngImport: i0, template: `
767
753
  <ngt-group #group [parameters]="parameters()">
768
754
  <ngt-scene #scene>
769
755
  <ngt-orthographic-camera #camera [up]="[0, 1, 0]" />
@@ -792,7 +778,7 @@ class NgtsCaustics {
792
778
  </ngt-group>
793
779
  `, isInline: true, dependencies: [{ kind: "component", type: NgtsEdges, selector: "ngts-edges", inputs: ["options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
794
780
  }
795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCaustics, decorators: [{
781
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCaustics, decorators: [{
796
782
  type: Component,
797
783
  args: [{
798
784
  selector: 'ngts-caustics',
@@ -871,32 +857,29 @@ class NgtsCenter {
871
857
  'cacheKey',
872
858
  ]);
873
859
  extend({ Group });
874
- const autoEffect = injectAutoEffect();
875
- afterNextRender(() => {
876
- autoEffect(() => {
877
- const [{ precise, top, bottom, right, left, front, back, disable, disableZ, disableY, disableX }, group, outer, inner,] = [
878
- this.centerOptions(),
879
- this.groupRef().nativeElement,
880
- this.outerRef().nativeElement,
881
- this.innerRef().nativeElement,
882
- ];
883
- const localState = getLocalState(inner);
884
- const children = localState?.objects();
885
- if (!children?.length)
886
- return;
887
- outer.matrixWorld.identity();
888
- const box3 = new Box3().setFromObject(inner, precise);
889
- const center = new Vector3();
890
- const sphere = new Sphere();
891
- const width = box3.max.x - box3.min.x;
892
- const height = box3.max.y - box3.min.y;
893
- const depth = box3.max.z - box3.min.z;
894
- box3.getCenter(center);
895
- box3.getBoundingSphere(sphere);
896
- const vAlign = top ? height / 2 : bottom ? -height / 2 : 0;
897
- const hAlign = left ? -width / 2 : right ? width / 2 : 0;
898
- const dAlign = front ? depth / 2 : back ? -depth / 2 : 0;
899
- outer.position.set(disable || disableX ? 0 : -center.x + hAlign, disable || disableY ? 0 : -center.y + vAlign, disable || disableZ ? 0 : -center.z + dAlign);
860
+ effect(() => {
861
+ const inner = this.innerRef().nativeElement;
862
+ const localState = getLocalState(inner);
863
+ if (!localState)
864
+ return;
865
+ const children = [localState.objects(), localState.nonObjects()];
866
+ if (!children?.length)
867
+ return;
868
+ const [{ precise, top, bottom, right, left, front, back, disable, disableZ, disableY, disableX }, group, outer] = [this.centerOptions(), this.groupRef().nativeElement, this.outerRef().nativeElement];
869
+ outer.matrixWorld.identity();
870
+ const box3 = new Box3().setFromObject(inner, precise);
871
+ const center = new Vector3();
872
+ const sphere = new Sphere();
873
+ const width = box3.max.x - box3.min.x;
874
+ const height = box3.max.y - box3.min.y;
875
+ const depth = box3.max.z - box3.min.z;
876
+ box3.getCenter(center);
877
+ box3.getBoundingSphere(sphere);
878
+ const vAlign = top ? height / 2 : bottom ? -height / 2 : 0;
879
+ const hAlign = left ? -width / 2 : right ? width / 2 : 0;
880
+ const dAlign = front ? depth / 2 : back ? -depth / 2 : 0;
881
+ outer.position.set(disable || disableX ? 0 : -center.x + hAlign, disable || disableY ? 0 : -center.y + vAlign, disable || disableZ ? 0 : -center.z + dAlign);
882
+ untracked(() => {
900
883
  this.centered.emit({
901
884
  parent: group.parent,
902
885
  container: group,
@@ -913,8 +896,8 @@ class NgtsCenter {
913
896
  });
914
897
  });
915
898
  }
916
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCenter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
917
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsCenter, isStandalone: true, selector: "ngts-center", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { centered: "centered" }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "outerRef", first: true, predicate: ["outer"], descendants: true, isSignal: true }, { propertyName: "innerRef", first: true, predicate: ["inner"], descendants: true, isSignal: true }], ngImport: i0, template: `
899
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCenter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
900
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsCenter, isStandalone: true, selector: "ngts-center", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { centered: "centered" }, viewQueries: [{ propertyName: "groupRef", first: true, predicate: ["group"], descendants: true, isSignal: true }, { propertyName: "outerRef", first: true, predicate: ["outer"], descendants: true, isSignal: true }, { propertyName: "innerRef", first: true, predicate: ["inner"], descendants: true, isSignal: true }], ngImport: i0, template: `
918
901
  <ngt-group #group [parameters]="parameters()">
919
902
  <ngt-group #outer>
920
903
  <ngt-group #inner>
@@ -924,7 +907,7 @@ class NgtsCenter {
924
907
  </ngt-group>
925
908
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
926
909
  }
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCenter, decorators: [{
910
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsCenter, decorators: [{
928
911
  type: Component,
929
912
  args: [{
930
913
  selector: 'ngts-center',
@@ -1102,8 +1085,8 @@ class NgtsContactShadows {
1102
1085
  renderTarget.texture.generateMipmaps = false;
1103
1086
  return renderTarget;
1104
1087
  }
1105
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsContactShadows, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1106
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsContactShadows, isStandalone: true, selector: "ngts-contact-shadows", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "contactShadowsRef", first: true, predicate: ["contactShadows"], descendants: true, isSignal: true }, { propertyName: "shadowsCameraRef", first: true, predicate: ["shadowsCamera"], descendants: true, isSignal: true }], ngImport: i0, template: `
1088
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsContactShadows, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1089
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsContactShadows, isStandalone: true, selector: "ngts-contact-shadows", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "contactShadowsRef", first: true, predicate: ["contactShadows"], descendants: true, isSignal: true }, { propertyName: "shadowsCameraRef", first: true, predicate: ["shadowsCamera"], descendants: true, isSignal: true }], ngImport: i0, template: `
1107
1090
  <ngt-group #contactShadows [rotation]="[Math.PI / 2, 0, 0]" [parameters]="parameters()">
1108
1091
  <ngt-mesh
1109
1092
  [scale]="[1, -1, 1]"
@@ -1122,7 +1105,7 @@ class NgtsContactShadows {
1122
1105
  </ngt-group>
1123
1106
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1124
1107
  }
1125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsContactShadows, decorators: [{
1108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsContactShadows, decorators: [{
1126
1109
  type: Component,
1127
1110
  args: [{
1128
1111
  selector: 'ngts-contact-shadows',
@@ -1151,7 +1134,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
1151
1134
  }]
1152
1135
  }], ctorParameters: () => [] });
1153
1136
 
1154
- const CUBEMAP_ROOT = 'https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/';
1155
1137
  const ENVIRONMENT_PRESETS = {
1156
1138
  apartment: 'lebombo_1k.hdr',
1157
1139
  city: 'potsdamer_platz_1k.hdr',
@@ -1164,103 +1146,37 @@ const ENVIRONMENT_PRESETS = {
1164
1146
  sunset: 'venice_sunset_1k.hdr',
1165
1147
  warehouse: 'empty_warehouse_01_1k.hdr',
1166
1148
  };
1167
- function resolveScene(scene) {
1168
- return is.ref(scene) ? scene.nativeElement : scene;
1169
- }
1170
- function setEnvProps(background, scene, defaultScene, texture, sceneProps = {}) {
1171
- sceneProps.backgroundBlurriness ??= sceneProps.blur ?? 0;
1172
- sceneProps.backgroundIntensity ??= 1;
1173
- // @ts-expect-error - it's ok, we're sending through applyProps
1174
- sceneProps.backgroundRotation ??= [0, 0, 0];
1175
- sceneProps.environmentIntensity ??= 1;
1176
- // @ts-expect-error - it's ok, we're sending through applyProps
1177
- sceneProps.environmentRotation ??= [0, 0, 0];
1178
- const target = resolveScene(scene || defaultScene);
1179
- const oldbg = target.background;
1180
- const oldenv = target.environment;
1181
- const oldSceneProps = {
1182
- backgroundBlurriness: target.backgroundBlurriness,
1183
- backgroundIntensity: target.backgroundIntensity,
1184
- backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
1185
- environmentIntensity: target.environmentIntensity,
1186
- environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0],
1187
- };
1188
- if (background !== 'only')
1189
- target.environment = texture;
1190
- if (background)
1191
- target.background = texture;
1192
- applyProps(target, sceneProps);
1193
- return () => {
1194
- if (background !== 'only')
1195
- target.environment = oldenv;
1196
- if (background)
1197
- target.background = oldbg;
1198
- applyProps(target, oldSceneProps);
1199
- };
1200
- }
1149
+ const CUBEMAP_ROOT = 'https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/';
1150
+ const defaultFiles = ['/px.png', '/nx.png', '/py.png', '/ny.png', '/pz.png', '/nz.png'];
1201
1151
  function injectEnvironment(options = () => ({}), { injector } = {}) {
1202
1152
  return assertInjector(injectEnvironment, injector, () => {
1203
1153
  const adjustedOptions = computed(() => {
1204
1154
  const { preset, extensions, encoding, ...rest } = options();
1205
1155
  let { files, path } = rest;
1206
1156
  if (files == null) {
1207
- files = ['/px.png', '/nx.png', '/py.png', '/ny.png', '/pz.png', '/nz.png'];
1157
+ files = defaultFiles;
1208
1158
  }
1209
1159
  if (path == null) {
1210
1160
  path = '';
1211
1161
  }
1212
1162
  if (preset) {
1213
- if (!(preset in ENVIRONMENT_PRESETS))
1214
- throw new Error('Preset must be one of: ' + Object.keys(ENVIRONMENT_PRESETS).join(', '));
1163
+ validatePreset(preset);
1215
1164
  files = ENVIRONMENT_PRESETS[preset];
1216
1165
  path = CUBEMAP_ROOT;
1217
1166
  }
1218
1167
  return { files, preset, encoding, path, extensions };
1219
1168
  });
1220
1169
  const files = pick(adjustedOptions, 'files');
1221
- const resultOptions = computed(() => {
1222
- const { files } = adjustedOptions();
1223
- const multiFile = Array.isArray(files);
1224
- const isCubeMap = multiFile && files.length === 6;
1225
- const isGainmain = multiFile && files.length === 3 && files.some((file) => file.endsWith('json'));
1226
- const firstEntry = multiFile ? files[0] : files;
1227
- const extension = isCubeMap
1228
- ? 'cube'
1229
- : isGainmain
1230
- ? 'webp'
1231
- : firstEntry.startsWith('data:application/exr')
1232
- ? 'exr'
1233
- : firstEntry.startsWith('data:application/hdr')
1234
- ? 'hdr'
1235
- : firstEntry.startsWith('data:image/jpeg')
1236
- ? 'jpg'
1237
- : firstEntry.split('.').pop()?.split('?')?.shift()?.toLowerCase();
1238
- return { multiFile, extension, isCubeMap };
1239
- });
1240
- const loader = computed(() => {
1241
- const { extension } = resultOptions();
1242
- const loader = extension === 'cube'
1243
- ? CubeTextureLoader
1244
- : extension === 'hdr'
1245
- ? RGBELoader
1246
- : extension === 'exr'
1247
- ? EXRLoader
1248
- : extension === 'jpg' || extension === 'jpeg'
1249
- ? HDRJPGLoader
1250
- : extension === 'webp'
1251
- ? GainMapLoader
1252
- : null;
1253
- if (!loader) {
1254
- throw new Error('injectEnvironment: Unrecognized file extension: ' + extension);
1255
- }
1256
- return loader;
1257
- });
1170
+ const multiFile = computed(() => Array.isArray(files()));
1171
+ const resultOptions = computed(() => getExtension(files()));
1172
+ const extension = pick(resultOptions, 'extension');
1173
+ const loader = computed(() => getLoader(extension()));
1258
1174
  const store = injectStore();
1259
1175
  const gl = store.select('gl');
1260
1176
  const texture = signal(null);
1261
1177
  effect(() => {
1262
- const [{ extension, multiFile }, _files] = [untracked(resultOptions), files()];
1263
- if (extension !== 'webp' && extension !== 'jpg' && extension !== 'jpeg')
1178
+ const [_extension, _multiFile, _files] = [untracked(extension), untracked(multiFile), files()];
1179
+ if (_extension !== 'webp' && _extension !== 'jpg' && _extension !== 'jpeg')
1264
1180
  return;
1265
1181
  gl().domElement.addEventListener('webglcontextlost', () => {
1266
1182
  // @ts-expect-error - files is correctly passed
@@ -1290,13 +1206,14 @@ function injectEnvironment(options = () => ({}), { injector } = {}) {
1290
1206
  if (!loaderResult)
1291
1207
  return;
1292
1208
  untracked(() => {
1293
- const { multiFile, extension, isCubeMap } = resultOptions();
1209
+ const { extension, isCubeMap } = resultOptions();
1210
+ const _multiFile = multiFile();
1294
1211
  const { encoding } = adjustedOptions();
1295
1212
  // @ts-expect-error - ensure textureResult is a Texture or CubeTexture
1296
- let textureResult = (multiFile ? loaderResult[0] : loaderResult);
1213
+ let textureResult = (_multiFile ? loaderResult[0] : loaderResult);
1297
1214
  // NOTE: racing condition, we can skip this
1298
1215
  // we just said above that if multiFile is false, it is a single Texture
1299
- if (!multiFile && Array.isArray(textureResult) && textureResult[0] instanceof CubeTexture) {
1216
+ if (!_multiFile && Array.isArray(textureResult) && textureResult[0] instanceof CubeTexture) {
1300
1217
  return;
1301
1218
  }
1302
1219
  if (!(textureResult instanceof CubeTexture) &&
@@ -1314,6 +1231,120 @@ function injectEnvironment(options = () => ({}), { injector } = {}) {
1314
1231
  return texture.asReadonly();
1315
1232
  });
1316
1233
  }
1234
+ injectEnvironment.preload = (options = () => ({})) => {
1235
+ const _options = options();
1236
+ let { files, path } = _options;
1237
+ const { preset, extensions } = _options;
1238
+ if (files == null) {
1239
+ files = defaultFiles;
1240
+ }
1241
+ if (path == null) {
1242
+ path = '';
1243
+ }
1244
+ if (preset) {
1245
+ validatePreset(preset);
1246
+ files = ENVIRONMENT_PRESETS[preset];
1247
+ path = CUBEMAP_ROOT;
1248
+ }
1249
+ const { extension } = getExtension(files);
1250
+ if (extension === 'webp' || extension === 'jpg' || extension === 'jpeg') {
1251
+ throw new Error('injectEnvironment: Preloading gainmaps is not supported');
1252
+ }
1253
+ const loader = getLoader(extension);
1254
+ if (!loader)
1255
+ throw new Error('injectEnvironment: Unrecognized file extension: ' + files);
1256
+ injectLoader.preload(() => loader,
1257
+ // @ts-expect-error - files is correctly passed
1258
+ () => (Array.isArray(files) ? [files] : files), (loader) => {
1259
+ loader.setPath?.(path);
1260
+ if (extensions)
1261
+ extensions(loader);
1262
+ });
1263
+ };
1264
+ injectEnvironment.clear = (clearOptions) => {
1265
+ const options = { files: defaultFiles, ...clearOptions };
1266
+ let { files } = options;
1267
+ const preset = options.preset;
1268
+ if (preset) {
1269
+ validatePreset(preset);
1270
+ files = ENVIRONMENT_PRESETS[preset];
1271
+ }
1272
+ injectLoader.clear(files);
1273
+ };
1274
+ function validatePreset(preset) {
1275
+ if (!(preset in ENVIRONMENT_PRESETS))
1276
+ throw new Error('Preset must be one of: ' + Object.keys(ENVIRONMENT_PRESETS).join(', '));
1277
+ }
1278
+ function getExtension(files) {
1279
+ const isCubeMap = Array.isArray(files) && files.length === 6;
1280
+ const isGainmap = Array.isArray(files) && files.length === 3 && files.some((file) => file.endsWith('json'));
1281
+ const firstEntry = Array.isArray(files) ? files[0] : files;
1282
+ // Everything else
1283
+ const extension = isCubeMap
1284
+ ? 'cube'
1285
+ : isGainmap
1286
+ ? 'webp'
1287
+ : firstEntry.startsWith('data:application/exr')
1288
+ ? 'exr'
1289
+ : firstEntry.startsWith('data:application/hdr')
1290
+ ? 'hdr'
1291
+ : firstEntry.startsWith('data:image/jpeg')
1292
+ ? 'jpg'
1293
+ : firstEntry.split('.').pop()?.split('?')?.shift()?.toLowerCase();
1294
+ return { extension, isCubeMap, isGainmap };
1295
+ }
1296
+ function getLoader(extension) {
1297
+ const loader = extension === 'cube'
1298
+ ? CubeTextureLoader
1299
+ : extension === 'hdr'
1300
+ ? RGBELoader
1301
+ : extension === 'exr'
1302
+ ? EXRLoader
1303
+ : extension === 'jpg' || extension === 'jpeg'
1304
+ ? HDRJPGLoader
1305
+ : extension === 'webp'
1306
+ ? GainMapLoader
1307
+ : null;
1308
+ if (!loader) {
1309
+ throw new Error('injectEnvironment: Unrecognized file extension: ' + extension);
1310
+ }
1311
+ return loader;
1312
+ }
1313
+
1314
+ function resolveScene(scene) {
1315
+ return is.ref(scene) ? scene.nativeElement : scene;
1316
+ }
1317
+ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {}) {
1318
+ sceneProps.backgroundBlurriness ??= sceneProps.blur ?? 0;
1319
+ sceneProps.backgroundIntensity ??= 1;
1320
+ // @ts-expect-error - it's ok, we're sending through applyProps
1321
+ sceneProps.backgroundRotation ??= [0, 0, 0];
1322
+ sceneProps.environmentIntensity ??= 1;
1323
+ // @ts-expect-error - it's ok, we're sending through applyProps
1324
+ sceneProps.environmentRotation ??= [0, 0, 0];
1325
+ const target = resolveScene(scene || defaultScene);
1326
+ const oldbg = target.background;
1327
+ const oldenv = target.environment;
1328
+ const oldSceneProps = {
1329
+ backgroundBlurriness: target.backgroundBlurriness,
1330
+ backgroundIntensity: target.backgroundIntensity,
1331
+ backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
1332
+ environmentIntensity: target.environmentIntensity,
1333
+ environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0],
1334
+ };
1335
+ if (background !== 'only')
1336
+ target.environment = texture;
1337
+ if (background)
1338
+ target.background = texture;
1339
+ applyProps(target, sceneProps);
1340
+ return () => {
1341
+ if (background !== 'only')
1342
+ target.environment = oldenv;
1343
+ if (background)
1344
+ target.background = oldbg;
1345
+ applyProps(target, oldSceneProps);
1346
+ };
1347
+ }
1317
1348
  const defaultBackground = {
1318
1349
  background: false,
1319
1350
  };
@@ -1321,10 +1352,10 @@ class NgtsEnvironmentMap {
1321
1352
  constructor() {
1322
1353
  this.options = input(defaultBackground, { transform: mergeInputs(defaultBackground) });
1323
1354
  this.envSet = output();
1324
- this.autoEffect = injectAutoEffect();
1325
- this.store = injectStore();
1326
- this.defaultScene = this.store.select('scene');
1327
- this.envConfig = computed(() => {
1355
+ const store = injectStore();
1356
+ const defaultScene = store.select('scene');
1357
+ const _map = pick(this.options, 'map');
1358
+ const _envConfig = computed(() => {
1328
1359
  const { background = false, scene, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, } = this.options();
1329
1360
  return {
1330
1361
  background,
@@ -1337,23 +1368,20 @@ class NgtsEnvironmentMap {
1337
1368
  environmentRotation,
1338
1369
  };
1339
1370
  });
1340
- this.map = pick(this.options, 'map');
1341
- afterNextRender(() => {
1342
- this.autoEffect(() => {
1343
- const map = this.map();
1344
- if (!map)
1345
- return;
1346
- const { background = false, scene, ...config } = this.envConfig();
1347
- const cleanup = setEnvProps(background, scene, this.defaultScene(), map, config);
1348
- this.envSet.emit();
1349
- return () => cleanup();
1350
- });
1371
+ effect((onCleanup) => {
1372
+ const map = _map();
1373
+ if (!map)
1374
+ return;
1375
+ const { background = false, scene, ...config } = _envConfig();
1376
+ const cleanup = setEnvProps(background, scene, defaultScene(), map, config);
1377
+ this.envSet.emit();
1378
+ onCleanup(() => cleanup());
1351
1379
  });
1352
1380
  }
1353
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentMap, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1354
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsEnvironmentMap, isStandalone: true, selector: "ngts-environment-map", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0 }); }
1381
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentMap, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1382
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsEnvironmentMap, isStandalone: true, selector: "ngts-environment-map", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0 }); }
1355
1383
  }
1356
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentMap, decorators: [{
1384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentMap, decorators: [{
1357
1385
  type: Directive,
1358
1386
  args: [{ standalone: true, selector: 'ngts-environment-map' }]
1359
1387
  }], ctorParameters: () => [] });
@@ -1361,10 +1389,8 @@ class NgtsEnvironmentCube {
1361
1389
  constructor() {
1362
1390
  this.options = input(defaultBackground, { transform: mergeInputs(defaultBackground) });
1363
1391
  this.envSet = output();
1364
- this.autoEffect = injectAutoEffect();
1365
1392
  this.store = injectStore();
1366
1393
  this.defaultScene = this.store.select('scene');
1367
- this.injector = inject(Injector);
1368
1394
  this.envConfig = computed(() => {
1369
1395
  const { background = false, scene, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, } = this.options();
1370
1396
  return {
@@ -1378,23 +1404,21 @@ class NgtsEnvironmentCube {
1378
1404
  environmentRotation,
1379
1405
  };
1380
1406
  });
1381
- afterNextRender(() => {
1382
- const _texture = injectEnvironment(this.options, { injector: this.injector });
1383
- this.autoEffect(() => {
1384
- const texture = _texture();
1385
- if (!texture)
1386
- return;
1387
- const { background = false, scene, ...config } = this.envConfig();
1388
- const cleanup = setEnvProps(background, scene, this.defaultScene(), texture, config);
1389
- this.envSet.emit();
1390
- return () => cleanup();
1391
- });
1407
+ const _texture = injectEnvironment(this.options);
1408
+ effect((onCleanup) => {
1409
+ const texture = _texture();
1410
+ if (!texture)
1411
+ return;
1412
+ const { background = false, scene, ...config } = this.envConfig();
1413
+ const cleanup = setEnvProps(background, scene, this.defaultScene(), texture, config);
1414
+ this.envSet.emit();
1415
+ onCleanup(() => cleanup());
1392
1416
  });
1393
1417
  }
1394
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentCube, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1395
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsEnvironmentCube, isStandalone: true, selector: "ngts-environment-cube", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0 }); }
1418
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentCube, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1419
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsEnvironmentCube, isStandalone: true, selector: "ngts-environment-cube", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0 }); }
1396
1420
  }
1397
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentCube, decorators: [{
1421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentCube, decorators: [{
1398
1422
  type: Directive,
1399
1423
  args: [{ standalone: true, selector: 'ngts-environment-cube' }]
1400
1424
  }], ctorParameters: () => [] });
@@ -1410,7 +1434,7 @@ class NgtsEnvironmentPortal {
1410
1434
  this.options = input(this.defaultOptions, { transform: mergeInputs(this.defaultOptions) });
1411
1435
  this.content = input.required();
1412
1436
  this.envSet = output();
1413
- this.autoEffect = injectAutoEffect();
1437
+ this.injector = inject(Injector);
1414
1438
  this.store = injectStore();
1415
1439
  this.defaultScene = this.store.select('scene');
1416
1440
  this.gl = this.store.select('gl');
@@ -1439,14 +1463,13 @@ class NgtsEnvironmentPortal {
1439
1463
  this.cameraArgs = computed(() => [this.near(), this.far(), this.fbo()]);
1440
1464
  this.virtualScene = prepare(new Scene());
1441
1465
  extend({ CubeCamera });
1442
- afterNextRender(() => {
1443
- this.autoEffect(() => {
1444
- const [files, preset, map] = [this.files(), this.preset(), this.map()];
1445
- // NOTE: when there's none of this, we don't render cube or map so we need to setEnv here
1446
- if (!!files || !!preset || !!map)
1447
- return;
1448
- return this.setPortalEnv();
1449
- });
1466
+ effect((onCleanup) => {
1467
+ const [files, preset, map] = [this.files(), this.preset(), this.map()];
1468
+ // NOTE: when there's none of this, we don't render cube or map so we need to setEnv here
1469
+ if (!!files || !!preset || !!map)
1470
+ return;
1471
+ const cleanup = this.setPortalEnv();
1472
+ onCleanup(() => cleanup?.());
1450
1473
  });
1451
1474
  let count = 1;
1452
1475
  injectBeforeRender(() => {
@@ -1459,14 +1482,19 @@ class NgtsEnvironmentPortal {
1459
1482
  }
1460
1483
  }
1461
1484
  });
1485
+ inject(DestroyRef).onDestroy(() => {
1486
+ if (this.setEnvEffectRef)
1487
+ this.setEnvEffectRef.destroy();
1488
+ });
1462
1489
  }
1463
1490
  // NOTE: we use onEnvSet here to ensure that EnvironmentCube or EnvironmentMap sets the env before the portal
1464
1491
  onEnvSet() {
1465
1492
  if (this.setEnvEffectRef)
1466
1493
  this.setEnvEffectRef.destroy();
1467
- this.setEnvEffectRef = this.autoEffect(() => {
1468
- return this.setPortalEnv();
1469
- }, { manualCleanup: true });
1494
+ this.setEnvEffectRef = effect((onCleanup) => {
1495
+ const cleanup = this.setPortalEnv();
1496
+ onCleanup(() => cleanup?.());
1497
+ }, { manualCleanup: true, injector: this.injector });
1470
1498
  }
1471
1499
  setPortalEnv() {
1472
1500
  const camera = this.cameraRef();
@@ -1486,8 +1514,8 @@ class NgtsEnvironmentPortal {
1486
1514
  this.envSet.emit();
1487
1515
  return cleanup;
1488
1516
  }
1489
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentPortal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1490
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsEnvironmentPortal, isStandalone: true, selector: "ngts-environment-portal", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { envSet: "envSet" }, viewQueries: [{ propertyName: "cameraRef", first: true, predicate: ["cubeCamera"], descendants: true, isSignal: true }], ngImport: i0, template: `
1517
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentPortal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1518
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsEnvironmentPortal, isStandalone: true, selector: "ngts-environment-portal", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { envSet: "envSet" }, viewQueries: [{ propertyName: "cameraRef", first: true, predicate: ["cubeCamera"], descendants: true, isSignal: true }], ngImport: i0, template: `
1491
1519
  <ngt-portal [container]="virtualScene">
1492
1520
  <ng-template portalContent let-injector="injector" let-container="container">
1493
1521
  <ng-container
@@ -1507,7 +1535,7 @@ class NgtsEnvironmentPortal {
1507
1535
  </ngt-portal>
1508
1536
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtsEnvironmentCube, selector: "ngts-environment-cube", inputs: ["options"], outputs: ["envSet"] }, { kind: "directive", type: NgtsEnvironmentMap, selector: "ngts-environment-map", inputs: ["options"], outputs: ["envSet"] }, { kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[portalContent]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1509
1537
  }
1510
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentPortal, decorators: [{
1538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentPortal, decorators: [{
1511
1539
  type: Component,
1512
1540
  args: [{
1513
1541
  selector: 'ngts-environment-portal',
@@ -1540,33 +1568,25 @@ class NgtsEnvironmentGround {
1540
1568
  constructor() {
1541
1569
  this.options = input({});
1542
1570
  this.envSet = output();
1543
- this.args = signal([null]);
1571
+ this.defaultTexture = injectEnvironment(this.options);
1544
1572
  this.height = computed(() => this.options().ground?.height);
1545
1573
  this.radius = computed(() => this.options().ground?.radius);
1546
1574
  this.scale = computed(() => this.options().ground?.scale ?? 1000);
1575
+ this.args = computed(() => [this.options().map || this.defaultTexture()]);
1547
1576
  this.envMapOptions = computed(() => {
1548
1577
  const { map: _, ...options } = this.options();
1549
1578
  const [map] = this.args();
1550
1579
  return Object.assign(options, { map });
1551
1580
  });
1552
1581
  extend({ GroundProjectedEnv });
1553
- const injector = inject(Injector);
1554
- const autoEffect = injectAutoEffect();
1555
- afterNextRender(() => {
1556
- const defaultTexture = injectEnvironment(this.options, { injector });
1557
- const texture = computed(() => this.options().map || defaultTexture());
1558
- autoEffect(() => {
1559
- this.args.set([texture()]);
1560
- }, { allowSignalWrites: true });
1561
- });
1562
1582
  }
1563
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentGround, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1564
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsEnvironmentGround, isStandalone: true, selector: "ngts-environment-ground", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0, template: `
1583
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentGround, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1584
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.4", type: NgtsEnvironmentGround, isStandalone: true, selector: "ngts-environment-ground", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, ngImport: i0, template: `
1565
1585
  <ngts-environment-map [options]="envMapOptions()" (envSet)="envSet.emit()" />
1566
1586
  <ngt-ground-projected-env *args="args()" [scale]="scale()" [height]="height()" [radius]="radius()" />
1567
1587
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtsEnvironmentMap, selector: "ngts-environment-map", inputs: ["options"], outputs: ["envSet"] }, { kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1568
1588
  }
1569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironmentGround, decorators: [{
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironmentGround, decorators: [{
1570
1590
  type: Component,
1571
1591
  args: [{
1572
1592
  selector: 'ngts-environment-ground',
@@ -1586,8 +1606,8 @@ class NgtsEnvironment {
1586
1606
  this.content = contentChild(TemplateRef);
1587
1607
  this.envSet = output();
1588
1608
  }
1589
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironment, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1590
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsEnvironment, isStandalone: true, selector: "ngts-environment", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, queries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
1609
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironment, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1610
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsEnvironment, isStandalone: true, selector: "ngts-environment", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { envSet: "envSet" }, queries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
1591
1611
  @if (options().ground) {
1592
1612
  <ngts-environment-ground [options]="options()" (envSet)="envSet.emit()" />
1593
1613
  } @else if (options().map) {
@@ -1599,7 +1619,7 @@ class NgtsEnvironment {
1599
1619
  }
1600
1620
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtsEnvironmentCube, selector: "ngts-environment-cube", inputs: ["options"], outputs: ["envSet"] }, { kind: "directive", type: NgtsEnvironmentMap, selector: "ngts-environment-map", inputs: ["options"], outputs: ["envSet"] }, { kind: "component", type: NgtsEnvironmentPortal, selector: "ngts-environment-portal", inputs: ["options", "content"], outputs: ["envSet"] }, { kind: "component", type: NgtsEnvironmentGround, selector: "ngts-environment-ground", inputs: ["options"], outputs: ["envSet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1601
1621
  }
1602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsEnvironment, decorators: [{
1622
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsEnvironment, decorators: [{
1603
1623
  type: Component,
1604
1624
  args: [{
1605
1625
  selector: 'ngts-environment',
@@ -1660,8 +1680,8 @@ class NgtsFloat {
1660
1680
  container.updateMatrix();
1661
1681
  });
1662
1682
  }
1663
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsFloat, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1664
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsFloat, isStandalone: true, selector: "ngts-float", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "floatRef", first: true, predicate: ["float"], descendants: true, isSignal: true }], ngImport: i0, template: `
1683
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsFloat, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1684
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsFloat, isStandalone: true, selector: "ngts-float", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "floatRef", first: true, predicate: ["float"], descendants: true, isSignal: true }], ngImport: i0, template: `
1665
1685
  <ngt-group [parameters]="parameters()">
1666
1686
  <ngt-group #float [matrixAutoUpdate]="false">
1667
1687
  <ng-content />
@@ -1669,7 +1689,7 @@ class NgtsFloat {
1669
1689
  </ngt-group>
1670
1690
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1671
1691
  }
1672
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsFloat, decorators: [{
1692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsFloat, decorators: [{
1673
1693
  type: Component,
1674
1694
  args: [{
1675
1695
  selector: 'ngts-float',
@@ -1712,26 +1732,23 @@ class NgtsLightformer {
1712
1732
  this.meshRef = viewChild.required('mesh');
1713
1733
  this.defaultMaterialRef = viewChild('defaultMaterial');
1714
1734
  extend({ Mesh, MeshBasicMaterial, RingGeometry, PlaneGeometry });
1715
- const autoEffect = injectAutoEffect();
1716
- afterNextRender(() => {
1717
- autoEffect(() => {
1718
- const material = this.defaultMaterialRef()?.nativeElement;
1719
- if (material) {
1720
- applyProps(material, { color: this.color() });
1721
- material.color.multiplyScalar(this.intensity());
1722
- }
1723
- });
1724
- autoEffect(() => {
1725
- const target = this.target();
1726
- if (!target)
1727
- return;
1728
- const mesh = this.meshRef().nativeElement;
1729
- mesh.lookAt(target);
1730
- });
1735
+ effect(() => {
1736
+ const material = this.defaultMaterialRef()?.nativeElement;
1737
+ if (!material)
1738
+ return;
1739
+ applyProps(material, { color: this.color() });
1740
+ material.color.multiplyScalar(this.intensity());
1741
+ });
1742
+ effect(() => {
1743
+ const target = this.target();
1744
+ if (!target)
1745
+ return;
1746
+ const mesh = this.meshRef().nativeElement;
1747
+ mesh.lookAt(target);
1731
1748
  });
1732
1749
  }
1733
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsLightformer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1734
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsLightformer, isStandalone: true, selector: "ngts-lightformer", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }, { propertyName: "defaultMaterialRef", first: true, predicate: ["defaultMaterial"], descendants: true, isSignal: true }], ngImport: i0, template: `
1750
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsLightformer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1751
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsLightformer, isStandalone: true, selector: "ngts-lightformer", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }, { propertyName: "defaultMaterialRef", first: true, predicate: ["defaultMaterial"], descendants: true, isSignal: true }], ngImport: i0, template: `
1735
1752
  <ngt-mesh #mesh [scale]="fixedScale()" [parameters]="parameters()">
1736
1753
  <ng-content select="[data-lightformer-geometry]">
1737
1754
  @switch (form()) {
@@ -1754,7 +1771,7 @@ class NgtsLightformer {
1754
1771
  </ngt-mesh>
1755
1772
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1756
1773
  }
1757
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsLightformer, decorators: [{
1774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsLightformer, decorators: [{
1758
1775
  type: Component,
1759
1776
  args: [{
1760
1777
  selector: 'ngts-lightformer',
@@ -1813,22 +1830,19 @@ class NgtsMask {
1813
1830
  };
1814
1831
  });
1815
1832
  extend({ Mesh });
1816
- const autoEffect = injectAutoEffect();
1817
- afterNextRender(() => {
1818
- autoEffect(() => {
1819
- const [mesh, spread] = [this.meshRef().nativeElement, this.spread()];
1820
- Object.assign(mesh.material, spread);
1821
- });
1833
+ effect(() => {
1834
+ const [mesh, spread] = [this.meshRef().nativeElement, this.spread()];
1835
+ Object.assign(mesh.material, spread);
1822
1836
  });
1823
1837
  }
1824
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMask, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1825
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMask, isStandalone: true, selector: "ngts-mask", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
1838
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsMask, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1839
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsMask, isStandalone: true, selector: "ngts-mask", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
1826
1840
  <ngt-mesh #mesh [renderOrder]="-id()" [parameters]="parameters()">
1827
1841
  <ng-content />
1828
1842
  </ngt-mesh>
1829
1843
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1830
1844
  }
1831
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMask, decorators: [{
1845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsMask, decorators: [{
1832
1846
  type: Component,
1833
1847
  args: [{
1834
1848
  selector: 'ngts-mask',
@@ -1904,17 +1918,15 @@ class NgtsMatcapTexture {
1904
1918
  constructor() {
1905
1919
  this.matcapTexture = input();
1906
1920
  this.matcapTextureLoaded = output();
1907
- this.injector = inject(Injector);
1908
1921
  this.template = inject(TemplateRef);
1909
1922
  this.vcr = inject(ViewContainerRef);
1910
1923
  this.id = computed(() => this.matcapTexture()?.id ?? 0);
1911
1924
  this.format = computed(() => this.matcapTexture()?.format ?? 1024);
1925
+ const { texture } = injectMatcapTexture(this.id, {
1926
+ format: this.format,
1927
+ onLoad: this.matcapTextureLoaded.emit.bind(this.matcapTextureLoaded),
1928
+ });
1912
1929
  afterNextRender(() => {
1913
- const { texture } = injectMatcapTexture(this.id, {
1914
- format: this.format,
1915
- onLoad: this.matcapTextureLoaded.emit.bind(this.matcapTextureLoaded),
1916
- injector: this.injector,
1917
- });
1918
1930
  untracked(() => {
1919
1931
  this.ref = this.vcr.createEmbeddedView(this.template, { $implicit: texture });
1920
1932
  this.ref.detectChanges();
@@ -1927,10 +1939,10 @@ class NgtsMatcapTexture {
1927
1939
  static ngTemplateContextGuard(_, ctx) {
1928
1940
  return true;
1929
1941
  }
1930
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMatcapTexture, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1931
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsMatcapTexture, isStandalone: true, selector: "ng-template[matcapTexture]", inputs: { matcapTexture: { classPropertyName: "matcapTexture", publicName: "matcapTexture", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { matcapTextureLoaded: "matcapTextureLoaded" }, ngImport: i0 }); }
1942
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsMatcapTexture, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1943
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsMatcapTexture, isStandalone: true, selector: "ng-template[matcapTexture]", inputs: { matcapTexture: { classPropertyName: "matcapTexture", publicName: "matcapTexture", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { matcapTextureLoaded: "matcapTextureLoaded" }, ngImport: i0 }); }
1932
1944
  }
1933
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMatcapTexture, decorators: [{
1945
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsMatcapTexture, decorators: [{
1934
1946
  type: Directive,
1935
1947
  args: [{ selector: 'ng-template[matcapTexture]', standalone: true }]
1936
1948
  }], ctorParameters: () => [] });
@@ -1977,7 +1989,6 @@ class NgtsNormalTexture {
1977
1989
  constructor() {
1978
1990
  this.normalTexture = input();
1979
1991
  this.normalTextureLoaded = output();
1980
- this.injector = inject(Injector);
1981
1992
  this.template = inject(TemplateRef);
1982
1993
  this.vcr = inject(ViewContainerRef);
1983
1994
  this.id = computed(() => this.normalTexture()?.id ?? 0);
@@ -1985,12 +1996,11 @@ class NgtsNormalTexture {
1985
1996
  const { id: _, ...settings } = this.normalTexture() || {};
1986
1997
  return settings;
1987
1998
  });
1999
+ const { texture } = injectNormalTexture(this.id, {
2000
+ settings: this.settings,
2001
+ onLoad: this.normalTextureLoaded.emit.bind(this.normalTextureLoaded),
2002
+ });
1988
2003
  afterNextRender(() => {
1989
- const { texture } = injectNormalTexture(this.id, {
1990
- settings: this.settings,
1991
- onLoad: this.normalTextureLoaded.emit.bind(this.normalTextureLoaded),
1992
- injector: this.injector,
1993
- });
1994
2004
  untracked(() => {
1995
2005
  this.ref = this.vcr.createEmbeddedView(this.template, { $implicit: texture });
1996
2006
  this.ref.detectChanges();
@@ -2003,10 +2013,10 @@ class NgtsNormalTexture {
2003
2013
  static ngTemplateContextGuard(_, ctx) {
2004
2014
  return true;
2005
2015
  }
2006
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsNormalTexture, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2007
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsNormalTexture, isStandalone: true, selector: "ng-template[normalTexture]", inputs: { normalTexture: { classPropertyName: "normalTexture", publicName: "normalTexture", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { normalTextureLoaded: "normalTextureLoaded" }, ngImport: i0 }); }
2016
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsNormalTexture, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2017
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsNormalTexture, isStandalone: true, selector: "ng-template[normalTexture]", inputs: { normalTexture: { classPropertyName: "normalTexture", publicName: "normalTexture", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { normalTextureLoaded: "normalTextureLoaded" }, ngImport: i0 }); }
2008
2018
  }
2009
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsNormalTexture, decorators: [{
2019
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsNormalTexture, decorators: [{
2010
2020
  type: Directive,
2011
2021
  args: [{ selector: 'ng-template[normalTexture]', standalone: true }]
2012
2022
  }], ctorParameters: () => [] });
@@ -2045,13 +2055,10 @@ class NgtsRandomizedLights {
2045
2055
  this.far = pick(this.options, 'far');
2046
2056
  this.cameraArgs = computed(() => [-this.size(), this.size(), this.size(), -this.size(), this.near(), this.far()]);
2047
2057
  extend({ Group, DirectionalLight, OrthographicCamera, Vector2 });
2048
- const autoEffect = injectAutoEffect();
2049
- afterNextRender(() => {
2050
- autoEffect(() => {
2051
- const lights = this.lightsRef().nativeElement;
2052
- this.accumulativeShadows.lightsMap.set(lights.uuid, this.update.bind(this));
2053
- return () => this.accumulativeShadows.lightsMap.delete(lights.uuid);
2054
- });
2058
+ effect((onCleanup) => {
2059
+ const lights = this.lightsRef().nativeElement;
2060
+ this.accumulativeShadows.lightsMap.set(lights.uuid, this.update.bind(this));
2061
+ onCleanup(() => this.accumulativeShadows.lightsMap.delete(lights.uuid));
2055
2062
  });
2056
2063
  }
2057
2064
  update() {
@@ -2072,8 +2079,8 @@ class NgtsRandomizedLights {
2072
2079
  }
2073
2080
  }
2074
2081
  }
2075
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRandomizedLights, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2076
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsRandomizedLights, isStandalone: true, selector: "ngts-randomized-lights", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "lightsRef", first: true, predicate: ["lights"], descendants: true, isSignal: true }], ngImport: i0, template: `
2082
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRandomizedLights, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2083
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsRandomizedLights, isStandalone: true, selector: "ngts-randomized-lights", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "lightsRef", first: true, predicate: ["lights"], descendants: true, isSignal: true }], ngImport: i0, template: `
2077
2084
  <ngt-group #lights [parameters]="parameters()">
2078
2085
  @for (i of count(); track $index) {
2079
2086
  <ngt-directional-light [castShadow]="castShadow()" [intensity]="intensity() / amount()">
@@ -2085,7 +2092,7 @@ class NgtsRandomizedLights {
2085
2092
  </ngt-group>
2086
2093
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2087
2094
  }
2088
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRandomizedLights, decorators: [{
2095
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRandomizedLights, decorators: [{
2089
2096
  type: Component,
2090
2097
  args: [{
2091
2098
  selector: 'ngts-randomized-lights',
@@ -2115,16 +2122,14 @@ class NgtsRenderTextureContainer {
2115
2122
  this.frames = input.required();
2116
2123
  this.injector = input.required();
2117
2124
  this.store = injectStore();
2118
- injectAutoEffect()(() => {
2119
- // track
2120
- this.store.state();
2121
- const renderPriority = this.renderPriority();
2125
+ effect((onCleanup) => {
2126
+ const [renderPriority, { internal }] = [this.renderPriority(), this.store.state()];
2122
2127
  let count = 0;
2123
2128
  let oldAutoClear;
2124
2129
  let oldXrEnabled;
2125
2130
  let oldRenderTarget;
2126
2131
  let oldIsPresenting;
2127
- const sub = injectBeforeRender(({ gl, scene, camera }) => {
2132
+ const cleanup = internal.subscribe(({ gl, scene, camera }) => {
2128
2133
  const [fbo, frames] = [this.fbo(), this.frames()];
2129
2134
  // NOTE: render the frames ^ 2
2130
2135
  // due to some race condition, we want to render double the frames here.
@@ -2144,14 +2149,16 @@ class NgtsRenderTextureContainer {
2144
2149
  gl.xr.isPresenting = oldIsPresenting;
2145
2150
  count++;
2146
2151
  }
2147
- }, { priority: renderPriority, injector: this.injector() });
2148
- return () => sub();
2152
+ }, renderPriority, this.store);
2153
+ onCleanup(() => {
2154
+ cleanup();
2155
+ });
2149
2156
  });
2150
2157
  }
2151
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTextureContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2152
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsRenderTextureContainer, isStandalone: true, selector: "[ngtsRenderTextureContainer]", inputs: { fbo: { classPropertyName: "fbo", publicName: "fbo", isSignal: true, isRequired: true, transformFunction: null }, renderPriority: { classPropertyName: "renderPriority", publicName: "renderPriority", isSignal: true, isRequired: true, transformFunction: null }, frames: { classPropertyName: "frames", publicName: "frames", isSignal: true, isRequired: true, transformFunction: null }, injector: { classPropertyName: "injector", publicName: "injector", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTextureContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2159
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsRenderTextureContainer, isStandalone: true, selector: "[ngtsRenderTextureContainer]", inputs: { fbo: { classPropertyName: "fbo", publicName: "fbo", isSignal: true, isRequired: true, transformFunction: null }, renderPriority: { classPropertyName: "renderPriority", publicName: "renderPriority", isSignal: true, isRequired: true, transformFunction: null }, frames: { classPropertyName: "frames", publicName: "frames", isSignal: true, isRequired: true, transformFunction: null }, injector: { classPropertyName: "injector", publicName: "injector", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2153
2160
  }
2154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTextureContainer, decorators: [{
2161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTextureContainer, decorators: [{
2155
2162
  type: Directive,
2156
2163
  args: [{ standalone: true, selector: '[ngtsRenderTextureContainer]' }]
2157
2164
  }], ctorParameters: () => [] });
@@ -2168,10 +2175,10 @@ class NgtsRenderTextureContent {
2168
2175
  static ngTemplateContextGuard(_, ctx) {
2169
2176
  return true;
2170
2177
  }
2171
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTextureContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2172
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.0", type: NgtsRenderTextureContent, isStandalone: true, selector: "ng-template[renderTextureContent]", ngImport: i0 }); }
2178
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTextureContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2179
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.4", type: NgtsRenderTextureContent, isStandalone: true, selector: "ng-template[renderTextureContent]", ngImport: i0 }); }
2173
2180
  }
2174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTextureContent, decorators: [{
2181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTextureContent, decorators: [{
2175
2182
  type: Directive,
2176
2183
  args: [{ selector: 'ng-template[renderTextureContent]', standalone: true }]
2177
2184
  }] });
@@ -2249,8 +2256,8 @@ class NgtsRenderTexture {
2249
2256
  onPointerOver() {
2250
2257
  /* noop */
2251
2258
  }
2252
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTexture, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2253
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsRenderTexture, isStandalone: true, selector: "ngts-render-texture", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "content", first: true, predicate: NgtsRenderTextureContent, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: `
2259
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTexture, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2260
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsRenderTexture, isStandalone: true, selector: "ngts-render-texture", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "content", first: true, predicate: NgtsRenderTextureContent, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: `
2254
2261
  <ngt-portal [container]="virtualScene()" [state]="{ events: { compute: compute(), priority: eventPriority() } }">
2255
2262
  <ng-template portalContent let-injector="injector" let-container="container">
2256
2263
  <ng-container
@@ -2271,7 +2278,7 @@ class NgtsRenderTexture {
2271
2278
  <ngt-primitive *args="[fbo().texture]" [attach]="attach()" [parameters]="parameters()" />
2272
2279
  `, isInline: true, dependencies: [{ kind: "component", type: NgtPortal, selector: "ngt-portal", inputs: ["container", "state", "autoRender", "autoRenderPriority"] }, { kind: "directive", type: NgtsRenderTextureContainer, selector: "[ngtsRenderTextureContainer]", inputs: ["fbo", "renderPriority", "frames", "injector"] }, { kind: "directive", type: NgtPortalContent, selector: "ng-template[portalContent]" }, { kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2273
2280
  }
2274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsRenderTexture, decorators: [{
2281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsRenderTexture, decorators: [{
2275
2282
  type: Component,
2276
2283
  args: [{
2277
2284
  selector: 'ngts-render-texture',
@@ -2349,8 +2356,8 @@ class NgtsSky {
2349
2356
  });
2350
2357
  this.sky = new Sky();
2351
2358
  }
2352
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSky, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2353
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsSky, isStandalone: true, selector: "ngts-sky", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2359
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSky, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2360
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.4", type: NgtsSky, isStandalone: true, selector: "ngts-sky", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2354
2361
  <ngt-primitive *args="[sky]" [parameters]="parameters()" [scale]="scale()">
2355
2362
  <ngt-value attach="material.uniforms.mieCoefficient.value" [rawValue]="mieCoefficient()" />
2356
2363
  <ngt-value attach="material.uniforms.mieDirectionalG.value" [rawValue]="mieDirectionalG()" />
@@ -2361,7 +2368,7 @@ class NgtsSky {
2361
2368
  </ngt-primitive>
2362
2369
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2363
2370
  }
2364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSky, decorators: [{
2371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSky, decorators: [{
2365
2372
  type: Component,
2366
2373
  args: [{
2367
2374
  selector: 'ngts-sky',
@@ -2430,8 +2437,8 @@ class NgtsVolumetricMesh {
2430
2437
  }
2431
2438
  });
2432
2439
  }
2433
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsVolumetricMesh, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2434
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsVolumetricMesh, isStandalone: true, selector: "ngts-volumetric-mesh", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2440
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsVolumetricMesh, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2441
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsVolumetricMesh, isStandalone: true, selector: "ngts-volumetric-mesh", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "meshRef", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2435
2442
  <ngt-mesh #mesh [geometry]="geometry()" [raycast]="null">
2436
2443
  <ngt-primitive *args="[material]" attach="material">
2437
2444
  <ngt-value attach="uniforms.opacity.value" [rawValue]="opacity()" />
@@ -2449,7 +2456,7 @@ class NgtsVolumetricMesh {
2449
2456
  </ngt-mesh>
2450
2457
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2451
2458
  }
2452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsVolumetricMesh, decorators: [{
2459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsVolumetricMesh, decorators: [{
2453
2460
  type: Component,
2454
2461
  args: [{
2455
2462
  selector: 'ngts-volumetric-mesh',
@@ -2562,25 +2569,21 @@ class NgtsSpotLightShadowShader {
2562
2569
  uTime: { value: 0 },
2563
2570
  };
2564
2571
  extend({ Mesh, PlaneGeometry, MeshBasicMaterial });
2565
- const autoEffect = injectAutoEffect();
2566
- const injector = inject(Injector);
2567
- afterNextRender(() => {
2568
- injectSpotLightCommon(this.spotLight.spotLight, this.mesh, this.width, this.height, this.distance, injector);
2569
- autoEffect(() => {
2570
- this.uniforms.uShadowMap.value = this.map();
2571
- });
2572
- autoEffect(() => {
2573
- const fsQuad = this.fsQuad();
2574
- return () => {
2575
- fsQuad.material.dispose();
2576
- fsQuad.dispose();
2577
- };
2572
+ injectSpotLightCommon(this.spotLight.spotLight, this.mesh, this.width, this.height, this.distance);
2573
+ effect(() => {
2574
+ this.uniforms.uShadowMap.value = this.map();
2575
+ });
2576
+ effect((onCleanup) => {
2577
+ const fsQuad = this.fsQuad();
2578
+ onCleanup(() => {
2579
+ fsQuad.material.dispose();
2580
+ fsQuad.dispose();
2578
2581
  });
2579
- autoEffect(() => {
2580
- const renderTarget = this.renderTarget();
2581
- return () => {
2582
- renderTarget.dispose();
2583
- };
2582
+ });
2583
+ effect((onCleanup) => {
2584
+ const renderTarget = this.renderTarget();
2585
+ onCleanup(() => {
2586
+ renderTarget.dispose();
2584
2587
  });
2585
2588
  });
2586
2589
  injectBeforeRender(({ gl, delta }) => {
@@ -2590,8 +2593,8 @@ class NgtsSpotLightShadowShader {
2590
2593
  gl.setRenderTarget(null);
2591
2594
  });
2592
2595
  }
2593
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadowShader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2594
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsSpotLightShadowShader, isStandalone: true, selector: "ngts-spot-light-shadow-shader", inputs: { shader: { classPropertyName: "shader", publicName: "shader", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mesh", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2596
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadowShader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2597
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsSpotLightShadowShader, isStandalone: true, selector: "ngts-spot-light-shadow-shader", inputs: { shader: { classPropertyName: "shader", publicName: "shader", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mesh", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2595
2598
  <ngt-mesh #mesh [scale]="scale()" [castShadow]="true">
2596
2599
  <ngt-plane-geometry />
2597
2600
  <ngt-mesh-basic-material
@@ -2606,7 +2609,7 @@ class NgtsSpotLightShadowShader {
2606
2609
  </ngt-mesh>
2607
2610
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2608
2611
  }
2609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadowShader, decorators: [{
2612
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadowShader, decorators: [{
2610
2613
  type: Component,
2611
2614
  args: [{
2612
2615
  selector: 'ngts-spot-light-shadow-shader',
@@ -2649,13 +2652,10 @@ class NgtsSpotLightShadowNoShader {
2649
2652
  this.height = pick(this.options, 'height');
2650
2653
  this.distance = pick(this.options, 'distance');
2651
2654
  extend({ Mesh, PlaneGeometry, MeshBasicMaterial });
2652
- const injector = inject(Injector);
2653
- afterNextRender(() => {
2654
- injectSpotLightCommon(this.spotLight.spotLight, this.mesh, this.width, this.height, this.distance, injector);
2655
- });
2655
+ injectSpotLightCommon(this.spotLight.spotLight, this.mesh, this.width, this.height, this.distance);
2656
2656
  }
2657
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadowNoShader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2658
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsSpotLightShadowNoShader, isStandalone: true, selector: "ngts-spot-light-shadow-no-shader", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mesh", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2657
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadowNoShader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2658
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.4", type: NgtsSpotLightShadowNoShader, isStandalone: true, selector: "ngts-spot-light-shadow-no-shader", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mesh", first: true, predicate: ["mesh"], descendants: true, isSignal: true }], ngImport: i0, template: `
2659
2659
  <ngt-mesh #mesh [scale]="scale()" [castShadow]="true">
2660
2660
  <ngt-plane-geometry />
2661
2661
  <ngt-mesh-basic-material
@@ -2670,7 +2670,7 @@ class NgtsSpotLightShadowNoShader {
2670
2670
  </ngt-mesh>
2671
2671
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2672
2672
  }
2673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadowNoShader, decorators: [{
2673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadowNoShader, decorators: [{
2674
2674
  type: Component,
2675
2675
  args: [{
2676
2676
  selector: 'ngts-spot-light-shadow-no-shader',
@@ -2698,8 +2698,8 @@ class NgtsSpotLightShadow {
2698
2698
  this.shader = input();
2699
2699
  this.options = input(defaultSpotLightShadowOptions, { transform: mergeInputs(defaultSpotLightShadowOptions) });
2700
2700
  }
2701
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadow, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2702
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsSpotLightShadow, isStandalone: true, selector: "ngts-spot-light-shadow", inputs: { shader: { classPropertyName: "shader", publicName: "shader", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2701
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadow, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2702
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsSpotLightShadow, isStandalone: true, selector: "ngts-spot-light-shadow", inputs: { shader: { classPropertyName: "shader", publicName: "shader", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2703
2703
  @if (shader(); as shader) {
2704
2704
  <ngts-spot-light-shadow-shader [shader]="shader" [options]="options()" />
2705
2705
  } @else {
@@ -2707,7 +2707,7 @@ class NgtsSpotLightShadow {
2707
2707
  }
2708
2708
  `, isInline: true, dependencies: [{ kind: "component", type: NgtsSpotLightShadowShader, selector: "ngts-spot-light-shadow-shader", inputs: ["shader", "options"] }, { kind: "component", type: NgtsSpotLightShadowNoShader, selector: "ngts-spot-light-shadow-no-shader", inputs: ["options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2709
2709
  }
2710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLightShadow, decorators: [{
2710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLightShadow, decorators: [{
2711
2711
  type: Component,
2712
2712
  args: [{
2713
2713
  selector: 'ngts-spot-light-shadow',
@@ -2770,8 +2770,8 @@ class NgtsSpotLight {
2770
2770
  this.volumetric = pick(this.options, 'volumetric');
2771
2771
  extend({ Group, SpotLight });
2772
2772
  }
2773
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLight, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2774
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsSpotLight, isStandalone: true, selector: "ngts-spot-light", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "spotLight", first: true, predicate: ["spotLight"], descendants: true, isSignal: true }], ngImport: i0, template: `
2773
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLight, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2774
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsSpotLight, isStandalone: true, selector: "ngts-spot-light", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "spotLight", first: true, predicate: ["spotLight"], descendants: true, isSignal: true }], ngImport: i0, template: `
2775
2775
  <ngt-group>
2776
2776
  <ngt-spot-light
2777
2777
  #spotLight
@@ -2793,7 +2793,7 @@ class NgtsSpotLight {
2793
2793
  </ngt-group>
2794
2794
  `, isInline: true, dependencies: [{ kind: "component", type: NgtsVolumetricMesh, selector: "ngts-volumetric-mesh", inputs: ["options"] }, { kind: "component", type: NgtsHelper, selector: "ngts-helper", inputs: ["type", "options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2795
2795
  }
2796
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsSpotLight, decorators: [{
2796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsSpotLight, decorators: [{
2797
2797
  type: Component,
2798
2798
  args: [{
2799
2799
  selector: 'ngts-spot-light',
@@ -2854,20 +2854,17 @@ class NgtsStageRefit {
2854
2854
  constructor() {
2855
2855
  this.radius = input.required();
2856
2856
  this.adjustCamera = input.required();
2857
- const autoEffect = injectAutoEffect();
2858
2857
  const bounds = inject(NgtsBounds);
2859
- afterNextRender(() => {
2860
- autoEffect(() => {
2861
- const [, adjustCamera] = [this.radius(), this.adjustCamera()];
2862
- if (adjustCamera)
2863
- bounds.refresh().clip().fit();
2864
- });
2858
+ effect(() => {
2859
+ const [, adjustCamera] = [this.radius(), this.adjustCamera()];
2860
+ if (adjustCamera)
2861
+ bounds.refresh().clip().fit();
2865
2862
  });
2866
2863
  }
2867
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsStageRefit, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2868
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.0", type: NgtsStageRefit, isStandalone: true, selector: "ngts-stage-refit", inputs: { radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: true, transformFunction: null }, adjustCamera: { classPropertyName: "adjustCamera", publicName: "adjustCamera", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2864
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsStageRefit, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2865
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.4", type: NgtsStageRefit, isStandalone: true, selector: "ngts-stage-refit", inputs: { radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: true, transformFunction: null }, adjustCamera: { classPropertyName: "adjustCamera", publicName: "adjustCamera", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2869
2866
  }
2870
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsStageRefit, decorators: [{
2867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsStageRefit, decorators: [{
2871
2868
  type: Directive,
2872
2869
  args: [{ standalone: true, selector: 'ngts-stage-refit' }]
2873
2870
  }], ctorParameters: () => [] });
@@ -2947,8 +2944,8 @@ class NgtsStage {
2947
2944
  this.dims.set({ radius: boundingSphere.radius, width, height, depth });
2948
2945
  this.centered.emit($event);
2949
2946
  }
2950
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsStage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2951
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: NgtsStage, isStandalone: true, selector: "ngts-stage", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { centered: "centered" }, ngImport: i0, template: `
2947
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsStage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2948
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.4", type: NgtsStage, isStandalone: true, selector: "ngts-stage", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { centered: "centered" }, ngImport: i0, template: `
2952
2949
  <ngt-ambient-light [intensity]="intensity() / 3" />
2953
2950
  <ngt-spot-light
2954
2951
  [penumbra]="1"
@@ -2989,7 +2986,7 @@ class NgtsStage {
2989
2986
  }
2990
2987
  `, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }, { kind: "component", type: NgtsBounds, selector: "ngts-bounds", inputs: ["options"] }, { kind: "directive", type: NgtsStageRefit, selector: "ngts-stage-refit", inputs: ["radius", "adjustCamera"] }, { kind: "component", type: NgtsCenter, selector: "ngts-center", inputs: ["options"], outputs: ["centered"] }, { kind: "component", type: NgtsContactShadows, selector: "ngts-contact-shadows", inputs: ["options"] }, { kind: "component", type: NgtsAccumulativeShadows, selector: "ngts-accumulative-shadows", inputs: ["options"] }, { kind: "component", type: NgtsEnvironment, selector: "ngts-environment", inputs: ["options"], outputs: ["envSet"] }, { kind: "component", type: NgtsRandomizedLights, selector: "ngts-randomized-lights", inputs: ["options"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2991
2988
  }
2992
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsStage, decorators: [{
2989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.4", ngImport: i0, type: NgtsStage, decorators: [{
2993
2990
  type: Component,
2994
2991
  args: [{
2995
2992
  selector: 'ngts-stage',