angular-three-soba 2.0.0-beta.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -4
- package/abstractions/README.md +279 -2
- package/abstractions/index.d.ts +13 -6
- package/abstractions/lib/billboard.d.ts +19 -0
- package/abstractions/lib/catmull-rom-line.d.ts +617 -0
- package/abstractions/lib/cubic-bezier-line.d.ts +19 -0
- package/abstractions/lib/edges.d.ts +800 -0
- package/abstractions/lib/gradient-texture.d.ts +24 -0
- package/abstractions/lib/grid.d.ts +315 -0
- package/abstractions/lib/helper.d.ts +25 -0
- package/abstractions/lib/line.d.ts +41 -0
- package/abstractions/lib/prism-geometry.d.ts +32 -0
- package/abstractions/lib/quadratic-bezier-line.d.ts +21 -0
- package/abstractions/lib/rounded-box.d.ts +41 -0
- package/abstractions/lib/text-3d.d.ts +314 -0
- package/abstractions/lib/text.d.ts +54 -0
- package/cameras/README.md +91 -2
- package/cameras/index.d.ts +4 -4
- package/cameras/lib/camera-content.d.ts +10 -0
- package/cameras/lib/cube-camera.d.ts +38 -0
- package/cameras/lib/orthographic-camera.d.ts +40 -0
- package/cameras/lib/perspective-camera.d.ts +36 -0
- package/controls/README.md +96 -2
- package/controls/index.d.ts +4 -1
- package/controls/lib/camera-controls.d.ts +31 -0
- package/controls/lib/orbit-controls.d.ts +38 -0
- package/controls/lib/pivot-controls/axis-arrow.d.ts +31 -0
- package/controls/lib/pivot-controls/axis-rotator.d.ts +30 -0
- package/controls/lib/pivot-controls/pivot-controls.d.ts +110 -0
- package/controls/lib/pivot-controls/plane-slider.d.ts +32 -0
- package/controls/lib/pivot-controls/scaling-sphere.d.ts +32 -0
- package/controls/lib/scroll-controls.d.ts +78 -0
- package/esm2022/abstractions/index.mjs +14 -7
- package/esm2022/abstractions/lib/billboard.mjs +69 -0
- package/esm2022/abstractions/lib/catmull-rom-line.mjs +76 -0
- package/esm2022/abstractions/lib/cubic-bezier-line.mjs +51 -0
- package/esm2022/abstractions/lib/edges.mjs +70 -0
- package/esm2022/abstractions/lib/gradient-texture.mjs +91 -0
- package/esm2022/abstractions/lib/grid.mjs +103 -0
- package/esm2022/abstractions/lib/helper.mjs +76 -0
- package/esm2022/abstractions/lib/line.mjs +126 -0
- package/esm2022/abstractions/lib/prism-geometry.mjs +46 -0
- package/esm2022/abstractions/lib/quadratic-bezier-line.mjs +73 -0
- package/esm2022/abstractions/lib/rounded-box.mjs +111 -0
- package/esm2022/abstractions/lib/text-3d.mjs +98 -0
- package/esm2022/abstractions/lib/text.mjs +91 -0
- package/esm2022/cameras/index.mjs +5 -5
- package/esm2022/cameras/lib/camera-content.mjs +14 -0
- package/esm2022/cameras/lib/cube-camera.mjs +111 -0
- package/esm2022/cameras/lib/orthographic-camera.mjs +131 -0
- package/esm2022/cameras/lib/perspective-camera.mjs +104 -0
- package/esm2022/controls/index.mjs +5 -2
- package/esm2022/controls/lib/camera-controls.mjs +127 -0
- package/esm2022/controls/lib/orbit-controls.mjs +132 -0
- package/esm2022/controls/lib/pivot-controls/axis-arrow.mjs +263 -0
- package/esm2022/controls/lib/pivot-controls/axis-rotator.mjs +264 -0
- package/esm2022/controls/lib/pivot-controls/pivot-controls.mjs +340 -0
- package/esm2022/controls/lib/pivot-controls/plane-slider.mjs +266 -0
- package/esm2022/controls/lib/pivot-controls/scaling-sphere.mjs +232 -0
- package/esm2022/controls/lib/scroll-controls.mjs +268 -0
- package/esm2022/loaders/index.mjs +6 -5
- package/esm2022/loaders/lib/font-loader.mjs +49 -0
- package/esm2022/loaders/lib/gltf-loader.mjs +51 -0
- package/esm2022/loaders/lib/loader.mjs +109 -0
- package/esm2022/loaders/lib/progress.mjs +51 -0
- package/esm2022/loaders/lib/texture-loader.mjs +32 -0
- package/esm2022/materials/index.mjs +8 -7
- package/esm2022/materials/lib/custom-shader-material.mjs +71 -0
- package/esm2022/materials/lib/mesh-distort-material.mjs +42 -0
- package/esm2022/materials/lib/mesh-reflector-material.mjs +278 -0
- package/esm2022/materials/lib/mesh-refraction-material.mjs +144 -0
- package/esm2022/materials/lib/mesh-transmission-material.mjs +188 -0
- package/esm2022/materials/lib/mesh-wobble-material.mjs +42 -0
- package/esm2022/materials/lib/point-material.mjs +33 -0
- package/esm2022/misc/index.mjs +14 -14
- package/esm2022/misc/lib/animations.mjs +71 -0
- package/esm2022/misc/lib/bake-shadows.mjs +26 -0
- package/esm2022/misc/lib/computed-attribute.mjs +55 -0
- package/esm2022/misc/lib/constants.mjs +5 -0
- package/esm2022/misc/lib/decal.mjs +139 -0
- package/esm2022/misc/lib/deprecated.mjs +15 -0
- package/esm2022/misc/lib/depth-buffer.mjs +39 -0
- package/esm2022/misc/lib/fbo.mjs +86 -0
- package/esm2022/misc/lib/html/html-content.mjs +327 -0
- package/esm2022/misc/lib/html/html.mjs +129 -0
- package/esm2022/misc/lib/html/utils.mjs +74 -0
- package/esm2022/misc/lib/intersect.mjs +52 -0
- package/esm2022/misc/lib/sampler.mjs +122 -0
- package/esm2022/misc/lib/scale-factor.mjs +29 -0
- package/esm2022/performances/index.mjs +7 -6
- package/esm2022/performances/lib/adaptive-dpr.mjs +52 -0
- package/esm2022/performances/lib/adaptive-events.mjs +28 -0
- package/esm2022/performances/lib/detailed.mjs +57 -0
- package/esm2022/performances/lib/instances/instances.mjs +183 -0
- package/esm2022/performances/lib/instances/position-mesh.mjs +51 -0
- package/esm2022/performances/lib/points/points.mjs +278 -0
- package/esm2022/performances/lib/points/position-point.mjs +53 -0
- package/esm2022/performances/lib/segments/segment-object.mjs +9 -0
- package/esm2022/performances/lib/segments/segments.mjs +129 -0
- package/esm2022/shaders/index.mjs +4 -18
- package/esm2022/shaders/lib/grid-material.mjs +81 -0
- package/esm2022/shaders/lib/mesh-refraction-material.mjs +163 -0
- package/esm2022/shaders/lib/point-material.mjs +24 -0
- package/esm2022/staging/index.mjs +19 -22
- package/esm2022/staging/lib/accumulative-shadows.mjs +182 -0
- package/esm2022/staging/lib/backdrop.mjs +73 -0
- package/esm2022/staging/lib/bb-anchor.mjs +58 -0
- package/esm2022/staging/lib/bounds.mjs +286 -0
- package/esm2022/staging/lib/camera-shake.mjs +69 -0
- package/esm2022/staging/lib/caustics.mjs +188 -0
- package/esm2022/staging/lib/center.mjs +118 -0
- package/esm2022/staging/lib/contact-shadows.mjs +214 -0
- package/esm2022/staging/lib/environment.mjs +481 -0
- package/esm2022/staging/lib/float.mjs +70 -0
- package/esm2022/staging/lib/lightformer.mjs +107 -0
- package/esm2022/staging/lib/matcap-texture.mjs +81 -0
- package/esm2022/staging/lib/normal-texture.mjs +81 -0
- package/esm2022/staging/lib/randomized-lights.mjs +104 -0
- package/esm2022/staging/lib/render-texture.mjs +203 -0
- package/esm2022/staging/lib/sky.mjs +86 -0
- package/esm2022/staging/lib/spot-light.mjs +453 -0
- package/esm2022/staging/lib/stage.mjs +236 -0
- package/esm2022/{utils/angular-three-soba-utils.mjs → stats/angular-three-soba-stats.mjs} +1 -1
- package/esm2022/stats/index.mjs +2 -0
- package/esm2022/stats/lib/stats.mjs +63 -0
- package/esm2022/vanilla-exports/angular-three-soba-vanilla-exports.mjs +5 -0
- package/esm2022/vanilla-exports/index.mjs +3 -0
- package/fesm2022/angular-three-soba-abstractions.mjs +884 -697
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +261 -308
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +1776 -109
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-loaders.mjs +191 -145
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +527 -748
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +783 -1935
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-performances.mjs +591 -475
- package/fesm2022/angular-three-soba-performances.mjs.map +1 -1
- package/fesm2022/angular-three-soba-shaders.mjs +51 -1369
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +2350 -3521
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- package/fesm2022/angular-three-soba-stats.mjs +70 -0
- package/fesm2022/angular-three-soba-stats.mjs.map +1 -0
- package/fesm2022/angular-three-soba-vanilla-exports.mjs +6 -0
- package/fesm2022/angular-three-soba-vanilla-exports.mjs.map +1 -0
- package/loaders/README.md +130 -2
- package/loaders/index.d.ts +5 -4
- package/loaders/lib/font-loader.d.ts +27 -0
- package/loaders/lib/gltf-loader.d.ts +24 -0
- package/loaders/lib/loader.d.ts +29 -0
- package/loaders/lib/progress.d.ts +9 -0
- package/loaders/lib/texture-loader.d.ts +13 -0
- package/materials/README.md +160 -2
- package/materials/index.d.ts +7 -6
- package/materials/lib/custom-shader-material.d.ts +20 -0
- package/materials/lib/mesh-distort-material.d.ts +17 -0
- package/materials/lib/mesh-reflector-material.d.ts +51 -0
- package/materials/lib/mesh-refraction-material.d.ts +42 -0
- package/materials/lib/mesh-transmission-material.d.ts +77 -0
- package/materials/lib/mesh-wobble-material.d.ts +15 -0
- package/materials/lib/point-material.d.ts +11 -0
- package/metadata.json +1 -1
- package/misc/README.md +217 -2
- package/misc/index.d.ts +13 -13
- package/misc/lib/animations.d.ts +17 -0
- package/misc/lib/computed-attribute.d.ts +64 -0
- package/misc/lib/constants.d.ts +1 -0
- package/misc/lib/decal.d.ts +27 -0
- package/misc/lib/deprecated.d.ts +14 -0
- package/misc/lib/depth-buffer.d.ts +8 -0
- package/misc/lib/fbo.d.ts +46 -0
- package/misc/lib/html/html-content.d.ts +47 -0
- package/misc/lib/html/html.d.ts +30 -0
- package/misc/lib/html/utils.d.ts +14 -0
- package/misc/lib/intersect.d.ts +13 -0
- package/misc/lib/sampler.d.ts +73 -0
- package/misc/lib/scale-factor.d.ts +3 -0
- package/package.json +89 -48
- package/performances/index.d.ts +6 -5
- package/performances/lib/adaptive-dpr.d.ts +7 -0
- package/performances/{adaptive-events → lib}/adaptive-events.d.ts +0 -3
- package/performances/lib/detailed.d.ts +17 -0
- package/performances/lib/instances/instances.d.ts +122 -0
- package/performances/lib/instances/position-mesh.d.ts +20 -0
- package/performances/lib/points/points.d.ts +224 -0
- package/performances/lib/points/position-point.d.ts +21 -0
- package/performances/lib/segments/segment-object.d.ts +17 -0
- package/performances/lib/segments/segments.d.ts +97 -0
- package/shaders/index.d.ts +3 -17
- package/shaders/lib/grid-material.d.ts +69 -0
- package/shaders/lib/mesh-refraction-material.d.ts +11 -0
- package/shaders/lib/point-material.d.ts +14 -0
- package/staging/README.md +473 -2
- package/staging/index.d.ts +18 -21
- package/staging/lib/accumulative-shadows.d.ts +75 -0
- package/staging/lib/backdrop.d.ts +22 -0
- package/staging/lib/bb-anchor.d.ts +17 -0
- package/staging/lib/bounds.d.ts +47 -0
- package/staging/lib/camera-shake.d.ts +29 -0
- package/staging/lib/caustics.d.ts +53 -0
- package/staging/lib/center.d.ts +390 -0
- package/staging/lib/contact-shadows.d.ts +55 -0
- package/staging/lib/environment.d.ts +132 -0
- package/staging/lib/float.d.ts +20 -0
- package/staging/lib/lightformer.d.ts +310 -0
- package/staging/lib/matcap-texture.d.ts +32 -0
- package/staging/lib/normal-texture.d.ts +37 -0
- package/staging/lib/randomized-lights.d.ts +54 -0
- package/staging/lib/render-texture.d.ts +64 -0
- package/staging/lib/sky.d.ts +32 -0
- package/staging/lib/spot-light.d.ts +119 -0
- package/staging/lib/stage.d.ts +352 -0
- package/stats/README.md +3 -0
- package/stats/index.d.ts +1 -0
- package/stats/lib/stats.d.ts +14 -0
- package/vanilla-exports/README.md +3 -0
- package/vanilla-exports/index.d.ts +27 -0
- package/web-types.json +1 -1
- package/abstractions/billboard/billboard.d.ts +0 -28
- package/abstractions/detailed/detailed.d.ts +0 -26
- package/abstractions/edges/edges.d.ts +0 -34
- package/abstractions/grid/grid.d.ts +0 -50
- package/abstractions/text/text.d.ts +0 -82
- package/abstractions/text-3d/text-3d.d.ts +0 -81
- package/assets/distort.vert.glsl +0 -1
- package/cameras/camera/camera-content.d.ts +0 -13
- package/cameras/camera/camera.d.ts +0 -26
- package/cameras/cube-camera/cube-camera.d.ts +0 -69
- package/cameras/orthographic-camera/orthographic-camera.d.ts +0 -37
- package/cameras/perspective-camera/perspective-camera.d.ts +0 -18
- package/controls/orbit-controls/orbit-controls.d.ts +0 -54
- package/esm2022/abstractions/billboard/billboard.mjs +0 -74
- package/esm2022/abstractions/detailed/detailed.mjs +0 -64
- package/esm2022/abstractions/edges/edges.mjs +0 -88
- package/esm2022/abstractions/grid/grid.mjs +0 -180
- package/esm2022/abstractions/text/text.mjs +0 -274
- package/esm2022/abstractions/text-3d/text-3d.mjs +0 -165
- package/esm2022/cameras/camera/camera-content.mjs +0 -20
- package/esm2022/cameras/camera/camera.mjs +0 -77
- package/esm2022/cameras/cube-camera/cube-camera.mjs +0 -161
- package/esm2022/cameras/orthographic-camera/orthographic-camera.mjs +0 -102
- package/esm2022/cameras/perspective-camera/perspective-camera.mjs +0 -46
- package/esm2022/controls/orbit-controls/orbit-controls.mjs +0 -181
- package/esm2022/loaders/gltf-loader/gltf-loader.mjs +0 -30
- package/esm2022/loaders/loader/loader.mjs +0 -138
- package/esm2022/loaders/progress/progress.mjs +0 -45
- package/esm2022/loaders/texture-loader/texture-loader.mjs +0 -28
- package/esm2022/materials/mesh-distort-material/mesh-distort-material.mjs +0 -82
- package/esm2022/materials/mesh-reflector-material/mesh-reflector-material.mjs +0 -367
- package/esm2022/materials/mesh-refraction-material/mesh-refraction-material.mjs +0 -171
- package/esm2022/materials/mesh-transmission-material/mesh-transmission-material.mjs +0 -278
- package/esm2022/materials/mesh-wobble-material/mesh-wobble-material.mjs +0 -68
- package/esm2022/materials/point-material/point-material.mjs +0 -46
- package/esm2022/misc/animations/animations.mjs +0 -59
- package/esm2022/misc/bake-shadows/bake-shadows.mjs +0 -24
- package/esm2022/misc/caustics/caustics.mjs +0 -387
- package/esm2022/misc/decal/decal.mjs +0 -187
- package/esm2022/misc/depth-buffer/depth-buffer.mjs +0 -44
- package/esm2022/misc/example/example.mjs +0 -160
- package/esm2022/misc/fbo/fbo.mjs +0 -47
- package/esm2022/misc/html/html-wrapper.mjs +0 -478
- package/esm2022/misc/html/html.mjs +0 -304
- package/esm2022/misc/sampler/sampler.mjs +0 -142
- package/esm2022/misc/shadow/shadow.mjs +0 -111
- package/esm2022/misc/stats-gl/stats-gl.mjs +0 -61
- package/esm2022/misc/trail/trail.mjs +0 -209
- package/esm2022/misc/trail-texture/inject-trail-texture.mjs +0 -17
- package/esm2022/misc/trail-texture/trail-texture.mjs +0 -106
- package/esm2022/modifiers/angular-three-soba-modifiers.mjs +0 -5
- package/esm2022/modifiers/curve-modifier/curve-modifier.mjs +0 -64
- package/esm2022/modifiers/index.mjs +0 -2
- package/esm2022/performances/adaptive-dpr/adaptive-dpr.mjs +0 -44
- package/esm2022/performances/adaptive-events/adaptive-events.mjs +0 -27
- package/esm2022/performances/points/points-input.mjs +0 -64
- package/esm2022/performances/points/points.mjs +0 -329
- package/esm2022/performances/points/position-point.mjs +0 -54
- package/esm2022/performances/segments/segment-object.mjs +0 -9
- package/esm2022/performances/segments/segments.mjs +0 -182
- package/esm2022/shaders/blur-pass/blur-pass.mjs +0 -61
- package/esm2022/shaders/caustics/caustics-material.mjs +0 -130
- package/esm2022/shaders/caustics/caustics-projection-material.mjs +0 -31
- package/esm2022/shaders/convolution-material/convolution-material.mjs +0 -94
- package/esm2022/shaders/discard-material/discard-material.mjs +0 -3
- package/esm2022/shaders/grid-material/grid-material.mjs +0 -77
- package/esm2022/shaders/mesh-distort-material/mesh-distort-material.mjs +0 -56
- package/esm2022/shaders/mesh-reflector-material/mesh-reflector-material.mjs +0 -223
- package/esm2022/shaders/mesh-refraction-material/mesh-refraction-material.mjs +0 -170
- package/esm2022/shaders/mesh-transmission-material/mesh-transmission-material.mjs +0 -268
- package/esm2022/shaders/mesh-wobble-material/mesh-wobble-material.mjs +0 -37
- package/esm2022/shaders/shader-material/shader-material.mjs +0 -34
- package/esm2022/shaders/soft-shadow-material/soft-shadow-material.mjs +0 -25
- package/esm2022/shaders/sparkles-material/sparkles-material.mjs +0 -33
- package/esm2022/shaders/spot-light-material/spot-light-material.mjs +0 -86
- package/esm2022/shaders/star-field-material/star-field-material.mjs +0 -33
- package/esm2022/shaders/wireframe-material/wireframe-material.mjs +0 -247
- package/esm2022/staging/accumulative-shadows/accumulative-shadows.mjs +0 -267
- package/esm2022/staging/accumulative-shadows/progressive-light-map.mjs +0 -108
- package/esm2022/staging/accumulative-shadows/randomized-lights.mjs +0 -206
- package/esm2022/staging/backdrop/backdrop.mjs +0 -77
- package/esm2022/staging/bb-anchor/bb-anchor.mjs +0 -70
- package/esm2022/staging/bounds/bounds.mjs +0 -308
- package/esm2022/staging/camera-shake/camera-shake.mjs +0 -123
- package/esm2022/staging/center/center.mjs +0 -163
- package/esm2022/staging/cloud/cloud.mjs +0 -158
- package/esm2022/staging/contact-shadows/contact-shadows.mjs +0 -246
- package/esm2022/staging/environment/assets.mjs +0 -13
- package/esm2022/staging/environment/environment-cube.mjs +0 -47
- package/esm2022/staging/environment/environment-ground.mjs +0 -41
- package/esm2022/staging/environment/environment-input.mjs +0 -119
- package/esm2022/staging/environment/environment-map.mjs +0 -53
- package/esm2022/staging/environment/environment-portal.mjs +0 -113
- package/esm2022/staging/environment/environment.mjs +0 -61
- package/esm2022/staging/environment/utils.mjs +0 -105
- package/esm2022/staging/float/float.mjs +0 -94
- package/esm2022/staging/matcap-texture/matcap-texture.mjs +0 -64
- package/esm2022/staging/normal-texture/normal-texture.mjs +0 -53
- package/esm2022/staging/sky/sky.mjs +0 -119
- package/esm2022/staging/sparkles/sparkles.mjs +0 -164
- package/esm2022/staging/spot-light/shadow-mesh-input.mjs +0 -63
- package/esm2022/staging/spot-light/shadow-mesh.mjs +0 -266
- package/esm2022/staging/spot-light/spot-light-input.mjs +0 -84
- package/esm2022/staging/spot-light/spot-light.mjs +0 -81
- package/esm2022/staging/spot-light/volumetric-mesh.mjs +0 -98
- package/esm2022/staging/stage/stage.mjs +0 -388
- package/esm2022/staging/stars/stars.mjs +0 -147
- package/esm2022/staging/wireframe/wireframe-input.mjs +0 -191
- package/esm2022/staging/wireframe/wireframe.mjs +0 -224
- package/esm2022/utils/content/content.mjs +0 -15
- package/esm2022/utils/index.mjs +0 -2
- package/fesm2022/angular-three-soba-modifiers.mjs +0 -71
- package/fesm2022/angular-three-soba-modifiers.mjs.map +0 -1
- package/fesm2022/angular-three-soba-utils.mjs +0 -22
- package/fesm2022/angular-three-soba-utils.mjs.map +0 -1
- package/loaders/gltf-loader/gltf-loader.d.ts +0 -10
- package/loaders/loader/loader.d.ts +0 -33
- package/loaders/progress/progress.d.ts +0 -9
- package/loaders/texture-loader/texture-loader.d.ts +0 -7
- package/materials/mesh-distort-material/mesh-distort-material.d.ts +0 -40
- package/materials/mesh-reflector-material/mesh-reflector-material.d.ts +0 -99
- package/materials/mesh-refraction-material/mesh-refraction-material.d.ts +0 -62
- package/materials/mesh-transmission-material/mesh-transmission-material.d.ts +0 -107
- package/materials/mesh-wobble-material/mesh-wobble-material.d.ts +0 -29
- package/materials/point-material/point-material.d.ts +0 -24
- package/misc/animations/animations.d.ts +0 -15
- package/misc/caustics/caustics.d.ts +0 -87
- package/misc/decal/decal.d.ts +0 -49
- package/misc/depth-buffer/depth-buffer.d.ts +0 -9
- package/misc/example/example.d.ts +0 -81
- package/misc/fbo/fbo.d.ts +0 -17
- package/misc/html/html-wrapper.d.ts +0 -559
- package/misc/html/html.d.ts +0 -214
- package/misc/sampler/sampler.d.ts +0 -67
- package/misc/shadow/shadow.d.ts +0 -37
- package/misc/stats-gl/stats-gl.d.ts +0 -24
- package/misc/trail/trail.d.ts +0 -57
- package/misc/trail-texture/inject-trail-texture.d.ts +0 -9
- package/misc/trail-texture/trail-texture.d.ts +0 -50
- package/modifiers/README.md +0 -3
- package/modifiers/curve-modifier/curve-modifier.d.ts +0 -23
- package/modifiers/index.d.ts +0 -1
- package/performances/adaptive-dpr/adaptive-dpr.d.ts +0 -14
- package/performances/points/points-input.d.ts +0 -32
- package/performances/points/points.d.ts +0 -92
- package/performances/points/position-point.d.ts +0 -11
- package/performances/segments/segment-object.d.ts +0 -7
- package/performances/segments/segments.d.ts +0 -124
- package/shaders/blur-pass/blur-pass.d.ts +0 -23
- package/shaders/caustics/caustics-material.d.ts +0 -4
- package/shaders/caustics/caustics-projection-material.d.ts +0 -4
- package/shaders/convolution-material/convolution-material.d.ts +0 -7
- package/shaders/discard-material/discard-material.d.ts +0 -3
- package/shaders/grid-material/grid-material.d.ts +0 -37
- package/shaders/mesh-distort-material/mesh-distort-material.d.ts +0 -295
- package/shaders/mesh-reflector-material/mesh-reflector-material.d.ts +0 -50
- package/shaders/mesh-refraction-material/mesh-refraction-material.d.ts +0 -4
- package/shaders/mesh-transmission-material/mesh-transmission-material.d.ts +0 -25
- package/shaders/mesh-wobble-material/mesh-wobble-material.d.ts +0 -16
- package/shaders/shader-material/shader-material.d.ts +0 -6
- package/shaders/soft-shadow-material/soft-shadow-material.d.ts +0 -19
- package/shaders/sparkles-material/sparkles-material.d.ts +0 -17
- package/shaders/spot-light-material/spot-light-material.d.ts +0 -13
- package/shaders/star-field-material/star-field-material.d.ts +0 -13
- package/shaders/wireframe-material/wireframe-material.d.ts +0 -58
- package/staging/accumulative-shadows/accumulative-shadows.d.ts +0 -146
- package/staging/accumulative-shadows/progressive-light-map.d.ts +0 -34
- package/staging/accumulative-shadows/randomized-lights.d.ts +0 -90
- package/staging/backdrop/backdrop.d.ts +0 -30
- package/staging/bb-anchor/bb-anchor.d.ts +0 -27
- package/staging/bounds/bounds.d.ts +0 -134
- package/staging/camera-shake/camera-shake.d.ts +0 -43
- package/staging/center/center.d.ts +0 -70
- package/staging/cloud/cloud.d.ts +0 -51
- package/staging/contact-shadows/contact-shadows.d.ts +0 -70
- package/staging/environment/assets.d.ts +0 -13
- package/staging/environment/environment-cube.d.ts +0 -15
- package/staging/environment/environment-ground.d.ts +0 -13
- package/staging/environment/environment-input.d.ts +0 -68
- package/staging/environment/environment-map.d.ts +0 -16
- package/staging/environment/environment-portal.d.ts +0 -18
- package/staging/environment/environment.d.ts +0 -8
- package/staging/environment/utils.d.ts +0 -7
- package/staging/float/float.d.ts +0 -31
- package/staging/matcap-texture/matcap-texture.d.ts +0 -13
- package/staging/normal-texture/normal-texture.d.ts +0 -16
- package/staging/sky/sky.d.ts +0 -48
- package/staging/sparkles/sparkles.d.ts +0 -63
- package/staging/spot-light/shadow-mesh-input.d.ts +0 -29
- package/staging/spot-light/shadow-mesh.d.ts +0 -37
- package/staging/spot-light/spot-light-input.d.ts +0 -38
- package/staging/spot-light/spot-light.d.ts +0 -39
- package/staging/spot-light/volumetric-mesh.d.ts +0 -24
- package/staging/stage/stage.d.ts +0 -130
- package/staging/stars/stars.d.ts +0 -45
- package/staging/wireframe/wireframe-input.d.ts +0 -65
- package/staging/wireframe/wireframe.d.ts +0 -28
- package/utils/README.md +0 -3
- package/utils/content/content.d.ts +0 -8
- package/utils/index.d.ts +0 -1
- /package/misc/{bake-shadows → lib}/bake-shadows.d.ts +0 -0
|
@@ -1,224 +1,200 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, CUSTOM_ELEMENTS_SCHEMA,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { input, computed, afterNextRender, Component, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, viewChild, untracked, inject, DestroyRef } from '@angular/core';
|
|
3
|
+
import { omit, is, pick, NgtArgs, injectBeforeRender, injectStore, applyProps, getLocalState } from 'angular-three';
|
|
4
|
+
import { injectAutoEffect } from 'ngxtension/auto-effect';
|
|
5
|
+
import CustomShaderMaterial from 'three-custom-shader-material/vanilla';
|
|
6
|
+
import { MeshDistortMaterial, BlurPass, MeshReflectorMaterial, MeshDiscardMaterial, MeshTransmissionMaterial, MeshWobbleMaterial } from 'angular-three-soba/vanilla-exports';
|
|
7
|
+
import { mergeInputs } from 'ngxtension/inject-inputs';
|
|
8
|
+
import { Plane, Vector3, Matrix4, Vector4, PerspectiveCamera, LinearFilter, HalfFloatType, WebGLRenderTarget, DepthTexture, DepthFormat, UnsignedShortType, FrontSide, NoToneMapping, BackSide } from 'three';
|
|
9
|
+
import { MeshRefractionMaterial, PointMaterial } from 'angular-three-soba/shaders';
|
|
7
10
|
import { MeshBVHUniformStruct, MeshBVH, SAH } from 'three-mesh-bvh';
|
|
8
|
-
import {
|
|
11
|
+
import { injectFBO } from 'angular-three-soba/misc';
|
|
9
12
|
|
|
10
|
-
class
|
|
11
|
-
set _time(time) {
|
|
12
|
-
this.inputs.set({ time });
|
|
13
|
-
}
|
|
14
|
-
set _distort(distort) {
|
|
15
|
-
this.inputs.set({ distort });
|
|
16
|
-
}
|
|
17
|
-
set _radius(radius) {
|
|
18
|
-
this.inputs.set({ radius });
|
|
19
|
-
}
|
|
20
|
-
set _speed(speed) {
|
|
21
|
-
this.inputs.set({ speed });
|
|
22
|
-
}
|
|
13
|
+
class NgtsCustomShaderMaterial {
|
|
23
14
|
constructor() {
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
this.baseMaterial = input.required();
|
|
16
|
+
this.attach = input('material');
|
|
17
|
+
this.options = input({});
|
|
18
|
+
this.parameters = omit(this.options, ['fragmentShader', 'vertexShader', 'uniforms', 'cacheKey']);
|
|
19
|
+
this.base = computed(() => {
|
|
20
|
+
const baseMaterial = this.baseMaterial();
|
|
21
|
+
return is.ref(baseMaterial) ? baseMaterial.nativeElement : baseMaterial;
|
|
22
|
+
});
|
|
23
|
+
this.fragmentShader = pick(this.options, 'fragmentShader');
|
|
24
|
+
this.vertexShader = pick(this.options, 'vertexShader');
|
|
25
|
+
this.uniforms = pick(this.options, 'uniforms');
|
|
26
|
+
this.cacheKey = pick(this.options, 'cacheKey');
|
|
27
|
+
this.material = computed(() => {
|
|
28
|
+
const [base, fragmentShader, vertexShader, uniforms, cacheKey] = [
|
|
29
|
+
this.base(),
|
|
30
|
+
this.fragmentShader(),
|
|
31
|
+
this.vertexShader(),
|
|
32
|
+
this.uniforms(),
|
|
33
|
+
this.cacheKey(),
|
|
34
|
+
];
|
|
35
|
+
// NOTE: this is specific to angular-three
|
|
36
|
+
if (is.instance(base)) {
|
|
37
|
+
delete base['__ngt__'];
|
|
38
|
+
delete base['__ngt_renderer__'];
|
|
39
|
+
}
|
|
40
|
+
return new CustomShaderMaterial({
|
|
41
|
+
baseMaterial: base,
|
|
42
|
+
fragmentShader,
|
|
43
|
+
vertexShader,
|
|
44
|
+
uniforms,
|
|
45
|
+
cacheKey,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
const autoEffect = injectAutoEffect();
|
|
49
|
+
afterNextRender(() => {
|
|
50
|
+
autoEffect(() => {
|
|
51
|
+
const material = this.material();
|
|
52
|
+
return () => material.dispose();
|
|
53
|
+
});
|
|
29
54
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
}
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCustomShaderMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
57
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsCustomShaderMaterial, isStandalone: true, selector: "ngts-custom-shader-material", inputs: { baseMaterial: { classPropertyName: "baseMaterial", publicName: "baseMaterial", isSignal: true, isRequired: true, transformFunction: null }, attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
58
|
+
<ngt-primitive *args="[material()]" [attach]="attach()" [parameters]="parameters()">
|
|
59
|
+
<ng-content />
|
|
60
|
+
</ngt-primitive>
|
|
61
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsCustomShaderMaterial, decorators: [{
|
|
64
|
+
type: Component,
|
|
65
|
+
args: [{
|
|
66
|
+
selector: 'ngts-custom-shader-material',
|
|
67
|
+
standalone: true,
|
|
68
|
+
template: `
|
|
69
|
+
<ngt-primitive *args="[material()]" [attach]="attach()" [parameters]="parameters()">
|
|
70
|
+
<ng-content />
|
|
71
|
+
</ngt-primitive>
|
|
72
|
+
`,
|
|
73
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
74
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
75
|
+
imports: [NgtArgs],
|
|
76
|
+
}]
|
|
77
|
+
}], ctorParameters: () => [] });
|
|
78
|
+
|
|
79
|
+
const defaultOptions$4 = {
|
|
80
|
+
speed: 1,
|
|
81
|
+
};
|
|
82
|
+
class NgtsMeshDistortMaterial {
|
|
83
|
+
constructor() {
|
|
84
|
+
this.attach = input('material');
|
|
85
|
+
this.options = input(defaultOptions$4, { transform: mergeInputs(defaultOptions$4) });
|
|
86
|
+
this.parameters = omit(this.options, ['speed']);
|
|
87
|
+
this.material = new MeshDistortMaterial();
|
|
88
|
+
this.speed = pick(this.options, 'speed');
|
|
36
89
|
injectBeforeRender(({ clock }) => {
|
|
37
|
-
this.material.time = clock.getElapsedTime() * this.
|
|
90
|
+
this.material.time = clock.getElapsedTime() * this.speed();
|
|
38
91
|
});
|
|
39
92
|
}
|
|
40
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
41
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
42
|
-
<ngt-primitive
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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"] }] }); }
|
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshDistortMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
94
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsMeshDistortMaterial, isStandalone: true, selector: "ngts-mesh-distort-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
95
|
+
<ngt-primitive *args="[material]" [attach]="attach()" [parameters]="parameters()">
|
|
96
|
+
<ng-content />
|
|
97
|
+
</ngt-primitive>
|
|
98
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
52
99
|
}
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshDistortMaterial, decorators: [{
|
|
54
101
|
type: Component,
|
|
55
102
|
args: [{
|
|
56
103
|
selector: 'ngts-mesh-distort-material',
|
|
57
104
|
standalone: true,
|
|
58
105
|
template: `
|
|
59
|
-
<ngt-primitive
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
[time]="time()"
|
|
63
|
-
[distort]="distort()"
|
|
64
|
-
[radius]="radius()"
|
|
65
|
-
ngtCompound
|
|
66
|
-
attach="material"
|
|
67
|
-
/>
|
|
106
|
+
<ngt-primitive *args="[material]" [attach]="attach()" [parameters]="parameters()">
|
|
107
|
+
<ng-content />
|
|
108
|
+
</ngt-primitive>
|
|
68
109
|
`,
|
|
69
|
-
imports: [NgtArgs],
|
|
70
110
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
111
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
112
|
+
imports: [NgtArgs],
|
|
71
113
|
}]
|
|
72
|
-
}], ctorParameters:
|
|
73
|
-
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' }]
|
|
86
|
-
}] } });
|
|
114
|
+
}], ctorParameters: () => [] });
|
|
87
115
|
|
|
88
|
-
|
|
116
|
+
const defaultOptions$3 = {
|
|
117
|
+
mixBlur: 0,
|
|
118
|
+
mixStrength: 1,
|
|
119
|
+
resolution: 256,
|
|
120
|
+
blur: [0, 0],
|
|
121
|
+
minDepthThreshold: 0.9,
|
|
122
|
+
maxDepthThreshold: 1,
|
|
123
|
+
depthScale: 0,
|
|
124
|
+
depthToBlurRatioBias: 0.25,
|
|
125
|
+
mirror: 0,
|
|
126
|
+
distortion: 1,
|
|
127
|
+
mixContrast: 1,
|
|
128
|
+
reflectorOffset: 0,
|
|
129
|
+
};
|
|
89
130
|
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
|
-
}
|
|
129
131
|
constructor() {
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.
|
|
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();
|
|
132
|
+
this.attach = input('material');
|
|
133
|
+
this.options = input(defaultOptions$3, { transform: mergeInputs(defaultOptions$3) });
|
|
134
|
+
this.parameters = omit(this.options, [
|
|
135
|
+
'distortionMap',
|
|
136
|
+
'resolution',
|
|
137
|
+
'mixBlur',
|
|
138
|
+
'mixStrength',
|
|
139
|
+
'blur',
|
|
140
|
+
'minDepthThreshold',
|
|
141
|
+
'maxDepthThreshold',
|
|
142
|
+
'depthScale',
|
|
143
|
+
'depthToBlurRatioBias',
|
|
144
|
+
'mirror',
|
|
145
|
+
'distortion',
|
|
146
|
+
'mixContrast',
|
|
147
|
+
'reflectorOffset',
|
|
148
|
+
]);
|
|
149
|
+
this.store = injectStore();
|
|
163
150
|
this.gl = this.store.select('gl');
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.
|
|
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');
|
|
151
|
+
this.materialRef = viewChild('material');
|
|
152
|
+
this.reflectOptions = pick(this.options, [
|
|
153
|
+
'distortionMap',
|
|
154
|
+
'resolution',
|
|
155
|
+
'mixBlur',
|
|
156
|
+
'mixStrength',
|
|
157
|
+
'blur',
|
|
158
|
+
'minDepthThreshold',
|
|
159
|
+
'maxDepthThreshold',
|
|
160
|
+
'depthScale',
|
|
161
|
+
'depthToBlurRatioBias',
|
|
162
|
+
'mirror',
|
|
163
|
+
'distortion',
|
|
164
|
+
'mixContrast',
|
|
165
|
+
'reflectorOffset',
|
|
166
|
+
]);
|
|
167
|
+
this.blur = pick(this.reflectOptions, 'blur');
|
|
188
168
|
this.normalizedBlur = computed(() => {
|
|
189
|
-
const blur = this.
|
|
169
|
+
const blur = this.blur();
|
|
190
170
|
return Array.isArray(blur) ? blur : [blur, blur];
|
|
191
171
|
});
|
|
192
|
-
this.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const mixStrength = this.
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const parameters = {
|
|
212
|
-
minFilter: THREE.LinearFilter,
|
|
213
|
-
magFilter: THREE.LinearFilter,
|
|
214
|
-
type: THREE.HalfFloatType,
|
|
172
|
+
this.hasBlur = computed(() => this.normalizedBlur()[0] + this.normalizedBlur()[1] > 0);
|
|
173
|
+
this.reflectorPlane = new Plane();
|
|
174
|
+
this.normal = new Vector3();
|
|
175
|
+
this.reflectorWorldPosition = new Vector3();
|
|
176
|
+
this.cameraWorldPosition = new Vector3();
|
|
177
|
+
this.rotationMatrix = new Matrix4();
|
|
178
|
+
this.lookAtPosition = new Vector3(0, 0, -1);
|
|
179
|
+
this.clipPlane = new Vector4();
|
|
180
|
+
this.view = new Vector3();
|
|
181
|
+
this.target = new Vector3();
|
|
182
|
+
this.q = new Vector4();
|
|
183
|
+
this.textureMatrix = new Matrix4();
|
|
184
|
+
this.virtualCamera = new PerspectiveCamera();
|
|
185
|
+
this.reflectState = computed(() => {
|
|
186
|
+
const [gl, { resolution, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, mirror, mixBlur, mixStrength, distortion, distortionMap, mixContrast, }, blur, hasBlur,] = [this.gl(), this.reflectOptions(), this.normalizedBlur(), this.hasBlur()];
|
|
187
|
+
const renderTargetParameters = {
|
|
188
|
+
minFilter: LinearFilter,
|
|
189
|
+
magFilter: LinearFilter,
|
|
190
|
+
type: HalfFloatType,
|
|
215
191
|
};
|
|
216
|
-
const fbo1 = new
|
|
192
|
+
const fbo1 = new WebGLRenderTarget(resolution, resolution, renderTargetParameters);
|
|
217
193
|
fbo1.depthBuffer = true;
|
|
218
|
-
fbo1.depthTexture = new
|
|
219
|
-
fbo1.depthTexture.format =
|
|
220
|
-
fbo1.depthTexture.type =
|
|
221
|
-
const fbo2 = new
|
|
194
|
+
fbo1.depthTexture = new DepthTexture(resolution, resolution);
|
|
195
|
+
fbo1.depthTexture.format = DepthFormat;
|
|
196
|
+
fbo1.depthTexture.type = UnsignedShortType;
|
|
197
|
+
const fbo2 = new WebGLRenderTarget(resolution, resolution, renderTargetParameters);
|
|
222
198
|
const blurPass = new BlurPass({
|
|
223
199
|
gl,
|
|
224
200
|
resolution,
|
|
@@ -229,9 +205,19 @@ class NgtsMeshReflectorMaterial {
|
|
|
229
205
|
depthScale,
|
|
230
206
|
depthToBlurRatioBias,
|
|
231
207
|
});
|
|
232
|
-
const
|
|
208
|
+
const defines = {};
|
|
209
|
+
if (hasBlur) {
|
|
210
|
+
defines['USE_BLUR'] = '';
|
|
211
|
+
}
|
|
212
|
+
if (depthScale > 0) {
|
|
213
|
+
defines['USE_DEPTH'] = '';
|
|
214
|
+
}
|
|
215
|
+
if (distortionMap) {
|
|
216
|
+
defines['USE_DISTORTION'] = '';
|
|
217
|
+
}
|
|
218
|
+
const reflectorParameters = {
|
|
233
219
|
mirror,
|
|
234
|
-
textureMatrix: this.
|
|
220
|
+
textureMatrix: this.textureMatrix,
|
|
235
221
|
mixBlur,
|
|
236
222
|
tDiffuse: fbo1.texture,
|
|
237
223
|
tDepth: fbo1.depthTexture,
|
|
@@ -245,30 +231,59 @@ class NgtsMeshReflectorMaterial {
|
|
|
245
231
|
distortion,
|
|
246
232
|
distortionMap,
|
|
247
233
|
mixContrast,
|
|
248
|
-
defines
|
|
249
|
-
USE_BLUR: hasBlur ? '' : undefined,
|
|
250
|
-
USE_DEPTH: depthScale > 0 ? '' : undefined,
|
|
251
|
-
USE_DISTORTION: distortionMap ? '' : undefined,
|
|
252
|
-
},
|
|
234
|
+
defines,
|
|
253
235
|
};
|
|
254
|
-
return { fbo1, fbo2, blurPass,
|
|
236
|
+
return { fbo1, fbo2, blurPass, reflectorParameters };
|
|
255
237
|
});
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
238
|
+
this.definesKey = computed(() => {
|
|
239
|
+
const defines = this.reflectState().reflectorParameters.defines;
|
|
240
|
+
return Object.entries(defines).reduce((acc, [key, value]) => (value != null ? `${acc} ${key}` : acc), '');
|
|
241
|
+
});
|
|
242
|
+
this.material = computed(() => {
|
|
243
|
+
const prevMaterial = untracked(this.materialRef)?.nativeElement;
|
|
244
|
+
if (prevMaterial) {
|
|
245
|
+
prevMaterial.dispose();
|
|
246
|
+
delete prevMaterial['__ngt__'];
|
|
247
|
+
delete prevMaterial['__ngt_renderer__'];
|
|
248
|
+
}
|
|
249
|
+
// tracking defines key so that the material is recreated when the defines change
|
|
250
|
+
this.definesKey();
|
|
251
|
+
return new MeshReflectorMaterial();
|
|
252
|
+
});
|
|
253
|
+
const autoEffect = injectAutoEffect();
|
|
254
|
+
afterNextRender(() => {
|
|
255
|
+
autoEffect(() => {
|
|
256
|
+
const material = this.materialRef()?.nativeElement;
|
|
257
|
+
if (!material)
|
|
258
|
+
return;
|
|
259
|
+
const { reflectorParameters } = this.reflectState();
|
|
260
|
+
applyProps(material, { ...reflectorParameters, ...this.parameters() });
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
inject(DestroyRef).onDestroy(() => {
|
|
264
|
+
const material = this.materialRef()?.nativeElement;
|
|
265
|
+
if (material) {
|
|
266
|
+
material.dispose();
|
|
267
|
+
delete material['__ngt__'];
|
|
268
|
+
delete material['__ngt_renderer__'];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
injectBeforeRender(({ gl, scene }) => {
|
|
272
|
+
const material = this.materialRef()?.nativeElement;
|
|
273
|
+
if (!material)
|
|
274
|
+
return;
|
|
275
|
+
const localState = getLocalState(material);
|
|
276
|
+
if (!localState)
|
|
277
|
+
return;
|
|
278
|
+
const parent = Reflect.get(material, 'parent') ?? untracked(localState.parent);
|
|
279
|
+
if (!parent)
|
|
280
|
+
return;
|
|
281
|
+
const { fbo1, fbo2, blurPass } = this.reflectState();
|
|
282
|
+
const hasBlur = this.hasBlur();
|
|
268
283
|
parent.visible = false;
|
|
269
284
|
const currentXrEnabled = gl.xr.enabled;
|
|
270
285
|
const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
|
|
271
|
-
this.beforeRender(
|
|
286
|
+
this.beforeRender();
|
|
272
287
|
gl.xr.enabled = false;
|
|
273
288
|
gl.shadowMap.autoUpdate = false;
|
|
274
289
|
gl.setRenderTarget(fbo1);
|
|
@@ -282,19 +297,26 @@ class NgtsMeshReflectorMaterial {
|
|
|
282
297
|
gl.shadowMap.autoUpdate = currentShadowAutoUpdate;
|
|
283
298
|
parent.visible = true;
|
|
284
299
|
gl.setRenderTarget(null);
|
|
285
|
-
}
|
|
300
|
+
});
|
|
286
301
|
}
|
|
287
|
-
beforeRender(
|
|
288
|
-
const
|
|
302
|
+
beforeRender() {
|
|
303
|
+
const material = this.materialRef()?.nativeElement;
|
|
304
|
+
if (!material)
|
|
305
|
+
return;
|
|
306
|
+
const localState = getLocalState(material);
|
|
307
|
+
if (!localState)
|
|
308
|
+
return;
|
|
309
|
+
const parent = Reflect.get(material, 'parent') ?? untracked(localState.parent);
|
|
289
310
|
if (!parent)
|
|
290
311
|
return;
|
|
291
|
-
const { camera } =
|
|
312
|
+
const { camera } = this.store.snapshot;
|
|
313
|
+
const { reflectorOffset } = untracked(this.reflectOptions);
|
|
292
314
|
this.reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
|
|
293
315
|
this.cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
|
|
294
316
|
this.rotationMatrix.extractRotation(parent.matrixWorld);
|
|
295
317
|
this.normal.set(0, 0, 1);
|
|
296
318
|
this.normal.applyMatrix4(this.rotationMatrix);
|
|
297
|
-
this.reflectorWorldPosition.addScaledVector(this.normal,
|
|
319
|
+
this.reflectorWorldPosition.addScaledVector(this.normal, reflectorOffset);
|
|
298
320
|
this.view.subVectors(this.reflectorWorldPosition, this.cameraWorldPosition);
|
|
299
321
|
// Avoid rendering when reflector is facing away
|
|
300
322
|
if (this.view.dot(this.normal) > 0)
|
|
@@ -317,10 +339,10 @@ class NgtsMeshReflectorMaterial {
|
|
|
317
339
|
this.virtualCamera.updateMatrixWorld();
|
|
318
340
|
this.virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
319
341
|
// Update the texture matrix
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
342
|
+
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);
|
|
343
|
+
this.textureMatrix.multiply(this.virtualCamera.projectionMatrix);
|
|
344
|
+
this.textureMatrix.multiply(this.virtualCamera.matrixWorldInverse);
|
|
345
|
+
this.textureMatrix.multiply(parent.matrixWorld);
|
|
324
346
|
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
325
347
|
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
326
348
|
this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal, this.reflectorWorldPosition);
|
|
@@ -339,162 +361,59 @@ class NgtsMeshReflectorMaterial {
|
|
|
339
361
|
projectionMatrix.elements[10] = this.clipPlane.z + 1.0;
|
|
340
362
|
projectionMatrix.elements[14] = this.clipPlane.w;
|
|
341
363
|
}
|
|
342
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
343
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
344
|
-
<ngt-
|
|
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
|
-
>
|
|
364
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshReflectorMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
365
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshReflectorMaterial, isStandalone: true, selector: "ngts-mesh-reflector-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
366
|
+
<ngt-primitive #material *args="[material()]" [attach]="attach()">
|
|
367
367
|
<ng-content />
|
|
368
|
-
</ngt-
|
|
369
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
368
|
+
</ngt-primitive>
|
|
369
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
370
370
|
}
|
|
371
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshReflectorMaterial, decorators: [{
|
|
372
372
|
type: Component,
|
|
373
373
|
args: [{
|
|
374
374
|
selector: 'ngts-mesh-reflector-material',
|
|
375
375
|
standalone: true,
|
|
376
376
|
template: `
|
|
377
|
-
<ngt-
|
|
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
|
-
>
|
|
377
|
+
<ngt-primitive #material *args="[material()]" [attach]="attach()">
|
|
400
378
|
<ng-content />
|
|
401
|
-
</ngt-
|
|
379
|
+
</ngt-primitive>
|
|
402
380
|
`,
|
|
403
|
-
imports: [NgIf, NgtKey],
|
|
404
381
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
382
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
383
|
+
imports: [NgtArgs],
|
|
405
384
|
}]
|
|
406
|
-
}], ctorParameters:
|
|
407
|
-
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' }]
|
|
447
|
-
}] } });
|
|
385
|
+
}], ctorParameters: () => [] });
|
|
448
386
|
|
|
449
|
-
|
|
450
|
-
|
|
387
|
+
const defaultOptions$2 = {
|
|
388
|
+
bounces: 2,
|
|
389
|
+
ior: 2.4,
|
|
390
|
+
fresnel: 0,
|
|
391
|
+
aberrationStrength: 0,
|
|
392
|
+
color: 'white',
|
|
393
|
+
fastChroma: true,
|
|
394
|
+
};
|
|
395
|
+
function isCubeTexture(def) {
|
|
396
|
+
return def && def.isCubeTexture;
|
|
397
|
+
}
|
|
451
398
|
class NgtsMeshRefractionMaterial {
|
|
452
|
-
/** Environment map */
|
|
453
|
-
set _envMap(envMap) {
|
|
454
|
-
this.inputs.set({ envMap });
|
|
455
|
-
}
|
|
456
|
-
/** Number of ray-cast bounces, it can be expensive to have too many, 2 */
|
|
457
|
-
set _bounces(bounces) {
|
|
458
|
-
this.inputs.set({ bounces });
|
|
459
|
-
}
|
|
460
|
-
/** Refraction index, 2.4 */
|
|
461
|
-
set _ior(ior) {
|
|
462
|
-
this.inputs.set({ ior });
|
|
463
|
-
}
|
|
464
|
-
/** Fresnel (strip light), 0 */
|
|
465
|
-
set _fresnel(fresnel) {
|
|
466
|
-
this.inputs.set({ fresnel });
|
|
467
|
-
}
|
|
468
|
-
/** RGB shift intensity, can be expensive, 0 */
|
|
469
|
-
set _aberrationStrength(aberrationStrength) {
|
|
470
|
-
this.inputs.set({ aberrationStrength });
|
|
471
|
-
}
|
|
472
|
-
/** Color, white */
|
|
473
|
-
set _color(color) {
|
|
474
|
-
this.inputs.set({ color });
|
|
475
|
-
}
|
|
476
|
-
/** If this is on it uses fewer ray casts for the RGB shift sacrificing physical accuracy, true */
|
|
477
|
-
set _fastChroma(fastChroma) {
|
|
478
|
-
this.inputs.set({ fastChroma });
|
|
479
|
-
}
|
|
480
399
|
constructor() {
|
|
481
|
-
this.
|
|
482
|
-
this.
|
|
483
|
-
this.
|
|
484
|
-
this.
|
|
485
|
-
this.
|
|
486
|
-
this.
|
|
487
|
-
this.
|
|
488
|
-
this.
|
|
489
|
-
this.fastChroma = this.inputs.select('fastChroma');
|
|
490
|
-
this.store = injectNgtStore();
|
|
400
|
+
this.envMap = input.required();
|
|
401
|
+
this.attach = input('material');
|
|
402
|
+
this.options = input(defaultOptions$2, { transform: mergeInputs(defaultOptions$2) });
|
|
403
|
+
this.parameters = omit(this.options, ['fastChroma', 'aberrationStrength']);
|
|
404
|
+
this.fastChroma = pick(this.options, 'fastChroma');
|
|
405
|
+
this.aberrationStrength = pick(this.options, 'aberrationStrength');
|
|
406
|
+
this.materialRef = viewChild('material');
|
|
407
|
+
this.store = injectStore();
|
|
491
408
|
this.size = this.store.select('size');
|
|
409
|
+
this.resolution = computed(() => [this.size().width, this.size().height]);
|
|
492
410
|
this.defines = computed(() => {
|
|
493
|
-
const [envMap, aberrationStrength, fastChroma] = [this.envMap(), this.aberrationStrength(), this.fastChroma()];
|
|
494
|
-
if (!envMap)
|
|
495
|
-
return null;
|
|
496
411
|
const temp = {};
|
|
497
|
-
|
|
412
|
+
const [envMap, aberrationStrength, fastChroma] = [
|
|
413
|
+
untracked(this.envMap),
|
|
414
|
+
this.aberrationStrength(),
|
|
415
|
+
this.fastChroma(),
|
|
416
|
+
];
|
|
498
417
|
const isCubeMap = isCubeTexture(envMap);
|
|
499
418
|
const w = (isCubeMap ? envMap.image[0]?.width : envMap.image.width) ?? 1024;
|
|
500
419
|
const cubeSize = w / 4;
|
|
@@ -514,484 +433,344 @@ class NgtsMeshRefractionMaterial {
|
|
|
514
433
|
temp['FAST_CHROMA'] = '';
|
|
515
434
|
return temp;
|
|
516
435
|
});
|
|
517
|
-
this.
|
|
436
|
+
this.defineKeys = computed(() => {
|
|
437
|
+
return Object.keys(this.defines()).join(' ');
|
|
438
|
+
});
|
|
439
|
+
this.material = computed(() => {
|
|
440
|
+
const prevMaterial = untracked(this.materialRef)?.nativeElement;
|
|
441
|
+
if (prevMaterial) {
|
|
442
|
+
prevMaterial.dispose();
|
|
443
|
+
delete prevMaterial['__ngt__'];
|
|
444
|
+
delete prevMaterial['__ngt_renderer__'];
|
|
445
|
+
}
|
|
446
|
+
// track by this.defineKeys
|
|
447
|
+
this.defineKeys();
|
|
448
|
+
return new MeshRefractionMaterial();
|
|
449
|
+
});
|
|
450
|
+
const autoEffect = injectAutoEffect();
|
|
451
|
+
afterNextRender(() => {
|
|
452
|
+
autoEffect(() => {
|
|
453
|
+
const material = this.materialRef()?.nativeElement;
|
|
454
|
+
if (!material)
|
|
455
|
+
return;
|
|
456
|
+
const localState = getLocalState(material);
|
|
457
|
+
if (!localState)
|
|
458
|
+
return;
|
|
459
|
+
const parent = untracked(localState.parent);
|
|
460
|
+
const geometry = parent.geometry;
|
|
461
|
+
if (geometry) {
|
|
462
|
+
material.bvh = new MeshBVHUniformStruct();
|
|
463
|
+
material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { strategy: SAH }));
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
518
467
|
injectBeforeRender(({ camera }) => {
|
|
519
|
-
const material = this.materialRef
|
|
468
|
+
const material = this.materialRef()?.nativeElement;
|
|
520
469
|
if (material) {
|
|
521
470
|
material.viewMatrixInverse = camera.matrixWorld;
|
|
522
471
|
material.projectionMatrixInverse = camera.projectionMatrixInverse;
|
|
523
472
|
}
|
|
524
473
|
});
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return;
|
|
532
|
-
const geometry = getLocalState(material).parent?.()?.geometry;
|
|
533
|
-
if (geometry) {
|
|
534
|
-
material.bvh = new MeshBVHUniformStruct();
|
|
535
|
-
material.bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH }));
|
|
474
|
+
inject(DestroyRef).onDestroy(() => {
|
|
475
|
+
const material = this.materialRef()?.nativeElement;
|
|
476
|
+
if (material) {
|
|
477
|
+
material.dispose();
|
|
478
|
+
delete material['__ngt__'];
|
|
479
|
+
delete material['__ngt_renderer__'];
|
|
536
480
|
}
|
|
537
481
|
});
|
|
538
482
|
}
|
|
539
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
540
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
541
|
-
<ngt-
|
|
542
|
-
*
|
|
543
|
-
|
|
544
|
-
[
|
|
545
|
-
[
|
|
546
|
-
[resolution]="resolution()"
|
|
547
|
-
[aberrationStrength]="aberrationStrength()"
|
|
483
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshRefractionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
484
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshRefractionMaterial, isStandalone: true, selector: "ngts-mesh-refraction-material", inputs: { envMap: { classPropertyName: "envMap", publicName: "envMap", isSignal: true, isRequired: true, transformFunction: null }, attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
485
|
+
<ngt-primitive
|
|
486
|
+
*args="[material()]"
|
|
487
|
+
#material
|
|
488
|
+
[attach]="attach()"
|
|
489
|
+
[parameters]="parameters()"
|
|
548
490
|
[envMap]="envMap()"
|
|
549
|
-
[
|
|
550
|
-
[
|
|
551
|
-
[
|
|
552
|
-
[color]="color()"
|
|
553
|
-
[fastChroma]="fastChroma()"
|
|
554
|
-
ngtCompound
|
|
555
|
-
attach="material"
|
|
491
|
+
[aberrationStrength]="aberrationStrength()"
|
|
492
|
+
[resolution]="resolution()"
|
|
493
|
+
[defines]="defines()"
|
|
556
494
|
>
|
|
557
495
|
<ng-content />
|
|
558
|
-
</ngt-
|
|
559
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
496
|
+
</ngt-primitive>
|
|
497
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
560
498
|
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshRefractionMaterial, decorators: [{
|
|
562
500
|
type: Component,
|
|
563
501
|
args: [{
|
|
564
502
|
selector: 'ngts-mesh-refraction-material',
|
|
565
503
|
standalone: true,
|
|
566
504
|
template: `
|
|
567
|
-
<ngt-
|
|
568
|
-
*
|
|
569
|
-
|
|
570
|
-
[
|
|
571
|
-
[
|
|
572
|
-
[resolution]="resolution()"
|
|
573
|
-
[aberrationStrength]="aberrationStrength()"
|
|
505
|
+
<ngt-primitive
|
|
506
|
+
*args="[material()]"
|
|
507
|
+
#material
|
|
508
|
+
[attach]="attach()"
|
|
509
|
+
[parameters]="parameters()"
|
|
574
510
|
[envMap]="envMap()"
|
|
575
|
-
[
|
|
576
|
-
[
|
|
577
|
-
[
|
|
578
|
-
[color]="color()"
|
|
579
|
-
[fastChroma]="fastChroma()"
|
|
580
|
-
ngtCompound
|
|
581
|
-
attach="material"
|
|
511
|
+
[aberrationStrength]="aberrationStrength()"
|
|
512
|
+
[resolution]="resolution()"
|
|
513
|
+
[defines]="defines()"
|
|
582
514
|
>
|
|
583
515
|
<ng-content />
|
|
584
|
-
</ngt-
|
|
516
|
+
</ngt-primitive>
|
|
585
517
|
`,
|
|
586
|
-
imports: [NgIf, NgtKey],
|
|
587
518
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
519
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
520
|
+
imports: [NgtArgs],
|
|
588
521
|
}]
|
|
589
|
-
}], ctorParameters:
|
|
590
|
-
type: Input
|
|
591
|
-
}], _envMap: [{
|
|
592
|
-
type: Input,
|
|
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' }]
|
|
612
|
-
}] } });
|
|
522
|
+
}], ctorParameters: () => [] });
|
|
613
523
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
this.inputs.set({ backside });
|
|
626
|
-
}
|
|
627
|
-
/** Backside thickness (when backside is true), default: 0 */
|
|
628
|
-
set _backsideThickness(backsideThickness) {
|
|
629
|
-
this.inputs.set({ backsideThickness });
|
|
630
|
-
}
|
|
631
|
-
/** Resolution of the local buffer, default: undefined (fullscreen) */
|
|
632
|
-
set _resolution(resolution) {
|
|
633
|
-
this.inputs.set({ resolution });
|
|
634
|
-
}
|
|
635
|
-
/** Resolution of the local buffer for backfaces, default: undefined (fullscreen) */
|
|
636
|
-
set _backsideResolution(backsideResolution) {
|
|
637
|
-
this.inputs.set({ backsideResolution });
|
|
638
|
-
}
|
|
639
|
-
/** Refraction samples, default: 10 */
|
|
640
|
-
set _samples(samples) {
|
|
641
|
-
this.inputs.set({ samples });
|
|
642
|
-
}
|
|
643
|
-
/** Buffer scene background (can be a texture, a cubetexture or a color), default: null */
|
|
644
|
-
set _background(background) {
|
|
645
|
-
this.inputs.set({ background });
|
|
646
|
-
}
|
|
647
|
-
/* Transmission, default: 1 */
|
|
648
|
-
set _transmission(transmission) {
|
|
649
|
-
this.inputs.set({ transmission });
|
|
650
|
-
}
|
|
651
|
-
/* Thickness (refraction), default: 0 */
|
|
652
|
-
set _thickness(thickness) {
|
|
653
|
-
this.inputs.set({ thickness });
|
|
654
|
-
}
|
|
655
|
-
/* Roughness (blur), default: 0 */
|
|
656
|
-
set _roughness(roughness) {
|
|
657
|
-
this.inputs.set({ roughness });
|
|
658
|
-
}
|
|
659
|
-
/* Chromatic aberration, default: 0.03 */
|
|
660
|
-
set _chromaticAberration(chromaticAberration) {
|
|
661
|
-
this.inputs.set({ chromaticAberration });
|
|
662
|
-
}
|
|
663
|
-
/* Anisotropy, default: 0.1 */
|
|
664
|
-
set _anisotropy(anisotropy) {
|
|
665
|
-
this.inputs.set({ anisotropy });
|
|
666
|
-
}
|
|
667
|
-
/* AnisotropicBlur, default: 0.1 */
|
|
668
|
-
set _anisotropicBlur(anisotropicBlur) {
|
|
669
|
-
this.inputs.set({ anisotropicBlur });
|
|
670
|
-
}
|
|
671
|
-
/* Distortion, default: 0 */
|
|
672
|
-
set _distortion(distortion) {
|
|
673
|
-
this.inputs.set({ distortion });
|
|
674
|
-
}
|
|
675
|
-
/* Distortion scale, default: 0.5 */
|
|
676
|
-
set _distortionScale(distortionScale) {
|
|
677
|
-
this.inputs.set({ distortionScale });
|
|
678
|
-
}
|
|
679
|
-
/* Temporal distortion (speed of movement), default: 0.0 */
|
|
680
|
-
set _temporalDistortion(temporalDistortion) {
|
|
681
|
-
this.inputs.set({ temporalDistortion });
|
|
682
|
-
}
|
|
683
|
-
/** The scene rendered into a texture (use it to share a texture between materials), default: null */
|
|
684
|
-
set _buffer(buffer) {
|
|
685
|
-
this.inputs.set({ buffer });
|
|
686
|
-
}
|
|
687
|
-
/** Internals */
|
|
688
|
-
set _time(time) {
|
|
689
|
-
this.inputs.set({ time });
|
|
690
|
-
}
|
|
524
|
+
const defaultOptions$1 = {
|
|
525
|
+
transmissionSampler: false,
|
|
526
|
+
backside: false,
|
|
527
|
+
side: FrontSide,
|
|
528
|
+
transmission: 1,
|
|
529
|
+
thickness: 0,
|
|
530
|
+
backsideThickness: 0,
|
|
531
|
+
backsideEnvMapIntensity: 1,
|
|
532
|
+
samples: 10,
|
|
533
|
+
};
|
|
534
|
+
class NgtsMeshTransmissionMaterial {
|
|
691
535
|
constructor() {
|
|
692
|
-
this.
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
536
|
+
this.attach = input('material');
|
|
537
|
+
this.options = input(defaultOptions$1, { transform: mergeInputs(defaultOptions$1) });
|
|
538
|
+
this.parameters = omit(this.options, [
|
|
539
|
+
'buffer',
|
|
540
|
+
'transmissionSampler',
|
|
541
|
+
'backside',
|
|
542
|
+
'side',
|
|
543
|
+
'transmission',
|
|
544
|
+
'thickness',
|
|
545
|
+
'backsideThickness',
|
|
546
|
+
'backsideEnvMapIntensity',
|
|
547
|
+
'samples',
|
|
548
|
+
'resolution',
|
|
549
|
+
'backsideResolution',
|
|
550
|
+
'background',
|
|
551
|
+
'anisotropy',
|
|
552
|
+
'anisotropicBlur',
|
|
553
|
+
]);
|
|
554
|
+
this.resolution = pick(this.options, 'resolution');
|
|
555
|
+
this.backsideResolution = pick(this.options, 'backsideResolution');
|
|
556
|
+
this.samples = pick(this.options, 'samples');
|
|
557
|
+
this.buffer = pick(this.options, 'buffer');
|
|
558
|
+
this.anisotropy = pick(this.options, 'anisotropy');
|
|
559
|
+
this.anisotropicBlur = pick(this.options, 'anisotropicBlur');
|
|
560
|
+
this.background = pick(this.options, 'background');
|
|
561
|
+
this.backside = pick(this.options, 'backside');
|
|
562
|
+
this.backsideThickness = pick(this.options, 'backsideThickness');
|
|
563
|
+
this.backsideEnvMapIntensity = pick(this.options, 'backsideEnvMapIntensity');
|
|
564
|
+
this.transmissionSampler = pick(this.options, 'transmissionSampler');
|
|
565
|
+
this.transmission = pick(this.options, 'transmission');
|
|
566
|
+
this.thickness = pick(this.options, 'thickness');
|
|
567
|
+
this.side = pick(this.options, 'side');
|
|
568
|
+
this.materialRef = viewChild('material');
|
|
569
|
+
this.backResolution = computed(() => this.backsideResolution() || this.resolution());
|
|
570
|
+
this.fboBack = injectFBO(() => ({ width: this.backResolution() }));
|
|
571
|
+
this.fboMain = injectFBO(() => ({ width: this.resolution() }));
|
|
572
|
+
this.bufferTexture = computed(() => this.buffer() || this.fboMain().texture);
|
|
573
|
+
this.anisotropicBlurOption = computed(() => this.anisotropicBlur() || this.anisotropy());
|
|
574
|
+
this.discardMaterial = new MeshDiscardMaterial();
|
|
575
|
+
this.material = computed(() => {
|
|
576
|
+
const previousMaterial = untracked(this.materialRef)?.nativeElement;
|
|
577
|
+
if (previousMaterial) {
|
|
578
|
+
previousMaterial.dispose();
|
|
579
|
+
delete previousMaterial['__ngt__'];
|
|
580
|
+
delete previousMaterial['__ngt_renderer__'];
|
|
581
|
+
}
|
|
582
|
+
const [samples, transmissionSampler] = [this.samples(), this.transmissionSampler()];
|
|
583
|
+
return new MeshTransmissionMaterial({ samples, transmissionSampler });
|
|
584
|
+
});
|
|
585
|
+
inject(DestroyRef).onDestroy(() => {
|
|
586
|
+
const material = this.materialRef()?.nativeElement;
|
|
587
|
+
if (material) {
|
|
588
|
+
material.dispose();
|
|
589
|
+
delete material['__ngt__'];
|
|
590
|
+
delete material['__ngt_renderer__'];
|
|
591
|
+
}
|
|
707
592
|
});
|
|
708
|
-
this.materialRef = injectNgtRef();
|
|
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
|
-
this.side = THREE.FrontSide;
|
|
732
593
|
let oldBg;
|
|
594
|
+
let oldEnvMapIntensity;
|
|
733
595
|
let oldTone;
|
|
734
596
|
let parent;
|
|
735
|
-
injectBeforeRender((
|
|
736
|
-
|
|
597
|
+
injectBeforeRender(({ clock, gl, scene, camera }) => {
|
|
598
|
+
const material = this.materialRef()?.nativeElement;
|
|
599
|
+
if (!material)
|
|
737
600
|
return;
|
|
738
|
-
const
|
|
739
|
-
|
|
601
|
+
const [fboMain, fboBack, transmissionSampler, background, backside, backsideThickness, backsideEnvMapIntensity, thickness, side,] = [
|
|
602
|
+
this.fboMain(),
|
|
603
|
+
this.fboBack(),
|
|
604
|
+
this.transmissionSampler(),
|
|
605
|
+
this.background(),
|
|
606
|
+
this.backside(),
|
|
607
|
+
this.backsideThickness(),
|
|
608
|
+
this.backsideEnvMapIntensity(),
|
|
609
|
+
this.thickness(),
|
|
610
|
+
this.side(),
|
|
611
|
+
];
|
|
612
|
+
material.time = clock.getElapsedTime();
|
|
740
613
|
// Render only if the buffer matches the built-in and no transmission sampler is set
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
parent = getLocalState(
|
|
614
|
+
// @ts-expect-error - we know material.buffer is not just undefined | null
|
|
615
|
+
if (material.buffer === fboMain.texture && !transmissionSampler) {
|
|
616
|
+
parent = getLocalState(material)?.parent();
|
|
744
617
|
if (parent) {
|
|
745
618
|
// Save defaults
|
|
746
|
-
oldTone =
|
|
747
|
-
oldBg =
|
|
619
|
+
oldTone = gl.toneMapping;
|
|
620
|
+
oldBg = scene.background;
|
|
621
|
+
oldEnvMapIntensity = material.envMapIntensity;
|
|
748
622
|
// Switch off tonemapping lest it double tone maps
|
|
749
623
|
// Save the current background and set the HDR as the new BG
|
|
750
624
|
// Use discardmaterial, the parent will be invisible, but it's shadows will still be cast
|
|
751
|
-
|
|
625
|
+
gl.toneMapping = NoToneMapping;
|
|
752
626
|
if (background)
|
|
753
|
-
|
|
754
|
-
parent
|
|
627
|
+
scene.background = background;
|
|
628
|
+
parent.material = this.discardMaterial;
|
|
755
629
|
if (backside) {
|
|
756
630
|
// Render into the backside buffer
|
|
757
|
-
|
|
758
|
-
|
|
631
|
+
gl.setRenderTarget(fboBack);
|
|
632
|
+
gl.render(scene, camera);
|
|
759
633
|
// And now prepare the material for the main render using the backside buffer
|
|
760
|
-
parent
|
|
761
|
-
parent
|
|
762
|
-
|
|
763
|
-
|
|
634
|
+
parent.material = material;
|
|
635
|
+
Object.assign(parent.material, {
|
|
636
|
+
buffer: fboBack.texture,
|
|
637
|
+
thickness: backsideThickness,
|
|
638
|
+
side: BackSide,
|
|
639
|
+
envMapIntensity: backsideEnvMapIntensity,
|
|
640
|
+
});
|
|
764
641
|
}
|
|
765
642
|
// Render into the main buffer
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
parent
|
|
769
|
-
parent
|
|
770
|
-
|
|
643
|
+
gl.setRenderTarget(fboMain);
|
|
644
|
+
gl.render(scene, camera);
|
|
645
|
+
parent.material = material;
|
|
646
|
+
Object.assign(parent.material, {
|
|
647
|
+
buffer: fboMain.texture,
|
|
648
|
+
thickness,
|
|
649
|
+
side,
|
|
650
|
+
envMapIntensity: oldEnvMapIntensity,
|
|
651
|
+
});
|
|
771
652
|
// Set old state back
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
state.gl.toneMapping = oldTone;
|
|
653
|
+
scene.background = oldBg;
|
|
654
|
+
gl.setRenderTarget(null);
|
|
655
|
+
gl.toneMapping = oldTone;
|
|
776
656
|
}
|
|
777
657
|
}
|
|
778
658
|
});
|
|
779
659
|
}
|
|
780
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
781
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
782
|
-
<ngt-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
[
|
|
786
|
-
[
|
|
660
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshTransmissionMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
661
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.0", type: NgtsMeshTransmissionMaterial, isStandalone: true, selector: "ngts-mesh-transmission-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "materialRef", first: true, predicate: ["material"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
662
|
+
<ngt-primitive
|
|
663
|
+
*args="[material()]"
|
|
664
|
+
#material
|
|
665
|
+
[attach]="attach()"
|
|
666
|
+
[parameters]="parameters()"
|
|
787
667
|
[_transmission]="transmission()"
|
|
788
668
|
[transmission]="transmissionSampler() ? transmission() : 0"
|
|
669
|
+
[buffer]="bufferTexture()"
|
|
670
|
+
[anisotropicBlur]="anisotropicBlurOption()"
|
|
671
|
+
[side]="side()"
|
|
789
672
|
[thickness]="thickness()"
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
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"] }] }); }
|
|
673
|
+
>
|
|
674
|
+
<ng-content />
|
|
675
|
+
</ngt-primitive>
|
|
676
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
800
677
|
}
|
|
801
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
678
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshTransmissionMaterial, decorators: [{
|
|
802
679
|
type: Component,
|
|
803
680
|
args: [{
|
|
804
681
|
selector: 'ngts-mesh-transmission-material',
|
|
805
682
|
standalone: true,
|
|
806
683
|
template: `
|
|
807
|
-
<ngt-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
[
|
|
811
|
-
[
|
|
684
|
+
<ngt-primitive
|
|
685
|
+
*args="[material()]"
|
|
686
|
+
#material
|
|
687
|
+
[attach]="attach()"
|
|
688
|
+
[parameters]="parameters()"
|
|
812
689
|
[_transmission]="transmission()"
|
|
813
690
|
[transmission]="transmissionSampler() ? transmission() : 0"
|
|
691
|
+
[buffer]="bufferTexture()"
|
|
692
|
+
[anisotropicBlur]="anisotropicBlurOption()"
|
|
693
|
+
[side]="side()"
|
|
814
694
|
[thickness]="thickness()"
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
[chromaticAberration]="chromaticAberration()"
|
|
819
|
-
[distortion]="distortion()"
|
|
820
|
-
[distortionScale]="distortionScale()"
|
|
821
|
-
[temporalDistortion]="temporalDistortion()"
|
|
822
|
-
[time]="time()"
|
|
823
|
-
/>
|
|
695
|
+
>
|
|
696
|
+
<ng-content />
|
|
697
|
+
</ngt-primitive>
|
|
824
698
|
`,
|
|
825
|
-
imports: [NgtArgs],
|
|
826
699
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
700
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
701
|
+
imports: [NgtArgs],
|
|
827
702
|
}]
|
|
828
|
-
}], ctorParameters:
|
|
829
|
-
type: Input
|
|
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' }]
|
|
884
|
-
}] } });
|
|
703
|
+
}], ctorParameters: () => [] });
|
|
885
704
|
|
|
886
|
-
|
|
705
|
+
const defaultOptions = {
|
|
706
|
+
speed: 1,
|
|
707
|
+
};
|
|
887
708
|
class NgtsMeshWobbleMaterial {
|
|
888
|
-
set _time(time) {
|
|
889
|
-
this.inputs.set({ time });
|
|
890
|
-
}
|
|
891
|
-
set _factor(factor) {
|
|
892
|
-
this.inputs.set({ factor });
|
|
893
|
-
}
|
|
894
|
-
set _speed(speed) {
|
|
895
|
-
this.inputs.set({ speed });
|
|
896
|
-
}
|
|
897
709
|
constructor() {
|
|
898
|
-
this.
|
|
899
|
-
this.
|
|
710
|
+
this.attach = input('material');
|
|
711
|
+
this.options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
|
|
712
|
+
this.parameters = omit(this.options, ['speed']);
|
|
900
713
|
this.material = new MeshWobbleMaterial();
|
|
901
|
-
this.time = this.inputs.select('time');
|
|
902
|
-
this.factor = this.inputs.select('factor');
|
|
903
714
|
injectBeforeRender(({ clock }) => {
|
|
904
|
-
|
|
715
|
+
const material = this.material;
|
|
716
|
+
material.time = clock.elapsedTime * this.options().speed;
|
|
905
717
|
});
|
|
906
718
|
}
|
|
907
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
908
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
909
|
-
<ngt-primitive
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
[factor]="factor()"
|
|
914
|
-
attach="material"
|
|
915
|
-
ngtCompound
|
|
916
|
-
/>
|
|
917
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }] }); }
|
|
719
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshWobbleMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
720
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsMeshWobbleMaterial, isStandalone: true, selector: "ngts-mesh-wobble-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
721
|
+
<ngt-primitive *args="[material]" [parameters]="parameters()" [attach]="attach()">
|
|
722
|
+
<ng-content />
|
|
723
|
+
</ngt-primitive>
|
|
724
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
918
725
|
}
|
|
919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
726
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsMeshWobbleMaterial, decorators: [{
|
|
920
727
|
type: Component,
|
|
921
728
|
args: [{
|
|
922
729
|
selector: 'ngts-mesh-wobble-material',
|
|
923
730
|
standalone: true,
|
|
924
731
|
template: `
|
|
925
|
-
<ngt-primitive
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
[time]="time()"
|
|
929
|
-
[factor]="factor()"
|
|
930
|
-
attach="material"
|
|
931
|
-
ngtCompound
|
|
932
|
-
/>
|
|
732
|
+
<ngt-primitive *args="[material]" [parameters]="parameters()" [attach]="attach()">
|
|
733
|
+
<ng-content />
|
|
734
|
+
</ngt-primitive>
|
|
933
735
|
`,
|
|
934
736
|
imports: [NgtArgs],
|
|
935
737
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
738
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
936
739
|
}]
|
|
937
|
-
}], ctorParameters:
|
|
938
|
-
type: Input
|
|
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
|
-
}] } });
|
|
740
|
+
}], ctorParameters: () => [] });
|
|
949
741
|
|
|
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
742
|
class NgtsPointMaterial {
|
|
972
743
|
constructor() {
|
|
973
|
-
this.
|
|
974
|
-
this.
|
|
744
|
+
this.attach = input('material');
|
|
745
|
+
this.options = input({});
|
|
746
|
+
this.material = new PointMaterial(this.options());
|
|
975
747
|
}
|
|
976
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
977
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
748
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPointMaterial, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
749
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: NgtsPointMaterial, isStandalone: true, selector: "ngts-point-material", inputs: { attach: { classPropertyName: "attach", publicName: "attach", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
750
|
+
<ngt-primitive *args="[material]" [attach]="attach()" [parameters]="options()">
|
|
751
|
+
<ng-content />
|
|
752
|
+
</ngt-primitive>
|
|
753
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgtArgs, selector: "ng-template[args]", inputs: ["args"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
978
754
|
}
|
|
979
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
755
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgtsPointMaterial, decorators: [{
|
|
980
756
|
type: Component,
|
|
981
757
|
args: [{
|
|
982
758
|
selector: 'ngts-point-material',
|
|
983
759
|
standalone: true,
|
|
984
|
-
template:
|
|
985
|
-
|
|
760
|
+
template: `
|
|
761
|
+
<ngt-primitive *args="[material]" [attach]="attach()" [parameters]="options()">
|
|
762
|
+
<ng-content />
|
|
763
|
+
</ngt-primitive>
|
|
764
|
+
`,
|
|
986
765
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
766
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
767
|
+
imports: [NgtArgs],
|
|
987
768
|
}]
|
|
988
|
-
}]
|
|
989
|
-
type: Input
|
|
990
|
-
}] } });
|
|
769
|
+
}] });
|
|
991
770
|
|
|
992
771
|
/**
|
|
993
772
|
* Generated bundle index. Do not edit.
|
|
994
773
|
*/
|
|
995
774
|
|
|
996
|
-
export { NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial,
|
|
775
|
+
export { NgtsCustomShaderMaterial, NgtsMeshDistortMaterial, NgtsMeshReflectorMaterial, NgtsMeshRefractionMaterial, NgtsMeshTransmissionMaterial, NgtsMeshWobbleMaterial, NgtsPointMaterial };
|
|
997
776
|
//# sourceMappingURL=angular-three-soba-materials.mjs.map
|