angular-three-soba 1.14.0 → 2.0.0-beta.3
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/README.md +2 -2
- package/abstractions/{lib/billboard → billboard}/billboard.d.ts +14 -4
- package/abstractions/catmull-rom-line/catmull-rom-line.d.ts +25 -0
- package/abstractions/cubic-bezier-line/cubic-bezier-line.d.ts +25 -0
- package/abstractions/{lib/edges → edges}/edges.d.ts +11 -7
- package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-helper.d.ts +16 -23
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +22 -0
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +30 -0
- package/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +32 -0
- package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/gizmo-viewcube.d.ts +2 -3
- package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport-axis.d.ts +28 -9
- package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewport/gizmo-viewport.d.ts +23 -4
- package/abstractions/index.d.ts +11 -11
- package/abstractions/line/line-input.d.ts +42 -0
- package/abstractions/line/line.d.ts +35 -0
- package/abstractions/{lib/quadratic-bezier-line → quadratic-bezier-line}/quadratic-bezier-line.d.ts +12 -8
- package/abstractions/text/text.d.ts +77 -0
- package/abstractions/text-3d/text-3d.d.ts +74 -0
- package/cameras/{lib/camera → camera}/camera-content.d.ts +1 -1
- package/cameras/{lib/camera → camera}/camera.d.ts +12 -8
- package/cameras/cube-camera/cube-camera.d.ts +42 -0
- package/cameras/index.d.ts +5 -4
- package/cameras/{lib/orthographic-camera → orthographic-camera}/orthographic-camera.d.ts +14 -5
- package/controls/index.d.ts +1 -1
- package/controls/{lib/orbit-controls → orbit-controls}/orbit-controls.d.ts +19 -11
- package/esm2022/abstractions/angular-three-soba-abstractions.mjs +1 -1
- package/esm2022/abstractions/billboard/billboard.mjs +71 -0
- package/esm2022/abstractions/catmull-rom-line/catmull-rom-line.mjs +131 -0
- package/esm2022/abstractions/cubic-bezier-line/cubic-bezier-line.mjs +113 -0
- package/esm2022/abstractions/edges/edges.mjs +93 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-helper.mjs +210 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/constants.mjs +31 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +95 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +155 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +62 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +80 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +206 -0
- package/esm2022/abstractions/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +273 -0
- package/esm2022/abstractions/index.mjs +12 -12
- package/esm2022/abstractions/line/line-input.mjs +113 -0
- package/esm2022/abstractions/line/line.mjs +165 -0
- package/esm2022/abstractions/quadratic-bezier-line/quadratic-bezier-line.mjs +128 -0
- package/esm2022/abstractions/text/text.mjs +275 -0
- package/esm2022/abstractions/text-3d/text-3d.mjs +167 -0
- package/esm2022/angular-three-soba.mjs +1 -1
- package/esm2022/cameras/angular-three-soba-cameras.mjs +1 -1
- package/esm2022/cameras/camera/camera-content.mjs +21 -0
- package/esm2022/cameras/camera/camera.mjs +71 -0
- package/esm2022/cameras/cube-camera/cube-camera.mjs +131 -0
- package/esm2022/cameras/index.mjs +6 -5
- package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +99 -0
- package/esm2022/cameras/perspective-camera/perspective-camera.mjs +47 -0
- package/esm2022/controls/angular-three-soba-controls.mjs +1 -1
- package/esm2022/controls/index.mjs +2 -2
- package/esm2022/controls/orbit-controls/orbit-controls.mjs +165 -0
- package/esm2022/index.mjs +1 -1
- package/esm2022/loaders/angular-three-soba-loaders.mjs +1 -1
- package/esm2022/loaders/gltf-loader/gltf-loader.mjs +33 -0
- package/esm2022/loaders/index.mjs +5 -6
- package/esm2022/loaders/loader/loader.mjs +133 -0
- package/esm2022/loaders/progress/progress.mjs +52 -0
- package/esm2022/loaders/texture-loader/texture-loader.mjs +28 -0
- package/esm2022/materials/angular-three-soba-materials.mjs +1 -1
- package/esm2022/materials/index.mjs +6 -6
- package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +73 -0
- package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +383 -0
- package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +168 -0
- package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +257 -0
- package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +66 -0
- package/esm2022/misc/angular-three-soba-misc.mjs +1 -1
- package/esm2022/misc/animations/animations.mjs +55 -0
- package/esm2022/misc/bake-shadows/bake-shadows.mjs +24 -0
- package/esm2022/misc/depth-buffer/depth-buffer.mjs +46 -0
- package/esm2022/misc/fbo/fbo.mjs +47 -0
- package/esm2022/misc/index.mjs +5 -5
- package/esm2022/performance/adaptive/adaptive-dpr.mjs +46 -0
- package/esm2022/performance/adaptive/adaptive-events.mjs +31 -0
- package/esm2022/performance/angular-three-soba-performance.mjs +1 -1
- package/esm2022/performance/detailed/detailed.mjs +61 -0
- package/esm2022/performance/index.mjs +7 -5
- package/esm2022/performance/instances/instance.mjs +48 -0
- package/esm2022/performance/instances/instances.mjs +189 -0
- package/esm2022/performance/instances/position-mesh.mjs +52 -0
- package/esm2022/performance/stats/stats.mjs +79 -0
- package/esm2022/shaders/angular-three-soba-shaders.mjs +1 -1
- package/esm2022/shaders/blur-pass/blur-pass.mjs +61 -0
- package/esm2022/shaders/caustics-material/caustics-material.mjs +128 -0
- package/esm2022/shaders/caustics-material/caustics-projection-material.mjs +33 -0
- package/esm2022/shaders/convolution-material/convolution-material.mjs +94 -0
- package/esm2022/shaders/discard-material/discard-material.mjs +3 -0
- package/esm2022/shaders/index.mjs +15 -15
- package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +55 -0
- package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +223 -0
- package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +170 -0
- package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +268 -0
- package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +37 -0
- package/esm2022/shaders/shader-material/shader-material.mjs +34 -0
- package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +33 -0
- package/esm2022/shaders/sparkles-material/sparkles-material.mjs +47 -0
- package/esm2022/shaders/spot-light-material/spot-light-material.mjs +86 -0
- package/esm2022/shaders/star-field-material/star-field-material.mjs +32 -0
- package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +283 -0
- package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +108 -0
- package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +208 -0
- package/esm2022/staging/angular-three-soba-staging.mjs +1 -1
- package/esm2022/staging/bounds/bounds.mjs +307 -0
- package/esm2022/staging/camera-shake/camera-shake.mjs +117 -0
- package/esm2022/staging/caustics/caustisc.mjs +384 -0
- package/esm2022/staging/center/center.mjs +148 -0
- package/esm2022/staging/cloud/cloud.mjs +164 -0
- package/esm2022/staging/contact-shadows/contact-shadows.mjs +249 -0
- package/esm2022/staging/environment/assets.mjs +13 -0
- package/esm2022/staging/environment/environment-cube.mjs +49 -0
- package/esm2022/staging/environment/environment-ground.mjs +43 -0
- package/esm2022/staging/environment/environment-input.mjs +106 -0
- package/esm2022/staging/environment/environment-map.mjs +53 -0
- package/esm2022/staging/environment/environment-portal.mjs +135 -0
- package/esm2022/staging/environment/environment.mjs +78 -0
- package/esm2022/staging/environment/utils.mjs +84 -0
- package/esm2022/staging/float/float.mjs +82 -0
- package/esm2022/staging/index.mjs +18 -18
- package/esm2022/staging/sky/sky.mjs +114 -0
- package/esm2022/staging/sparkles/sparkles.mjs +161 -0
- package/esm2022/staging/spot-light/spot-light-input.mjs +75 -0
- package/esm2022/staging/spot-light/spot-light-shadow-mesh-input.mjs +57 -0
- package/esm2022/staging/spot-light/spot-light-shadow-mesh.mjs +256 -0
- package/esm2022/staging/spot-light/spot-light.mjs +94 -0
- package/esm2022/staging/spot-light/volumetric-mesh.mjs +101 -0
- package/esm2022/staging/stage/stage.mjs +374 -0
- package/esm2022/staging/stars/stars.mjs +148 -0
- package/fesm2022/angular-three-soba-abstractions.mjs +1116 -890
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +126 -122
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +72 -54
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-loaders.mjs +147 -131
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +340 -258
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +140 -123
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-performance.mjs +383 -106
- package/fesm2022/angular-three-soba-performance.mjs.map +1 -1
- package/fesm2022/angular-three-soba-shaders.mjs +57 -9
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +1609 -1561
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- package/fesm2022/angular-three-soba.mjs.map +1 -1
- package/loaders/gltf-loader/gltf-loader.d.ts +9 -0
- package/loaders/index.d.ts +4 -5
- package/loaders/{lib/loader → loader}/loader.d.ts +20 -15
- package/loaders/progress/progress.d.ts +9 -0
- package/loaders/texture-loader/texture-loader.d.ts +7 -0
- package/materials/index.d.ts +5 -5
- package/materials/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +11 -5
- package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +81 -0
- package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +50 -0
- package/materials/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +51 -6
- package/materials/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +9 -3
- package/misc/animations/animations.d.ts +13 -0
- package/misc/{lib/bake-shadows → bake-shadows}/bake-shadows.d.ts +2 -5
- package/misc/depth-buffer/depth-buffer.d.ts +9 -0
- package/misc/{lib/fbo → fbo}/fbo.d.ts +4 -2
- package/misc/index.d.ts +4 -4
- package/package.json +25 -23
- package/performance/{lib/adaptive → adaptive}/adaptive-dpr.d.ts +4 -7
- package/performance/{lib/adaptive → adaptive}/adaptive-events.d.ts +2 -6
- package/performance/detailed/detailed.d.ts +20 -0
- package/performance/index.d.ts +6 -4
- package/performance/instances/instance.d.ts +9 -0
- package/performance/instances/instances.d.ts +35 -0
- package/performance/instances/position-mesh.d.ts +10 -0
- package/performance/{lib/stats → stats}/stats.d.ts +10 -7
- package/plugin/package.json +1 -1
- package/plugin/src/generators/init/compat.js.map +1 -1
- package/plugin/src/generators/init/init.d.ts +1 -1
- package/plugin/src/generators/init/init.js +1 -1
- package/plugin/src/generators/init/init.js.map +1 -1
- package/plugin/src/index.js.map +1 -1
- package/shaders/{lib/blur-pass → blur-pass}/blur-pass.d.ts +2 -2
- package/shaders/index.d.ts +14 -14
- package/shaders/{lib/mesh-distort-material → mesh-distort-material}/mesh-distort-material.d.ts +1 -1
- package/shaders/{lib/mesh-wobble-material → mesh-wobble-material}/mesh-wobble-material.d.ts +1 -0
- package/shaders/{lib/soft-shadow-material → soft-shadow-material}/soft-shadow-material.d.ts +2 -2
- package/shaders/sparkles-material/sparkles-material.d.ts +3 -0
- package/staging/{lib/accumulative-shadows → accumulative-shadows}/accumulative-shadows.d.ts +55 -17
- package/staging/{lib/accumulative-shadows → accumulative-shadows}/progressive-light-map.d.ts +2 -2
- package/staging/{lib/accumulative-shadows → accumulative-shadows}/randomized-lights.d.ts +45 -10
- package/staging/{lib/bounds → bounds}/bounds.d.ts +32 -22
- package/staging/{lib/camera-shake → camera-shake}/camera-shake.d.ts +15 -11
- package/staging/{lib/caustics/caustics.d.ts → caustics/caustisc.d.ts} +36 -13
- package/staging/{lib/center → center}/center.d.ts +30 -8
- package/staging/cloud/cloud.d.ts +48 -0
- package/staging/{lib/contact-shadows → contact-shadows}/contact-shadows.d.ts +38 -10
- package/staging/environment/environment-cube.d.ts +11 -0
- package/staging/environment/environment-ground.d.ts +13 -0
- package/staging/environment/environment-input.d.ts +68 -0
- package/staging/environment/environment-map.d.ts +11 -0
- package/staging/{lib/environment → environment}/environment-portal.d.ts +5 -7
- package/staging/{lib/environment → environment}/environment.d.ts +2 -2
- package/staging/environment/utils.d.ts +7 -0
- package/staging/float/float.d.ts +27 -0
- package/staging/index.d.ts +17 -17
- package/staging/{lib/sky → sky}/sky.d.ts +26 -5
- package/staging/{lib/sparkles → sparkles}/sparkles.d.ts +30 -10
- package/staging/{lib/spot-light → spot-light}/spot-light-input.d.ts +24 -2
- package/staging/{lib/spot-light/shadow-mesh-input.d.ts → spot-light/spot-light-shadow-mesh-input.d.ts} +18 -3
- package/staging/spot-light/spot-light-shadow-mesh.d.ts +38 -0
- package/staging/{lib/spot-light → spot-light}/spot-light.d.ts +11 -5
- package/staging/{lib/spot-light → spot-light}/volumetric-mesh.d.ts +8 -5
- package/staging/{lib/stage → stage}/stage.d.ts +33 -14
- package/staging/{lib/stars → stars}/stars.d.ts +21 -7
- package/abstractions/lib/catmull-rom-line/catmull-rom-line.d.ts +0 -15
- package/abstractions/lib/cubic-bezier-line/cubic-bezier-line.d.ts +0 -15
- package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -16
- package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -24
- package/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.d.ts +0 -14
- package/abstractions/lib/line/line-input.d.ts +0 -19
- package/abstractions/lib/line/line.d.ts +0 -21
- package/abstractions/lib/text/text.d.ts +0 -21
- package/abstractions/lib/text-3d/text-3d.d.ts +0 -39
- package/assets/default-spot-light-shadow.glsl +0 -10
- package/cameras/lib/cube-camera/cube-camera.d.ts +0 -27
- package/esm2022/abstractions/lib/billboard/billboard.mjs +0 -74
- package/esm2022/abstractions/lib/catmull-rom-line/catmull-rom-line.mjs +0 -120
- package/esm2022/abstractions/lib/cubic-bezier-line/cubic-bezier-line.mjs +0 -99
- package/esm2022/abstractions/lib/edges/edges.mjs +0 -96
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-helper.mjs +0 -213
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -92
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -184
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube-inputs.mjs +0 -46
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -134
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -195
- package/esm2022/abstractions/lib/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -267
- package/esm2022/abstractions/lib/line/line-input.mjs +0 -76
- package/esm2022/abstractions/lib/line/line.mjs +0 -133
- package/esm2022/abstractions/lib/quadratic-bezier-line/quadratic-bezier-line.mjs +0 -128
- package/esm2022/abstractions/lib/text/text.mjs +0 -115
- package/esm2022/abstractions/lib/text-3d/text-3d.mjs +0 -145
- package/esm2022/cameras/lib/camera/camera-content.mjs +0 -21
- package/esm2022/cameras/lib/camera/camera.mjs +0 -75
- package/esm2022/cameras/lib/cube-camera/cube-camera.mjs +0 -131
- package/esm2022/cameras/lib/orthographic-camera/orthographic-camera.mjs +0 -93
- package/esm2022/cameras/lib/perspective-camera/perspective-camera.mjs +0 -47
- package/esm2022/controls/lib/orbit-controls/orbit-controls.mjs +0 -147
- package/esm2022/loaders/lib/cube-texture-loader/cube-texture-loader.mjs +0 -10
- package/esm2022/loaders/lib/gltf-loader/gltf-loader.mjs +0 -32
- package/esm2022/loaders/lib/loader/loader.mjs +0 -134
- package/esm2022/loaders/lib/progress/progress.mjs +0 -39
- package/esm2022/loaders/lib/texture-loader/texture-loader.mjs +0 -19
- package/esm2022/materials/lib/mesh-distort-material/mesh-distort-material.mjs +0 -75
- package/esm2022/materials/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -328
- package/esm2022/materials/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -158
- package/esm2022/materials/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -238
- package/esm2022/materials/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
- package/esm2022/misc/lib/animations/animations.mjs +0 -52
- package/esm2022/misc/lib/bake-shadows/bake-shadows.mjs +0 -26
- package/esm2022/misc/lib/depth-buffer/depth-buffer.mjs +0 -39
- package/esm2022/misc/lib/fbo/fbo.mjs +0 -39
- package/esm2022/performance/lib/adaptive/adaptive-dpr.mjs +0 -47
- package/esm2022/performance/lib/adaptive/adaptive-events.mjs +0 -37
- package/esm2022/performance/lib/detailed/detailed.mjs +0 -54
- package/esm2022/performance/lib/stats/stats.mjs +0 -80
- package/esm2022/shaders/lib/blur-pass/blur-pass.mjs +0 -61
- package/esm2022/shaders/lib/caustics-material/caustics-material.mjs +0 -128
- package/esm2022/shaders/lib/caustics-projection-material/caustics-projection-material.mjs +0 -33
- package/esm2022/shaders/lib/convolution-material/convolution-material.mjs +0 -94
- package/esm2022/shaders/lib/discard-material/discard-material.mjs +0 -3
- package/esm2022/shaders/lib/mesh-distort-material/mesh-distort-material.mjs +0 -55
- package/esm2022/shaders/lib/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
- package/esm2022/shaders/lib/mesh-refraction-material/mesh-refraction-material.mjs +0 -169
- package/esm2022/shaders/lib/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
- package/esm2022/shaders/lib/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
- package/esm2022/shaders/lib/shader-material/shader-material.mjs +0 -34
- package/esm2022/shaders/lib/soft-shadow-material/soft-shadow-material.mjs +0 -33
- package/esm2022/shaders/lib/spot-light-material/spot-light-material.mjs +0 -86
- package/esm2022/shaders/lib/star-field-material/star-field-material.mjs +0 -32
- package/esm2022/staging/lib/accumulative-shadows/accumulative-shadows.mjs +0 -249
- package/esm2022/staging/lib/accumulative-shadows/progressive-light-map.mjs +0 -108
- package/esm2022/staging/lib/accumulative-shadows/randomized-lights.mjs +0 -201
- package/esm2022/staging/lib/bounds/bounds.mjs +0 -284
- package/esm2022/staging/lib/camera-shake/camera-shake.mjs +0 -122
- package/esm2022/staging/lib/caustics/caustics.mjs +0 -364
- package/esm2022/staging/lib/center/center.mjs +0 -143
- package/esm2022/staging/lib/cloud/cloud.mjs +0 -160
- package/esm2022/staging/lib/contact-shadows/contact-shadows.mjs +0 -228
- package/esm2022/staging/lib/environment/assets.mjs +0 -13
- package/esm2022/staging/lib/environment/environment-cube.mjs +0 -41
- package/esm2022/staging/lib/environment/environment-ground.mjs +0 -67
- package/esm2022/staging/lib/environment/environment-inputs.mjs +0 -87
- package/esm2022/staging/lib/environment/environment-map.mjs +0 -39
- package/esm2022/staging/lib/environment/environment-portal.mjs +0 -111
- package/esm2022/staging/lib/environment/environment.mjs +0 -165
- package/esm2022/staging/lib/environment/utils.mjs +0 -70
- package/esm2022/staging/lib/float/float.mjs +0 -77
- package/esm2022/staging/lib/sky/sky.mjs +0 -109
- package/esm2022/staging/lib/sparkles/sparkles.mjs +0 -210
- package/esm2022/staging/lib/spot-light/common.mjs +0 -42
- package/esm2022/staging/lib/spot-light/shadow-mesh-input.mjs +0 -51
- package/esm2022/staging/lib/spot-light/spot-light-input.mjs +0 -62
- package/esm2022/staging/lib/spot-light/spot-light-shadow-no-shader.mjs +0 -74
- package/esm2022/staging/lib/spot-light/spot-light-shadow-shader.mjs +0 -126
- package/esm2022/staging/lib/spot-light/spot-light-shadow.mjs +0 -63
- package/esm2022/staging/lib/spot-light/spot-light.mjs +0 -117
- package/esm2022/staging/lib/spot-light/volumetric-mesh.mjs +0 -86
- package/esm2022/staging/lib/stage/stage.mjs +0 -368
- package/esm2022/staging/lib/stars/stars.mjs +0 -140
- package/loaders/lib/cube-texture-loader/cube-texture-loader.d.ts +0 -3
- package/loaders/lib/gltf-loader/gltf-loader.d.ts +0 -8
- package/loaders/lib/progress/progress.d.ts +0 -16
- package/loaders/lib/texture-loader/texture-loader.d.ts +0 -5
- package/materials/lib/mesh-reflector-material/mesh-reflector-material.d.ts +0 -41
- package/materials/lib/mesh-refraction-material/mesh-refraction-material.d.ts +0 -28
- package/misc/lib/animations/animations.d.ts +0 -13
- package/misc/lib/depth-buffer/depth-buffer.d.ts +0 -7
- package/performance/lib/detailed/detailed.d.ts +0 -13
- package/staging/lib/cloud/cloud.d.ts +0 -23
- package/staging/lib/environment/environment-cube.d.ts +0 -11
- package/staging/lib/environment/environment-ground.d.ts +0 -9
- package/staging/lib/environment/environment-inputs.d.ts +0 -28
- package/staging/lib/environment/environment-map.d.ts +0 -10
- package/staging/lib/environment/utils.d.ts +0 -8
- package/staging/lib/float/float.d.ts +0 -16
- package/staging/lib/spot-light/common.d.ts +0 -3
- package/staging/lib/spot-light/spot-light-shadow-no-shader.d.ts +0 -14
- package/staging/lib/spot-light/spot-light-shadow-shader.d.ts +0 -25
- package/staging/lib/spot-light/spot-light-shadow.d.ts +0 -6
- /package/abstractions/{lib/gizmo-helper → gizmo-helper}/gizmo-viewcube/constants.d.ts +0 -0
- /package/cameras/{lib/perspective-camera → perspective-camera}/perspective-camera.d.ts +0 -0
- /package/plugin/{README.md → libs/plugin/README.md} +0 -0
- /package/shaders/{lib/caustics-material → caustics-material}/caustics-material.d.ts +0 -0
- /package/shaders/{lib/caustics-projection-material → caustics-material}/caustics-projection-material.d.ts +0 -0
- /package/shaders/{lib/convolution-material → convolution-material}/convolution-material.d.ts +0 -0
- /package/shaders/{lib/discard-material → discard-material}/discard-material.d.ts +0 -0
- /package/shaders/{lib/mesh-reflector-material → mesh-reflector-material}/mesh-reflector-material.d.ts +0 -0
- /package/shaders/{lib/mesh-refraction-material → mesh-refraction-material}/mesh-refraction-material.d.ts +0 -0
- /package/shaders/{lib/mesh-transmission-material → mesh-transmission-material}/mesh-transmission-material.d.ts +0 -0
- /package/shaders/{lib/shader-material → shader-material}/shader-material.d.ts +0 -0
- /package/shaders/{lib/spot-light-material → spot-light-material}/spot-light-material.d.ts +0 -0
- /package/shaders/{lib/star-field-material → star-field-material}/star-field-material.d.ts +0 -0
- /package/staging/{lib/environment → environment}/assets.d.ts +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { inject, Component, CUSTOM_ELEMENTS_SCHEMA, Input, computed, effect } from '@angular/core';
|
|
3
|
+
import { NgtSignalStore, injectNgtRef, injectBeforeRender, NgtArgs, extend, NgtStore, getLocalState } from 'angular-three';
|
|
4
4
|
import { NGTS_DISTORT_MATERIAL_SHADER, MeshReflectorMaterial, BlurPass, MeshRefractionMaterial, MeshTransmissionMaterial, DiscardMaterial, MeshWobbleMaterial } from 'angular-three-soba/shaders';
|
|
5
5
|
import { NgIf } from '@angular/common';
|
|
6
|
-
import { debounceTime, map, combineLatest } from 'rxjs';
|
|
7
6
|
import * as THREE from 'three';
|
|
8
7
|
import { MeshBVH, SAH } from 'three-mesh-bvh';
|
|
9
8
|
import { injectNgtsFBO } from 'angular-three-soba/misc';
|
|
10
9
|
|
|
11
|
-
class NgtsMeshDistortMaterial extends
|
|
10
|
+
class NgtsMeshDistortMaterial extends NgtSignalStore {
|
|
12
11
|
set time(time) {
|
|
13
12
|
this.set({ time });
|
|
14
13
|
}
|
|
@@ -21,15 +20,13 @@ class NgtsMeshDistortMaterial extends NgtRxStore {
|
|
|
21
20
|
set speed(speed) {
|
|
22
21
|
this.set({ speed });
|
|
23
22
|
}
|
|
24
|
-
initialize() {
|
|
25
|
-
super.initialize();
|
|
26
|
-
this.set({ speed: 1, time: 0, distort: 0.4, radius: 1 });
|
|
27
|
-
}
|
|
28
23
|
constructor() {
|
|
29
|
-
super();
|
|
30
|
-
this.
|
|
31
|
-
this.material = new this.MeshDistortMaterial();
|
|
24
|
+
super({ speed: 1, time: 0, distort: 0.4, radius: 1 });
|
|
25
|
+
this.material = new (inject(NGTS_DISTORT_MATERIAL_SHADER))();
|
|
32
26
|
this.materialRef = injectNgtRef();
|
|
27
|
+
this.distortTime = this.select('time');
|
|
28
|
+
this.distortDistort = this.select('distort');
|
|
29
|
+
this.distortRadius = this.select('radius');
|
|
33
30
|
injectBeforeRender(({ clock }) => {
|
|
34
31
|
this.material.time = clock.getElapsedTime() * this.get('speed');
|
|
35
32
|
});
|
|
@@ -39,9 +36,9 @@ class NgtsMeshDistortMaterial extends NgtRxStore {
|
|
|
39
36
|
<ngt-primitive
|
|
40
37
|
*args="[material]"
|
|
41
38
|
[ref]="materialRef"
|
|
42
|
-
[time]="
|
|
43
|
-
[distort]="
|
|
44
|
-
[radius]="
|
|
39
|
+
[time]="distortTime()"
|
|
40
|
+
[distort]="distortDistort()"
|
|
41
|
+
[radius]="distortRadius()"
|
|
45
42
|
ngtCompound
|
|
46
43
|
attach="material"
|
|
47
44
|
/>
|
|
@@ -56,9 +53,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
56
53
|
<ngt-primitive
|
|
57
54
|
*args="[material]"
|
|
58
55
|
[ref]="materialRef"
|
|
59
|
-
[time]="
|
|
60
|
-
[distort]="
|
|
61
|
-
[radius]="
|
|
56
|
+
[time]="distortTime()"
|
|
57
|
+
[distort]="distortDistort()"
|
|
58
|
+
[radius]="distortRadius()"
|
|
62
59
|
ngtCompound
|
|
63
60
|
attach="material"
|
|
64
61
|
/>
|
|
@@ -79,7 +76,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
79
76
|
}] } });
|
|
80
77
|
|
|
81
78
|
extend({ MeshReflectorMaterial });
|
|
82
|
-
class NgtsMeshReflectorMaterial extends
|
|
79
|
+
class NgtsMeshReflectorMaterial extends NgtSignalStore {
|
|
83
80
|
set resolution(resolution) {
|
|
84
81
|
this.set({ resolution });
|
|
85
82
|
}
|
|
@@ -119,12 +116,37 @@ class NgtsMeshReflectorMaterial extends NgtRxStore {
|
|
|
119
116
|
set reflectorOffset(reflectorOffset) {
|
|
120
117
|
this.set({ reflectorOffset });
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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;
|
|
148
|
+
constructor() {
|
|
149
|
+
super({
|
|
128
150
|
mixBlur: 0,
|
|
129
151
|
mixStrength: 1,
|
|
130
152
|
resolution: 256,
|
|
@@ -138,42 +160,73 @@ class NgtsMeshReflectorMaterial extends NgtRxStore {
|
|
|
138
160
|
mixContrast: 1,
|
|
139
161
|
reflectorOffset: 0,
|
|
140
162
|
});
|
|
141
|
-
}
|
|
142
|
-
constructor() {
|
|
143
|
-
super();
|
|
144
163
|
this.materialRef = injectNgtRef();
|
|
145
|
-
this.
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
159
|
-
this.
|
|
160
|
-
this.
|
|
161
|
-
this.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
this.reflectorProps = computed(() => this.#reflectorEntities().reflectorProps);
|
|
165
|
+
this.defines = computed(() => this.reflectorProps().defines);
|
|
166
|
+
this.reflectorMirror = computed(() => this.reflectorProps().mirror);
|
|
167
|
+
this.reflectorTextureMatrix = computed(() => this.reflectorProps().textureMatrix);
|
|
168
|
+
this.reflectorMixBlur = computed(() => this.reflectorProps().mixBlur);
|
|
169
|
+
this.reflectorTDiffuse = computed(() => this.reflectorProps().tDiffuse);
|
|
170
|
+
this.reflectorTDepth = computed(() => this.reflectorProps().tDepth);
|
|
171
|
+
this.reflectorTDiffuseBlur = computed(() => this.reflectorProps().tDiffuseBlur);
|
|
172
|
+
this.reflectorHasBlur = computed(() => this.reflectorProps().hasBlur);
|
|
173
|
+
this.reflectorMixStrength = computed(() => this.reflectorProps().mixStrength);
|
|
174
|
+
this.reflectorMinDepthThreshold = computed(() => this.reflectorProps().minDepthThreshold);
|
|
175
|
+
this.reflectorMaxDepthThreshold = computed(() => this.reflectorProps().maxDepthThreshold);
|
|
176
|
+
this.reflectorDepthScale = computed(() => this.reflectorProps().depthScale);
|
|
177
|
+
this.reflectorDepthToBlurRatioBias = computed(() => this.reflectorProps().depthToBlurRatioBias);
|
|
178
|
+
this.reflectorDistortion = computed(() => this.reflectorProps().distortion);
|
|
179
|
+
this.reflectorDistortionMap = computed(() => this.reflectorProps().distortionMap);
|
|
180
|
+
this.reflectorMixContrast = computed(() => this.reflectorProps().mixContrast);
|
|
181
|
+
this.#store = inject(NgtStore);
|
|
182
|
+
this.#gl = this.#store.select('gl');
|
|
183
|
+
this.#reflectorPlane = new THREE.Plane();
|
|
184
|
+
this.#normal = new THREE.Vector3();
|
|
185
|
+
this.#reflectorWorldPosition = new THREE.Vector3();
|
|
186
|
+
this.#cameraWorldPosition = new THREE.Vector3();
|
|
187
|
+
this.#rotationMatrix = new THREE.Matrix4();
|
|
188
|
+
this.#lookAtPosition = new THREE.Vector3(0, 0, -1);
|
|
189
|
+
this.#clipPlane = new THREE.Vector4();
|
|
190
|
+
this.#view = new THREE.Vector3();
|
|
191
|
+
this.#target = new THREE.Vector3();
|
|
192
|
+
this.#q = new THREE.Vector4();
|
|
193
|
+
this.#textureMatrix = new THREE.Matrix4();
|
|
194
|
+
this.#virtualCamera = new THREE.PerspectiveCamera();
|
|
195
|
+
this.#blur = this.select('blur');
|
|
196
|
+
this.#resolution = this.select('resolution');
|
|
197
|
+
this.#mirror = this.select('mirror');
|
|
198
|
+
this.#mixBlur = this.select('mixBlur');
|
|
199
|
+
this.#mixStrength = this.select('mixStrength');
|
|
200
|
+
this.#minDepthThreshold = this.select('minDepthThreshold');
|
|
201
|
+
this.#maxDepthThreshold = this.select('maxDepthThreshold');
|
|
202
|
+
this.#depthScale = this.select('depthScale');
|
|
203
|
+
this.#depthToBlurRatioBias = this.select('depthToBlurRatioBias');
|
|
204
|
+
this.#distortion = this.select('distortion');
|
|
205
|
+
this.#distortionMap = this.select('distortionMap');
|
|
206
|
+
this.#mixContrast = this.select('mixContrast');
|
|
207
|
+
this.#normalizedBlur = computed(() => {
|
|
208
|
+
const blur = this.#blur();
|
|
209
|
+
return Array.isArray(blur) ? blur : [blur, blur];
|
|
210
|
+
});
|
|
211
|
+
this.#hasBlur = computed(() => {
|
|
212
|
+
const [x, y] = this.#normalizedBlur();
|
|
213
|
+
return x + y > 0;
|
|
214
|
+
});
|
|
215
|
+
this.#reflectorEntities = computed(() => {
|
|
216
|
+
const gl = this.#gl();
|
|
217
|
+
const resolution = this.#resolution();
|
|
218
|
+
const blur = this.#normalizedBlur();
|
|
219
|
+
const minDepthThreshold = this.#minDepthThreshold();
|
|
220
|
+
const maxDepthThreshold = this.#maxDepthThreshold();
|
|
221
|
+
const depthScale = this.#depthScale();
|
|
222
|
+
const depthToBlurRatioBias = this.#depthToBlurRatioBias();
|
|
223
|
+
const mirror = this.#mirror();
|
|
224
|
+
const mixBlur = this.#mixBlur();
|
|
225
|
+
const mixStrength = this.#mixStrength();
|
|
226
|
+
const mixContrast = this.#mixContrast();
|
|
227
|
+
const distortion = this.#distortion();
|
|
228
|
+
const distortionMap = this.#distortionMap();
|
|
229
|
+
const hasBlur = this.#hasBlur();
|
|
177
230
|
const parameters = {
|
|
178
231
|
minFilter: THREE.LinearFilter,
|
|
179
232
|
magFilter: THREE.LinearFilter,
|
|
@@ -198,7 +251,7 @@ class NgtsMeshReflectorMaterial extends NgtRxStore {
|
|
|
198
251
|
});
|
|
199
252
|
const reflectorProps = {
|
|
200
253
|
mirror,
|
|
201
|
-
textureMatrix: this
|
|
254
|
+
textureMatrix: this.#textureMatrix,
|
|
202
255
|
mixBlur,
|
|
203
256
|
tDiffuse: fbo1.texture,
|
|
204
257
|
tDepth: fbo1.depthTexture,
|
|
@@ -219,85 +272,30 @@ class NgtsMeshReflectorMaterial extends NgtRxStore {
|
|
|
219
272
|
},
|
|
220
273
|
};
|
|
221
274
|
return { fbo1, fbo2, blurPass, reflectorProps };
|
|
222
|
-
})
|
|
223
|
-
injectBeforeRender(this
|
|
224
|
-
}
|
|
225
|
-
beforeRender(state) {
|
|
226
|
-
const parent = getLocalState(this.materialRef.nativeElement).parent;
|
|
227
|
-
if (!parent)
|
|
228
|
-
return;
|
|
229
|
-
const { camera } = state;
|
|
230
|
-
this.reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
|
|
231
|
-
this.cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
|
|
232
|
-
this.rotationMatrix.extractRotation(parent.matrixWorld);
|
|
233
|
-
this.normal.set(0, 0, 1);
|
|
234
|
-
this.normal.applyMatrix4(this.rotationMatrix);
|
|
235
|
-
this.reflectorWorldPosition.addScaledVector(this.normal, this.get('reflectorOffset'));
|
|
236
|
-
this.view.subVectors(this.reflectorWorldPosition, this.cameraWorldPosition);
|
|
237
|
-
// Avoid rendering when reflector is facing away
|
|
238
|
-
if (this.view.dot(this.normal) > 0)
|
|
239
|
-
return;
|
|
240
|
-
this.view.reflect(this.normal).negate();
|
|
241
|
-
this.view.add(this.reflectorWorldPosition);
|
|
242
|
-
this.rotationMatrix.extractRotation(camera.matrixWorld);
|
|
243
|
-
this.lookAtPosition.set(0, 0, -1);
|
|
244
|
-
this.lookAtPosition.applyMatrix4(this.rotationMatrix);
|
|
245
|
-
this.lookAtPosition.add(this.cameraWorldPosition);
|
|
246
|
-
this.target.subVectors(this.reflectorWorldPosition, this.lookAtPosition);
|
|
247
|
-
this.target.reflect(this.normal).negate();
|
|
248
|
-
this.target.add(this.reflectorWorldPosition);
|
|
249
|
-
this.virtualCamera.position.copy(this.view);
|
|
250
|
-
this.virtualCamera.up.set(0, 1, 0);
|
|
251
|
-
this.virtualCamera.up.applyMatrix4(this.rotationMatrix);
|
|
252
|
-
this.virtualCamera.up.reflect(this.normal);
|
|
253
|
-
this.virtualCamera.lookAt(this.target);
|
|
254
|
-
this.virtualCamera.far = camera.far; // Used in WebGLBackground
|
|
255
|
-
this.virtualCamera.updateMatrixWorld();
|
|
256
|
-
this.virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
257
|
-
// Update the texture matrix
|
|
258
|
-
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);
|
|
259
|
-
this.textureMatrix.multiply(this.virtualCamera.projectionMatrix);
|
|
260
|
-
this.textureMatrix.multiply(this.virtualCamera.matrixWorldInverse);
|
|
261
|
-
this.textureMatrix.multiply(parent.matrixWorld);
|
|
262
|
-
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
263
|
-
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
264
|
-
this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal, this.reflectorWorldPosition);
|
|
265
|
-
this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse);
|
|
266
|
-
this.clipPlane.set(this.reflectorPlane.normal.x, this.reflectorPlane.normal.y, this.reflectorPlane.normal.z, this.reflectorPlane.constant);
|
|
267
|
-
const projectionMatrix = this.virtualCamera.projectionMatrix;
|
|
268
|
-
this.q.x = (Math.sign(this.clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
|
|
269
|
-
this.q.y = (Math.sign(this.clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
|
|
270
|
-
this.q.z = -1.0;
|
|
271
|
-
this.q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
272
|
-
// Calculate the scaled plane vector
|
|
273
|
-
this.clipPlane.multiplyScalar(2.0 / this.clipPlane.dot(this.q));
|
|
274
|
-
// Replacing the third row of the projection matrix
|
|
275
|
-
projectionMatrix.elements[2] = this.clipPlane.x;
|
|
276
|
-
projectionMatrix.elements[6] = this.clipPlane.y;
|
|
277
|
-
projectionMatrix.elements[10] = this.clipPlane.z + 1.0;
|
|
278
|
-
projectionMatrix.elements[14] = this.clipPlane.w;
|
|
275
|
+
});
|
|
276
|
+
injectBeforeRender(this.#onBeforeRender.bind(this));
|
|
279
277
|
}
|
|
280
|
-
onBeforeRender(state) {
|
|
278
|
+
#onBeforeRender(state) {
|
|
281
279
|
if (!this.materialRef.nativeElement)
|
|
282
280
|
return;
|
|
283
|
-
const parent = getLocalState(this.materialRef.nativeElement).parent;
|
|
281
|
+
const parent = getLocalState(this.materialRef.nativeElement).parent();
|
|
284
282
|
if (!parent)
|
|
285
283
|
return;
|
|
286
284
|
const { gl, scene } = state;
|
|
287
|
-
const
|
|
288
|
-
const { fbo1, fbo2, blurPass } = this
|
|
285
|
+
const hasBlur = this.#hasBlur();
|
|
286
|
+
const { fbo1, fbo2, blurPass } = this.#reflectorEntities();
|
|
289
287
|
if (fbo1 && fbo2 && blurPass) {
|
|
290
288
|
parent.visible = false;
|
|
291
289
|
const currentXrEnabled = gl.xr.enabled;
|
|
292
290
|
const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
|
|
293
|
-
this
|
|
291
|
+
this.#beforeRender(state);
|
|
294
292
|
gl.xr.enabled = false;
|
|
295
293
|
gl.shadowMap.autoUpdate = false;
|
|
296
294
|
gl.setRenderTarget(fbo1);
|
|
297
295
|
gl.state.buffers.depth.setMask(true);
|
|
298
296
|
if (!gl.autoClear)
|
|
299
297
|
gl.clear();
|
|
300
|
-
gl.render(scene, this
|
|
298
|
+
gl.render(scene, this.#virtualCamera);
|
|
301
299
|
if (hasBlur)
|
|
302
300
|
blurPass.render(gl, fbo1, fbo2);
|
|
303
301
|
gl.xr.enabled = currentXrEnabled;
|
|
@@ -306,33 +304,88 @@ class NgtsMeshReflectorMaterial extends NgtRxStore {
|
|
|
306
304
|
gl.setRenderTarget(null);
|
|
307
305
|
}
|
|
308
306
|
}
|
|
307
|
+
#beforeRender(state) {
|
|
308
|
+
const parent = getLocalState(this.materialRef.nativeElement).parent();
|
|
309
|
+
if (!parent)
|
|
310
|
+
return;
|
|
311
|
+
const { camera } = state;
|
|
312
|
+
this.#reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
|
|
313
|
+
this.#cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
|
|
314
|
+
this.#rotationMatrix.extractRotation(parent.matrixWorld);
|
|
315
|
+
this.#normal.set(0, 0, 1);
|
|
316
|
+
this.#normal.applyMatrix4(this.#rotationMatrix);
|
|
317
|
+
this.#reflectorWorldPosition.addScaledVector(this.#normal, this.get('reflectorOffset'));
|
|
318
|
+
this.#view.subVectors(this.#reflectorWorldPosition, this.#cameraWorldPosition);
|
|
319
|
+
// Avoid rendering when reflector is facing away
|
|
320
|
+
if (this.#view.dot(this.#normal) > 0)
|
|
321
|
+
return;
|
|
322
|
+
this.#view.reflect(this.#normal).negate();
|
|
323
|
+
this.#view.add(this.#reflectorWorldPosition);
|
|
324
|
+
this.#rotationMatrix.extractRotation(camera.matrixWorld);
|
|
325
|
+
this.#lookAtPosition.set(0, 0, -1);
|
|
326
|
+
this.#lookAtPosition.applyMatrix4(this.#rotationMatrix);
|
|
327
|
+
this.#lookAtPosition.add(this.#cameraWorldPosition);
|
|
328
|
+
this.#target.subVectors(this.#reflectorWorldPosition, this.#lookAtPosition);
|
|
329
|
+
this.#target.reflect(this.#normal).negate();
|
|
330
|
+
this.#target.add(this.#reflectorWorldPosition);
|
|
331
|
+
this.#virtualCamera.position.copy(this.#view);
|
|
332
|
+
this.#virtualCamera.up.set(0, 1, 0);
|
|
333
|
+
this.#virtualCamera.up.applyMatrix4(this.#rotationMatrix);
|
|
334
|
+
this.#virtualCamera.up.reflect(this.#normal);
|
|
335
|
+
this.#virtualCamera.lookAt(this.#target);
|
|
336
|
+
this.#virtualCamera.far = camera.far; // Used in WebGLBackground
|
|
337
|
+
this.#virtualCamera.updateMatrixWorld();
|
|
338
|
+
this.#virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
339
|
+
// Update the texture matrix
|
|
340
|
+
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);
|
|
341
|
+
this.#textureMatrix.multiply(this.#virtualCamera.projectionMatrix);
|
|
342
|
+
this.#textureMatrix.multiply(this.#virtualCamera.matrixWorldInverse);
|
|
343
|
+
this.#textureMatrix.multiply(parent.matrixWorld);
|
|
344
|
+
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
345
|
+
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
346
|
+
this.#reflectorPlane.setFromNormalAndCoplanarPoint(this.#normal, this.#reflectorWorldPosition);
|
|
347
|
+
this.#reflectorPlane.applyMatrix4(this.#virtualCamera.matrixWorldInverse);
|
|
348
|
+
this.#clipPlane.set(this.#reflectorPlane.normal.x, this.#reflectorPlane.normal.y, this.#reflectorPlane.normal.z, this.#reflectorPlane.constant);
|
|
349
|
+
const projectionMatrix = this.#virtualCamera.projectionMatrix;
|
|
350
|
+
this.#q.x = (Math.sign(this.#clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
|
|
351
|
+
this.#q.y = (Math.sign(this.#clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
|
|
352
|
+
this.#q.z = -1.0;
|
|
353
|
+
this.#q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
354
|
+
// Calculate the scaled plane vector
|
|
355
|
+
this.#clipPlane.multiplyScalar(2.0 / this.#clipPlane.dot(this.#q));
|
|
356
|
+
// Replacing the third row of the projection matrix
|
|
357
|
+
projectionMatrix.elements[2] = this.#clipPlane.x;
|
|
358
|
+
projectionMatrix.elements[6] = this.#clipPlane.y;
|
|
359
|
+
projectionMatrix.elements[10] = this.#clipPlane.z + 1.0;
|
|
360
|
+
projectionMatrix.elements[14] = this.#clipPlane.w;
|
|
361
|
+
}
|
|
309
362
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
310
363
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsMeshReflectorMaterial, isStandalone: true, selector: "ngts-mesh-reflector-material", inputs: { materialRef: "materialRef", resolution: "resolution", mixBlur: "mixBlur", mixStrength: "mixStrength", blur: "blur", mirror: "mirror", minDepthThreshold: "minDepthThreshold", maxDepthThreshold: "maxDepthThreshold", depthScale: "depthScale", depthToBlurRatioBias: "depthToBlurRatioBias", distortionMap: "distortionMap", distortion: "distortion", mixContrast: "mixContrast", reflectorOffset: "reflectorOffset" }, usesInheritance: true, ngImport: i0, template: `
|
|
311
364
|
<ngt-mesh-reflector-material
|
|
312
365
|
ngtCompound
|
|
313
366
|
attach="material"
|
|
314
|
-
*ngIf="defines
|
|
367
|
+
*ngIf="defines()"
|
|
315
368
|
[ref]="materialRef"
|
|
316
|
-
[defines]="defines"
|
|
317
|
-
[mirror]="
|
|
318
|
-
[textureMatrix]="
|
|
319
|
-
[mixBlur]="
|
|
320
|
-
[tDiffuse]="
|
|
321
|
-
[tDepth]="
|
|
322
|
-
[tDiffuseBlur]="
|
|
323
|
-
[hasBlur]="
|
|
324
|
-
[mixStrength]="
|
|
325
|
-
[minDepthThreshold]="
|
|
326
|
-
[maxDepthThreshold]="
|
|
327
|
-
[depthScale]="
|
|
328
|
-
[depthToBlurRatioBias]="
|
|
329
|
-
[distortion]="
|
|
330
|
-
[distortionMap]="
|
|
331
|
-
[mixContrast]="
|
|
369
|
+
[defines]="defines()"
|
|
370
|
+
[mirror]="reflectorMirror()"
|
|
371
|
+
[textureMatrix]="reflectorTextureMatrix()"
|
|
372
|
+
[mixBlur]="reflectorMixBlur()"
|
|
373
|
+
[tDiffuse]="reflectorTDiffuse()"
|
|
374
|
+
[tDepth]="reflectorTDepth()"
|
|
375
|
+
[tDiffuseBlur]="reflectorTDiffuseBlur()"
|
|
376
|
+
[hasBlur]="reflectorHasBlur()"
|
|
377
|
+
[mixStrength]="reflectorMixStrength()"
|
|
378
|
+
[minDepthThreshold]="reflectorMinDepthThreshold()"
|
|
379
|
+
[maxDepthThreshold]="reflectorMaxDepthThreshold()"
|
|
380
|
+
[depthScale]="reflectorDepthScale()"
|
|
381
|
+
[depthToBlurRatioBias]="reflectorDepthToBlurRatioBias()"
|
|
382
|
+
[distortion]="reflectorDistortion()"
|
|
383
|
+
[distortionMap]="reflectorDistortionMap()"
|
|
384
|
+
[mixContrast]="reflectorMixContrast()"
|
|
332
385
|
>
|
|
333
386
|
<ng-content />
|
|
334
387
|
</ngt-mesh-reflector-material>
|
|
335
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
388
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
336
389
|
}
|
|
337
390
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
|
|
338
391
|
type: Component,
|
|
@@ -343,29 +396,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
343
396
|
<ngt-mesh-reflector-material
|
|
344
397
|
ngtCompound
|
|
345
398
|
attach="material"
|
|
346
|
-
*ngIf="defines
|
|
399
|
+
*ngIf="defines()"
|
|
347
400
|
[ref]="materialRef"
|
|
348
|
-
[defines]="defines"
|
|
349
|
-
[mirror]="
|
|
350
|
-
[textureMatrix]="
|
|
351
|
-
[mixBlur]="
|
|
352
|
-
[tDiffuse]="
|
|
353
|
-
[tDepth]="
|
|
354
|
-
[tDiffuseBlur]="
|
|
355
|
-
[hasBlur]="
|
|
356
|
-
[mixStrength]="
|
|
357
|
-
[minDepthThreshold]="
|
|
358
|
-
[maxDepthThreshold]="
|
|
359
|
-
[depthScale]="
|
|
360
|
-
[depthToBlurRatioBias]="
|
|
361
|
-
[distortion]="
|
|
362
|
-
[distortionMap]="
|
|
363
|
-
[mixContrast]="
|
|
401
|
+
[defines]="defines()"
|
|
402
|
+
[mirror]="reflectorMirror()"
|
|
403
|
+
[textureMatrix]="reflectorTextureMatrix()"
|
|
404
|
+
[mixBlur]="reflectorMixBlur()"
|
|
405
|
+
[tDiffuse]="reflectorTDiffuse()"
|
|
406
|
+
[tDepth]="reflectorTDepth()"
|
|
407
|
+
[tDiffuseBlur]="reflectorTDiffuseBlur()"
|
|
408
|
+
[hasBlur]="reflectorHasBlur()"
|
|
409
|
+
[mixStrength]="reflectorMixStrength()"
|
|
410
|
+
[minDepthThreshold]="reflectorMinDepthThreshold()"
|
|
411
|
+
[maxDepthThreshold]="reflectorMaxDepthThreshold()"
|
|
412
|
+
[depthScale]="reflectorDepthScale()"
|
|
413
|
+
[depthToBlurRatioBias]="reflectorDepthToBlurRatioBias()"
|
|
414
|
+
[distortion]="reflectorDistortion()"
|
|
415
|
+
[distortionMap]="reflectorDistortionMap()"
|
|
416
|
+
[mixContrast]="reflectorMixContrast()"
|
|
364
417
|
>
|
|
365
418
|
<ng-content />
|
|
366
419
|
</ngt-mesh-reflector-material>
|
|
367
420
|
`,
|
|
368
|
-
imports: [NgtArgs,
|
|
421
|
+
imports: [NgtArgs, NgIf],
|
|
369
422
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
370
423
|
}]
|
|
371
424
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
@@ -400,7 +453,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
400
453
|
|
|
401
454
|
extend({ MeshRefractionMaterial });
|
|
402
455
|
const isCubeTexture = (def) => def && def.isCubeTexture;
|
|
403
|
-
class NgtsMeshRefractionMaterial extends
|
|
456
|
+
class NgtsMeshRefractionMaterial extends NgtSignalStore {
|
|
404
457
|
/** Environment map */
|
|
405
458
|
set envMap(envMap) {
|
|
406
459
|
this.set({ envMap });
|
|
@@ -429,19 +482,28 @@ class NgtsMeshRefractionMaterial extends NgtRxStore {
|
|
|
429
482
|
set fastChroma(fastChroma) {
|
|
430
483
|
this.set({ fastChroma });
|
|
431
484
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
aberrationStrength: 0,
|
|
436
|
-
fastChroma: true,
|
|
437
|
-
});
|
|
438
|
-
}
|
|
485
|
+
#store;
|
|
486
|
+
#size;
|
|
487
|
+
#envMap;
|
|
439
488
|
constructor() {
|
|
440
|
-
super();
|
|
489
|
+
super({ aberrationStrength: 0, fastChroma: true });
|
|
441
490
|
this.materialRef = injectNgtRef();
|
|
442
|
-
this.
|
|
443
|
-
this.
|
|
444
|
-
this.
|
|
491
|
+
this.refractionEnvMap = this.select('envMap');
|
|
492
|
+
this.refractionBounces = this.select('bounces');
|
|
493
|
+
this.refractionIor = this.select('ior');
|
|
494
|
+
this.refractionFresnel = this.select('fresnel');
|
|
495
|
+
this.refractionAberrationStrength = this.select('aberrationStrength');
|
|
496
|
+
this.refractionColor = this.select('color');
|
|
497
|
+
this.refractionFastChroma = this.select('fastChroma');
|
|
498
|
+
this.#store = inject(NgtStore);
|
|
499
|
+
this.#size = this.#store.select('size');
|
|
500
|
+
this.#envMap = this.select('envMap');
|
|
501
|
+
this.defines = computed(() => {
|
|
502
|
+
const envMap = this.#envMap();
|
|
503
|
+
if (!envMap)
|
|
504
|
+
return null;
|
|
505
|
+
const aberrationStrength = this.refractionAberrationStrength();
|
|
506
|
+
const fastChroma = this.refractionFastChroma();
|
|
445
507
|
const temp = {};
|
|
446
508
|
// Sampler2D and SamplerCube need different defines
|
|
447
509
|
const isCubeMap = isCubeTexture(envMap);
|
|
@@ -462,21 +524,22 @@ class NgtsMeshRefractionMaterial extends NgtRxStore {
|
|
|
462
524
|
if (fastChroma)
|
|
463
525
|
temp['FAST_CHROMA'] = '';
|
|
464
526
|
return temp;
|
|
465
|
-
})
|
|
466
|
-
this.
|
|
527
|
+
});
|
|
528
|
+
this.resolution = computed(() => [this.#size().width, this.#size().height]);
|
|
467
529
|
injectBeforeRender(({ camera }) => {
|
|
468
530
|
if (this.materialRef.nativeElement) {
|
|
469
531
|
this.materialRef.nativeElement.viewMatrixInverse = camera.matrixWorld;
|
|
470
532
|
this.materialRef.nativeElement.projectionMatrixInverse = camera.projectionMatrixInverse;
|
|
471
533
|
}
|
|
472
534
|
});
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
535
|
+
this.#setupGeometry();
|
|
536
|
+
}
|
|
537
|
+
#setupGeometry() {
|
|
538
|
+
effect(() => {
|
|
539
|
+
const material = this.materialRef.nativeElement;
|
|
540
|
+
if (!material)
|
|
541
|
+
return;
|
|
542
|
+
const geometry = getLocalState(material).parent()?.geometry;
|
|
480
543
|
if (geometry) {
|
|
481
544
|
material.bvh.updateFrom(new MeshBVH(geometry.toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
|
|
482
545
|
}
|
|
@@ -485,23 +548,23 @@ class NgtsMeshRefractionMaterial extends NgtRxStore {
|
|
|
485
548
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
486
549
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsMeshRefractionMaterial, isStandalone: true, selector: "ngts-mesh-refraction-material", inputs: { materialRef: "materialRef", envMap: "envMap", bounces: "bounces", ior: "ior", fresnel: "fresnel", aberrationStrength: "aberrationStrength", color: "color", fastChroma: "fastChroma" }, usesInheritance: true, ngImport: i0, template: `
|
|
487
550
|
<ngt-mesh-refraction-material
|
|
488
|
-
*ngIf="defines
|
|
551
|
+
*ngIf="defines() as defines"
|
|
489
552
|
[ref]="materialRef"
|
|
490
553
|
[defines]="defines"
|
|
491
|
-
[resolution]="
|
|
492
|
-
[aberrationStrength]="
|
|
493
|
-
[envMap]="
|
|
494
|
-
[bounces]="
|
|
495
|
-
[ior]="
|
|
496
|
-
[fresnel]="
|
|
497
|
-
[color]="
|
|
498
|
-
[fastChroma]="
|
|
554
|
+
[resolution]="resolution()"
|
|
555
|
+
[aberrationStrength]="refractionAberrationStrength()"
|
|
556
|
+
[envMap]="refractionEnvMap()"
|
|
557
|
+
[bounces]="refractionBounces()"
|
|
558
|
+
[ior]="refractionIor()"
|
|
559
|
+
[fresnel]="refractionFresnel()"
|
|
560
|
+
[color]="refractionColor()"
|
|
561
|
+
[fastChroma]="refractionFastChroma()"
|
|
499
562
|
ngtCompound
|
|
500
563
|
attach="material"
|
|
501
564
|
>
|
|
502
565
|
<ng-content />
|
|
503
566
|
</ngt-mesh-refraction-material>
|
|
504
|
-
`, isInline: true, dependencies: [{ kind: "
|
|
567
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
505
568
|
}
|
|
506
569
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
|
|
507
570
|
type: Component,
|
|
@@ -510,30 +573,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
510
573
|
standalone: true,
|
|
511
574
|
template: `
|
|
512
575
|
<ngt-mesh-refraction-material
|
|
513
|
-
*ngIf="defines
|
|
576
|
+
*ngIf="defines() as defines"
|
|
514
577
|
[ref]="materialRef"
|
|
515
578
|
[defines]="defines"
|
|
516
|
-
[resolution]="
|
|
517
|
-
[aberrationStrength]="
|
|
518
|
-
[envMap]="
|
|
519
|
-
[bounces]="
|
|
520
|
-
[ior]="
|
|
521
|
-
[fresnel]="
|
|
522
|
-
[color]="
|
|
523
|
-
[fastChroma]="
|
|
579
|
+
[resolution]="resolution()"
|
|
580
|
+
[aberrationStrength]="refractionAberrationStrength()"
|
|
581
|
+
[envMap]="refractionEnvMap()"
|
|
582
|
+
[bounces]="refractionBounces()"
|
|
583
|
+
[ior]="refractionIor()"
|
|
584
|
+
[fresnel]="refractionFresnel()"
|
|
585
|
+
[color]="refractionColor()"
|
|
586
|
+
[fastChroma]="refractionFastChroma()"
|
|
524
587
|
ngtCompound
|
|
525
588
|
attach="material"
|
|
526
589
|
>
|
|
527
590
|
<ng-content />
|
|
528
591
|
</ngt-mesh-refraction-material>
|
|
529
592
|
`,
|
|
530
|
-
imports: [
|
|
593
|
+
imports: [NgIf],
|
|
531
594
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
532
595
|
}]
|
|
533
596
|
}], ctorParameters: function () { return []; }, propDecorators: { materialRef: [{
|
|
534
597
|
type: Input
|
|
535
598
|
}], envMap: [{
|
|
536
|
-
type: Input
|
|
599
|
+
type: Input,
|
|
600
|
+
args: [{ required: true }]
|
|
537
601
|
}], bounces: [{
|
|
538
602
|
type: Input
|
|
539
603
|
}], ior: [{
|
|
@@ -549,7 +613,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
549
613
|
}] } });
|
|
550
614
|
|
|
551
615
|
extend({ MeshTransmissionMaterial });
|
|
552
|
-
class NgtsMeshTranmissionMaterial extends
|
|
616
|
+
class NgtsMeshTranmissionMaterial extends NgtSignalStore {
|
|
553
617
|
/** transmissionSampler, you can use the threejs transmission sampler texture that is
|
|
554
618
|
* generated once for all transmissive materials. The upside is that it can be faster if you
|
|
555
619
|
* use multiple MeshPhysical and Transmission materials, the downside is that transmissive materials
|
|
@@ -621,12 +685,15 @@ class NgtsMeshTranmissionMaterial extends NgtRxStore {
|
|
|
621
685
|
set time(time) {
|
|
622
686
|
this.set({ time });
|
|
623
687
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
688
|
+
#discardMaterial;
|
|
689
|
+
#backsideResolution;
|
|
690
|
+
#resolution;
|
|
691
|
+
#fboBackSettings;
|
|
692
|
+
#fboMainSettings;
|
|
693
|
+
constructor() {
|
|
694
|
+
super({
|
|
627
695
|
transmissionSampler: false,
|
|
628
696
|
backside: false,
|
|
629
|
-
side: THREE.FrontSide,
|
|
630
697
|
transmission: 1,
|
|
631
698
|
thickness: 0,
|
|
632
699
|
backsideThickness: 0,
|
|
@@ -639,23 +706,40 @@ class NgtsMeshTranmissionMaterial extends NgtRxStore {
|
|
|
639
706
|
temporalDistortion: 0.0,
|
|
640
707
|
buffer: null,
|
|
641
708
|
});
|
|
642
|
-
}
|
|
643
|
-
constructor() {
|
|
644
|
-
super();
|
|
645
709
|
this.materialRef = injectNgtRef();
|
|
646
|
-
this.
|
|
647
|
-
this.
|
|
648
|
-
this.
|
|
710
|
+
this.transmissionTransmissionSampler = this.select('transmissionSampler');
|
|
711
|
+
this.transmissionBackside = this.select('backside');
|
|
712
|
+
this.transmissionTransmission = this.select('transmission');
|
|
713
|
+
this.transmissionThickness = this.select('thickness');
|
|
714
|
+
this.transmissionBacksideThickness = this.select('backsideThickness');
|
|
715
|
+
this.transmissionSamples = this.select('samples');
|
|
716
|
+
this.transmissionRoughness = this.select('roughness');
|
|
717
|
+
this.transmissionAnisotropy = this.select('anisotropy');
|
|
718
|
+
this.transmissionChromaticAberration = this.select('chromaticAberration');
|
|
719
|
+
this.transmissionDistortion = this.select('distortion');
|
|
720
|
+
this.transmissionDistortionScale = this.select('distortionScale');
|
|
721
|
+
this.transmissionTemporalDistortion = this.select('temporalDistortion');
|
|
722
|
+
this.transmissionBuffer = this.select('buffer');
|
|
723
|
+
this.transmissionTime = this.select('time');
|
|
724
|
+
this.#discardMaterial = new DiscardMaterial();
|
|
725
|
+
this.#backsideResolution = this.select('backsideResolution');
|
|
726
|
+
this.#resolution = this.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
|
+
this.side = THREE.FrontSide;
|
|
649
732
|
let oldBg;
|
|
650
733
|
let oldTone;
|
|
651
734
|
let parent;
|
|
652
735
|
injectBeforeRender((state) => {
|
|
653
|
-
|
|
736
|
+
if (!this.materialRef.nativeElement)
|
|
737
|
+
return;
|
|
738
|
+
const { transmissionSampler, background, backside, backsideThickness, thickness } = this.get();
|
|
654
739
|
this.materialRef.nativeElement.time = state.clock.getElapsedTime();
|
|
655
740
|
// Render only if the buffer matches the built-in and no transmission sampler is set
|
|
656
|
-
if (this.materialRef.nativeElement.buffer === this.fboMainRef.
|
|
657
|
-
|
|
658
|
-
parent = getLocalState(this.materialRef.nativeElement).parent;
|
|
741
|
+
if (this.materialRef.nativeElement.buffer === this.fboMainRef().texture && !transmissionSampler) {
|
|
742
|
+
parent = getLocalState(this.materialRef.nativeElement).parent();
|
|
659
743
|
if (parent) {
|
|
660
744
|
// Save defaults
|
|
661
745
|
oldTone = state.gl.toneMapping;
|
|
@@ -666,23 +750,23 @@ class NgtsMeshTranmissionMaterial extends NgtRxStore {
|
|
|
666
750
|
state.gl.toneMapping = THREE.NoToneMapping;
|
|
667
751
|
if (background)
|
|
668
752
|
state.scene.background = background;
|
|
669
|
-
parent['material'] = this
|
|
753
|
+
parent['material'] = this.#discardMaterial;
|
|
670
754
|
if (backside) {
|
|
671
755
|
// Render into the backside buffer
|
|
672
|
-
state.gl.setRenderTarget(this.fboBackRef
|
|
756
|
+
state.gl.setRenderTarget(this.fboBackRef());
|
|
673
757
|
state.gl.render(state.scene, state.camera);
|
|
674
758
|
// And now prepare the material for the main render using the backside buffer
|
|
675
759
|
parent['material'] = this.materialRef.nativeElement;
|
|
676
|
-
parent['material'].buffer = this.fboBackRef.
|
|
760
|
+
parent['material'].buffer = this.fboBackRef().texture;
|
|
677
761
|
parent['material'].thickness = backsideThickness;
|
|
678
762
|
parent['material'].side = THREE.BackSide;
|
|
679
763
|
}
|
|
680
764
|
// Render into the main buffer
|
|
681
|
-
state.gl.setRenderTarget(this.fboMainRef
|
|
765
|
+
state.gl.setRenderTarget(this.fboMainRef());
|
|
682
766
|
state.gl.render(state.scene, state.camera);
|
|
683
767
|
parent['material'].thickness = thickness;
|
|
684
|
-
parent['material'].side = side;
|
|
685
|
-
parent['material'].buffer = this.fboMainRef.
|
|
768
|
+
parent['material'].side = this.side;
|
|
769
|
+
parent['material'].buffer = this.fboMainRef().texture;
|
|
686
770
|
// Set old state back
|
|
687
771
|
state.scene.background = oldBg;
|
|
688
772
|
state.gl.setRenderTarget(null);
|
|
@@ -695,21 +779,21 @@ class NgtsMeshTranmissionMaterial extends NgtRxStore {
|
|
|
695
779
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgtsMeshTranmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
696
780
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgtsMeshTranmissionMaterial, isStandalone: true, selector: "ngts-mesh-transmission-material", inputs: { materialRef: "materialRef", transmissionSampler: "transmissionSampler", backside: "backside", backsideThickness: "backsideThickness", resolution: "resolution", backsideResolution: "backsideResolution", samples: "samples", background: "background", transmission: "transmission", thickness: "thickness", roughness: "roughness", chromaticAberration: "chromaticAberration", anisotropy: "anisotropy", distortion: "distortion", distortionScale: "distortionScale", temporalDistortion: "temporalDistortion", buffer: "buffer", time: "time" }, usesInheritance: true, ngImport: i0, template: `
|
|
697
781
|
<ngt-mesh-transmission-material
|
|
698
|
-
*args="[get('samples'), get('transmissionSampler')]"
|
|
699
782
|
ngtCompound
|
|
783
|
+
*args="[transmissionSamples(), transmissionTransmissionSampler()]"
|
|
700
784
|
[ref]="materialRef"
|
|
701
|
-
[buffer]="
|
|
702
|
-
[_transmission]="
|
|
703
|
-
[transmission]="
|
|
704
|
-
[thickness]="
|
|
705
|
-
[side]="
|
|
706
|
-
[anisotropy]="
|
|
707
|
-
[roughness]="
|
|
708
|
-
[chromaticAberration]="
|
|
709
|
-
[distortion]="
|
|
710
|
-
[distortionScale]="
|
|
711
|
-
[temporalDistortion]="
|
|
712
|
-
[time]="
|
|
785
|
+
[buffer]="transmissionBuffer() || fboMainRef()?.texture"
|
|
786
|
+
[_transmission]="transmissionTransmission()"
|
|
787
|
+
[transmission]="transmissionTransmissionSampler() ? transmissionTransmission() : 0"
|
|
788
|
+
[thickness]="transmissionThickness()"
|
|
789
|
+
[side]="side"
|
|
790
|
+
[anisotropy]="transmissionAnisotropy()"
|
|
791
|
+
[roughness]="transmissionRoughness()"
|
|
792
|
+
[chromaticAberration]="transmissionChromaticAberration()"
|
|
793
|
+
[distortion]="transmissionDistortion()"
|
|
794
|
+
[distortionScale]="transmissionDistortionScale()"
|
|
795
|
+
[temporalDistortion]="transmissionTemporalDistortion()"
|
|
796
|
+
[time]="transmissionTime()"
|
|
713
797
|
/>
|
|
714
798
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "[args]", inputs: ["args"] }] }); }
|
|
715
799
|
}
|
|
@@ -720,21 +804,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
720
804
|
standalone: true,
|
|
721
805
|
template: `
|
|
722
806
|
<ngt-mesh-transmission-material
|
|
723
|
-
*args="[get('samples'), get('transmissionSampler')]"
|
|
724
807
|
ngtCompound
|
|
808
|
+
*args="[transmissionSamples(), transmissionTransmissionSampler()]"
|
|
725
809
|
[ref]="materialRef"
|
|
726
|
-
[buffer]="
|
|
727
|
-
[_transmission]="
|
|
728
|
-
[transmission]="
|
|
729
|
-
[thickness]="
|
|
730
|
-
[side]="
|
|
731
|
-
[anisotropy]="
|
|
732
|
-
[roughness]="
|
|
733
|
-
[chromaticAberration]="
|
|
734
|
-
[distortion]="
|
|
735
|
-
[distortionScale]="
|
|
736
|
-
[temporalDistortion]="
|
|
737
|
-
[time]="
|
|
810
|
+
[buffer]="transmissionBuffer() || fboMainRef()?.texture"
|
|
811
|
+
[_transmission]="transmissionTransmission()"
|
|
812
|
+
[transmission]="transmissionTransmissionSampler() ? transmissionTransmission() : 0"
|
|
813
|
+
[thickness]="transmissionThickness()"
|
|
814
|
+
[side]="side"
|
|
815
|
+
[anisotropy]="transmissionAnisotropy()"
|
|
816
|
+
[roughness]="transmissionRoughness()"
|
|
817
|
+
[chromaticAberration]="transmissionChromaticAberration()"
|
|
818
|
+
[distortion]="transmissionDistortion()"
|
|
819
|
+
[distortionScale]="transmissionDistortionScale()"
|
|
820
|
+
[temporalDistortion]="transmissionTemporalDistortion()"
|
|
821
|
+
[time]="transmissionTime()"
|
|
738
822
|
/>
|
|
739
823
|
`,
|
|
740
824
|
imports: [NgtArgs],
|
|
@@ -779,7 +863,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
779
863
|
}] } });
|
|
780
864
|
|
|
781
865
|
extend({ MeshWobbleMaterial });
|
|
782
|
-
class NgtsMeshWobbleMaterial extends
|
|
866
|
+
class NgtsMeshWobbleMaterial extends NgtSignalStore {
|
|
783
867
|
set time(time) {
|
|
784
868
|
this.set({ time });
|
|
785
869
|
}
|
|
@@ -789,14 +873,12 @@ class NgtsMeshWobbleMaterial extends NgtRxStore {
|
|
|
789
873
|
set speed(speed) {
|
|
790
874
|
this.set({ speed });
|
|
791
875
|
}
|
|
792
|
-
initialize() {
|
|
793
|
-
super.initialize();
|
|
794
|
-
this.set({ speed: 1, time: 0, factor: 1 });
|
|
795
|
-
}
|
|
796
876
|
constructor() {
|
|
797
|
-
super();
|
|
877
|
+
super({ speed: 1, time: 0, factor: 1 });
|
|
798
878
|
this.material = new MeshWobbleMaterial();
|
|
799
879
|
this.materialRef = injectNgtRef();
|
|
880
|
+
this.wobbleTime = this.select('time');
|
|
881
|
+
this.wobbleFactor = this.select('factor');
|
|
800
882
|
injectBeforeRender(({ clock }) => {
|
|
801
883
|
this.material.time = clock.getElapsedTime() * this.get('speed');
|
|
802
884
|
});
|
|
@@ -806,8 +888,8 @@ class NgtsMeshWobbleMaterial extends NgtRxStore {
|
|
|
806
888
|
<ngt-primitive
|
|
807
889
|
*args="[material]"
|
|
808
890
|
[ref]="materialRef"
|
|
809
|
-
[time]="
|
|
810
|
-
[factor]="
|
|
891
|
+
[time]="wobbleTime()"
|
|
892
|
+
[factor]="wobbleFactor()"
|
|
811
893
|
attach="material"
|
|
812
894
|
ngtCompound
|
|
813
895
|
/>
|
|
@@ -822,8 +904,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
822
904
|
<ngt-primitive
|
|
823
905
|
*args="[material]"
|
|
824
906
|
[ref]="materialRef"
|
|
825
|
-
[time]="
|
|
826
|
-
[factor]="
|
|
907
|
+
[time]="wobbleTime()"
|
|
908
|
+
[factor]="wobbleFactor()"
|
|
827
909
|
attach="material"
|
|
828
910
|
ngtCompound
|
|
829
911
|
/>
|