angular-three-soba 2.0.0-beta.3 → 2.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstractions/billboard/billboard.d.ts +12 -8
- package/abstractions/detailed/detailed.d.ts +26 -0
- package/abstractions/edges/edges.d.ts +24 -12
- package/abstractions/grid/grid.d.ts +50 -0
- package/abstractions/index.d.ts +2 -7
- package/abstractions/text/text.d.ts +10 -5
- package/abstractions/text-3d/text-3d.d.ts +51 -41
- package/cameras/camera/camera-content.d.ts +1 -1
- package/cameras/camera/camera.d.ts +16 -13
- package/cameras/cube-camera/cube-camera.d.ts +50 -23
- package/cameras/index.d.ts +0 -1
- package/cameras/orthographic-camera/orthographic-camera.d.ts +29 -18
- package/cameras/perspective-camera/perspective-camera.d.ts +10 -1
- package/controls/orbit-controls/orbit-controls.d.ts +34 -15
- package/esm2022/abstractions/billboard/billboard.mjs +36 -33
- package/esm2022/abstractions/detailed/detailed.mjs +64 -0
- package/esm2022/abstractions/edges/edges.mjs +58 -63
- package/esm2022/abstractions/grid/grid.mjs +180 -0
- package/esm2022/abstractions/index.mjs +3 -8
- package/esm2022/abstractions/text/text.mjs +123 -124
- package/esm2022/abstractions/text-3d/text-3d.mjs +120 -115
- package/esm2022/cameras/camera/camera-content.mjs +6 -6
- package/esm2022/cameras/camera/camera.mjs +48 -42
- package/esm2022/cameras/cube-camera/cube-camera.mjs +130 -99
- package/esm2022/cameras/index.mjs +1 -2
- package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +78 -75
- package/esm2022/cameras/perspective-camera/perspective-camera.mjs +25 -26
- package/esm2022/controls/orbit-controls/orbit-controls.mjs +109 -85
- package/esm2022/gizmos/angular-three-soba-gizmos.mjs +5 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-helper.mjs +198 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +93 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +151 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.mjs +66 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +71 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +195 -0
- package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +272 -0
- package/esm2022/gizmos/index.mjs +4 -0
- package/esm2022/loaders/gltf-loader/gltf-loader.mjs +8 -6
- package/esm2022/loaders/loader/loader.mjs +92 -87
- package/esm2022/loaders/progress/progress.mjs +31 -30
- package/esm2022/loaders/texture-loader/texture-loader.mjs +6 -5
- package/esm2022/materials/index.mjs +2 -1
- package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +60 -51
- package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +239 -255
- package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +102 -99
- package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +167 -146
- package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +44 -42
- package/esm2022/materials/point-material/point-material.mjs +50 -0
- package/esm2022/misc/animations/animations.mjs +39 -34
- package/esm2022/misc/bake-shadows/bake-shadows.mjs +13 -13
- package/esm2022/misc/caustics/caustics.mjs +387 -0
- package/esm2022/misc/decal/decal.mjs +187 -0
- package/esm2022/misc/depth-buffer/depth-buffer.mjs +35 -36
- package/esm2022/misc/example/example.mjs +161 -0
- package/esm2022/misc/fbo/fbo.mjs +37 -36
- package/esm2022/misc/html/html-wrapper.mjs +478 -0
- package/esm2022/misc/html/html.mjs +305 -0
- package/esm2022/misc/index.mjs +10 -1
- package/esm2022/misc/sampler/sampler.mjs +143 -0
- package/esm2022/misc/shadow/shadow.mjs +111 -0
- package/esm2022/misc/stats-gl/stats-gl.mjs +61 -0
- package/esm2022/misc/trail/trail.mjs +210 -0
- package/esm2022/misc/trail-texture/inject-trail-texture.mjs +18 -0
- package/esm2022/misc/trail-texture/trail-texture.mjs +106 -0
- package/esm2022/modifiers/angular-three-soba-modifiers.mjs +5 -0
- package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +64 -0
- package/esm2022/modifiers/index.mjs +2 -0
- package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +44 -0
- package/esm2022/performances/adaptive-events/adaptive-events.mjs +27 -0
- package/esm2022/performances/angular-three-soba-performances.mjs +5 -0
- package/esm2022/performances/index.mjs +8 -0
- package/esm2022/performances/instances/instances.mjs +221 -0
- package/esm2022/performances/instances/position-mesh.mjs +52 -0
- package/esm2022/performances/points/points-input.mjs +64 -0
- package/esm2022/performances/points/points.mjs +327 -0
- package/esm2022/performances/points/position-point.mjs +54 -0
- package/esm2022/performances/segments/segment-object.mjs +9 -0
- package/esm2022/performances/segments/segments.mjs +183 -0
- package/esm2022/shaders/blur-pass/blur-pass.mjs +2 -2
- package/esm2022/shaders/caustics/caustics-material.mjs +130 -0
- package/esm2022/shaders/caustics/caustics-projection-material.mjs +31 -0
- package/esm2022/shaders/convolution-material/convolution-material.mjs +1 -1
- package/esm2022/shaders/discard-material/discard-material.mjs +1 -1
- package/esm2022/shaders/grid-material/grid-material.mjs +77 -0
- package/esm2022/shaders/index.mjs +6 -3
- package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +42 -41
- package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +2 -2
- package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +2 -2
- package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +4 -4
- package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +1 -1
- package/esm2022/shaders/shader-material/shader-material.mjs +3 -5
- package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +17 -25
- package/esm2022/shaders/sparkles-material/sparkles-material.mjs +32 -46
- package/esm2022/shaders/spot-light-material/spot-light-material.mjs +7 -7
- package/esm2022/shaders/star-field-material/star-field-material.mjs +3 -2
- package/esm2022/shaders/wireframe-material/wireframe-material.mjs +247 -0
- package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +161 -176
- package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +8 -8
- package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +128 -129
- package/esm2022/staging/backdrop/backdrop.mjs +77 -0
- package/esm2022/staging/bb-anchor/bb-anchor.mjs +69 -0
- package/esm2022/staging/bounds/bounds.mjs +145 -143
- package/esm2022/staging/camera-shake/camera-shake.mjs +86 -80
- package/esm2022/staging/center/center.mjs +129 -112
- package/esm2022/staging/cloud/cloud.mjs +118 -124
- package/esm2022/staging/contact-shadows/contact-shadows.mjs +131 -136
- package/esm2022/staging/environment/assets.mjs +12 -12
- package/esm2022/staging/environment/environment-cube.mjs +28 -30
- package/esm2022/staging/environment/environment-ground.mjs +17 -19
- package/esm2022/staging/environment/environment-input.mjs +98 -85
- package/esm2022/staging/environment/environment-map.mjs +33 -33
- package/esm2022/staging/environment/environment-portal.mjs +75 -97
- package/esm2022/staging/environment/environment.mjs +34 -51
- package/esm2022/staging/environment/utils.mjs +40 -17
- package/esm2022/staging/float/float.mjs +70 -58
- package/esm2022/staging/index.mjs +7 -3
- package/esm2022/staging/matcap-texture/matcap-texture.mjs +64 -0
- package/esm2022/staging/normal-texture/normal-texture.mjs +53 -0
- package/esm2022/staging/sky/sky.mjs +85 -80
- package/esm2022/staging/sparkles/sparkles.mjs +108 -105
- package/esm2022/staging/spot-light/shadow-mesh-input.mjs +63 -0
- package/esm2022/staging/spot-light/shadow-mesh.mjs +267 -0
- package/esm2022/staging/spot-light/spot-light-input.mjs +67 -58
- package/esm2022/staging/spot-light/spot-light.mjs +51 -63
- package/esm2022/staging/spot-light/volumetric-mesh.mjs +67 -70
- package/esm2022/staging/stage/stage.mjs +305 -290
- package/esm2022/staging/stars/stars.mjs +101 -102
- package/esm2022/staging/wireframe/wireframe-input.mjs +191 -0
- package/esm2022/staging/wireframe/wireframe.mjs +228 -0
- package/esm2022/utils/angular-three-soba-utils.mjs +5 -0
- package/esm2022/utils/content/content.mjs +15 -0
- package/esm2022/utils/index.mjs +2 -0
- package/fesm2022/angular-three-soba-abstractions.mjs +514 -1947
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +303 -259
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +108 -83
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-gizmos.mjs +1045 -0
- package/fesm2022/angular-three-soba-gizmos.mjs.map +1 -0
- package/fesm2022/angular-three-soba-loaders.mjs +129 -119
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +662 -592
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +2219 -108
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-modifiers.mjs +71 -0
- package/fesm2022/angular-three-soba-modifiers.mjs.map +1 -0
- package/fesm2022/angular-three-soba-performances.mjs +957 -0
- package/fesm2022/angular-three-soba-performances.mjs.map +1 -0
- package/fesm2022/angular-three-soba-shaders.mjs +551 -256
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +2910 -2573
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- package/fesm2022/angular-three-soba-utils.mjs +22 -0
- package/fesm2022/angular-three-soba-utils.mjs.map +1 -0
- package/gizmos/README.md +3 -0
- package/gizmos/gizmo-helper/gizmo-helper.d.ts +69 -0
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +29 -0
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.d.ts +33 -0
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +10 -0
- package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +40 -0
- package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +30 -0
- package/gizmos/index.d.ts +3 -0
- package/loaders/gltf-loader/gltf-loader.d.ts +4 -3
- package/loaders/loader/loader.d.ts +19 -17
- package/loaders/progress/progress.d.ts +1 -1
- package/loaders/texture-loader/texture-loader.d.ts +2 -2
- package/materials/index.d.ts +1 -0
- package/materials/mesh-distort-material/mesh-distort-material.d.ts +25 -15
- package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +74 -56
- package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +33 -21
- package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +55 -39
- package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +19 -10
- package/materials/point-material/point-material.d.ts +24 -0
- package/metadata.json +1 -0
- package/misc/animations/animations.d.ts +6 -4
- package/misc/caustics/caustics.d.ts +87 -0
- package/misc/decal/decal.d.ts +49 -0
- package/misc/depth-buffer/depth-buffer.d.ts +2 -2
- package/misc/example/example.d.ts +81 -0
- package/misc/fbo/fbo.d.ts +2 -2
- package/misc/html/html-wrapper.d.ts +559 -0
- package/misc/html/html.d.ts +214 -0
- package/misc/index.d.ts +9 -0
- package/misc/sampler/sampler.d.ts +67 -0
- package/misc/shadow/shadow.d.ts +37 -0
- package/misc/stats-gl/stats-gl.d.ts +24 -0
- package/misc/trail/trail.d.ts +57 -0
- package/misc/trail-texture/inject-trail-texture.d.ts +9 -0
- package/misc/trail-texture/trail-texture.d.ts +50 -0
- package/modifiers/README.md +3 -0
- package/modifiers/curve-modifier/curve-modifier.d.ts +23 -0
- package/modifiers/index.d.ts +1 -0
- package/package.json +42 -26
- package/performances/README.md +3 -0
- package/performances/adaptive-dpr/adaptive-dpr.d.ts +14 -0
- package/{performance/adaptive → performances/adaptive-events}/adaptive-events.d.ts +3 -0
- package/performances/index.d.ts +7 -0
- package/performances/instances/instances.d.ts +79 -0
- package/{performance → performances}/instances/position-mesh.d.ts +1 -1
- package/performances/points/points-input.d.ts +32 -0
- package/performances/points/points.d.ts +92 -0
- package/performances/points/position-point.d.ts +11 -0
- package/performances/segments/segment-object.d.ts +7 -0
- package/performances/segments/segments.d.ts +124 -0
- package/shaders/grid-material/grid-material.d.ts +37 -0
- package/shaders/index.d.ts +5 -2
- package/shaders/mesh-distort-material/mesh-distort-material.d.ts +173 -6
- package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +1 -1
- package/shaders/shader-material/shader-material.d.ts +2 -2
- package/shaders/soft-shadow-material/soft-shadow-material.d.ts +10 -1
- package/shaders/sparkles-material/sparkles-material.d.ts +15 -1
- package/shaders/spot-light-material/spot-light-material.d.ts +11 -2
- package/shaders/star-field-material/star-field-material.d.ts +11 -1
- package/shaders/wireframe-material/wireframe-material.d.ts +58 -0
- package/staging/accumulative-shadows/accumulative-shadows.d.ts +89 -39
- package/staging/accumulative-shadows/randomized-lights.d.ts +41 -28
- package/staging/backdrop/backdrop.d.ts +30 -0
- package/staging/bb-anchor/bb-anchor.d.ts +27 -0
- package/staging/bounds/bounds.d.ts +101 -25
- package/staging/camera-shake/camera-shake.d.ts +30 -19
- package/staging/center/center.d.ts +43 -35
- package/staging/cloud/cloud.d.ts +27 -24
- package/staging/contact-shadows/contact-shadows.d.ts +43 -30
- package/staging/environment/assets.d.ts +9 -9
- package/staging/environment/environment-cube.d.ts +9 -5
- package/staging/environment/environment-ground.d.ts +7 -7
- package/staging/environment/environment-input.d.ts +38 -38
- package/staging/environment/environment-map.d.ts +10 -5
- package/staging/environment/environment-portal.d.ts +10 -5
- package/staging/environment/environment.d.ts +0 -4
- package/staging/environment/utils.d.ts +2 -2
- package/staging/float/float.d.ts +15 -11
- package/staging/index.d.ts +6 -2
- package/staging/matcap-texture/matcap-texture.d.ts +13 -0
- package/staging/normal-texture/normal-texture.d.ts +16 -0
- package/staging/sky/sky.d.ts +28 -21
- package/staging/sparkles/sparkles.d.ts +36 -22
- package/staging/spot-light/shadow-mesh-input.d.ts +29 -0
- package/staging/spot-light/shadow-mesh.d.ts +37 -0
- package/staging/spot-light/spot-light-input.d.ts +25 -25
- package/staging/spot-light/spot-light.d.ts +31 -15
- package/staging/spot-light/volumetric-mesh.d.ts +15 -9
- package/staging/stage/stage.d.ts +89 -65
- package/staging/stars/stars.d.ts +28 -17
- package/staging/wireframe/wireframe-input.d.ts +65 -0
- package/staging/wireframe/wireframe.d.ts +28 -0
- package/utils/README.md +3 -0
- package/utils/content/content.d.ts +8 -0
- package/utils/index.d.ts +1 -0
- package/web-types.json +1 -0
- package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +0 -25
- package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +0 -25
- package/abstractions/gizmo-helper/gizmo-helper.d.ts +0 -34
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -30
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -32
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -14
- package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -47
- package/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -40
- package/abstractions/line/line-input.d.ts +0 -42
- package/abstractions/line/line.d.ts +0 -35
- package/abstractions/quadratic-bezier-line/quadratic-bezier-line.d.ts +0 -23
- package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +0 -131
- package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +0 -113
- package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +0 -210
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -95
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -155
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -62
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -80
- package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -206
- package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -273
- package/esm2022/abstractions/line/line-input.mjs +0 -113
- package/esm2022/abstractions/line/line.mjs +0 -165
- package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
- package/esm2022/performance/adaptive/adaptive-dpr.mjs +0 -46
- package/esm2022/performance/adaptive/adaptive-events.mjs +0 -31
- package/esm2022/performance/angular-three-soba-performance.mjs +0 -5
- package/esm2022/performance/detailed/detailed.mjs +0 -61
- package/esm2022/performance/index.mjs +0 -7
- package/esm2022/performance/instances/instance.mjs +0 -48
- package/esm2022/performance/instances/instances.mjs +0 -189
- package/esm2022/performance/instances/position-mesh.mjs +0 -52
- package/esm2022/performance/stats/stats.mjs +0 -79
- package/esm2022/shaders/caustics-material/caustics-material.mjs +0 -128
- package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +0 -33
- package/esm2022/staging/caustics/caustisc.mjs +0 -384
- package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +0 -57
- package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +0 -256
- package/fesm2022/angular-three-soba-performance.mjs +0 -487
- package/fesm2022/angular-three-soba-performance.mjs.map +0 -1
- package/performance/README.md +0 -3
- package/performance/adaptive/adaptive-dpr.d.ts +0 -8
- package/performance/detailed/detailed.d.ts +0 -20
- package/performance/index.d.ts +0 -6
- package/performance/instances/instance.d.ts +0 -9
- package/performance/instances/instances.d.ts +0 -35
- package/performance/stats/stats.d.ts +0 -18
- package/plugin/generators.json +0 -19
- package/plugin/libs/plugin/README.md +0 -11
- package/plugin/package.json +0 -9
- package/plugin/src/generators/init/compat.d.ts +0 -2
- package/plugin/src/generators/init/compat.js +0 -6
- package/plugin/src/generators/init/compat.js.map +0 -1
- package/plugin/src/generators/init/init.d.ts +0 -4
- package/plugin/src/generators/init/init.js +0 -22
- package/plugin/src/generators/init/init.js.map +0 -1
- package/plugin/src/generators/init/schema.json +0 -6
- package/plugin/src/index.d.ts +0 -1
- package/plugin/src/index.js +0 -6
- package/plugin/src/index.js.map +0 -1
- package/staging/caustics/caustisc.d.ts +0 -70
- package/staging/spot-light/spot-light-shadow-mesh-input.d.ts +0 -29
- package/staging/spot-light/spot-light-shadow-mesh.d.ts +0 -38
- /package/{abstractions → gizmos}/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -0
- /package/shaders/{caustics-material → caustics}/caustics-material.d.ts +0 -0
- /package/shaders/{caustics-material → caustics}/caustics-projection-material.d.ts +0 -0
|
@@ -1,152 +1,133 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA, Input, computed, effect } from '@angular/core';
|
|
3
|
+
import { signalStore, injectNgtRef, injectBeforeRender, NgtArgs, extend, injectNgtStore, getLocalState, NgtKey } from 'angular-three';
|
|
4
|
+
import { injectNgtsMeshDistortMaterial, MeshReflectorMaterial, BlurPass, MeshRefractionMaterial, MeshTransmissionMaterial, DiscardMaterial, MeshWobbleMaterial } from 'angular-three-soba/shaders';
|
|
5
5
|
import { NgIf } from '@angular/common';
|
|
6
6
|
import * as THREE from 'three';
|
|
7
|
-
import { MeshBVH, SAH } from 'three-mesh-bvh';
|
|
7
|
+
import { MeshBVHUniformStruct, MeshBVH, SAH } from 'three-mesh-bvh';
|
|
8
8
|
import { injectNgtsFBO } from 'angular-three-soba/misc';
|
|
9
9
|
|
|
10
|
-
class NgtsMeshDistortMaterial
|
|
11
|
-
set
|
|
12
|
-
this.set({ time });
|
|
10
|
+
class NgtsMeshDistortMaterial {
|
|
11
|
+
set _time(time) {
|
|
12
|
+
this.inputs.set({ time });
|
|
13
13
|
}
|
|
14
|
-
set
|
|
15
|
-
this.set({ distort });
|
|
14
|
+
set _distort(distort) {
|
|
15
|
+
this.inputs.set({ distort });
|
|
16
16
|
}
|
|
17
|
-
set
|
|
18
|
-
this.set({ radius });
|
|
17
|
+
set _radius(radius) {
|
|
18
|
+
this.inputs.set({ radius });
|
|
19
19
|
}
|
|
20
|
-
set
|
|
21
|
-
this.set({ speed });
|
|
20
|
+
set _speed(speed) {
|
|
21
|
+
this.inputs.set({ speed });
|
|
22
22
|
}
|
|
23
23
|
constructor() {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
this.inputs = signalStore({
|
|
25
|
+
speed: 1,
|
|
26
|
+
time: 0,
|
|
27
|
+
distort: 0.4,
|
|
28
|
+
radius: 1,
|
|
29
|
+
});
|
|
26
30
|
this.materialRef = injectNgtRef();
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
31
|
+
this.MeshDistortMaterial = injectNgtsMeshDistortMaterial();
|
|
32
|
+
this.material = new this.MeshDistortMaterial();
|
|
33
|
+
this.time = this.inputs.select('time');
|
|
34
|
+
this.distort = this.inputs.select('distort');
|
|
35
|
+
this.radius = this.inputs.select('radius');
|
|
30
36
|
injectBeforeRender(({ clock }) => {
|
|
31
|
-
this.material.time = clock.getElapsedTime() * this.get('speed');
|
|
37
|
+
this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
|
|
32
38
|
});
|
|
33
39
|
}
|
|
34
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
35
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
41
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshDistortMaterial, isStandalone: true, selector: "ngts-mesh-distort-material", inputs: { materialRef: "materialRef", _time: ["time", "_time"], _distort: ["distort", "_distort"], _radius: ["radius", "_radius"], _speed: ["speed", "_speed"] }, ngImport: i0, template: `
|
|
42
|
+
<ngt-primitive
|
|
43
|
+
*args="[material]"
|
|
44
|
+
[ref]="materialRef"
|
|
45
|
+
[time]="time()"
|
|
46
|
+
[distort]="distort()"
|
|
47
|
+
[radius]="radius()"
|
|
48
|
+
ngtCompound
|
|
49
|
+
attach="material"
|
|
50
|
+
/>
|
|
51
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
|
|
46
52
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
|
|
48
54
|
type: Component,
|
|
49
55
|
args: [{
|
|
50
56
|
selector: 'ngts-mesh-distort-material',
|
|
51
57
|
standalone: true,
|
|
52
58
|
template: `
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
<ngt-primitive
|
|
60
|
+
*args="[material]"
|
|
61
|
+
[ref]="materialRef"
|
|
62
|
+
[time]="time()"
|
|
63
|
+
[distort]="distort()"
|
|
64
|
+
[radius]="radius()"
|
|
65
|
+
ngtCompound
|
|
66
|
+
attach="material"
|
|
67
|
+
/>
|
|
68
|
+
`,
|
|
63
69
|
imports: [NgtArgs],
|
|
64
70
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
65
71
|
}]
|
|
66
72
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
67
73
|
type: Input
|
|
68
|
-
}],
|
|
69
|
-
type: Input
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}],
|
|
75
|
-
type: Input
|
|
74
|
+
}], _time: [{
|
|
75
|
+
type: Input,
|
|
76
|
+
args: [{ alias: 'time' }]
|
|
77
|
+
}], _distort: [{
|
|
78
|
+
type: Input,
|
|
79
|
+
args: [{ alias: 'distort' }]
|
|
80
|
+
}], _radius: [{
|
|
81
|
+
type: Input,
|
|
82
|
+
args: [{ alias: 'radius' }]
|
|
83
|
+
}], _speed: [{
|
|
84
|
+
type: Input,
|
|
85
|
+
args: [{ alias: 'speed' }]
|
|
76
86
|
}] } });
|
|
77
87
|
|
|
78
88
|
extend({ MeshReflectorMaterial });
|
|
79
|
-
class NgtsMeshReflectorMaterial
|
|
80
|
-
set
|
|
81
|
-
this.set({ resolution });
|
|
82
|
-
}
|
|
83
|
-
set
|
|
84
|
-
this.set({ mixBlur });
|
|
85
|
-
}
|
|
86
|
-
set
|
|
87
|
-
this.set({ mixStrength });
|
|
88
|
-
}
|
|
89
|
-
set
|
|
90
|
-
this.set({ blur });
|
|
91
|
-
}
|
|
92
|
-
set
|
|
93
|
-
this.set({ mirror });
|
|
94
|
-
}
|
|
95
|
-
set
|
|
96
|
-
this.set({ minDepthThreshold });
|
|
97
|
-
}
|
|
98
|
-
set
|
|
99
|
-
this.set({ maxDepthThreshold });
|
|
100
|
-
}
|
|
101
|
-
set
|
|
102
|
-
this.set({ depthScale });
|
|
103
|
-
}
|
|
104
|
-
set
|
|
105
|
-
this.set({ depthToBlurRatioBias });
|
|
106
|
-
}
|
|
107
|
-
set
|
|
108
|
-
this.set({ distortionMap });
|
|
109
|
-
}
|
|
110
|
-
set
|
|
111
|
-
this.set({ distortion });
|
|
112
|
-
}
|
|
113
|
-
set
|
|
114
|
-
this.set({ mixContrast });
|
|
115
|
-
}
|
|
116
|
-
set
|
|
117
|
-
this.set({ reflectorOffset });
|
|
118
|
-
}
|
|
119
|
-
#store;
|
|
120
|
-
#gl;
|
|
121
|
-
#reflectorPlane;
|
|
122
|
-
#normal;
|
|
123
|
-
#reflectorWorldPosition;
|
|
124
|
-
#cameraWorldPosition;
|
|
125
|
-
#rotationMatrix;
|
|
126
|
-
#lookAtPosition;
|
|
127
|
-
#clipPlane;
|
|
128
|
-
#view;
|
|
129
|
-
#target;
|
|
130
|
-
#q;
|
|
131
|
-
#textureMatrix;
|
|
132
|
-
#virtualCamera;
|
|
133
|
-
#blur;
|
|
134
|
-
#resolution;
|
|
135
|
-
#mirror;
|
|
136
|
-
#mixBlur;
|
|
137
|
-
#mixStrength;
|
|
138
|
-
#minDepthThreshold;
|
|
139
|
-
#maxDepthThreshold;
|
|
140
|
-
#depthScale;
|
|
141
|
-
#depthToBlurRatioBias;
|
|
142
|
-
#distortion;
|
|
143
|
-
#distortionMap;
|
|
144
|
-
#mixContrast;
|
|
145
|
-
#normalizedBlur;
|
|
146
|
-
#hasBlur;
|
|
147
|
-
#reflectorEntities;
|
|
89
|
+
class NgtsMeshReflectorMaterial {
|
|
90
|
+
set _resolution(resolution) {
|
|
91
|
+
this.inputs.set({ resolution });
|
|
92
|
+
}
|
|
93
|
+
set _mixBlur(mixBlur) {
|
|
94
|
+
this.inputs.set({ mixBlur });
|
|
95
|
+
}
|
|
96
|
+
set _mixStrength(mixStrength) {
|
|
97
|
+
this.inputs.set({ mixStrength });
|
|
98
|
+
}
|
|
99
|
+
set _blur(blur) {
|
|
100
|
+
this.inputs.set({ blur });
|
|
101
|
+
}
|
|
102
|
+
set _mirror(mirror) {
|
|
103
|
+
this.inputs.set({ mirror });
|
|
104
|
+
}
|
|
105
|
+
set _minDepthThreshold(minDepthThreshold) {
|
|
106
|
+
this.inputs.set({ minDepthThreshold });
|
|
107
|
+
}
|
|
108
|
+
set _maxDepthThreshold(maxDepthThreshold) {
|
|
109
|
+
this.inputs.set({ maxDepthThreshold });
|
|
110
|
+
}
|
|
111
|
+
set _depthScale(depthScale) {
|
|
112
|
+
this.inputs.set({ depthScale });
|
|
113
|
+
}
|
|
114
|
+
set _depthToBlurRatioBias(depthToBlurRatioBias) {
|
|
115
|
+
this.inputs.set({ depthToBlurRatioBias });
|
|
116
|
+
}
|
|
117
|
+
set _distortionMap(distortionMap) {
|
|
118
|
+
this.inputs.set({ distortionMap });
|
|
119
|
+
}
|
|
120
|
+
set _distortion(distortion) {
|
|
121
|
+
this.inputs.set({ distortion });
|
|
122
|
+
}
|
|
123
|
+
set _mixContrast(mixContrast) {
|
|
124
|
+
this.inputs.set({ mixContrast });
|
|
125
|
+
}
|
|
126
|
+
set _reflectorOffset(reflectorOffset) {
|
|
127
|
+
this.inputs.set({ reflectorOffset });
|
|
128
|
+
}
|
|
148
129
|
constructor() {
|
|
149
|
-
|
|
130
|
+
this.inputs = signalStore({
|
|
150
131
|
mixBlur: 0,
|
|
151
132
|
mixStrength: 1,
|
|
152
133
|
resolution: 256,
|
|
@@ -161,76 +142,75 @@ class NgtsMeshReflectorMaterial extends NgtSignalStore {
|
|
|
161
142
|
reflectorOffset: 0,
|
|
162
143
|
});
|
|
163
144
|
this.materialRef = injectNgtRef();
|
|
164
|
-
this.reflectorProps = computed(() => this
|
|
145
|
+
this.reflectorProps = computed(() => this.states().reflectorProps);
|
|
165
146
|
this.defines = computed(() => this.reflectorProps().defines);
|
|
166
|
-
this.
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
184
|
-
this
|
|
185
|
-
this
|
|
186
|
-
this
|
|
187
|
-
this
|
|
188
|
-
this
|
|
189
|
-
this
|
|
190
|
-
this
|
|
191
|
-
this
|
|
192
|
-
this
|
|
193
|
-
this
|
|
194
|
-
this
|
|
195
|
-
this
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
-
this
|
|
199
|
-
this
|
|
200
|
-
this
|
|
201
|
-
this
|
|
202
|
-
this
|
|
203
|
-
this
|
|
204
|
-
this
|
|
205
|
-
this
|
|
206
|
-
this
|
|
207
|
-
this
|
|
208
|
-
const blur = this
|
|
147
|
+
this.mirror = computed(() => this.reflectorProps().mirror);
|
|
148
|
+
this.textureMatrix = computed(() => this.reflectorProps().textureMatrix);
|
|
149
|
+
this.mixBlur = computed(() => this.reflectorProps().mixBlur);
|
|
150
|
+
this.tDiffuse = computed(() => this.reflectorProps().tDiffuse);
|
|
151
|
+
this.tDepth = computed(() => this.reflectorProps().tDepth);
|
|
152
|
+
this.tDiffuseBlur = computed(() => this.reflectorProps().tDiffuseBlur);
|
|
153
|
+
this.hasBlur = computed(() => this.reflectorProps().hasBlur);
|
|
154
|
+
this.mixStrength = computed(() => this.reflectorProps().mixStrength);
|
|
155
|
+
this.minDepthThreshold = computed(() => this.reflectorProps().minDepthThreshold);
|
|
156
|
+
this.maxDepthThreshold = computed(() => this.reflectorProps().maxDepthThreshold);
|
|
157
|
+
this.depthScale = computed(() => this.reflectorProps().depthScale);
|
|
158
|
+
this.depthToBlurRatioBias = computed(() => this.reflectorProps().depthToBlurRatioBias);
|
|
159
|
+
this.distortion = computed(() => this.reflectorProps().distortion);
|
|
160
|
+
this.distortionMap = computed(() => this.reflectorProps().distortionMap);
|
|
161
|
+
this.mixContrast = computed(() => this.reflectorProps().mixContrast);
|
|
162
|
+
this.store = injectNgtStore();
|
|
163
|
+
this.gl = this.store.select('gl');
|
|
164
|
+
this.reflectorPlane = new THREE.Plane();
|
|
165
|
+
this.normal = new THREE.Vector3();
|
|
166
|
+
this.reflectorWorldPosition = new THREE.Vector3();
|
|
167
|
+
this.cameraWorldPosition = new THREE.Vector3();
|
|
168
|
+
this.rotationMatrix = new THREE.Matrix4();
|
|
169
|
+
this.lookAtPosition = new THREE.Vector3(0, 0, -1);
|
|
170
|
+
this.clipPlane = new THREE.Vector4();
|
|
171
|
+
this.view = new THREE.Vector3();
|
|
172
|
+
this.target = new THREE.Vector3();
|
|
173
|
+
this.q = new THREE.Vector4();
|
|
174
|
+
this.virtualCamera = new THREE.PerspectiveCamera();
|
|
175
|
+
this._textureMatrix = new THREE.Matrix4();
|
|
176
|
+
this.__blur = this.inputs.select('blur');
|
|
177
|
+
this.__resolution = this.inputs.select('resolution');
|
|
178
|
+
this.__mirror = this.inputs.select('mirror');
|
|
179
|
+
this.__mixBlur = this.inputs.select('mixBlur');
|
|
180
|
+
this.__mixStrength = this.inputs.select('mixStrength');
|
|
181
|
+
this.__minDepthThreshold = this.inputs.select('minDepthThreshold');
|
|
182
|
+
this.__maxDepthThreshold = this.inputs.select('maxDepthThreshold');
|
|
183
|
+
this.__depthScale = this.inputs.select('depthScale');
|
|
184
|
+
this.__depthToBlurRatioBias = this.inputs.select('depthToBlurRatioBias');
|
|
185
|
+
this.__distortion = this.inputs.select('distortion');
|
|
186
|
+
this.__distortionMap = this.inputs.select('distortionMap');
|
|
187
|
+
this.__mixContrast = this.inputs.select('mixContrast');
|
|
188
|
+
this.normalizedBlur = computed(() => {
|
|
189
|
+
const blur = this.__blur();
|
|
209
190
|
return Array.isArray(blur) ? blur : [blur, blur];
|
|
210
191
|
});
|
|
211
|
-
this
|
|
212
|
-
const [x, y] = this
|
|
192
|
+
this.__hasBlur = computed(() => {
|
|
193
|
+
const [x, y] = this.normalizedBlur();
|
|
213
194
|
return x + y > 0;
|
|
214
195
|
});
|
|
215
|
-
this
|
|
216
|
-
const gl = this
|
|
217
|
-
const resolution = this
|
|
218
|
-
const blur = this
|
|
219
|
-
const minDepthThreshold = this
|
|
220
|
-
const maxDepthThreshold = this
|
|
221
|
-
const depthScale = this
|
|
222
|
-
const depthToBlurRatioBias = this
|
|
223
|
-
const mirror = this
|
|
224
|
-
const mixBlur = this
|
|
225
|
-
const mixStrength = this
|
|
226
|
-
const mixContrast = this
|
|
227
|
-
const distortion = this
|
|
228
|
-
const distortionMap = this
|
|
229
|
-
const hasBlur = this
|
|
196
|
+
this.states = computed(() => {
|
|
197
|
+
const gl = this.gl();
|
|
198
|
+
const resolution = this.__resolution();
|
|
199
|
+
const blur = this.normalizedBlur();
|
|
200
|
+
const minDepthThreshold = this.__minDepthThreshold();
|
|
201
|
+
const maxDepthThreshold = this.__maxDepthThreshold();
|
|
202
|
+
const depthScale = this.__depthScale();
|
|
203
|
+
const depthToBlurRatioBias = this.__depthToBlurRatioBias();
|
|
204
|
+
const mirror = this.__mirror();
|
|
205
|
+
const mixBlur = this.__mixBlur();
|
|
206
|
+
const mixStrength = this.__mixStrength();
|
|
207
|
+
const mixContrast = this.__mixContrast();
|
|
208
|
+
const distortion = this.__distortion();
|
|
209
|
+
const distortionMap = this.__distortionMap();
|
|
210
|
+
const hasBlur = this.__hasBlur();
|
|
230
211
|
const parameters = {
|
|
231
212
|
minFilter: THREE.LinearFilter,
|
|
232
213
|
magFilter: THREE.LinearFilter,
|
|
233
|
-
encoding: gl.outputEncoding,
|
|
234
214
|
type: THREE.HalfFloatType,
|
|
235
215
|
};
|
|
236
216
|
const fbo1 = new THREE.WebGLRenderTarget(resolution, resolution, parameters);
|
|
@@ -251,7 +231,7 @@ class NgtsMeshReflectorMaterial extends NgtSignalStore {
|
|
|
251
231
|
});
|
|
252
232
|
const reflectorProps = {
|
|
253
233
|
mirror,
|
|
254
|
-
textureMatrix: this
|
|
234
|
+
textureMatrix: this._textureMatrix,
|
|
255
235
|
mixBlur,
|
|
256
236
|
tDiffuse: fbo1.texture,
|
|
257
237
|
tDepth: fbo1.depthTexture,
|
|
@@ -273,29 +253,29 @@ class NgtsMeshReflectorMaterial extends NgtSignalStore {
|
|
|
273
253
|
};
|
|
274
254
|
return { fbo1, fbo2, blurPass, reflectorProps };
|
|
275
255
|
});
|
|
276
|
-
injectBeforeRender(this
|
|
256
|
+
injectBeforeRender(this.onBeforeRender.bind(this));
|
|
277
257
|
}
|
|
278
|
-
|
|
258
|
+
onBeforeRender(state) {
|
|
279
259
|
if (!this.materialRef.nativeElement)
|
|
280
260
|
return;
|
|
281
|
-
const parent = getLocalState(this.materialRef.nativeElement).parent();
|
|
261
|
+
const parent = getLocalState(this.materialRef.nativeElement).parent?.();
|
|
282
262
|
if (!parent)
|
|
283
263
|
return;
|
|
284
264
|
const { gl, scene } = state;
|
|
285
|
-
const hasBlur = this
|
|
286
|
-
const { fbo1, fbo2, blurPass } = this
|
|
265
|
+
const hasBlur = this.__hasBlur();
|
|
266
|
+
const { fbo1, fbo2, blurPass } = this.states();
|
|
287
267
|
if (fbo1 && fbo2 && blurPass) {
|
|
288
268
|
parent.visible = false;
|
|
289
269
|
const currentXrEnabled = gl.xr.enabled;
|
|
290
270
|
const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
|
|
291
|
-
this
|
|
271
|
+
this.beforeRender(state);
|
|
292
272
|
gl.xr.enabled = false;
|
|
293
273
|
gl.shadowMap.autoUpdate = false;
|
|
294
274
|
gl.setRenderTarget(fbo1);
|
|
295
275
|
gl.state.buffers.depth.setMask(true);
|
|
296
276
|
if (!gl.autoClear)
|
|
297
277
|
gl.clear();
|
|
298
|
-
gl.render(scene, this
|
|
278
|
+
gl.render(scene, this.virtualCamera);
|
|
299
279
|
if (hasBlur)
|
|
300
280
|
blurPass.render(gl, fbo1, fbo2);
|
|
301
281
|
gl.xr.enabled = currentXrEnabled;
|
|
@@ -304,206 +284,215 @@ class NgtsMeshReflectorMaterial extends NgtSignalStore {
|
|
|
304
284
|
gl.setRenderTarget(null);
|
|
305
285
|
}
|
|
306
286
|
}
|
|
307
|
-
|
|
308
|
-
const parent = getLocalState(this.materialRef.nativeElement).parent();
|
|
287
|
+
beforeRender(state) {
|
|
288
|
+
const parent = getLocalState(this.materialRef.nativeElement).parent?.();
|
|
309
289
|
if (!parent)
|
|
310
290
|
return;
|
|
311
291
|
const { camera } = state;
|
|
312
|
-
this
|
|
313
|
-
this
|
|
314
|
-
this
|
|
315
|
-
this
|
|
316
|
-
this
|
|
317
|
-
this
|
|
318
|
-
this
|
|
292
|
+
this.reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
|
|
293
|
+
this.cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
|
|
294
|
+
this.rotationMatrix.extractRotation(parent.matrixWorld);
|
|
295
|
+
this.normal.set(0, 0, 1);
|
|
296
|
+
this.normal.applyMatrix4(this.rotationMatrix);
|
|
297
|
+
this.reflectorWorldPosition.addScaledVector(this.normal, this.inputs.get('reflectorOffset'));
|
|
298
|
+
this.view.subVectors(this.reflectorWorldPosition, this.cameraWorldPosition);
|
|
319
299
|
// Avoid rendering when reflector is facing away
|
|
320
|
-
if (this
|
|
300
|
+
if (this.view.dot(this.normal) > 0)
|
|
321
301
|
return;
|
|
322
|
-
this
|
|
323
|
-
this
|
|
324
|
-
this
|
|
325
|
-
this
|
|
326
|
-
this
|
|
327
|
-
this
|
|
328
|
-
this
|
|
329
|
-
this
|
|
330
|
-
this
|
|
331
|
-
this
|
|
332
|
-
this
|
|
333
|
-
this
|
|
334
|
-
this
|
|
335
|
-
this
|
|
336
|
-
this
|
|
337
|
-
this
|
|
338
|
-
this
|
|
302
|
+
this.view.reflect(this.normal).negate();
|
|
303
|
+
this.view.add(this.reflectorWorldPosition);
|
|
304
|
+
this.rotationMatrix.extractRotation(camera.matrixWorld);
|
|
305
|
+
this.lookAtPosition.set(0, 0, -1);
|
|
306
|
+
this.lookAtPosition.applyMatrix4(this.rotationMatrix);
|
|
307
|
+
this.lookAtPosition.add(this.cameraWorldPosition);
|
|
308
|
+
this.target.subVectors(this.reflectorWorldPosition, this.lookAtPosition);
|
|
309
|
+
this.target.reflect(this.normal).negate();
|
|
310
|
+
this.target.add(this.reflectorWorldPosition);
|
|
311
|
+
this.virtualCamera.position.copy(this.view);
|
|
312
|
+
this.virtualCamera.up.set(0, 1, 0);
|
|
313
|
+
this.virtualCamera.up.applyMatrix4(this.rotationMatrix);
|
|
314
|
+
this.virtualCamera.up.reflect(this.normal);
|
|
315
|
+
this.virtualCamera.lookAt(this.target);
|
|
316
|
+
this.virtualCamera.far = camera.far; // Used in WebGLBackground
|
|
317
|
+
this.virtualCamera.updateMatrixWorld();
|
|
318
|
+
this.virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
339
319
|
// Update the texture matrix
|
|
340
|
-
this
|
|
341
|
-
this
|
|
342
|
-
this
|
|
343
|
-
this
|
|
320
|
+
this._textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
|
|
321
|
+
this._textureMatrix.multiply(this.virtualCamera.projectionMatrix);
|
|
322
|
+
this._textureMatrix.multiply(this.virtualCamera.matrixWorldInverse);
|
|
323
|
+
this._textureMatrix.multiply(parent.matrixWorld);
|
|
344
324
|
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
345
325
|
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
346
|
-
this
|
|
347
|
-
this
|
|
348
|
-
this
|
|
349
|
-
const projectionMatrix = this
|
|
350
|
-
this
|
|
351
|
-
this
|
|
352
|
-
this
|
|
353
|
-
this
|
|
326
|
+
this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal, this.reflectorWorldPosition);
|
|
327
|
+
this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse);
|
|
328
|
+
this.clipPlane.set(this.reflectorPlane.normal.x, this.reflectorPlane.normal.y, this.reflectorPlane.normal.z, this.reflectorPlane.constant);
|
|
329
|
+
const projectionMatrix = this.virtualCamera.projectionMatrix;
|
|
330
|
+
this.q.x = (Math.sign(this.clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
|
|
331
|
+
this.q.y = (Math.sign(this.clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
|
|
332
|
+
this.q.z = -1.0;
|
|
333
|
+
this.q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
354
334
|
// Calculate the scaled plane vector
|
|
355
|
-
this
|
|
335
|
+
this.clipPlane.multiplyScalar(2.0 / this.clipPlane.dot(this.q));
|
|
356
336
|
// Replacing the third row of the projection matrix
|
|
357
|
-
projectionMatrix.elements[2] = this
|
|
358
|
-
projectionMatrix.elements[6] = this
|
|
359
|
-
projectionMatrix.elements[10] = this
|
|
360
|
-
projectionMatrix.elements[14] = this
|
|
361
|
-
}
|
|
362
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
363
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
337
|
+
projectionMatrix.elements[2] = this.clipPlane.x;
|
|
338
|
+
projectionMatrix.elements[6] = this.clipPlane.y;
|
|
339
|
+
projectionMatrix.elements[10] = this.clipPlane.z + 1.0;
|
|
340
|
+
projectionMatrix.elements[14] = this.clipPlane.w;
|
|
341
|
+
}
|
|
342
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
343
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshReflectorMaterial, isStandalone: true, selector: "ngts-mesh-reflector-material", inputs: { materialRef: "materialRef", _resolution: ["resolution", "_resolution"], _mixBlur: ["mixBlur", "_mixBlur"], _mixStrength: ["mixStrength", "_mixStrength"], _blur: ["blur", "_blur"], _mirror: ["mirror", "_mirror"], _minDepthThreshold: ["minDepthThreshold", "_minDepthThreshold"], _maxDepthThreshold: ["maxDepthThreshold", "_maxDepthThreshold"], _depthScale: ["depthScale", "_depthScale"], _depthToBlurRatioBias: ["depthToBlurRatioBias", "_depthToBlurRatioBias"], _distortionMap: ["distortionMap", "_distortionMap"], _distortion: ["distortion", "_distortion"], _mixContrast: ["mixContrast", "_mixContrast"], _reflectorOffset: ["reflectorOffset", "_reflectorOffset"] }, ngImport: i0, template: `
|
|
344
|
+
<ngt-mesh-reflector-material
|
|
345
|
+
*ngIf="defines() as defines"
|
|
346
|
+
[key]="defines"
|
|
347
|
+
ngtCompound
|
|
348
|
+
attach="material"
|
|
349
|
+
[ref]="materialRef"
|
|
350
|
+
[defines]="defines"
|
|
351
|
+
[mirror]="mirror()"
|
|
352
|
+
[textureMatrix]="textureMatrix()"
|
|
353
|
+
[mixBlur]="mixBlur()"
|
|
354
|
+
[tDiffuse]="tDiffuse()"
|
|
355
|
+
[tDepth]="tDepth()"
|
|
356
|
+
[tDiffuseBlur]="tDiffuseBlur()"
|
|
357
|
+
[hasBlur]="hasBlur()"
|
|
358
|
+
[mixStrength]="mixStrength()"
|
|
359
|
+
[minDepthThreshold]="minDepthThreshold()"
|
|
360
|
+
[maxDepthThreshold]="maxDepthThreshold()"
|
|
361
|
+
[depthScale]="depthScale()"
|
|
362
|
+
[depthToBlurRatioBias]="depthToBlurRatioBias()"
|
|
363
|
+
[distortion]="distortion()"
|
|
364
|
+
[distortionMap]="distortionMap()"
|
|
365
|
+
[mixContrast]="mixContrast()"
|
|
366
|
+
>
|
|
367
|
+
<ng-content />
|
|
368
|
+
</ngt-mesh-reflector-material>
|
|
369
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
389
370
|
}
|
|
390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
|
|
391
372
|
type: Component,
|
|
392
373
|
args: [{
|
|
393
374
|
selector: 'ngts-mesh-reflector-material',
|
|
394
375
|
standalone: true,
|
|
395
376
|
template: `
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
377
|
+
<ngt-mesh-reflector-material
|
|
378
|
+
*ngIf="defines() as defines"
|
|
379
|
+
[key]="defines"
|
|
380
|
+
ngtCompound
|
|
381
|
+
attach="material"
|
|
382
|
+
[ref]="materialRef"
|
|
383
|
+
[defines]="defines"
|
|
384
|
+
[mirror]="mirror()"
|
|
385
|
+
[textureMatrix]="textureMatrix()"
|
|
386
|
+
[mixBlur]="mixBlur()"
|
|
387
|
+
[tDiffuse]="tDiffuse()"
|
|
388
|
+
[tDepth]="tDepth()"
|
|
389
|
+
[tDiffuseBlur]="tDiffuseBlur()"
|
|
390
|
+
[hasBlur]="hasBlur()"
|
|
391
|
+
[mixStrength]="mixStrength()"
|
|
392
|
+
[minDepthThreshold]="minDepthThreshold()"
|
|
393
|
+
[maxDepthThreshold]="maxDepthThreshold()"
|
|
394
|
+
[depthScale]="depthScale()"
|
|
395
|
+
[depthToBlurRatioBias]="depthToBlurRatioBias()"
|
|
396
|
+
[distortion]="distortion()"
|
|
397
|
+
[distortionMap]="distortionMap()"
|
|
398
|
+
[mixContrast]="mixContrast()"
|
|
399
|
+
>
|
|
400
|
+
<ng-content />
|
|
401
|
+
</ngt-mesh-reflector-material>
|
|
402
|
+
`,
|
|
403
|
+
imports: [NgIf, NgtKey],
|
|
422
404
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
423
405
|
}]
|
|
424
406
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
425
407
|
type: Input
|
|
426
|
-
}],
|
|
427
|
-
type: Input
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}],
|
|
433
|
-
type: Input
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}],
|
|
439
|
-
type: Input
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}],
|
|
445
|
-
type: Input
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}],
|
|
451
|
-
type: Input
|
|
408
|
+
}], _resolution: [{
|
|
409
|
+
type: Input,
|
|
410
|
+
args: [{ alias: 'resolution' }]
|
|
411
|
+
}], _mixBlur: [{
|
|
412
|
+
type: Input,
|
|
413
|
+
args: [{ alias: 'mixBlur' }]
|
|
414
|
+
}], _mixStrength: [{
|
|
415
|
+
type: Input,
|
|
416
|
+
args: [{ alias: 'mixStrength' }]
|
|
417
|
+
}], _blur: [{
|
|
418
|
+
type: Input,
|
|
419
|
+
args: [{ alias: 'blur' }]
|
|
420
|
+
}], _mirror: [{
|
|
421
|
+
type: Input,
|
|
422
|
+
args: [{ alias: 'mirror' }]
|
|
423
|
+
}], _minDepthThreshold: [{
|
|
424
|
+
type: Input,
|
|
425
|
+
args: [{ alias: 'minDepthThreshold' }]
|
|
426
|
+
}], _maxDepthThreshold: [{
|
|
427
|
+
type: Input,
|
|
428
|
+
args: [{ alias: 'maxDepthThreshold' }]
|
|
429
|
+
}], _depthScale: [{
|
|
430
|
+
type: Input,
|
|
431
|
+
args: [{ alias: 'depthScale' }]
|
|
432
|
+
}], _depthToBlurRatioBias: [{
|
|
433
|
+
type: Input,
|
|
434
|
+
args: [{ alias: 'depthToBlurRatioBias' }]
|
|
435
|
+
}], _distortionMap: [{
|
|
436
|
+
type: Input,
|
|
437
|
+
args: [{ alias: 'distortionMap' }]
|
|
438
|
+
}], _distortion: [{
|
|
439
|
+
type: Input,
|
|
440
|
+
args: [{ alias: 'distortion' }]
|
|
441
|
+
}], _mixContrast: [{
|
|
442
|
+
type: Input,
|
|
443
|
+
args: [{ alias: 'mixContrast' }]
|
|
444
|
+
}], _reflectorOffset: [{
|
|
445
|
+
type: Input,
|
|
446
|
+
args: [{ alias: 'reflectorOffset' }]
|
|
452
447
|
}] } });
|
|
453
448
|
|
|
454
449
|
extend({ MeshRefractionMaterial });
|
|
455
450
|
const isCubeTexture = (def) => def && def.isCubeTexture;
|
|
456
|
-
class NgtsMeshRefractionMaterial
|
|
451
|
+
class NgtsMeshRefractionMaterial {
|
|
457
452
|
/** Environment map */
|
|
458
|
-
set
|
|
459
|
-
this.set({ envMap });
|
|
453
|
+
set _envMap(envMap) {
|
|
454
|
+
this.inputs.set({ envMap });
|
|
460
455
|
}
|
|
461
456
|
/** Number of ray-cast bounces, it can be expensive to have too many, 2 */
|
|
462
|
-
set
|
|
463
|
-
this.set({ bounces });
|
|
457
|
+
set _bounces(bounces) {
|
|
458
|
+
this.inputs.set({ bounces });
|
|
464
459
|
}
|
|
465
460
|
/** Refraction index, 2.4 */
|
|
466
|
-
set
|
|
467
|
-
this.set({ ior });
|
|
461
|
+
set _ior(ior) {
|
|
462
|
+
this.inputs.set({ ior });
|
|
468
463
|
}
|
|
469
464
|
/** Fresnel (strip light), 0 */
|
|
470
|
-
set
|
|
471
|
-
this.set({ fresnel });
|
|
465
|
+
set _fresnel(fresnel) {
|
|
466
|
+
this.inputs.set({ fresnel });
|
|
472
467
|
}
|
|
473
468
|
/** RGB shift intensity, can be expensive, 0 */
|
|
474
|
-
set
|
|
475
|
-
this.set({ aberrationStrength });
|
|
469
|
+
set _aberrationStrength(aberrationStrength) {
|
|
470
|
+
this.inputs.set({ aberrationStrength });
|
|
476
471
|
}
|
|
477
472
|
/** Color, white */
|
|
478
|
-
set
|
|
479
|
-
this.set({ color });
|
|
473
|
+
set _color(color) {
|
|
474
|
+
this.inputs.set({ color });
|
|
480
475
|
}
|
|
481
476
|
/** If this is on it uses fewer ray casts for the RGB shift sacrificing physical accuracy, true */
|
|
482
|
-
set
|
|
483
|
-
this.set({ fastChroma });
|
|
477
|
+
set _fastChroma(fastChroma) {
|
|
478
|
+
this.inputs.set({ fastChroma });
|
|
484
479
|
}
|
|
485
|
-
#store;
|
|
486
|
-
#size;
|
|
487
|
-
#envMap;
|
|
488
480
|
constructor() {
|
|
489
|
-
|
|
481
|
+
this.inputs = signalStore({ aberrationStrength: 0, fastChroma: true });
|
|
490
482
|
this.materialRef = injectNgtRef();
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
this.
|
|
495
|
-
this.
|
|
496
|
-
this.
|
|
497
|
-
this.
|
|
498
|
-
this
|
|
499
|
-
this
|
|
500
|
-
this.#envMap = this.select('envMap');
|
|
483
|
+
this.envMap = this.inputs.select('envMap');
|
|
484
|
+
this.bounces = this.inputs.select('bounces');
|
|
485
|
+
this.ior = this.inputs.select('ior');
|
|
486
|
+
this.fresnel = this.inputs.select('fresnel');
|
|
487
|
+
this.aberrationStrength = this.inputs.select('aberrationStrength');
|
|
488
|
+
this.color = this.inputs.select('color');
|
|
489
|
+
this.fastChroma = this.inputs.select('fastChroma');
|
|
490
|
+
this.store = injectNgtStore();
|
|
491
|
+
this.size = this.store.select('size');
|
|
501
492
|
this.defines = computed(() => {
|
|
502
|
-
const envMap = this
|
|
493
|
+
const [envMap, aberrationStrength, fastChroma] = [this.envMap(), this.aberrationStrength(), this.fastChroma()];
|
|
503
494
|
if (!envMap)
|
|
504
495
|
return null;
|
|
505
|
-
const aberrationStrength = this.refractionAberrationStrength();
|
|
506
|
-
const fastChroma = this.refractionFastChroma();
|
|
507
496
|
const temp = {};
|
|
508
497
|
// Sampler2D and SamplerCube need different defines
|
|
509
498
|
const isCubeMap = isCubeTexture(envMap);
|
|
@@ -525,173 +514,182 @@ class NgtsMeshRefractionMaterial extends NgtSignalStore {
|
|
|
525
514
|
temp['FAST_CHROMA'] = '';
|
|
526
515
|
return temp;
|
|
527
516
|
});
|
|
528
|
-
this.resolution = computed(() => [this
|
|
517
|
+
this.resolution = computed(() => [this.size().width, this.size().height]);
|
|
529
518
|
injectBeforeRender(({ camera }) => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
519
|
+
const material = this.materialRef.nativeElement;
|
|
520
|
+
if (material) {
|
|
521
|
+
material.viewMatrixInverse = camera.matrixWorld;
|
|
522
|
+
material.projectionMatrixInverse = camera.projectionMatrixInverse;
|
|
533
523
|
}
|
|
534
524
|
});
|
|
535
|
-
this
|
|
525
|
+
this.setupGeometry();
|
|
536
526
|
}
|
|
537
|
-
|
|
527
|
+
setupGeometry() {
|
|
538
528
|
effect(() => {
|
|
539
529
|
const material = this.materialRef.nativeElement;
|
|
540
530
|
if (!material)
|
|
541
531
|
return;
|
|
542
|
-
const geometry = getLocalState(material).parent()?.geometry;
|
|
532
|
+
const geometry = getLocalState(material).parent?.()?.geometry;
|
|
543
533
|
if (geometry) {
|
|
544
|
-
material.bvh
|
|
534
|
+
material.bvh = new MeshBVHUniformStruct();
|
|
535
|
+
material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
|
|
545
536
|
}
|
|
546
537
|
});
|
|
547
538
|
}
|
|
548
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
549
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
539
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
540
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshRefractionMaterial, isStandalone: true, selector: "ngts-mesh-refraction-material", inputs: { materialRef: "materialRef", _envMap: ["envMap", "_envMap"], _bounces: ["bounces", "_bounces"], _ior: ["ior", "_ior"], _fresnel: ["fresnel", "_fresnel"], _aberrationStrength: ["aberrationStrength", "_aberrationStrength"], _color: ["color", "_color"], _fastChroma: ["fastChroma", "_fastChroma"] }, ngImport: i0, template: `
|
|
541
|
+
<ngt-mesh-refraction-material
|
|
542
|
+
*ngIf="defines() as defines"
|
|
543
|
+
[key]="defines"
|
|
544
|
+
[ref]="materialRef"
|
|
545
|
+
[defines]="defines"
|
|
546
|
+
[resolution]="resolution()"
|
|
547
|
+
[aberrationStrength]="aberrationStrength()"
|
|
548
|
+
[envMap]="envMap()"
|
|
549
|
+
[bounces]="bounces()"
|
|
550
|
+
[ior]="ior()"
|
|
551
|
+
[fresnel]="fresnel()"
|
|
552
|
+
[color]="color()"
|
|
553
|
+
[fastChroma]="fastChroma()"
|
|
554
|
+
ngtCompound
|
|
555
|
+
attach="material"
|
|
556
|
+
>
|
|
557
|
+
<ng-content />
|
|
558
|
+
</ngt-mesh-refraction-material>
|
|
559
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
568
560
|
}
|
|
569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
|
|
570
562
|
type: Component,
|
|
571
563
|
args: [{
|
|
572
564
|
selector: 'ngts-mesh-refraction-material',
|
|
573
565
|
standalone: true,
|
|
574
566
|
template: `
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
567
|
+
<ngt-mesh-refraction-material
|
|
568
|
+
*ngIf="defines() as defines"
|
|
569
|
+
[key]="defines"
|
|
570
|
+
[ref]="materialRef"
|
|
571
|
+
[defines]="defines"
|
|
572
|
+
[resolution]="resolution()"
|
|
573
|
+
[aberrationStrength]="aberrationStrength()"
|
|
574
|
+
[envMap]="envMap()"
|
|
575
|
+
[bounces]="bounces()"
|
|
576
|
+
[ior]="ior()"
|
|
577
|
+
[fresnel]="fresnel()"
|
|
578
|
+
[color]="color()"
|
|
579
|
+
[fastChroma]="fastChroma()"
|
|
580
|
+
ngtCompound
|
|
581
|
+
attach="material"
|
|
582
|
+
>
|
|
583
|
+
<ng-content />
|
|
584
|
+
</ngt-mesh-refraction-material>
|
|
585
|
+
`,
|
|
586
|
+
imports: [NgIf, NgtKey],
|
|
594
587
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
595
588
|
}]
|
|
596
589
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
597
590
|
type: Input
|
|
598
|
-
}],
|
|
591
|
+
}], _envMap: [{
|
|
599
592
|
type: Input,
|
|
600
|
-
args: [{ required: true }]
|
|
601
|
-
}],
|
|
602
|
-
type: Input
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}],
|
|
608
|
-
type: Input
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
593
|
+
args: [{ required: true, alias: 'envMap' }]
|
|
594
|
+
}], _bounces: [{
|
|
595
|
+
type: Input,
|
|
596
|
+
args: [{ alias: 'bounces' }]
|
|
597
|
+
}], _ior: [{
|
|
598
|
+
type: Input,
|
|
599
|
+
args: [{ alias: 'ior' }]
|
|
600
|
+
}], _fresnel: [{
|
|
601
|
+
type: Input,
|
|
602
|
+
args: [{ alias: 'fresnel' }]
|
|
603
|
+
}], _aberrationStrength: [{
|
|
604
|
+
type: Input,
|
|
605
|
+
args: [{ alias: 'aberrationStrength' }]
|
|
606
|
+
}], _color: [{
|
|
607
|
+
type: Input,
|
|
608
|
+
args: [{ alias: 'color' }]
|
|
609
|
+
}], _fastChroma: [{
|
|
610
|
+
type: Input,
|
|
611
|
+
args: [{ alias: 'fastChroma' }]
|
|
613
612
|
}] } });
|
|
614
613
|
|
|
615
614
|
extend({ MeshTransmissionMaterial });
|
|
616
|
-
class NgtsMeshTranmissionMaterial
|
|
615
|
+
class NgtsMeshTranmissionMaterial {
|
|
617
616
|
/** transmissionSampler, you can use the threejs transmission sampler texture that is
|
|
618
617
|
* generated once for all transmissive materials. The upside is that it can be faster if you
|
|
619
618
|
* use multiple MeshPhysical and Transmission materials, the downside is that transmissive materials
|
|
620
619
|
* using this can't see other transparent or transmissive objects, default: false */
|
|
621
|
-
set
|
|
622
|
-
this.set({ transmissionSampler });
|
|
620
|
+
set _transmissionSampler(transmissionSampler) {
|
|
621
|
+
this.inputs.set({ transmissionSampler });
|
|
623
622
|
}
|
|
624
623
|
/** Render the backside of the material (more cost, better results), default: false */
|
|
625
|
-
set
|
|
626
|
-
this.set({ backside });
|
|
624
|
+
set _backside(backside) {
|
|
625
|
+
this.inputs.set({ backside });
|
|
627
626
|
}
|
|
628
627
|
/** Backside thickness (when backside is true), default: 0 */
|
|
629
|
-
set
|
|
630
|
-
this.set({ backsideThickness });
|
|
628
|
+
set _backsideThickness(backsideThickness) {
|
|
629
|
+
this.inputs.set({ backsideThickness });
|
|
631
630
|
}
|
|
632
631
|
/** Resolution of the local buffer, default: undefined (fullscreen) */
|
|
633
|
-
set
|
|
634
|
-
this.set({ resolution });
|
|
632
|
+
set _resolution(resolution) {
|
|
633
|
+
this.inputs.set({ resolution });
|
|
635
634
|
}
|
|
636
635
|
/** Resolution of the local buffer for backfaces, default: undefined (fullscreen) */
|
|
637
|
-
set
|
|
638
|
-
this.set({ backsideResolution });
|
|
636
|
+
set _backsideResolution(backsideResolution) {
|
|
637
|
+
this.inputs.set({ backsideResolution });
|
|
639
638
|
}
|
|
640
639
|
/** Refraction samples, default: 10 */
|
|
641
|
-
set
|
|
642
|
-
this.set({ samples });
|
|
640
|
+
set _samples(samples) {
|
|
641
|
+
this.inputs.set({ samples });
|
|
643
642
|
}
|
|
644
643
|
/** Buffer scene background (can be a texture, a cubetexture or a color), default: null */
|
|
645
|
-
set
|
|
646
|
-
this.set({ background });
|
|
644
|
+
set _background(background) {
|
|
645
|
+
this.inputs.set({ background });
|
|
647
646
|
}
|
|
648
647
|
/* Transmission, default: 1 */
|
|
649
|
-
set
|
|
650
|
-
this.set({ transmission });
|
|
648
|
+
set _transmission(transmission) {
|
|
649
|
+
this.inputs.set({ transmission });
|
|
651
650
|
}
|
|
652
651
|
/* Thickness (refraction), default: 0 */
|
|
653
|
-
set
|
|
654
|
-
this.set({ thickness });
|
|
652
|
+
set _thickness(thickness) {
|
|
653
|
+
this.inputs.set({ thickness });
|
|
655
654
|
}
|
|
656
655
|
/* Roughness (blur), default: 0 */
|
|
657
|
-
set
|
|
658
|
-
this.set({ roughness });
|
|
656
|
+
set _roughness(roughness) {
|
|
657
|
+
this.inputs.set({ roughness });
|
|
659
658
|
}
|
|
660
659
|
/* Chromatic aberration, default: 0.03 */
|
|
661
|
-
set
|
|
662
|
-
this.set({ chromaticAberration });
|
|
660
|
+
set _chromaticAberration(chromaticAberration) {
|
|
661
|
+
this.inputs.set({ chromaticAberration });
|
|
663
662
|
}
|
|
664
663
|
/* Anisotropy, default: 0.1 */
|
|
665
|
-
set
|
|
666
|
-
this.set({ anisotropy });
|
|
664
|
+
set _anisotropy(anisotropy) {
|
|
665
|
+
this.inputs.set({ anisotropy });
|
|
666
|
+
}
|
|
667
|
+
/* AnisotropicBlur, default: 0.1 */
|
|
668
|
+
set _anisotropicBlur(anisotropicBlur) {
|
|
669
|
+
this.inputs.set({ anisotropicBlur });
|
|
667
670
|
}
|
|
668
671
|
/* Distortion, default: 0 */
|
|
669
|
-
set
|
|
670
|
-
this.set({ distortion });
|
|
672
|
+
set _distortion(distortion) {
|
|
673
|
+
this.inputs.set({ distortion });
|
|
671
674
|
}
|
|
672
675
|
/* Distortion scale, default: 0.5 */
|
|
673
|
-
set
|
|
674
|
-
this.set({ distortionScale });
|
|
676
|
+
set _distortionScale(distortionScale) {
|
|
677
|
+
this.inputs.set({ distortionScale });
|
|
675
678
|
}
|
|
676
679
|
/* Temporal distortion (speed of movement), default: 0.0 */
|
|
677
|
-
set
|
|
678
|
-
this.set({ temporalDistortion });
|
|
680
|
+
set _temporalDistortion(temporalDistortion) {
|
|
681
|
+
this.inputs.set({ temporalDistortion });
|
|
679
682
|
}
|
|
680
683
|
/** The scene rendered into a texture (use it to share a texture between materials), default: null */
|
|
681
|
-
set
|
|
682
|
-
this.set({ buffer });
|
|
684
|
+
set _buffer(buffer) {
|
|
685
|
+
this.inputs.set({ buffer });
|
|
683
686
|
}
|
|
684
687
|
/** Internals */
|
|
685
|
-
set
|
|
686
|
-
this.set({ time });
|
|
687
|
-
}
|
|
688
|
-
#discardMaterial;
|
|
689
|
-
#backsideResolution;
|
|
690
|
-
#resolution;
|
|
691
|
-
#fboBackSettings;
|
|
692
|
-
#fboMainSettings;
|
|
688
|
+
set _time(time) {
|
|
689
|
+
this.inputs.set({ time });
|
|
690
|
+
}
|
|
693
691
|
constructor() {
|
|
694
|
-
|
|
692
|
+
this.inputs = signalStore({
|
|
695
693
|
transmissionSampler: false,
|
|
696
694
|
backside: false,
|
|
697
695
|
transmission: 1,
|
|
@@ -700,6 +698,7 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
|
700
698
|
samples: 10,
|
|
701
699
|
roughness: 0,
|
|
702
700
|
anisotropy: 0.1,
|
|
701
|
+
anisotropicBlur: 0.1,
|
|
703
702
|
chromaticAberration: 0.03,
|
|
704
703
|
distortion: 0,
|
|
705
704
|
distortionScale: 0.5,
|
|
@@ -707,27 +706,28 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
|
707
706
|
buffer: null,
|
|
708
707
|
});
|
|
709
708
|
this.materialRef = injectNgtRef();
|
|
710
|
-
this.
|
|
711
|
-
this.
|
|
712
|
-
this.
|
|
713
|
-
this.
|
|
714
|
-
this.
|
|
715
|
-
this.
|
|
716
|
-
this.
|
|
717
|
-
this.
|
|
718
|
-
this.
|
|
719
|
-
this.
|
|
720
|
-
this.
|
|
721
|
-
this.
|
|
722
|
-
this.
|
|
723
|
-
this.
|
|
724
|
-
this
|
|
725
|
-
this
|
|
726
|
-
this
|
|
727
|
-
this
|
|
728
|
-
this
|
|
729
|
-
this.
|
|
730
|
-
this.
|
|
709
|
+
this.transmissionSampler = this.inputs.select('transmissionSampler');
|
|
710
|
+
this.backside = this.inputs.select('backside');
|
|
711
|
+
this.transmission = this.inputs.select('transmission');
|
|
712
|
+
this.thickness = this.inputs.select('thickness');
|
|
713
|
+
this.backsideThickness = this.inputs.select('backsideThickness');
|
|
714
|
+
this.samples = this.inputs.select('samples');
|
|
715
|
+
this.roughness = this.inputs.select('roughness');
|
|
716
|
+
this.anisotropy = this.inputs.select('anisotropy');
|
|
717
|
+
this.anisotropicBlur = this.inputs.select('anisotropicBlur');
|
|
718
|
+
this.chromaticAberration = this.inputs.select('chromaticAberration');
|
|
719
|
+
this.distortion = this.inputs.select('distortion');
|
|
720
|
+
this.distortionScale = this.inputs.select('distortionScale');
|
|
721
|
+
this.temporalDistortion = this.inputs.select('temporalDistortion');
|
|
722
|
+
this.buffer = this.inputs.select('buffer');
|
|
723
|
+
this.time = this.inputs.select('time');
|
|
724
|
+
this.discardMaterial = new DiscardMaterial();
|
|
725
|
+
this.backsideResolution = this.inputs.select('backsideResolution');
|
|
726
|
+
this.resolution = this.inputs.select('resolution');
|
|
727
|
+
this.fboBackSettings = computed(() => ({ width: this.backsideResolution() || this.resolution() }));
|
|
728
|
+
this.fboMainSettings = computed(() => ({ width: this.resolution() }));
|
|
729
|
+
this.fboBackRef = injectNgtsFBO(this.fboBackSettings);
|
|
730
|
+
this.fboMainRef = injectNgtsFBO(this.fboMainSettings);
|
|
731
731
|
this.side = THREE.FrontSide;
|
|
732
732
|
let oldBg;
|
|
733
733
|
let oldTone;
|
|
@@ -735,11 +735,12 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
|
735
735
|
injectBeforeRender((state) => {
|
|
736
736
|
if (!this.materialRef.nativeElement)
|
|
737
737
|
return;
|
|
738
|
-
const { transmissionSampler, background, backside, backsideThickness, thickness } = this.get();
|
|
738
|
+
const { transmissionSampler, background, backside, backsideThickness, thickness } = this.inputs.get();
|
|
739
739
|
this.materialRef.nativeElement.time = state.clock.getElapsedTime();
|
|
740
740
|
// Render only if the buffer matches the built-in and no transmission sampler is set
|
|
741
|
-
if (this.materialRef.nativeElement.buffer === this.fboMainRef
|
|
742
|
-
|
|
741
|
+
if (this.materialRef.nativeElement.buffer === this.fboMainRef.nativeElement?.texture &&
|
|
742
|
+
!transmissionSampler) {
|
|
743
|
+
parent = getLocalState(this.materialRef.nativeElement).parent?.();
|
|
743
744
|
if (parent) {
|
|
744
745
|
// Save defaults
|
|
745
746
|
oldTone = state.gl.toneMapping;
|
|
@@ -750,23 +751,23 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
|
750
751
|
state.gl.toneMapping = THREE.NoToneMapping;
|
|
751
752
|
if (background)
|
|
752
753
|
state.scene.background = background;
|
|
753
|
-
parent['material'] = this
|
|
754
|
+
parent['material'] = this.discardMaterial;
|
|
754
755
|
if (backside) {
|
|
755
756
|
// Render into the backside buffer
|
|
756
|
-
state.gl.setRenderTarget(this.fboBackRef
|
|
757
|
+
state.gl.setRenderTarget(this.fboBackRef.nativeElement);
|
|
757
758
|
state.gl.render(state.scene, state.camera);
|
|
758
759
|
// And now prepare the material for the main render using the backside buffer
|
|
759
760
|
parent['material'] = this.materialRef.nativeElement;
|
|
760
|
-
parent['material'].buffer = this.fboBackRef
|
|
761
|
+
parent['material'].buffer = this.fboBackRef.nativeElement?.texture;
|
|
761
762
|
parent['material'].thickness = backsideThickness;
|
|
762
763
|
parent['material'].side = THREE.BackSide;
|
|
763
764
|
}
|
|
764
765
|
// Render into the main buffer
|
|
765
|
-
state.gl.setRenderTarget(this.fboMainRef
|
|
766
|
+
state.gl.setRenderTarget(this.fboMainRef.nativeElement);
|
|
766
767
|
state.gl.render(state.scene, state.camera);
|
|
767
768
|
parent['material'].thickness = thickness;
|
|
768
769
|
parent['material'].side = this.side;
|
|
769
|
-
parent['material'].buffer = this.fboMainRef
|
|
770
|
+
parent['material'].buffer = this.fboMainRef.nativeElement?.texture;
|
|
770
771
|
// Set old state back
|
|
771
772
|
state.scene.background = oldBg;
|
|
772
773
|
state.gl.setRenderTarget(null);
|
|
@@ -776,150 +777,219 @@ class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
|
776
777
|
}
|
|
777
778
|
});
|
|
778
779
|
}
|
|
779
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
780
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
780
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
781
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshTranmissionMaterial, isStandalone: true, selector: "ngts-mesh-transmission-material", inputs: { materialRef: "materialRef", _transmissionSampler: ["transmissionSampler", "_transmissionSampler"], _backside: ["backside", "_backside"], _backsideThickness: ["backsideThickness", "_backsideThickness"], _resolution: ["resolution", "_resolution"], _backsideResolution: ["backsideResolution", "_backsideResolution"], _samples: ["samples", "_samples"], _background: ["background", "_background"], _transmission: ["transmission", "_transmission"], _thickness: ["thickness", "_thickness"], _roughness: ["roughness", "_roughness"], _chromaticAberration: ["chromaticAberration", "_chromaticAberration"], _anisotropy: ["anisotropy", "_anisotropy"], _anisotropicBlur: ["anisotropicBlur", "_anisotropicBlur"], _distortion: ["distortion", "_distortion"], _distortionScale: ["distortionScale", "_distortionScale"], _temporalDistortion: ["temporalDistortion", "_temporalDistortion"], _buffer: ["buffer", "_buffer"], _time: ["time", "_time"] }, ngImport: i0, template: `
|
|
782
|
+
<ngt-mesh-transmission-material
|
|
783
|
+
ngtCompound
|
|
784
|
+
*args="[samples(), transmissionSampler()]"
|
|
785
|
+
[ref]="materialRef"
|
|
786
|
+
[buffer]="buffer() || fboMainRef.nativeElement?.texture"
|
|
787
|
+
[_transmission]="transmission()"
|
|
788
|
+
[transmission]="transmissionSampler() ? transmission() : 0"
|
|
789
|
+
[thickness]="thickness()"
|
|
790
|
+
[side]="side"
|
|
791
|
+
[anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
|
|
792
|
+
[roughness]="roughness()"
|
|
793
|
+
[chromaticAberration]="chromaticAberration()"
|
|
794
|
+
[distortion]="distortion()"
|
|
795
|
+
[distortionScale]="distortionScale()"
|
|
796
|
+
[temporalDistortion]="temporalDistortion()"
|
|
797
|
+
[time]="time()"
|
|
798
|
+
/>
|
|
799
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
|
|
799
800
|
}
|
|
800
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
801
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshTranmissionMaterial, decorators: [{
|
|
801
802
|
type: Component,
|
|
802
803
|
args: [{
|
|
803
804
|
selector: 'ngts-mesh-transmission-material',
|
|
804
805
|
standalone: true,
|
|
805
806
|
template: `
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
807
|
+
<ngt-mesh-transmission-material
|
|
808
|
+
ngtCompound
|
|
809
|
+
*args="[samples(), transmissionSampler()]"
|
|
810
|
+
[ref]="materialRef"
|
|
811
|
+
[buffer]="buffer() || fboMainRef.nativeElement?.texture"
|
|
812
|
+
[_transmission]="transmission()"
|
|
813
|
+
[transmission]="transmissionSampler() ? transmission() : 0"
|
|
814
|
+
[thickness]="thickness()"
|
|
815
|
+
[side]="side"
|
|
816
|
+
[anisotropicBlur]="anisotropicBlur() ?? anisotropy()"
|
|
817
|
+
[roughness]="roughness()"
|
|
818
|
+
[chromaticAberration]="chromaticAberration()"
|
|
819
|
+
[distortion]="distortion()"
|
|
820
|
+
[distortionScale]="distortionScale()"
|
|
821
|
+
[temporalDistortion]="temporalDistortion()"
|
|
822
|
+
[time]="time()"
|
|
823
|
+
/>
|
|
824
|
+
`,
|
|
824
825
|
imports: [NgtArgs],
|
|
825
826
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
826
827
|
}]
|
|
827
828
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
828
829
|
type: Input
|
|
829
|
-
}],
|
|
830
|
-
type: Input
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
}],
|
|
836
|
-
type: Input
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}],
|
|
842
|
-
type: Input
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}],
|
|
848
|
-
type: Input
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}],
|
|
854
|
-
type: Input
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}],
|
|
860
|
-
type: Input
|
|
861
|
-
|
|
862
|
-
|
|
830
|
+
}], _transmissionSampler: [{
|
|
831
|
+
type: Input,
|
|
832
|
+
args: [{ alias: 'transmissionSampler' }]
|
|
833
|
+
}], _backside: [{
|
|
834
|
+
type: Input,
|
|
835
|
+
args: [{ alias: 'backside' }]
|
|
836
|
+
}], _backsideThickness: [{
|
|
837
|
+
type: Input,
|
|
838
|
+
args: [{ alias: 'backsideThickness' }]
|
|
839
|
+
}], _resolution: [{
|
|
840
|
+
type: Input,
|
|
841
|
+
args: [{ alias: 'resolution' }]
|
|
842
|
+
}], _backsideResolution: [{
|
|
843
|
+
type: Input,
|
|
844
|
+
args: [{ alias: 'backsideResolution' }]
|
|
845
|
+
}], _samples: [{
|
|
846
|
+
type: Input,
|
|
847
|
+
args: [{ alias: 'samples' }]
|
|
848
|
+
}], _background: [{
|
|
849
|
+
type: Input,
|
|
850
|
+
args: [{ alias: 'background' }]
|
|
851
|
+
}], _transmission: [{
|
|
852
|
+
type: Input,
|
|
853
|
+
args: [{ alias: 'transmission' }]
|
|
854
|
+
}], _thickness: [{
|
|
855
|
+
type: Input,
|
|
856
|
+
args: [{ alias: 'thickness' }]
|
|
857
|
+
}], _roughness: [{
|
|
858
|
+
type: Input,
|
|
859
|
+
args: [{ alias: 'roughness' }]
|
|
860
|
+
}], _chromaticAberration: [{
|
|
861
|
+
type: Input,
|
|
862
|
+
args: [{ alias: 'chromaticAberration' }]
|
|
863
|
+
}], _anisotropy: [{
|
|
864
|
+
type: Input,
|
|
865
|
+
args: [{ alias: 'anisotropy' }]
|
|
866
|
+
}], _anisotropicBlur: [{
|
|
867
|
+
type: Input,
|
|
868
|
+
args: [{ alias: 'anisotropicBlur' }]
|
|
869
|
+
}], _distortion: [{
|
|
870
|
+
type: Input,
|
|
871
|
+
args: [{ alias: 'distortion' }]
|
|
872
|
+
}], _distortionScale: [{
|
|
873
|
+
type: Input,
|
|
874
|
+
args: [{ alias: 'distortionScale' }]
|
|
875
|
+
}], _temporalDistortion: [{
|
|
876
|
+
type: Input,
|
|
877
|
+
args: [{ alias: 'temporalDistortion' }]
|
|
878
|
+
}], _buffer: [{
|
|
879
|
+
type: Input,
|
|
880
|
+
args: [{ alias: 'buffer' }]
|
|
881
|
+
}], _time: [{
|
|
882
|
+
type: Input,
|
|
883
|
+
args: [{ alias: 'time' }]
|
|
863
884
|
}] } });
|
|
864
885
|
|
|
865
886
|
extend({ MeshWobbleMaterial });
|
|
866
|
-
class NgtsMeshWobbleMaterial
|
|
867
|
-
set
|
|
868
|
-
this.set({ time });
|
|
887
|
+
class NgtsMeshWobbleMaterial {
|
|
888
|
+
set _time(time) {
|
|
889
|
+
this.inputs.set({ time });
|
|
869
890
|
}
|
|
870
|
-
set
|
|
871
|
-
this.set({ factor });
|
|
891
|
+
set _factor(factor) {
|
|
892
|
+
this.inputs.set({ factor });
|
|
872
893
|
}
|
|
873
|
-
set
|
|
874
|
-
this.set({ speed });
|
|
894
|
+
set _speed(speed) {
|
|
895
|
+
this.inputs.set({ speed });
|
|
875
896
|
}
|
|
876
897
|
constructor() {
|
|
877
|
-
|
|
878
|
-
this.material = new MeshWobbleMaterial();
|
|
898
|
+
this.inputs = signalStore({ speed: 1, time: 0, factor: 1 });
|
|
879
899
|
this.materialRef = injectNgtRef();
|
|
880
|
-
this.
|
|
881
|
-
this.
|
|
900
|
+
this.material = new MeshWobbleMaterial();
|
|
901
|
+
this.time = this.inputs.select('time');
|
|
902
|
+
this.factor = this.inputs.select('factor');
|
|
882
903
|
injectBeforeRender(({ clock }) => {
|
|
883
|
-
this.material.time = clock.getElapsedTime() * this.get('speed');
|
|
904
|
+
this.material.time = clock.getElapsedTime() * this.inputs.get('speed');
|
|
884
905
|
});
|
|
885
906
|
}
|
|
886
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
887
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
907
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
908
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { materialRef: "materialRef", _time: ["time", "_time"], _factor: ["factor", "_factor"], _speed: ["speed", "_speed"] }, ngImport: i0, template: `
|
|
909
|
+
<ngt-primitive
|
|
910
|
+
*args="[material]"
|
|
911
|
+
[ref]="materialRef"
|
|
912
|
+
[time]="time()"
|
|
913
|
+
[factor]="factor()"
|
|
914
|
+
attach="material"
|
|
915
|
+
ngtCompound
|
|
916
|
+
/>
|
|
917
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
|
|
897
918
|
}
|
|
898
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
|
|
899
920
|
type: Component,
|
|
900
921
|
args: [{
|
|
901
922
|
selector: 'ngts-mesh-wobble-material',
|
|
902
923
|
standalone: true,
|
|
903
924
|
template: `
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
925
|
+
<ngt-primitive
|
|
926
|
+
*args="[material]"
|
|
927
|
+
[ref]="materialRef"
|
|
928
|
+
[time]="time()"
|
|
929
|
+
[factor]="factor()"
|
|
930
|
+
attach="material"
|
|
931
|
+
ngtCompound
|
|
932
|
+
/>
|
|
933
|
+
`,
|
|
913
934
|
imports: [NgtArgs],
|
|
914
935
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
915
936
|
}]
|
|
916
937
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
917
938
|
type: Input
|
|
918
|
-
}],
|
|
919
|
-
type: Input
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
939
|
+
}], _time: [{
|
|
940
|
+
type: Input,
|
|
941
|
+
args: [{ alias: 'time' }]
|
|
942
|
+
}], _factor: [{
|
|
943
|
+
type: Input,
|
|
944
|
+
args: [{ alias: 'factor' }]
|
|
945
|
+
}], _speed: [{
|
|
946
|
+
type: Input,
|
|
947
|
+
args: [{ alias: 'speed' }]
|
|
948
|
+
}] } });
|
|
949
|
+
|
|
950
|
+
const opaque_fragment = parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'opaque_fragment' : 'output_fragment';
|
|
951
|
+
class PointMaterial extends THREE.PointsMaterial {
|
|
952
|
+
constructor(parameters) {
|
|
953
|
+
super(parameters);
|
|
954
|
+
this.onBeforeCompile = (shader, renderer) => {
|
|
955
|
+
const { isWebGL2 } = renderer.capabilities;
|
|
956
|
+
shader.fragmentShader = shader.fragmentShader.replace(`#include <${opaque_fragment}>`, `
|
|
957
|
+
${!isWebGL2
|
|
958
|
+
? `#extension GL_OES_standard_derivatives : enable\n#include <${opaque_fragment}>`
|
|
959
|
+
: `#include <${opaque_fragment}>`}
|
|
960
|
+
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
|
|
961
|
+
float r = dot(cxy, cxy);
|
|
962
|
+
float delta = fwidth(r);
|
|
963
|
+
float mask = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
|
|
964
|
+
gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
|
|
965
|
+
#include <tonemapping_fragment>
|
|
966
|
+
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
967
|
+
`);
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
class NgtsPointMaterial {
|
|
972
|
+
constructor() {
|
|
973
|
+
this.pointMaterialRef = injectNgtRef();
|
|
974
|
+
this.material = new PointMaterial({});
|
|
975
|
+
}
|
|
976
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsPointMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
977
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: NgtsPointMaterial, isStandalone: true, selector: "ngts-point-material", inputs: { pointMaterialRef: "pointMaterialRef" }, ngImport: i0, template: `
|
|
978
|
+
<ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />
|
|
979
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
|
|
980
|
+
}
|
|
981
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: NgtsPointMaterial, decorators: [{
|
|
982
|
+
type: Component,
|
|
983
|
+
args: [{
|
|
984
|
+
selector: 'ngts-point-material',
|
|
985
|
+
standalone: true,
|
|
986
|
+
template: `
|
|
987
|
+
<ngt-primitive ngtCompound [ref]="pointMaterialRef" *args="[material]" attach="material" />
|
|
988
|
+
`,
|
|
989
|
+
imports: [NgtArgs],
|
|
990
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
991
|
+
}]
|
|
992
|
+
}], propDecorators: { pointMaterialRef: [{
|
|
923
993
|
type: Input
|
|
924
994
|
}] } });
|
|
925
995
|
|
|
@@ -927,5 +997,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
927
997
|
* Generated bundle index. Do not edit.
|
|
928
998
|
*/
|
|
929
999
|
|
|
930
|
-
export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial };
|
|
1000
|
+
export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTranmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial, PointMaterial };
|
|
931
1001
|
//# sourceMappingURL=angular-three-soba-materials.mjs.map
|