angular-three-soba 2.0.0-beta.26 → 2.0.0-beta.261
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 +278 -2
- package/abstractions/index.d.ts +11 -6
- package/abstractions/lib/catmull-rom-line.d.ts +648 -0
- package/abstractions/lib/cubic-bezier-line.d.ts +19 -0
- package/abstractions/lib/edges.d.ts +850 -0
- package/abstractions/lib/gradient-texture.d.ts +24 -0
- package/abstractions/lib/grid.d.ts +339 -0
- package/abstractions/lib/helper.d.ts +25 -0
- package/abstractions/lib/line.d.ts +41 -0
- package/abstractions/lib/prism-geometry.d.ts +30 -0
- package/abstractions/lib/quadratic-bezier-line.d.ts +21 -0
- package/abstractions/lib/text-3d.d.ts +338 -0
- package/abstractions/lib/text.d.ts +55 -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 +95 -2
- package/controls/index.d.ts +2 -1
- package/controls/lib/camera-controls.d.ts +31 -0
- package/controls/lib/orbit-controls.d.ts +38 -0
- package/esm2022/abstractions/index.mjs +12 -7
- 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 +80 -0
- package/esm2022/abstractions/lib/line.mjs +123 -0
- package/esm2022/abstractions/lib/prism-geometry.mjs +55 -0
- package/esm2022/abstractions/lib/quadratic-bezier-line.mjs +73 -0
- package/esm2022/abstractions/lib/text-3d.mjs +98 -0
- package/esm2022/abstractions/lib/text.mjs +92 -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 +3 -2
- package/esm2022/controls/lib/camera-controls.mjs +127 -0
- package/esm2022/controls/lib/orbit-controls.mjs +126 -0
- package/esm2022/loaders/index.mjs +6 -5
- package/esm2022/loaders/lib/font-loader.mjs +49 -0
- package/esm2022/loaders/lib/gltf-loader.mjs +33 -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 +7 -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/misc/index.mjs +10 -14
- package/esm2022/misc/lib/animations.mjs +74 -0
- package/esm2022/misc/lib/bake-shadows.mjs +26 -0
- package/esm2022/misc/lib/computed-attribute.mjs +56 -0
- package/esm2022/misc/lib/constants.mjs +5 -0
- package/esm2022/misc/lib/decal.mjs +135 -0
- package/esm2022/misc/lib/deprecated.mjs +15 -0
- package/esm2022/misc/lib/depth-buffer.mjs +39 -0
- package/esm2022/misc/lib/fbo.mjs +89 -0
- package/esm2022/misc/lib/sampler.mjs +121 -0
- package/esm2022/shaders/index.mjs +3 -18
- package/esm2022/shaders/lib/grid-material.mjs +81 -0
- package/esm2022/shaders/lib/mesh-refraction-material.mjs +163 -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 +113 -0
- package/esm2022/staging/lib/contact-shadows.mjs +201 -0
- package/esm2022/staging/lib/environment.mjs +465 -0
- package/esm2022/staging/lib/float.mjs +60 -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 +85 -0
- package/esm2022/staging/lib/randomized-lights.mjs +104 -0
- package/esm2022/staging/lib/render-texture.mjs +213 -0
- package/esm2022/staging/lib/sky.mjs +86 -0
- package/esm2022/staging/lib/spot-light.mjs +450 -0
- package/esm2022/staging/lib/stage.mjs +236 -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 +739 -718
- package/fesm2022/angular-three-soba-abstractions.mjs.map +1 -1
- package/fesm2022/angular-three-soba-cameras.mjs +260 -307
- package/fesm2022/angular-three-soba-cameras.mjs.map +1 -1
- package/fesm2022/angular-three-soba-controls.mjs +174 -110
- package/fesm2022/angular-three-soba-controls.mjs.map +1 -1
- package/fesm2022/angular-three-soba-loaders.mjs +151 -129
- package/fesm2022/angular-three-soba-loaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-materials.mjs +511 -764
- package/fesm2022/angular-three-soba-materials.mjs.map +1 -1
- package/fesm2022/angular-three-soba-misc.mjs +405 -2149
- package/fesm2022/angular-three-soba-misc.mjs.map +1 -1
- package/fesm2022/angular-three-soba-shaders.mjs +33 -1373
- package/fesm2022/angular-three-soba-shaders.mjs.map +1 -1
- package/fesm2022/angular-three-soba-staging.mjs +2329 -3538
- package/fesm2022/angular-three-soba-staging.mjs.map +1 -1
- 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 +21 -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 +6 -6
- package/materials/lib/custom-shader-material.d.ts +19 -0
- package/materials/lib/mesh-distort-material.d.ts +18 -0
- package/materials/lib/mesh-reflector-material.d.ts +50 -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/metadata.json +1 -1
- package/misc/README.md +217 -2
- package/misc/index.d.ts +9 -13
- package/misc/lib/animations.d.ts +14 -0
- package/misc/lib/computed-attribute.d.ts +69 -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 +47 -0
- package/misc/lib/sampler.d.ts +73 -0
- package/package.json +60 -38
- package/shaders/index.d.ts +2 -17
- package/shaders/lib/grid-material.d.ts +69 -0
- package/shaders/lib/mesh-refraction-material.d.ts +11 -0
- package/staging/README.md +472 -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 +422 -0
- package/staging/lib/contact-shadows.d.ts +45 -0
- package/staging/lib/environment.d.ts +159 -0
- package/staging/lib/float.d.ts +19 -0
- package/staging/lib/lightformer.d.ts +334 -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 +120 -0
- package/staging/lib/stage.d.ts +376 -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 -84
- 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 -172
- package/esm2022/cameras/camera/camera-content.mjs +0 -21
- 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 -185
- package/esm2022/gizmos/angular-three-soba-gizmos.mjs +0 -5
- package/esm2022/gizmos/gizmo-helper/gizmo-helper.mjs +0 -197
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/constants.mjs +0 -31
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.mjs +0 -93
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.mjs +0 -150
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.mjs +0 -66
- package/esm2022/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.mjs +0 -71
- package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.mjs +0 -195
- package/esm2022/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.mjs +0 -272
- package/esm2022/gizmos/index.mjs +0 -4
- 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 -52
- 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 -50
- 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/angular-three-soba-performances.mjs +0 -5
- package/esm2022/performances/index.mjs +0 -8
- package/esm2022/performances/instances/instances.mjs +0 -220
- package/esm2022/performances/instances/position-mesh.mjs +0 -52
- package/esm2022/performances/points/points-input.mjs +0 -64
- package/esm2022/performances/points/points.mjs +0 -326
- 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 -69
- 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 -165
- 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 -106
- 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 -389
- package/esm2022/staging/stars/stars.mjs +0 -147
- package/esm2022/staging/wireframe/wireframe-input.mjs +0 -191
- package/esm2022/staging/wireframe/wireframe.mjs +0 -228
- package/esm2022/utils/angular-three-soba-utils.mjs +0 -5
- package/esm2022/utils/content/content.mjs +0 -15
- package/esm2022/utils/index.mjs +0 -2
- package/fesm2022/angular-three-soba-gizmos.mjs +0 -1043
- package/fesm2022/angular-three-soba-gizmos.mjs.map +0 -1
- package/fesm2022/angular-three-soba-modifiers.mjs +0 -71
- package/fesm2022/angular-three-soba-modifiers.mjs.map +0 -1
- package/fesm2022/angular-three-soba-performances.mjs +0 -956
- package/fesm2022/angular-three-soba-performances.mjs.map +0 -1
- package/fesm2022/angular-three-soba-utils.mjs +0 -22
- package/fesm2022/angular-three-soba-utils.mjs.map +0 -1
- package/gizmos/README.md +0 -3
- package/gizmos/gizmo-helper/gizmo-helper.d.ts +0 -69
- package/gizmos/gizmo-helper/gizmo-viewcube/constants.d.ts +0 -12
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-edge.d.ts +0 -22
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-face.d.ts +0 -29
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube-input.d.ts +0 -33
- package/gizmos/gizmo-helper/gizmo-viewcube/gizmo-viewcube.d.ts +0 -10
- package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport-axis.d.ts +0 -40
- package/gizmos/gizmo-helper/gizmo-viewport/gizmo-viewport.d.ts +0 -30
- package/gizmos/index.d.ts +0 -3
- 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/README.md +0 -3
- package/performances/adaptive-dpr/adaptive-dpr.d.ts +0 -14
- package/performances/adaptive-events/adaptive-events.d.ts +0 -9
- package/performances/index.d.ts +0 -7
- package/performances/instances/instances.d.ts +0 -79
- package/performances/instances/position-mesh.d.ts +0 -10
- 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,368 +1,25 @@
|
|
|
1
|
+
import { getVersion } from 'angular-three-soba/misc';
|
|
2
|
+
import { shaderMaterial } from 'angular-three-soba/vanilla-exports';
|
|
1
3
|
import * as THREE from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import { InjectionToken, inject, runInInjectionContext, computed, effect } from '@angular/core';
|
|
4
|
+
import { Color, Vector3 } from 'three';
|
|
4
5
|
import { MeshBVHUniformStruct, shaderStructs, shaderIntersectFunction } from 'three-mesh-bvh';
|
|
5
|
-
import { assertInjectionContext } from 'angular-three';
|
|
6
|
-
|
|
7
|
-
class ConvolutionMaterial extends ShaderMaterial {
|
|
8
|
-
constructor(texelSize = new Vector2()) {
|
|
9
|
-
super({
|
|
10
|
-
uniforms: {
|
|
11
|
-
inputBuffer: new Uniform(null),
|
|
12
|
-
depthBuffer: new Uniform(null),
|
|
13
|
-
resolution: new Uniform(new Vector2()),
|
|
14
|
-
texelSize: new Uniform(new Vector2()),
|
|
15
|
-
halfTexelSize: new Uniform(new Vector2()),
|
|
16
|
-
kernel: new Uniform(0.0),
|
|
17
|
-
scale: new Uniform(1.0),
|
|
18
|
-
cameraNear: new Uniform(0.0),
|
|
19
|
-
cameraFar: new Uniform(1.0),
|
|
20
|
-
minDepthThreshold: new Uniform(0.0),
|
|
21
|
-
maxDepthThreshold: new Uniform(1.0),
|
|
22
|
-
depthScale: new Uniform(0.0),
|
|
23
|
-
depthToBlurRatioBias: new Uniform(0.25),
|
|
24
|
-
},
|
|
25
|
-
fragmentShader: `#include <common>
|
|
26
|
-
#include <dithering_pars_fragment>
|
|
27
|
-
uniform sampler2D inputBuffer;
|
|
28
|
-
uniform sampler2D depthBuffer;
|
|
29
|
-
uniform float cameraNear;
|
|
30
|
-
uniform float cameraFar;
|
|
31
|
-
uniform float minDepthThreshold;
|
|
32
|
-
uniform float maxDepthThreshold;
|
|
33
|
-
uniform float depthScale;
|
|
34
|
-
uniform float depthToBlurRatioBias;
|
|
35
|
-
varying vec2 vUv;
|
|
36
|
-
varying vec2 vUv0;
|
|
37
|
-
varying vec2 vUv1;
|
|
38
|
-
varying vec2 vUv2;
|
|
39
|
-
varying vec2 vUv3;
|
|
40
|
-
|
|
41
|
-
void main() {
|
|
42
|
-
float depthFactor = 0.0;
|
|
43
|
-
|
|
44
|
-
#ifdef USE_DEPTH
|
|
45
|
-
vec4 depth = texture2D(depthBuffer, vUv);
|
|
46
|
-
depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));
|
|
47
|
-
depthFactor *= depthScale;
|
|
48
|
-
depthFactor = max(0.0, min(1.0, depthFactor + 0.25));
|
|
49
|
-
#endif
|
|
50
|
-
|
|
51
|
-
vec4 sum = texture2D(inputBuffer, mix(vUv0, vUv, depthFactor));
|
|
52
|
-
sum += texture2D(inputBuffer, mix(vUv1, vUv, depthFactor));
|
|
53
|
-
sum += texture2D(inputBuffer, mix(vUv2, vUv, depthFactor));
|
|
54
|
-
sum += texture2D(inputBuffer, mix(vUv3, vUv, depthFactor));
|
|
55
|
-
gl_FragColor = sum * 0.25 ;
|
|
56
|
-
|
|
57
|
-
#include <dithering_fragment>
|
|
58
|
-
#include <tonemapping_fragment>
|
|
59
|
-
#include <encodings_fragment>
|
|
60
|
-
}`,
|
|
61
|
-
vertexShader: `uniform vec2 texelSize;
|
|
62
|
-
uniform vec2 halfTexelSize;
|
|
63
|
-
uniform float kernel;
|
|
64
|
-
uniform float scale;
|
|
65
|
-
varying vec2 vUv;
|
|
66
|
-
varying vec2 vUv0;
|
|
67
|
-
varying vec2 vUv1;
|
|
68
|
-
varying vec2 vUv2;
|
|
69
|
-
varying vec2 vUv3;
|
|
70
|
-
|
|
71
|
-
void main() {
|
|
72
|
-
vec2 uv = position.xy * 0.5 + 0.5;
|
|
73
|
-
vUv = uv;
|
|
74
|
-
|
|
75
|
-
vec2 dUv = (texelSize * vec2(kernel) + halfTexelSize) * scale;
|
|
76
|
-
vUv0 = vec2(uv.x - dUv.x, uv.y + dUv.y);
|
|
77
|
-
vUv1 = vec2(uv.x + dUv.x, uv.y + dUv.y);
|
|
78
|
-
vUv2 = vec2(uv.x + dUv.x, uv.y - dUv.y);
|
|
79
|
-
vUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y);
|
|
80
|
-
|
|
81
|
-
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
82
|
-
}`,
|
|
83
|
-
blending: NoBlending,
|
|
84
|
-
depthWrite: false,
|
|
85
|
-
depthTest: false,
|
|
86
|
-
});
|
|
87
|
-
this.toneMapped = false;
|
|
88
|
-
this.setTexelSize(texelSize.x, texelSize.y);
|
|
89
|
-
this.kernel = new Float32Array([0.0, 1.0, 2.0, 2.0, 3.0]);
|
|
90
|
-
}
|
|
91
|
-
setTexelSize(x, y) {
|
|
92
|
-
this.uniforms['texelSize'].value.set(x, y);
|
|
93
|
-
this.uniforms['halfTexelSize'].value.set(x, y).multiplyScalar(0.5);
|
|
94
|
-
}
|
|
95
|
-
setResolution(resolution) {
|
|
96
|
-
this.uniforms['resolution'].value.copy(resolution);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
class BlurPass {
|
|
101
|
-
constructor({ gl, resolution, width = 500, height = 500, minDepthThreshold = 0, maxDepthThreshold = 1, depthScale = 0, depthToBlurRatioBias = 0.25, }) {
|
|
102
|
-
this.renderToScreen = false;
|
|
103
|
-
this.renderTargetA = new WebGLRenderTarget(resolution, resolution, {
|
|
104
|
-
minFilter: LinearFilter,
|
|
105
|
-
magFilter: LinearFilter,
|
|
106
|
-
stencilBuffer: false,
|
|
107
|
-
depthBuffer: false,
|
|
108
|
-
type: HalfFloatType,
|
|
109
|
-
});
|
|
110
|
-
this.renderTargetB = this.renderTargetA.clone();
|
|
111
|
-
this.convolutionMaterial = new ConvolutionMaterial();
|
|
112
|
-
this.convolutionMaterial.setTexelSize(1.0 / width, 1.0 / height);
|
|
113
|
-
this.convolutionMaterial.setResolution(new Vector2(width, height));
|
|
114
|
-
this.scene = new Scene();
|
|
115
|
-
this.camera = new PerspectiveCamera();
|
|
116
|
-
this.convolutionMaterial.uniforms['minDepthThreshold'].value = minDepthThreshold;
|
|
117
|
-
this.convolutionMaterial.uniforms['maxDepthThreshold'].value = maxDepthThreshold;
|
|
118
|
-
this.convolutionMaterial.uniforms['depthScale'].value = depthScale;
|
|
119
|
-
this.convolutionMaterial.uniforms['depthToBlurRatioBias'].value = depthToBlurRatioBias;
|
|
120
|
-
this.convolutionMaterial.defines['USE_DEPTH'] = depthScale > 0;
|
|
121
|
-
const vertices = new Float32Array([-1, -1, 0, 3, -1, 0, -1, 3, 0]);
|
|
122
|
-
const uvs = new Float32Array([0, 0, 2, 0, 0, 2]);
|
|
123
|
-
const geometry = new BufferGeometry();
|
|
124
|
-
geometry.setAttribute('position', new BufferAttribute(vertices, 3));
|
|
125
|
-
geometry.setAttribute('uv', new BufferAttribute(uvs, 2));
|
|
126
|
-
this.screen = new Mesh(geometry, this.convolutionMaterial);
|
|
127
|
-
this.screen.frustumCulled = false;
|
|
128
|
-
this.scene.add(this.screen);
|
|
129
|
-
}
|
|
130
|
-
render(renderer, inputBuffer, outputBuffer) {
|
|
131
|
-
const scene = this.scene;
|
|
132
|
-
const camera = this.camera;
|
|
133
|
-
const renderTargetA = this.renderTargetA;
|
|
134
|
-
const renderTargetB = this.renderTargetB;
|
|
135
|
-
let material = this.convolutionMaterial;
|
|
136
|
-
let uniforms = material.uniforms;
|
|
137
|
-
uniforms['depthBuffer'].value = inputBuffer.depthTexture;
|
|
138
|
-
const kernel = material.kernel;
|
|
139
|
-
let lastRT = inputBuffer;
|
|
140
|
-
let destRT;
|
|
141
|
-
let i, l;
|
|
142
|
-
// Apply the multi-pass blur.
|
|
143
|
-
for (i = 0, l = kernel.length - 1; i < l; ++i) {
|
|
144
|
-
// Alternate between targets.
|
|
145
|
-
destRT = (i & 1) === 0 ? renderTargetA : renderTargetB;
|
|
146
|
-
uniforms['kernel'].value = kernel[i];
|
|
147
|
-
uniforms['inputBuffer'].value = lastRT.texture;
|
|
148
|
-
renderer.setRenderTarget(destRT);
|
|
149
|
-
renderer.render(scene, camera);
|
|
150
|
-
lastRT = destRT;
|
|
151
|
-
}
|
|
152
|
-
uniforms['kernel'].value = kernel[i];
|
|
153
|
-
uniforms['inputBuffer'].value = lastRT.texture;
|
|
154
|
-
renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer);
|
|
155
|
-
renderer.render(scene, camera);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function shaderMaterial(uniforms, vertexShader, fragmentShader, onInit) {
|
|
160
|
-
const material = class extends THREE.ShaderMaterial {
|
|
161
|
-
constructor(parameters = {}) {
|
|
162
|
-
const entries = Object.entries(uniforms);
|
|
163
|
-
// Create unforms and shaders
|
|
164
|
-
super({
|
|
165
|
-
uniforms: entries.reduce((acc, [name, value]) => {
|
|
166
|
-
const uniform = THREE.UniformsUtils.clone({ [name]: { value } });
|
|
167
|
-
return {
|
|
168
|
-
...acc,
|
|
169
|
-
...uniform,
|
|
170
|
-
};
|
|
171
|
-
}, {}),
|
|
172
|
-
vertexShader,
|
|
173
|
-
fragmentShader,
|
|
174
|
-
});
|
|
175
|
-
this.key = '';
|
|
176
|
-
// Create getter/setters
|
|
177
|
-
entries.forEach(([name]) => Object.defineProperty(this, name, {
|
|
178
|
-
get: () => this.uniforms[name].value,
|
|
179
|
-
set: (v) => (this.uniforms[name].value = v),
|
|
180
|
-
}));
|
|
181
|
-
// Assign parameters, this might include uniforms
|
|
182
|
-
Object.assign(this, parameters);
|
|
183
|
-
// Call onInit
|
|
184
|
-
if (onInit)
|
|
185
|
-
onInit(this);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
material.key = THREE.MathUtils.generateUUID();
|
|
189
|
-
return material;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const CausticsMaterial = shaderMaterial({
|
|
193
|
-
cameraMatrixWorld: new THREE.Matrix4(),
|
|
194
|
-
cameraProjectionMatrixInv: new THREE.Matrix4(),
|
|
195
|
-
normalTexture: null,
|
|
196
|
-
depthTexture: null,
|
|
197
|
-
lightDir: new THREE.Vector3(0, 1, 0),
|
|
198
|
-
lightPlaneNormal: new THREE.Vector3(0, 1, 0),
|
|
199
|
-
lightPlaneConstant: 0,
|
|
200
|
-
near: 0.1,
|
|
201
|
-
far: 100,
|
|
202
|
-
modelMatrix: new THREE.Matrix4(),
|
|
203
|
-
worldRadius: 1 / 40,
|
|
204
|
-
ior: 1.1,
|
|
205
|
-
bounces: 0,
|
|
206
|
-
resolution: 1024,
|
|
207
|
-
size: 10,
|
|
208
|
-
intensity: 0.5,
|
|
209
|
-
},
|
|
210
|
-
/* glsl */ `
|
|
211
|
-
varying vec2 vUv;
|
|
212
|
-
void main() {
|
|
213
|
-
vUv = uv;
|
|
214
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
215
|
-
}`,
|
|
216
|
-
/* glsl */ `
|
|
217
|
-
uniform mat4 cameraMatrixWorld;
|
|
218
|
-
uniform mat4 cameraProjectionMatrixInv;
|
|
219
|
-
uniform vec3 lightDir;
|
|
220
|
-
uniform vec3 lightPlaneNormal;
|
|
221
|
-
uniform float lightPlaneConstant;
|
|
222
|
-
uniform float near;
|
|
223
|
-
uniform float far;
|
|
224
|
-
uniform float time;
|
|
225
|
-
uniform float worldRadius;
|
|
226
|
-
uniform float resolution;
|
|
227
|
-
uniform float size;
|
|
228
|
-
uniform float intensity;
|
|
229
|
-
uniform float ior;
|
|
230
|
-
precision highp isampler2D;
|
|
231
|
-
precision highp usampler2D;
|
|
232
|
-
uniform sampler2D normalTexture;
|
|
233
|
-
uniform sampler2D depthTexture;
|
|
234
|
-
uniform float bounces;
|
|
235
|
-
varying vec2 vUv;
|
|
236
|
-
vec3 WorldPosFromDepth(float depth, vec2 coord) {
|
|
237
|
-
float z = depth * 2.0 - 1.0;
|
|
238
|
-
vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
|
|
239
|
-
vec4 viewSpacePosition = cameraProjectionMatrixInv * clipSpacePosition;
|
|
240
|
-
// Perspective division
|
|
241
|
-
viewSpacePosition /= viewSpacePosition.w;
|
|
242
|
-
vec4 worldSpacePosition = cameraMatrixWorld * viewSpacePosition;
|
|
243
|
-
return worldSpacePosition.xyz;
|
|
244
|
-
}
|
|
245
|
-
float sdPlane( vec3 p, vec3 n, float h ) {
|
|
246
|
-
// n must be normalized
|
|
247
|
-
return dot(p,n) + h;
|
|
248
|
-
}
|
|
249
|
-
float planeIntersect( vec3 ro, vec3 rd, vec4 p ) {
|
|
250
|
-
return -(dot(ro,p.xyz)+p.w)/dot(rd,p.xyz);
|
|
251
|
-
}
|
|
252
|
-
vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 pos, vec3 normal, float ior, out vec3 rayOrigin, out vec3 rayDirection) {
|
|
253
|
-
rayOrigin = ro;
|
|
254
|
-
rayDirection = rd;
|
|
255
|
-
rayDirection = refract(rayDirection, normal, 1.0 / ior);
|
|
256
|
-
rayOrigin = pos + rayDirection * 0.1;
|
|
257
|
-
return rayDirection;
|
|
258
|
-
}
|
|
259
|
-
void main() {
|
|
260
|
-
// Each sample consists of random offset in the x and y direction
|
|
261
|
-
float caustic = 0.0;
|
|
262
|
-
float causticTexelSize = (1.0 / resolution) * size * 2.0;
|
|
263
|
-
float texelsNeeded = worldRadius / causticTexelSize;
|
|
264
|
-
float sampleRadius = texelsNeeded / resolution;
|
|
265
|
-
float sum = 0.0;
|
|
266
|
-
if (texture2D(depthTexture, vUv).x == 1.0) {
|
|
267
|
-
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
vec2 offset1 = vec2(-0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
|
|
271
|
-
vec2 offset2 = vec2(-0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
|
|
272
|
-
vec2 offset3 = vec2(0.5, 0.5);//vec2(rand() - 0.5, rand() - 0.5);
|
|
273
|
-
vec2 offset4 = vec2(0.5, -0.5);//vec2(rand() - 0.5, rand() - 0.5);
|
|
274
|
-
vec2 uv1 = vUv + offset1 * sampleRadius;
|
|
275
|
-
vec2 uv2 = vUv + offset2 * sampleRadius;
|
|
276
|
-
vec2 uv3 = vUv + offset3 * sampleRadius;
|
|
277
|
-
vec2 uv4 = vUv + offset4 * sampleRadius;
|
|
278
|
-
vec3 normal1 = texture2D(normalTexture, uv1, -10.0).rgb * 2.0 - 1.0;
|
|
279
|
-
vec3 normal2 = texture2D(normalTexture, uv2, -10.0).rgb * 2.0 - 1.0;
|
|
280
|
-
vec3 normal3 = texture2D(normalTexture, uv3, -10.0).rgb * 2.0 - 1.0;
|
|
281
|
-
vec3 normal4 = texture2D(normalTexture, uv4, -10.0).rgb * 2.0 - 1.0;
|
|
282
|
-
float depth1 = texture2D(depthTexture, uv1, -10.0).x;
|
|
283
|
-
float depth2 = texture2D(depthTexture, uv2, -10.0).x;
|
|
284
|
-
float depth3 = texture2D(depthTexture, uv3, -10.0).x;
|
|
285
|
-
float depth4 = texture2D(depthTexture, uv4, -10.0).x;
|
|
286
|
-
// Sanity check the depths
|
|
287
|
-
if (depth1 == 1.0 || depth2 == 1.0 || depth3 == 1.0 || depth4 == 1.0) {
|
|
288
|
-
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
vec3 pos1 = WorldPosFromDepth(depth1, uv1);
|
|
292
|
-
vec3 pos2 = WorldPosFromDepth(depth2, uv2);
|
|
293
|
-
vec3 pos3 = WorldPosFromDepth(depth3, uv3);
|
|
294
|
-
vec3 pos4 = WorldPosFromDepth(depth4, uv4);
|
|
295
|
-
vec3 originPos1 = WorldPosFromDepth(0.0, uv1);
|
|
296
|
-
vec3 originPos2 = WorldPosFromDepth(0.0, uv2);
|
|
297
|
-
vec3 originPos3 = WorldPosFromDepth(0.0, uv3);
|
|
298
|
-
vec3 originPos4 = WorldPosFromDepth(0.0, uv4);
|
|
299
|
-
vec3 endPos1, endPos2, endPos3, endPos4;
|
|
300
|
-
vec3 endDir1, endDir2, endDir3, endDir4;
|
|
301
|
-
totalInternalReflection(originPos1, lightDir, pos1, normal1, ior, endPos1, endDir1);
|
|
302
|
-
totalInternalReflection(originPos2, lightDir, pos2, normal2, ior, endPos2, endDir2);
|
|
303
|
-
totalInternalReflection(originPos3, lightDir, pos3, normal3, ior, endPos3, endDir3);
|
|
304
|
-
totalInternalReflection(originPos4, lightDir, pos4, normal4, ior, endPos4, endDir4);
|
|
305
|
-
float lightPosArea = length(cross(originPos2 - originPos1, originPos3 - originPos1)) + length(cross(originPos3 - originPos1, originPos4 - originPos1));
|
|
306
|
-
float t1 = planeIntersect(endPos1, endDir1, vec4(lightPlaneNormal, lightPlaneConstant));
|
|
307
|
-
float t2 = planeIntersect(endPos2, endDir2, vec4(lightPlaneNormal, lightPlaneConstant));
|
|
308
|
-
float t3 = planeIntersect(endPos3, endDir3, vec4(lightPlaneNormal, lightPlaneConstant));
|
|
309
|
-
float t4 = planeIntersect(endPos4, endDir4, vec4(lightPlaneNormal, lightPlaneConstant));
|
|
310
|
-
vec3 finalPos1 = endPos1 + endDir1 * t1;
|
|
311
|
-
vec3 finalPos2 = endPos2 + endDir2 * t2;
|
|
312
|
-
vec3 finalPos3 = endPos3 + endDir3 * t3;
|
|
313
|
-
vec3 finalPos4 = endPos4 + endDir4 * t4;
|
|
314
|
-
float finalArea = length(cross(finalPos2 - finalPos1, finalPos3 - finalPos1)) + length(cross(finalPos3 - finalPos1, finalPos4 - finalPos1));
|
|
315
|
-
caustic += intensity * (lightPosArea / finalArea);
|
|
316
|
-
// Calculate the area of the triangle in light spaces
|
|
317
|
-
gl_FragColor = vec4(vec3(max(caustic, 0.0)), 1.0);
|
|
318
|
-
}`);
|
|
319
|
-
|
|
320
|
-
const CausticsProjectionMaterial = shaderMaterial({
|
|
321
|
-
causticsTexture: null,
|
|
322
|
-
causticsTextureB: null,
|
|
323
|
-
color: new THREE.Color(),
|
|
324
|
-
lightProjMatrix: new THREE.Matrix4(),
|
|
325
|
-
lightViewMatrix: new THREE.Matrix4(),
|
|
326
|
-
}, `varying vec3 vWorldPosition;
|
|
327
|
-
void main() {
|
|
328
|
-
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
|
|
329
|
-
vec4 worldPosition = modelMatrix * vec4(position, 1.);
|
|
330
|
-
vWorldPosition = worldPosition.xyz;
|
|
331
|
-
}`, `varying vec3 vWorldPosition;
|
|
332
|
-
uniform vec3 color;
|
|
333
|
-
uniform sampler2D causticsTexture;
|
|
334
|
-
uniform sampler2D causticsTextureB;
|
|
335
|
-
uniform mat4 lightProjMatrix;
|
|
336
|
-
uniform mat4 lightViewMatrix;
|
|
337
|
-
void main() {
|
|
338
|
-
// Apply caustics
|
|
339
|
-
vec4 lightSpacePos = lightProjMatrix * lightViewMatrix * vec4(vWorldPosition, 1.0);
|
|
340
|
-
lightSpacePos.xyz /= lightSpacePos.w;
|
|
341
|
-
lightSpacePos.xyz = lightSpacePos.xyz * 0.5 + 0.5;
|
|
342
|
-
vec3 front = texture2D(causticsTexture, lightSpacePos.xy).rgb;
|
|
343
|
-
vec3 back = texture2D(causticsTextureB, lightSpacePos.xy).rgb;
|
|
344
|
-
gl_FragColor = vec4((front + back) * color, 1.0);
|
|
345
|
-
#include <tonemapping_fragment>
|
|
346
|
-
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
347
|
-
}`);
|
|
348
|
-
|
|
349
|
-
const DiscardMaterial = shaderMaterial({}, 'void main() { }', 'void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }');
|
|
350
6
|
|
|
351
7
|
const GridMaterial = shaderMaterial({
|
|
352
8
|
cellSize: 0.5,
|
|
353
9
|
sectionSize: 1,
|
|
354
10
|
fadeDistance: 100,
|
|
355
11
|
fadeStrength: 1,
|
|
12
|
+
fadeFrom: 1,
|
|
356
13
|
cellThickness: 0.5,
|
|
357
14
|
sectionThickness: 1,
|
|
358
|
-
cellColor: new
|
|
359
|
-
sectionColor: new
|
|
15
|
+
cellColor: new Color(),
|
|
16
|
+
sectionColor: new Color(),
|
|
360
17
|
infiniteGrid: false,
|
|
361
18
|
followCamera: false,
|
|
362
|
-
worldCamProjPosition: new
|
|
363
|
-
worldPlanePosition: new
|
|
19
|
+
worldCamProjPosition: new Vector3(),
|
|
20
|
+
worldPlanePosition: new Vector3(),
|
|
364
21
|
},
|
|
365
|
-
/* glsl */ `
|
|
22
|
+
/* language=glsl glsl */ `
|
|
366
23
|
varying vec3 localPosition;
|
|
367
24
|
varying vec4 worldPosition;
|
|
368
25
|
|
|
@@ -385,7 +42,7 @@ const GridMaterial = shaderMaterial({
|
|
|
385
42
|
gl_Position = projectionMatrix * viewMatrix * worldPosition;
|
|
386
43
|
}
|
|
387
44
|
`,
|
|
388
|
-
/* glsl */ `
|
|
45
|
+
/* language=glsl glsl */ `
|
|
389
46
|
varying vec3 localPosition;
|
|
390
47
|
varying vec4 worldPosition;
|
|
391
48
|
|
|
@@ -396,6 +53,7 @@ const GridMaterial = shaderMaterial({
|
|
|
396
53
|
uniform vec3 sectionColor;
|
|
397
54
|
uniform float fadeDistance;
|
|
398
55
|
uniform float fadeStrength;
|
|
56
|
+
uniform float fadeFrom;
|
|
399
57
|
uniform float cellThickness;
|
|
400
58
|
uniform float sectionThickness;
|
|
401
59
|
|
|
@@ -410,7 +68,8 @@ const GridMaterial = shaderMaterial({
|
|
|
410
68
|
float g1 = getGrid(cellSize, cellThickness);
|
|
411
69
|
float g2 = getGrid(sectionSize, sectionThickness);
|
|
412
70
|
|
|
413
|
-
|
|
71
|
+
vec3 from = worldCamProjPosition*vec3(fadeFrom);
|
|
72
|
+
float dist = distance(from, worldPosition.xyz);
|
|
414
73
|
float d = 1.0 - min(dist / fadeDistance, 1.0);
|
|
415
74
|
vec3 color = mix(cellColor, sectionColor, min(1.0, sectionThickness * g2));
|
|
416
75
|
|
|
@@ -419,288 +78,10 @@ const GridMaterial = shaderMaterial({
|
|
|
419
78
|
if (gl_FragColor.a <= 0.0) discard;
|
|
420
79
|
|
|
421
80
|
#include <tonemapping_fragment>
|
|
422
|
-
#include <${
|
|
81
|
+
#include <${getVersion() >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
423
82
|
}
|
|
424
83
|
`);
|
|
425
84
|
|
|
426
|
-
const NGTS_DISTORT_MATERIAL_SHADER = new InjectionToken('DistortMaterialShader');
|
|
427
|
-
function injectNgtsMeshDistortMaterial() {
|
|
428
|
-
return inject(NGTS_DISTORT_MATERIAL_SHADER);
|
|
429
|
-
}
|
|
430
|
-
function createMeshDistortMaterial(distortShader) {
|
|
431
|
-
return class extends THREE.MeshPhysicalMaterial {
|
|
432
|
-
constructor(parameters = {}) {
|
|
433
|
-
super(parameters);
|
|
434
|
-
this.setValues(parameters);
|
|
435
|
-
this._time = { value: 0 };
|
|
436
|
-
this._distort = { value: 0.4 };
|
|
437
|
-
this._radius = { value: 1 };
|
|
438
|
-
}
|
|
439
|
-
onBeforeCompile(shader) {
|
|
440
|
-
shader.uniforms['time'] = this._time;
|
|
441
|
-
shader.uniforms['radius'] = this._radius;
|
|
442
|
-
shader.uniforms['distort'] = this._distort;
|
|
443
|
-
shader.vertexShader = `
|
|
444
|
-
uniform float time;
|
|
445
|
-
uniform float radius;
|
|
446
|
-
uniform float distort;
|
|
447
|
-
${distortShader}
|
|
448
|
-
${shader.vertexShader}
|
|
449
|
-
`;
|
|
450
|
-
shader.vertexShader = shader.vertexShader.replace('#include <begin_vertex>', `
|
|
451
|
-
float updateTime = time / 50.0;
|
|
452
|
-
float noise = snoise(vec3(position / 2.0 + updateTime * 5.0));
|
|
453
|
-
vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius));
|
|
454
|
-
`);
|
|
455
|
-
}
|
|
456
|
-
get time() {
|
|
457
|
-
return this._time.value;
|
|
458
|
-
}
|
|
459
|
-
set time(v) {
|
|
460
|
-
this._time.value = v;
|
|
461
|
-
}
|
|
462
|
-
get distort() {
|
|
463
|
-
return this._distort.value;
|
|
464
|
-
}
|
|
465
|
-
set distort(v) {
|
|
466
|
-
this._distort.value = v;
|
|
467
|
-
}
|
|
468
|
-
get radius() {
|
|
469
|
-
return this._radius.value;
|
|
470
|
-
}
|
|
471
|
-
set radius(v) {
|
|
472
|
-
this._radius.value = v;
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
function provideNgtsMeshDistortMaterialShader(distortShader) {
|
|
477
|
-
return { provide: NGTS_DISTORT_MATERIAL_SHADER, useFactory: () => createMeshDistortMaterial(distortShader) };
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
class MeshReflectorMaterial extends MeshStandardMaterial {
|
|
481
|
-
constructor(parameters = {}) {
|
|
482
|
-
super(parameters);
|
|
483
|
-
this._tDepth = { value: null };
|
|
484
|
-
this._distortionMap = { value: null };
|
|
485
|
-
this._tDiffuse = { value: null };
|
|
486
|
-
this._tDiffuseBlur = { value: null };
|
|
487
|
-
this._textureMatrix = { value: null };
|
|
488
|
-
this._hasBlur = { value: false };
|
|
489
|
-
this._mirror = { value: 0.0 };
|
|
490
|
-
this._mixBlur = { value: 0.0 };
|
|
491
|
-
this._blurStrength = { value: 0.5 };
|
|
492
|
-
this._minDepthThreshold = { value: 0.9 };
|
|
493
|
-
this._maxDepthThreshold = { value: 1 };
|
|
494
|
-
this._depthScale = { value: 0 };
|
|
495
|
-
this._depthToBlurRatioBias = { value: 0.25 };
|
|
496
|
-
this._distortion = { value: 1 };
|
|
497
|
-
this._mixContrast = { value: 1.0 };
|
|
498
|
-
this.setValues(parameters);
|
|
499
|
-
}
|
|
500
|
-
onBeforeCompile(shader) {
|
|
501
|
-
if (!shader.defines?.USE_UV) {
|
|
502
|
-
shader.defines.USE_UV = '';
|
|
503
|
-
}
|
|
504
|
-
shader.uniforms.hasBlur = this._hasBlur;
|
|
505
|
-
shader.uniforms.tDiffuse = this._tDiffuse;
|
|
506
|
-
shader.uniforms.tDepth = this._tDepth;
|
|
507
|
-
shader.uniforms.distortionMap = this._distortionMap;
|
|
508
|
-
shader.uniforms.tDiffuseBlur = this._tDiffuseBlur;
|
|
509
|
-
shader.uniforms.textureMatrix = this._textureMatrix;
|
|
510
|
-
shader.uniforms.mirror = this._mirror;
|
|
511
|
-
shader.uniforms.mixBlur = this._mixBlur;
|
|
512
|
-
shader.uniforms.mixStrength = this._blurStrength;
|
|
513
|
-
shader.uniforms.minDepthThreshold = this._minDepthThreshold;
|
|
514
|
-
shader.uniforms.maxDepthThreshold = this._maxDepthThreshold;
|
|
515
|
-
shader.uniforms.depthScale = this._depthScale;
|
|
516
|
-
shader.uniforms.depthToBlurRatioBias = this._depthToBlurRatioBias;
|
|
517
|
-
shader.uniforms.distortion = this._distortion;
|
|
518
|
-
shader.uniforms.mixContrast = this._mixContrast;
|
|
519
|
-
shader.vertexShader = `
|
|
520
|
-
uniform mat4 textureMatrix;
|
|
521
|
-
varying vec4 my_vUv;
|
|
522
|
-
${shader.vertexShader}`;
|
|
523
|
-
shader.vertexShader = shader.vertexShader.replace('#include <project_vertex>', `#include <project_vertex>
|
|
524
|
-
my_vUv = textureMatrix * vec4( position, 1.0 );
|
|
525
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );`);
|
|
526
|
-
shader.fragmentShader = `
|
|
527
|
-
uniform sampler2D tDiffuse;
|
|
528
|
-
uniform sampler2D tDiffuseBlur;
|
|
529
|
-
uniform sampler2D tDepth;
|
|
530
|
-
uniform sampler2D distortionMap;
|
|
531
|
-
uniform float distortion;
|
|
532
|
-
uniform float cameraNear;
|
|
533
|
-
uniform float cameraFar;
|
|
534
|
-
uniform bool hasBlur;
|
|
535
|
-
uniform float mixBlur;
|
|
536
|
-
uniform float mirror;
|
|
537
|
-
uniform float mixStrength;
|
|
538
|
-
uniform float minDepthThreshold;
|
|
539
|
-
uniform float maxDepthThreshold;
|
|
540
|
-
uniform float mixContrast;
|
|
541
|
-
uniform float depthScale;
|
|
542
|
-
uniform float depthToBlurRatioBias;
|
|
543
|
-
varying vec4 my_vUv;
|
|
544
|
-
${shader.fragmentShader}`;
|
|
545
|
-
shader.fragmentShader = shader.fragmentShader.replace('#include <emissivemap_fragment>', `#include <emissivemap_fragment>
|
|
546
|
-
|
|
547
|
-
float distortionFactor = 0.0;
|
|
548
|
-
#ifdef USE_DISTORTION
|
|
549
|
-
distortionFactor = texture2D(distortionMap, vUv).r * distortion;
|
|
550
|
-
#endif
|
|
551
|
-
|
|
552
|
-
vec4 new_vUv = my_vUv;
|
|
553
|
-
new_vUv.x += distortionFactor;
|
|
554
|
-
new_vUv.y += distortionFactor;
|
|
555
|
-
|
|
556
|
-
vec4 base = texture2DProj(tDiffuse, new_vUv);
|
|
557
|
-
vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);
|
|
558
|
-
|
|
559
|
-
vec4 merge = base;
|
|
560
|
-
|
|
561
|
-
#ifdef USE_NORMALMAP
|
|
562
|
-
vec2 normal_uv = vec2(0.0);
|
|
563
|
-
vec4 normalColor = texture2D(normalMap, vUv * normalScale);
|
|
564
|
-
vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
|
|
565
|
-
vec3 coord = new_vUv.xyz / new_vUv.w;
|
|
566
|
-
normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;
|
|
567
|
-
vec4 base_normal = texture2D(tDiffuse, normal_uv);
|
|
568
|
-
vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);
|
|
569
|
-
merge = base_normal;
|
|
570
|
-
blur = blur_normal;
|
|
571
|
-
#endif
|
|
572
|
-
|
|
573
|
-
float depthFactor = 0.0001;
|
|
574
|
-
float blurFactor = 0.0;
|
|
575
|
-
|
|
576
|
-
#ifdef USE_DEPTH
|
|
577
|
-
vec4 depth = texture2DProj(tDepth, new_vUv);
|
|
578
|
-
depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));
|
|
579
|
-
depthFactor *= depthScale;
|
|
580
|
-
depthFactor = max(0.0001, min(1.0, depthFactor));
|
|
581
|
-
|
|
582
|
-
#ifdef USE_BLUR
|
|
583
|
-
blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);
|
|
584
|
-
merge = merge * min(1.0, depthFactor + 0.5);
|
|
585
|
-
#else
|
|
586
|
-
merge = merge * depthFactor;
|
|
587
|
-
#endif
|
|
588
|
-
|
|
589
|
-
#endif
|
|
590
|
-
|
|
591
|
-
float reflectorRoughnessFactor = roughness;
|
|
592
|
-
#ifdef USE_ROUGHNESSMAP
|
|
593
|
-
vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );
|
|
594
|
-
reflectorRoughnessFactor *= reflectorTexelRoughness.g;
|
|
595
|
-
#endif
|
|
596
|
-
|
|
597
|
-
#ifdef USE_BLUR
|
|
598
|
-
blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);
|
|
599
|
-
merge = mix(merge, blur, blurFactor);
|
|
600
|
-
#endif
|
|
601
|
-
|
|
602
|
-
vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);
|
|
603
|
-
newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;
|
|
604
|
-
newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;
|
|
605
|
-
newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;
|
|
606
|
-
|
|
607
|
-
diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);
|
|
608
|
-
`);
|
|
609
|
-
}
|
|
610
|
-
get tDiffuse() {
|
|
611
|
-
return this._tDiffuse.value;
|
|
612
|
-
}
|
|
613
|
-
set tDiffuse(v) {
|
|
614
|
-
this._tDiffuse.value = v;
|
|
615
|
-
}
|
|
616
|
-
get tDepth() {
|
|
617
|
-
return this._tDepth.value;
|
|
618
|
-
}
|
|
619
|
-
set tDepth(v) {
|
|
620
|
-
this._tDepth.value = v;
|
|
621
|
-
}
|
|
622
|
-
get distortionMap() {
|
|
623
|
-
return this._distortionMap.value;
|
|
624
|
-
}
|
|
625
|
-
set distortionMap(v) {
|
|
626
|
-
this._distortionMap.value = v;
|
|
627
|
-
}
|
|
628
|
-
get tDiffuseBlur() {
|
|
629
|
-
return this._tDiffuseBlur.value;
|
|
630
|
-
}
|
|
631
|
-
set tDiffuseBlur(v) {
|
|
632
|
-
this._tDiffuseBlur.value = v;
|
|
633
|
-
}
|
|
634
|
-
get textureMatrix() {
|
|
635
|
-
return this._textureMatrix.value;
|
|
636
|
-
}
|
|
637
|
-
set textureMatrix(v) {
|
|
638
|
-
this._textureMatrix.value = v;
|
|
639
|
-
}
|
|
640
|
-
get hasBlur() {
|
|
641
|
-
return this._hasBlur.value;
|
|
642
|
-
}
|
|
643
|
-
set hasBlur(v) {
|
|
644
|
-
this._hasBlur.value = v;
|
|
645
|
-
}
|
|
646
|
-
get mirror() {
|
|
647
|
-
return this._mirror.value;
|
|
648
|
-
}
|
|
649
|
-
set mirror(v) {
|
|
650
|
-
this._mirror.value = v;
|
|
651
|
-
}
|
|
652
|
-
get mixBlur() {
|
|
653
|
-
return this._mixBlur.value;
|
|
654
|
-
}
|
|
655
|
-
set mixBlur(v) {
|
|
656
|
-
this._mixBlur.value = v;
|
|
657
|
-
}
|
|
658
|
-
get mixStrength() {
|
|
659
|
-
return this._blurStrength.value;
|
|
660
|
-
}
|
|
661
|
-
set mixStrength(v) {
|
|
662
|
-
this._blurStrength.value = v;
|
|
663
|
-
}
|
|
664
|
-
get minDepthThreshold() {
|
|
665
|
-
return this._minDepthThreshold.value;
|
|
666
|
-
}
|
|
667
|
-
set minDepthThreshold(v) {
|
|
668
|
-
this._minDepthThreshold.value = v;
|
|
669
|
-
}
|
|
670
|
-
get maxDepthThreshold() {
|
|
671
|
-
return this._maxDepthThreshold.value;
|
|
672
|
-
}
|
|
673
|
-
set maxDepthThreshold(v) {
|
|
674
|
-
this._maxDepthThreshold.value = v;
|
|
675
|
-
}
|
|
676
|
-
get depthScale() {
|
|
677
|
-
return this._depthScale.value;
|
|
678
|
-
}
|
|
679
|
-
set depthScale(v) {
|
|
680
|
-
this._depthScale.value = v;
|
|
681
|
-
}
|
|
682
|
-
get depthToBlurRatioBias() {
|
|
683
|
-
return this._depthToBlurRatioBias.value;
|
|
684
|
-
}
|
|
685
|
-
set depthToBlurRatioBias(v) {
|
|
686
|
-
this._depthToBlurRatioBias.value = v;
|
|
687
|
-
}
|
|
688
|
-
get distortion() {
|
|
689
|
-
return this._distortion.value;
|
|
690
|
-
}
|
|
691
|
-
set distortion(v) {
|
|
692
|
-
this._distortion.value = v;
|
|
693
|
-
}
|
|
694
|
-
get mixContrast() {
|
|
695
|
-
return this._mixContrast.value;
|
|
696
|
-
}
|
|
697
|
-
set mixContrast(v) {
|
|
698
|
-
this._mixContrast.value = v;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Author: N8Programs
|
|
703
|
-
// https://github.com/N8python/diamonds
|
|
704
85
|
const MeshRefractionMaterial = shaderMaterial({
|
|
705
86
|
envMap: null,
|
|
706
87
|
bounces: 3,
|
|
@@ -708,25 +89,26 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
708
89
|
correctMips: true,
|
|
709
90
|
aberrationStrength: 0.01,
|
|
710
91
|
fresnel: 0,
|
|
711
|
-
// @ts-expect-error
|
|
92
|
+
// @ts-expect-error - UniformValue from pmndrs/vanilla does not include MeshBVHUniformStruct
|
|
712
93
|
bvh: new MeshBVHUniformStruct(),
|
|
713
94
|
color: new THREE.Color('white'),
|
|
95
|
+
opacity: 1,
|
|
714
96
|
resolution: new THREE.Vector2(),
|
|
715
97
|
viewMatrixInverse: new THREE.Matrix4(),
|
|
716
98
|
projectionMatrixInverse: new THREE.Matrix4(),
|
|
717
99
|
},
|
|
718
|
-
/*glsl*/ `
|
|
100
|
+
/* language=glsl glsl */ `
|
|
719
101
|
uniform mat4 viewMatrixInverse;
|
|
720
102
|
|
|
721
103
|
varying vec3 vWorldPosition;
|
|
722
104
|
varying vec3 vNormal;
|
|
723
105
|
varying mat4 vModelMatrixInverse;
|
|
724
106
|
|
|
725
|
-
#
|
|
726
|
-
varying vec3 vInstanceColor;
|
|
727
|
-
#endif
|
|
107
|
+
#include <color_pars_vertex>
|
|
728
108
|
|
|
729
109
|
void main() {
|
|
110
|
+
#include <color_vertex>
|
|
111
|
+
|
|
730
112
|
vec4 transformedNormal = vec4(normal, 0.0);
|
|
731
113
|
vec4 transformedPosition = vec4(position, 1.0);
|
|
732
114
|
#ifdef USE_INSTANCING
|
|
@@ -740,15 +122,11 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
740
122
|
vModelMatrixInverse = inverse(modelMatrix);
|
|
741
123
|
#endif
|
|
742
124
|
|
|
743
|
-
#ifdef USE_INSTANCING_COLOR
|
|
744
|
-
vInstanceColor = instanceColor.rgb;
|
|
745
|
-
#endif
|
|
746
|
-
|
|
747
125
|
vWorldPosition = (modelMatrix * transformedPosition).xyz;
|
|
748
126
|
vNormal = normalize((viewMatrixInverse * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz);
|
|
749
127
|
gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformedPosition;
|
|
750
128
|
}`,
|
|
751
|
-
/*glsl*/ `
|
|
129
|
+
/* language=glsl glsl */ `
|
|
752
130
|
#define ENVMAP_TYPE_CUBE_UV
|
|
753
131
|
precision highp isampler2D;
|
|
754
132
|
precision highp usampler2D;
|
|
@@ -756,9 +134,7 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
756
134
|
varying vec3 vNormal;
|
|
757
135
|
varying mat4 vModelMatrixInverse;
|
|
758
136
|
|
|
759
|
-
#
|
|
760
|
-
varying vec3 vInstanceColor;
|
|
761
|
-
#endif
|
|
137
|
+
#include <color_pars_fragment>
|
|
762
138
|
|
|
763
139
|
#ifdef ENVMAP_TYPE_CUBEM
|
|
764
140
|
uniform samplerCube envMap;
|
|
@@ -779,6 +155,7 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
779
155
|
uniform mat4 viewMatrixInverse;
|
|
780
156
|
uniform float aberrationStrength;
|
|
781
157
|
uniform vec3 color;
|
|
158
|
+
uniform float opacity;
|
|
782
159
|
|
|
783
160
|
float fresnelFunc(vec3 viewDirection, vec3 worldNormal) {
|
|
784
161
|
return pow( 1.0 + dot( viewDirection, worldNormal), 10.0 );
|
|
@@ -834,7 +211,10 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
834
211
|
vec3 normal = vNormal;
|
|
835
212
|
vec3 rayOrigin = cameraPosition;
|
|
836
213
|
vec3 rayDirection = normalize(vWorldPosition - cameraPosition);
|
|
837
|
-
|
|
214
|
+
|
|
215
|
+
vec4 diffuseColor = vec4(color, opacity);
|
|
216
|
+
#include <color_fragment>
|
|
217
|
+
|
|
838
218
|
#ifdef CHROMATIC_ABERRATIONS
|
|
839
219
|
vec3 rayDirectionG = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
|
|
840
220
|
#ifdef FAST_CHROMA
|
|
@@ -847,743 +227,23 @@ const MeshRefractionMaterial = shaderMaterial({
|
|
|
847
227
|
float finalColorR = textureGradient(envMap, rayDirectionR, directionCamPerfect).r;
|
|
848
228
|
float finalColorG = textureGradient(envMap, rayDirectionG, directionCamPerfect).g;
|
|
849
229
|
float finalColorB = textureGradient(envMap, rayDirectionB, directionCamPerfect).b;
|
|
850
|
-
|
|
230
|
+
diffuseColor.rgb *= vec3(finalColorR, finalColorG, finalColorB);
|
|
851
231
|
#else
|
|
852
232
|
rayDirection = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
|
|
853
|
-
|
|
854
|
-
#endif
|
|
855
|
-
|
|
856
|
-
finalColor *= color;
|
|
857
|
-
#ifdef USE_INSTANCING_COLOR
|
|
858
|
-
finalColor *= vInstanceColor;
|
|
233
|
+
diffuseColor.rgb *= textureGradient(envMap, rayDirection, directionCamPerfect).rgb;
|
|
859
234
|
#endif
|
|
860
235
|
|
|
861
236
|
vec3 viewDirection = normalize(vWorldPosition - cameraPosition);
|
|
862
237
|
float nFresnel = fresnelFunc(viewDirection, normal) * fresnel;
|
|
863
|
-
gl_FragColor = vec4(mix(
|
|
238
|
+
gl_FragColor = vec4(mix(diffuseColor.rgb, vec3(1.0), nFresnel), diffuseColor.a);
|
|
239
|
+
|
|
864
240
|
#include <tonemapping_fragment>
|
|
865
|
-
#include <${
|
|
241
|
+
#include <${getVersion() >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
866
242
|
}`);
|
|
867
243
|
|
|
868
|
-
class MeshTransmissionMaterial extends THREE.MeshPhysicalMaterial {
|
|
869
|
-
constructor(samples = 6, transmissionSampler = false) {
|
|
870
|
-
super();
|
|
871
|
-
this.uniforms = {
|
|
872
|
-
chromaticAberration: { value: 0.05 },
|
|
873
|
-
// Transmission must always be 0, unless transmissionSampler is being used
|
|
874
|
-
transmission: { value: 0 },
|
|
875
|
-
// Instead a workaround is used, see below for reasons why
|
|
876
|
-
_transmission: { value: 1 },
|
|
877
|
-
transmissionMap: { value: null },
|
|
878
|
-
// Roughness is 1 in THREE.MeshPhysicalMaterial but it makes little sense in a transmission material
|
|
879
|
-
roughness: { value: 0 },
|
|
880
|
-
thickness: { value: 0 },
|
|
881
|
-
thicknessMap: { value: null },
|
|
882
|
-
attenuationDistance: { value: Infinity },
|
|
883
|
-
attenuationColor: { value: new THREE.Color('white') },
|
|
884
|
-
anisotropicBlur: { value: 0.1 },
|
|
885
|
-
time: { value: 0 },
|
|
886
|
-
distortion: { value: 0.0 },
|
|
887
|
-
distortionScale: { value: 0.5 },
|
|
888
|
-
temporalDistortion: { value: 0.0 },
|
|
889
|
-
buffer: { value: null },
|
|
890
|
-
};
|
|
891
|
-
this.onBeforeCompile = (shader) => {
|
|
892
|
-
shader.uniforms = {
|
|
893
|
-
...shader.uniforms,
|
|
894
|
-
...this.uniforms,
|
|
895
|
-
};
|
|
896
|
-
// If the transmission sampler is active inject a flag
|
|
897
|
-
if (transmissionSampler)
|
|
898
|
-
shader.defines['USE_SAMPLER'] = '';
|
|
899
|
-
// Otherwise we do use use .transmission and must therefore force USE_TRANSMISSION
|
|
900
|
-
// because threejs won't inject it for us
|
|
901
|
-
else
|
|
902
|
-
shader.defines['USE_TRANSMISSION'] = '';
|
|
903
|
-
// Head
|
|
904
|
-
shader.fragmentShader =
|
|
905
|
-
/*glsl*/ `
|
|
906
|
-
uniform float chromaticAberration;
|
|
907
|
-
uniform float anisotropicBlur;
|
|
908
|
-
uniform float time;
|
|
909
|
-
uniform float distortion;
|
|
910
|
-
uniform float distortionScale;
|
|
911
|
-
uniform float temporalDistortion;
|
|
912
|
-
uniform sampler2D buffer;
|
|
913
|
-
|
|
914
|
-
vec3 random3(vec3 c) {
|
|
915
|
-
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
|
|
916
|
-
vec3 r;
|
|
917
|
-
r.z = fract(512.0*j);
|
|
918
|
-
j *= .125;
|
|
919
|
-
r.x = fract(512.0*j);
|
|
920
|
-
j *= .125;
|
|
921
|
-
r.y = fract(512.0*j);
|
|
922
|
-
return r-0.5;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
float seed = 0.0;
|
|
926
|
-
uint hash( uint x ) {
|
|
927
|
-
x += ( x << 10u );
|
|
928
|
-
x ^= ( x >> 6u );
|
|
929
|
-
x += ( x << 3u );
|
|
930
|
-
x ^= ( x >> 11u );
|
|
931
|
-
x += ( x << 15u );
|
|
932
|
-
return x;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// Compound versions of the hashing algorithm I whipped together.
|
|
936
|
-
uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y) ); }
|
|
937
|
-
uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); }
|
|
938
|
-
uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); }
|
|
939
|
-
|
|
940
|
-
// Construct a float with half-open range [0:1] using low 23 bits.
|
|
941
|
-
// All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0.
|
|
942
|
-
float floatConstruct( uint m ) {
|
|
943
|
-
const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask
|
|
944
|
-
const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32
|
|
945
|
-
m &= ieeeMantissa; // Keep only mantissa bits (fractional part)
|
|
946
|
-
m |= ieeeOne; // Add fractional part to 1.0
|
|
947
|
-
float f = uintBitsToFloat( m ); // Range [1:2]
|
|
948
|
-
return f - 1.0; // Range [0:1]
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
// Pseudo-random value in half-open range [0:1].
|
|
952
|
-
float random( float x ) { return floatConstruct(hash(floatBitsToUint(x))); }
|
|
953
|
-
float random( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); }
|
|
954
|
-
float random( vec3 v ) { return floatConstruct(hash(floatBitsToUint(v))); }
|
|
955
|
-
float random( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); }
|
|
956
|
-
|
|
957
|
-
float rand() {
|
|
958
|
-
float result = random(vec3(gl_FragCoord.xy, seed));
|
|
959
|
-
seed += 1.0;
|
|
960
|
-
return result;
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
const float F3 = 0.3333333;
|
|
964
|
-
const float G3 = 0.1666667;
|
|
965
|
-
|
|
966
|
-
float snoise(vec3 p) {
|
|
967
|
-
vec3 s = floor(p + dot(p, vec3(F3)));
|
|
968
|
-
vec3 x = p - s + dot(s, vec3(G3));
|
|
969
|
-
vec3 e = step(vec3(0.0), x - x.yzx);
|
|
970
|
-
vec3 i1 = e*(1.0 - e.zxy);
|
|
971
|
-
vec3 i2 = 1.0 - e.zxy*(1.0 - e);
|
|
972
|
-
vec3 x1 = x - i1 + G3;
|
|
973
|
-
vec3 x2 = x - i2 + 2.0*G3;
|
|
974
|
-
vec3 x3 = x - 1.0 + 3.0*G3;
|
|
975
|
-
vec4 w, d;
|
|
976
|
-
w.x = dot(x, x);
|
|
977
|
-
w.y = dot(x1, x1);
|
|
978
|
-
w.z = dot(x2, x2);
|
|
979
|
-
w.w = dot(x3, x3);
|
|
980
|
-
w = max(0.6 - w, 0.0);
|
|
981
|
-
d.x = dot(random3(s), x);
|
|
982
|
-
d.y = dot(random3(s + i1), x1);
|
|
983
|
-
d.z = dot(random3(s + i2), x2);
|
|
984
|
-
d.w = dot(random3(s + 1.0), x3);
|
|
985
|
-
w *= w;
|
|
986
|
-
w *= w;
|
|
987
|
-
d *= w;
|
|
988
|
-
return dot(d, vec4(52.0));
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
float snoiseFractal(vec3 m) {
|
|
992
|
-
return 0.5333333* snoise(m)
|
|
993
|
-
+0.2666667* snoise(2.0*m)
|
|
994
|
-
+0.1333333* snoise(4.0*m)
|
|
995
|
-
+0.0666667* snoise(8.0*m);
|
|
996
|
-
}\n` + shader.fragmentShader;
|
|
997
|
-
// Remove transmission
|
|
998
|
-
shader.fragmentShader = shader.fragmentShader.replace('#include <transmission_pars_fragment>',
|
|
999
|
-
/*glsl*/ `
|
|
1000
|
-
#ifdef USE_TRANSMISSION
|
|
1001
|
-
// Transmission code is based on glTF-Sampler-Viewer
|
|
1002
|
-
// https://github.com/KhronosGroup/glTF-Sample-Viewer
|
|
1003
|
-
uniform float _transmission;
|
|
1004
|
-
uniform float thickness;
|
|
1005
|
-
uniform float attenuationDistance;
|
|
1006
|
-
uniform vec3 attenuationColor;
|
|
1007
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
1008
|
-
uniform sampler2D transmissionMap;
|
|
1009
|
-
#endif
|
|
1010
|
-
#ifdef USE_THICKNESSMAP
|
|
1011
|
-
uniform sampler2D thicknessMap;
|
|
1012
|
-
#endif
|
|
1013
|
-
uniform vec2 transmissionSamplerSize;
|
|
1014
|
-
uniform sampler2D transmissionSamplerMap;
|
|
1015
|
-
uniform mat4 modelMatrix;
|
|
1016
|
-
uniform mat4 projectionMatrix;
|
|
1017
|
-
varying vec3 vWorldPosition;
|
|
1018
|
-
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
1019
|
-
// Direction of refracted light.
|
|
1020
|
-
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
1021
|
-
// Compute rotation-independant scaling of the model matrix.
|
|
1022
|
-
vec3 modelScale;
|
|
1023
|
-
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
1024
|
-
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
1025
|
-
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
1026
|
-
// The thickness is specified in local space.
|
|
1027
|
-
return normalize( refractionVector ) * thickness * modelScale;
|
|
1028
|
-
}
|
|
1029
|
-
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
1030
|
-
// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
|
|
1031
|
-
// an IOR of 1.5 results in the default amount of microfacet refraction.
|
|
1032
|
-
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
1033
|
-
}
|
|
1034
|
-
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
1035
|
-
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
1036
|
-
#ifdef USE_SAMPLER
|
|
1037
|
-
#ifdef texture2DLodEXT
|
|
1038
|
-
return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod);
|
|
1039
|
-
#else
|
|
1040
|
-
return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod);
|
|
1041
|
-
#endif
|
|
1042
|
-
#else
|
|
1043
|
-
return texture2D(buffer, fragCoord.xy);
|
|
1044
|
-
#endif
|
|
1045
|
-
}
|
|
1046
|
-
vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
1047
|
-
if ( isinf( attenuationDistance ) ) {
|
|
1048
|
-
// Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all.
|
|
1049
|
-
return radiance;
|
|
1050
|
-
} else {
|
|
1051
|
-
// Compute light attenuation using Beer's law.
|
|
1052
|
-
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
1053
|
-
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law
|
|
1054
|
-
return transmittance * radiance;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
1058
|
-
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
1059
|
-
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
|
|
1060
|
-
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
1061
|
-
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
1062
|
-
vec3 refractedRayExit = position + transmissionRay;
|
|
1063
|
-
// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
|
|
1064
|
-
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
1065
|
-
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
1066
|
-
refractionCoords += 1.0;
|
|
1067
|
-
refractionCoords /= 2.0;
|
|
1068
|
-
// Sample framebuffer to get pixel the refracted ray hits.
|
|
1069
|
-
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
1070
|
-
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
1071
|
-
// Get the specular component.
|
|
1072
|
-
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
1073
|
-
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
|
|
1074
|
-
}
|
|
1075
|
-
#endif\n`);
|
|
1076
|
-
// Add refraction
|
|
1077
|
-
shader.fragmentShader = shader.fragmentShader.replace('#include <transmission_fragment>',
|
|
1078
|
-
/*glsl*/ `
|
|
1079
|
-
// Improve the refraction to use the world pos
|
|
1080
|
-
material.transmission = _transmission;
|
|
1081
|
-
material.transmissionAlpha = 1.0;
|
|
1082
|
-
material.thickness = thickness;
|
|
1083
|
-
material.attenuationDistance = attenuationDistance;
|
|
1084
|
-
material.attenuationColor = attenuationColor;
|
|
1085
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
1086
|
-
material.transmission *= texture2D( transmissionMap, vUv ).r;
|
|
1087
|
-
#endif
|
|
1088
|
-
#ifdef USE_THICKNESSMAP
|
|
1089
|
-
material.thickness *= texture2D( thicknessMap, vUv ).g;
|
|
1090
|
-
#endif
|
|
1091
|
-
|
|
1092
|
-
vec3 pos = vWorldPosition;
|
|
1093
|
-
vec3 v = normalize( cameraPosition - pos );
|
|
1094
|
-
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
1095
|
-
vec3 transmission = vec3(0.0);
|
|
1096
|
-
float transmissionR, transmissionB, transmissionG;
|
|
1097
|
-
float randomCoords = rand();
|
|
1098
|
-
float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur);
|
|
1099
|
-
vec3 distortionNormal = vec3(0.0);
|
|
1100
|
-
vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion;
|
|
1101
|
-
if (distortion > 0.0) {
|
|
1102
|
-
distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset)));
|
|
1103
|
-
}
|
|
1104
|
-
for (float i = 0.0; i < ${samples}.0; i ++) {
|
|
1105
|
-
vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand() - 0.5, rand() - 0.5, rand() - 0.5)) * pow(rand(), 0.33) + distortionNormal);
|
|
1106
|
-
transmissionR = getIBLVolumeRefraction(
|
|
1107
|
-
sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|
1108
|
-
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness + thickness_smear * (i + randomCoords) / float(${samples}),
|
|
1109
|
-
material.attenuationColor, material.attenuationDistance
|
|
1110
|
-
).r;
|
|
1111
|
-
transmissionG = getIBLVolumeRefraction(
|
|
1112
|
-
sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|
1113
|
-
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + chromaticAberration * (i + randomCoords) / float(${samples})) , material.thickness + thickness_smear * (i + randomCoords) / float(${samples}),
|
|
1114
|
-
material.attenuationColor, material.attenuationDistance
|
|
1115
|
-
).g;
|
|
1116
|
-
transmissionB = getIBLVolumeRefraction(
|
|
1117
|
-
sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|
1118
|
-
pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${samples})), material.thickness + thickness_smear * (i + randomCoords) / float(${samples}),
|
|
1119
|
-
material.attenuationColor, material.attenuationDistance
|
|
1120
|
-
).b;
|
|
1121
|
-
transmission.r += transmissionR;
|
|
1122
|
-
transmission.g += transmissionG;
|
|
1123
|
-
transmission.b += transmissionB;
|
|
1124
|
-
}
|
|
1125
|
-
transmission /= ${samples}.0;
|
|
1126
|
-
totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n`);
|
|
1127
|
-
};
|
|
1128
|
-
Object.keys(this.uniforms).forEach((name) => Object.defineProperty(this, name, {
|
|
1129
|
-
get: () => this.uniforms[name].value,
|
|
1130
|
-
set: (v) => (this.uniforms[name].value = v),
|
|
1131
|
-
}));
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
class MeshWobbleMaterial extends THREE.MeshStandardMaterial {
|
|
1136
|
-
constructor(parameters = {}) {
|
|
1137
|
-
super(parameters);
|
|
1138
|
-
this.setValues(parameters);
|
|
1139
|
-
this._time = { value: 0 };
|
|
1140
|
-
this._factor = { value: 1 };
|
|
1141
|
-
}
|
|
1142
|
-
onBeforeCompile(shader) {
|
|
1143
|
-
shader.uniforms['time'] = this._time;
|
|
1144
|
-
shader.uniforms['factor'] = this._factor;
|
|
1145
|
-
shader.vertexShader = `
|
|
1146
|
-
uniform float time;
|
|
1147
|
-
uniform float factor;
|
|
1148
|
-
${shader.vertexShader}
|
|
1149
|
-
`;
|
|
1150
|
-
shader.vertexShader = shader.vertexShader.replace('#include <begin_vertex>', `float theta = sin( time + position.y ) / 2.0 * factor;
|
|
1151
|
-
float c = cos( theta );
|
|
1152
|
-
float s = sin( theta );
|
|
1153
|
-
mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
|
|
1154
|
-
vec3 transformed = vec3( position ) * m;
|
|
1155
|
-
vNormal = vNormal * m;`);
|
|
1156
|
-
}
|
|
1157
|
-
get time() {
|
|
1158
|
-
return this._time.value;
|
|
1159
|
-
}
|
|
1160
|
-
set time(v) {
|
|
1161
|
-
this._time.value = v;
|
|
1162
|
-
}
|
|
1163
|
-
get factor() {
|
|
1164
|
-
return this._factor.value;
|
|
1165
|
-
}
|
|
1166
|
-
set factor(v) {
|
|
1167
|
-
this._factor.value = v;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
const SoftShadowMaterial = shaderMaterial({
|
|
1172
|
-
color: new THREE.Color(),
|
|
1173
|
-
blend: 2.0,
|
|
1174
|
-
alphaTest: 0.75,
|
|
1175
|
-
opacity: 0,
|
|
1176
|
-
map: null,
|
|
1177
|
-
}, `varying vec2 vUv;
|
|
1178
|
-
void main() {
|
|
1179
|
-
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
|
|
1180
|
-
vUv = uv;
|
|
1181
|
-
}`, `varying vec2 vUv;
|
|
1182
|
-
uniform sampler2D map;
|
|
1183
|
-
uniform vec3 color;
|
|
1184
|
-
uniform float opacity;
|
|
1185
|
-
uniform float alphaTest;
|
|
1186
|
-
uniform float blend;
|
|
1187
|
-
void main() {
|
|
1188
|
-
vec4 sampledDiffuseColor = texture2D(map, vUv);
|
|
1189
|
-
gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity);
|
|
1190
|
-
#include <tonemapping_fragment>
|
|
1191
|
-
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
1192
|
-
}`);
|
|
1193
|
-
|
|
1194
|
-
const SparklesMaterial = shaderMaterial({ time: 0, pixelRatio: 1 }, ` uniform float pixelRatio;
|
|
1195
|
-
uniform float time;
|
|
1196
|
-
attribute float size;
|
|
1197
|
-
attribute float speed;
|
|
1198
|
-
attribute float opacity;
|
|
1199
|
-
attribute vec3 noise;
|
|
1200
|
-
attribute vec3 color;
|
|
1201
|
-
varying vec3 vColor;
|
|
1202
|
-
varying float vOpacity;
|
|
1203
|
-
void main() {
|
|
1204
|
-
vec4 modelPosition = modelMatrix * vec4(position, 1.0);
|
|
1205
|
-
modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;
|
|
1206
|
-
modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;
|
|
1207
|
-
modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;
|
|
1208
|
-
vec4 viewPosition = viewMatrix * modelPosition;
|
|
1209
|
-
vec4 projectionPostion = projectionMatrix * viewPosition;
|
|
1210
|
-
gl_Position = projectionPostion;
|
|
1211
|
-
gl_PointSize = size * 25. * pixelRatio;
|
|
1212
|
-
gl_PointSize *= (1.0 / - viewPosition.z);
|
|
1213
|
-
vColor = color;
|
|
1214
|
-
vOpacity = opacity;
|
|
1215
|
-
}`, ` varying vec3 vColor;
|
|
1216
|
-
varying float vOpacity;
|
|
1217
|
-
void main() {
|
|
1218
|
-
float distanceToCenter = distance(gl_PointCoord, vec2(0.5));
|
|
1219
|
-
float strength = 0.05 / distanceToCenter - 0.1;
|
|
1220
|
-
gl_FragColor = vec4(vColor, strength * vOpacity);
|
|
1221
|
-
#include <tonemapping_fragment>
|
|
1222
|
-
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
1223
|
-
}`);
|
|
1224
|
-
|
|
1225
|
-
class SpotLightMaterial extends THREE.ShaderMaterial {
|
|
1226
|
-
constructor() {
|
|
1227
|
-
super({
|
|
1228
|
-
uniforms: {
|
|
1229
|
-
depth: { value: null },
|
|
1230
|
-
opacity: { value: 1 },
|
|
1231
|
-
attenuation: { value: 2.5 },
|
|
1232
|
-
anglePower: { value: 12 },
|
|
1233
|
-
spotPosition: { value: new THREE.Vector3(0, 0, 0) },
|
|
1234
|
-
lightColor: { value: new THREE.Color('white') },
|
|
1235
|
-
cameraNear: { value: 0 },
|
|
1236
|
-
cameraFar: { value: 1 },
|
|
1237
|
-
resolution: { value: new THREE.Vector2(0, 0) },
|
|
1238
|
-
},
|
|
1239
|
-
transparent: true,
|
|
1240
|
-
depthWrite: false,
|
|
1241
|
-
vertexShader: /* glsl */ `
|
|
1242
|
-
varying vec3 vNormal;
|
|
1243
|
-
varying vec3 vWorldPosition;
|
|
1244
|
-
varying float vViewZ;
|
|
1245
|
-
varying float vIntensity;
|
|
1246
|
-
uniform vec3 spotPosition;
|
|
1247
|
-
uniform float attenuation;
|
|
1248
|
-
|
|
1249
|
-
void main() {
|
|
1250
|
-
// compute intensity
|
|
1251
|
-
vNormal = normalize( normalMatrix * normal );
|
|
1252
|
-
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
1253
|
-
vWorldPosition = worldPosition.xyz;
|
|
1254
|
-
vec4 viewPosition = viewMatrix * worldPosition;
|
|
1255
|
-
vViewZ = viewPosition.z;
|
|
1256
|
-
float intensity = distance(worldPosition.xyz, spotPosition) / attenuation;
|
|
1257
|
-
intensity = 1.0 - clamp(intensity, 0.0, 1.0);
|
|
1258
|
-
vIntensity = intensity;
|
|
1259
|
-
// set gl_Position
|
|
1260
|
-
gl_Position = projectionMatrix * viewPosition;
|
|
1261
|
-
|
|
1262
|
-
}`,
|
|
1263
|
-
fragmentShader: /* glsl */ `
|
|
1264
|
-
#include <packing>
|
|
1265
|
-
|
|
1266
|
-
varying vec3 vNormal;
|
|
1267
|
-
varying vec3 vWorldPosition;
|
|
1268
|
-
uniform vec3 lightColor;
|
|
1269
|
-
uniform vec3 spotPosition;
|
|
1270
|
-
uniform float attenuation;
|
|
1271
|
-
uniform float anglePower;
|
|
1272
|
-
uniform sampler2D depth;
|
|
1273
|
-
uniform vec2 resolution;
|
|
1274
|
-
uniform float cameraNear;
|
|
1275
|
-
uniform float cameraFar;
|
|
1276
|
-
varying float vViewZ;
|
|
1277
|
-
varying float vIntensity;
|
|
1278
|
-
uniform float opacity;
|
|
1279
|
-
|
|
1280
|
-
float readDepth( sampler2D depthSampler, vec2 coord ) {
|
|
1281
|
-
float fragCoordZ = texture2D( depthSampler, coord ).x;
|
|
1282
|
-
float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);
|
|
1283
|
-
return viewZ;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
void main() {
|
|
1287
|
-
float d = 1.0;
|
|
1288
|
-
bool isSoft = resolution[0] > 0.0 && resolution[1] > 0.0;
|
|
1289
|
-
if (isSoft) {
|
|
1290
|
-
vec2 sUv = gl_FragCoord.xy / resolution;
|
|
1291
|
-
d = readDepth(depth, sUv);
|
|
1292
|
-
}
|
|
1293
|
-
float intensity = vIntensity;
|
|
1294
|
-
vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));
|
|
1295
|
-
float angleIntensity = pow( dot(normal, vec3(0.0, 0.0, 1.0)), anglePower );
|
|
1296
|
-
intensity *= angleIntensity;
|
|
1297
|
-
// fades when z is close to sampled depth, meaning the cone is intersecting existing geometry
|
|
1298
|
-
if (isSoft) {
|
|
1299
|
-
intensity *= smoothstep(0., 1., vViewZ - d);
|
|
1300
|
-
}
|
|
1301
|
-
gl_FragColor = vec4(lightColor, intensity * opacity);
|
|
1302
|
-
|
|
1303
|
-
#include <tonemapping_fragment>
|
|
1304
|
-
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
1305
|
-
}`,
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
const StarFieldMaterial = shaderMaterial({ time: 0.0, fade: 0.0 },
|
|
1311
|
-
// language=GLSL
|
|
1312
|
-
`
|
|
1313
|
-
uniform float time;
|
|
1314
|
-
attribute float size;
|
|
1315
|
-
varying vec3 vColor;
|
|
1316
|
-
void main() {
|
|
1317
|
-
vColor = color;
|
|
1318
|
-
vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
|
|
1319
|
-
gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
|
|
1320
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
1321
|
-
}
|
|
1322
|
-
`,
|
|
1323
|
-
// language=GLSL
|
|
1324
|
-
`
|
|
1325
|
-
uniform sampler2D pointTexture;
|
|
1326
|
-
uniform float fade;
|
|
1327
|
-
varying vec3 vColor;
|
|
1328
|
-
void main() {
|
|
1329
|
-
float opacity = 1.0;
|
|
1330
|
-
if (fade == 1.0) {
|
|
1331
|
-
float d = distance(gl_PointCoord, vec2(0.5, 0.5));
|
|
1332
|
-
opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
|
|
1333
|
-
}
|
|
1334
|
-
gl_FragColor = vec4(vColor, opacity);
|
|
1335
|
-
|
|
1336
|
-
#include <tonemapping_fragment>
|
|
1337
|
-
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
1338
|
-
}
|
|
1339
|
-
`);
|
|
1340
|
-
|
|
1341
|
-
const WireframeMaterialShaders = {
|
|
1342
|
-
uniforms: {
|
|
1343
|
-
strokeOpacity: 1,
|
|
1344
|
-
fillOpacity: 0.25,
|
|
1345
|
-
fillMix: 0,
|
|
1346
|
-
thickness: 0.05,
|
|
1347
|
-
colorBackfaces: false,
|
|
1348
|
-
dashInvert: true,
|
|
1349
|
-
dash: false,
|
|
1350
|
-
dashRepeats: 4,
|
|
1351
|
-
dashLength: 0.5,
|
|
1352
|
-
squeeze: false,
|
|
1353
|
-
squeezeMin: 0.2,
|
|
1354
|
-
squeezeMax: 1,
|
|
1355
|
-
stroke: new THREE.Color('#ff0000'),
|
|
1356
|
-
backfaceStroke: new THREE.Color('#0000ff'),
|
|
1357
|
-
fill: new THREE.Color('#00ff00'),
|
|
1358
|
-
},
|
|
1359
|
-
vertex: /* glsl */ `
|
|
1360
|
-
attribute vec3 barycentric;
|
|
1361
|
-
|
|
1362
|
-
varying vec3 v_edges_Barycentric;
|
|
1363
|
-
varying vec3 v_edges_Position;
|
|
1364
|
-
|
|
1365
|
-
void initWireframe() {
|
|
1366
|
-
v_edges_Barycentric = barycentric;
|
|
1367
|
-
v_edges_Position = position.xyz;
|
|
1368
|
-
}
|
|
1369
|
-
`,
|
|
1370
|
-
fragment: /* glsl */ `
|
|
1371
|
-
#ifndef PI
|
|
1372
|
-
#define PI 3.1415926535897932384626433832795
|
|
1373
|
-
#endif
|
|
1374
|
-
|
|
1375
|
-
varying vec3 v_edges_Barycentric;
|
|
1376
|
-
varying vec3 v_edges_Position;
|
|
1377
|
-
|
|
1378
|
-
uniform float strokeOpacity;
|
|
1379
|
-
uniform float fillOpacity;
|
|
1380
|
-
uniform float fillMix;
|
|
1381
|
-
uniform float thickness;
|
|
1382
|
-
uniform bool colorBackfaces;
|
|
1383
|
-
|
|
1384
|
-
// Dash
|
|
1385
|
-
uniform bool dashInvert;
|
|
1386
|
-
uniform bool dash;
|
|
1387
|
-
uniform bool dashOnly;
|
|
1388
|
-
uniform float dashRepeats;
|
|
1389
|
-
uniform float dashLength;
|
|
1390
|
-
|
|
1391
|
-
// Squeeze
|
|
1392
|
-
uniform bool squeeze;
|
|
1393
|
-
uniform float squeezeMin;
|
|
1394
|
-
uniform float squeezeMax;
|
|
1395
|
-
|
|
1396
|
-
// Colors
|
|
1397
|
-
uniform vec3 stroke;
|
|
1398
|
-
uniform vec3 backfaceStroke;
|
|
1399
|
-
uniform vec3 fill;
|
|
1400
|
-
|
|
1401
|
-
// This is like
|
|
1402
|
-
float wireframe_aastep(float threshold, float dist) {
|
|
1403
|
-
float afwidth = fwidth(dist) * 0.5;
|
|
1404
|
-
return smoothstep(threshold - afwidth, threshold + afwidth, dist);
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
float wireframe_map(float value, float min1, float max1, float min2, float max2) {
|
|
1408
|
-
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
float getWireframe() {
|
|
1412
|
-
vec3 barycentric = v_edges_Barycentric;
|
|
1413
|
-
|
|
1414
|
-
// Distance from center of each triangle to its edges.
|
|
1415
|
-
float d = min(min(barycentric.x, barycentric.y), barycentric.z);
|
|
1416
|
-
|
|
1417
|
-
// for dashed rendering, we can use this to get the 0 .. 1 value of the line length
|
|
1418
|
-
float positionAlong = max(barycentric.x, barycentric.y);
|
|
1419
|
-
if (barycentric.y < barycentric.x && barycentric.y < barycentric.z) {
|
|
1420
|
-
positionAlong = 1.0 - positionAlong;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
// the thickness of the stroke
|
|
1424
|
-
float computedThickness = wireframe_map(thickness, 0.0, 1.0, 0.0, 0.34);
|
|
1425
|
-
|
|
1426
|
-
// if we want to shrink the thickness toward the center of the line segment
|
|
1427
|
-
if (squeeze) {
|
|
1428
|
-
computedThickness *= mix(squeezeMin, squeezeMax, (1.0 - sin(positionAlong * PI)));
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
// Create dash pattern
|
|
1432
|
-
if (dash) {
|
|
1433
|
-
// here we offset the stroke position depending on whether it
|
|
1434
|
-
// should overlap or not
|
|
1435
|
-
float offset = 1.0 / dashRepeats * dashLength / 2.0;
|
|
1436
|
-
if (!dashInvert) {
|
|
1437
|
-
offset += 1.0 / dashRepeats / 2.0;
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
// if we should animate the dash or not
|
|
1441
|
-
// if (dashAnimate) {
|
|
1442
|
-
// offset += time * 0.22;
|
|
1443
|
-
// }
|
|
1444
|
-
|
|
1445
|
-
// create the repeating dash pattern
|
|
1446
|
-
float pattern = fract((positionAlong + offset) * dashRepeats);
|
|
1447
|
-
computedThickness *= 1.0 - wireframe_aastep(dashLength, pattern);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
// compute the anti-aliased stroke edge
|
|
1451
|
-
float edge = 1.0 - wireframe_aastep(computedThickness, d);
|
|
1452
|
-
|
|
1453
|
-
return edge;
|
|
1454
|
-
}
|
|
1455
|
-
`,
|
|
1456
|
-
};
|
|
1457
|
-
const WireframeMaterial = shaderMaterial(WireframeMaterialShaders.uniforms, WireframeMaterialShaders.vertex +
|
|
1458
|
-
/* glsl */ `
|
|
1459
|
-
void main() {
|
|
1460
|
-
initWireframe();
|
|
1461
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1462
|
-
}
|
|
1463
|
-
`, WireframeMaterialShaders.fragment +
|
|
1464
|
-
/* glsl */ `
|
|
1465
|
-
void main () {
|
|
1466
|
-
// Compute color
|
|
1467
|
-
|
|
1468
|
-
float edge = getWireframe();
|
|
1469
|
-
vec4 colorStroke = vec4(stroke, edge);
|
|
1470
|
-
|
|
1471
|
-
#ifdef FLIP_SIDED
|
|
1472
|
-
colorStroke.rgb = backfaceStroke;
|
|
1473
|
-
#endif
|
|
1474
|
-
|
|
1475
|
-
vec4 colorFill = vec4(fill, fillOpacity);
|
|
1476
|
-
vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
|
|
1477
|
-
|
|
1478
|
-
gl_FragColor = outColor;
|
|
1479
|
-
}
|
|
1480
|
-
`);
|
|
1481
|
-
function setWireframeOverride(material, uniforms) {
|
|
1482
|
-
material.onBeforeCompile = (shader) => {
|
|
1483
|
-
shader.uniforms = {
|
|
1484
|
-
...shader.uniforms,
|
|
1485
|
-
...uniforms,
|
|
1486
|
-
};
|
|
1487
|
-
shader.vertexShader = shader.vertexShader.replace('void main() {', `
|
|
1488
|
-
${WireframeMaterialShaders.vertex}
|
|
1489
|
-
void main() {
|
|
1490
|
-
initWireframe();
|
|
1491
|
-
`);
|
|
1492
|
-
shader.fragmentShader = shader.fragmentShader.replace('void main() {', `
|
|
1493
|
-
${WireframeMaterialShaders.fragment}
|
|
1494
|
-
void main() {
|
|
1495
|
-
`);
|
|
1496
|
-
shader.fragmentShader = shader.fragmentShader.replace('#include <color_fragment>',
|
|
1497
|
-
/* glsl */ `
|
|
1498
|
-
#include <color_fragment>
|
|
1499
|
-
float edge = getWireframe();
|
|
1500
|
-
vec4 colorStroke = vec4(stroke, edge);
|
|
1501
|
-
#ifdef FLIP_SIDED
|
|
1502
|
-
colorStroke.rgb = backfaceStroke;
|
|
1503
|
-
#endif
|
|
1504
|
-
vec4 colorFill = vec4(mix(diffuseColor.rgb, fill, fillMix), mix(diffuseColor.a, fillOpacity, fillMix));
|
|
1505
|
-
vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);
|
|
1506
|
-
|
|
1507
|
-
diffuseColor.rgb = outColor.rgb;
|
|
1508
|
-
diffuseColor.a *= outColor.a;
|
|
1509
|
-
`);
|
|
1510
|
-
};
|
|
1511
|
-
material.side = THREE.DoubleSide;
|
|
1512
|
-
material.transparent = true;
|
|
1513
|
-
}
|
|
1514
|
-
function injectNgtsWireframeUniforms(uniformsFactory, stateFactory, { injector } = {}) {
|
|
1515
|
-
injector = assertInjectionContext(injectNgtsWireframeUniforms, injector);
|
|
1516
|
-
return runInInjectionContext(injector, () => {
|
|
1517
|
-
const uniforms = uniformsFactory();
|
|
1518
|
-
const state = computed(() => stateFactory());
|
|
1519
|
-
const fillOpacity = computed(() => state().fillOpacity);
|
|
1520
|
-
const fillMix = computed(() => state().fillMix);
|
|
1521
|
-
const strokeOpacity = computed(() => state().strokeOpacity);
|
|
1522
|
-
const thickness = computed(() => state().thickness);
|
|
1523
|
-
const colorBackfaces = computed(() => state().colorBackfaces);
|
|
1524
|
-
const dash = computed(() => state().dash);
|
|
1525
|
-
const dashInvert = computed(() => state().dashInvert);
|
|
1526
|
-
const dashRepeats = computed(() => state().dashRepeats);
|
|
1527
|
-
const dashLength = computed(() => state().dashLength);
|
|
1528
|
-
const squeeze = computed(() => state().squeeze);
|
|
1529
|
-
const squeezeMin = computed(() => state().squeezeMin);
|
|
1530
|
-
const squeezeMax = computed(() => state().squeezeMax);
|
|
1531
|
-
const stroke = computed(() => state().stroke);
|
|
1532
|
-
const fill = computed(() => state().fill);
|
|
1533
|
-
const backfaceStroke = computed(() => state().backfaceStroke);
|
|
1534
|
-
effect(() => {
|
|
1535
|
-
uniforms['fillOpacity'].value = fillOpacity() ?? uniforms['fillOpacity'].value;
|
|
1536
|
-
});
|
|
1537
|
-
effect(() => {
|
|
1538
|
-
uniforms['fillMix'].value = fillMix() ?? uniforms['fillMix'].value;
|
|
1539
|
-
});
|
|
1540
|
-
effect(() => {
|
|
1541
|
-
uniforms['strokeOpacity'].value = strokeOpacity() ?? uniforms['strokeOpacity'].value;
|
|
1542
|
-
});
|
|
1543
|
-
effect(() => {
|
|
1544
|
-
uniforms['thickness'].value = thickness() ?? uniforms['thickness'].value;
|
|
1545
|
-
});
|
|
1546
|
-
effect(() => {
|
|
1547
|
-
uniforms['colorBackfaces'].value = colorBackfaces() ?? uniforms['colorBackfaces'].value;
|
|
1548
|
-
});
|
|
1549
|
-
effect(() => {
|
|
1550
|
-
uniforms['dash'].value = dash() ?? uniforms['dash'].value;
|
|
1551
|
-
});
|
|
1552
|
-
effect(() => {
|
|
1553
|
-
uniforms['dashInvert'].value = dashInvert() ?? uniforms['dashInvert'].value;
|
|
1554
|
-
});
|
|
1555
|
-
effect(() => {
|
|
1556
|
-
uniforms['dashRepeats'].value = dashRepeats() ?? uniforms['dashRepeats'].value;
|
|
1557
|
-
});
|
|
1558
|
-
effect(() => {
|
|
1559
|
-
uniforms['dashLength'].value = dashLength() ?? uniforms['dashLength'].value;
|
|
1560
|
-
});
|
|
1561
|
-
effect(() => {
|
|
1562
|
-
uniforms['squeeze'].value = squeeze() ?? uniforms['squeeze'].value;
|
|
1563
|
-
});
|
|
1564
|
-
effect(() => {
|
|
1565
|
-
uniforms['squeezeMin'].value = squeezeMin() ?? uniforms['squeezeMin'].value;
|
|
1566
|
-
});
|
|
1567
|
-
effect(() => {
|
|
1568
|
-
uniforms['squeezeMax'].value = squeezeMax() ?? uniforms['squeezeMax'].value;
|
|
1569
|
-
});
|
|
1570
|
-
effect(() => {
|
|
1571
|
-
uniforms['stroke'].value = stroke() ? new THREE.Color(stroke()) : uniforms['stroke'].value;
|
|
1572
|
-
});
|
|
1573
|
-
effect(() => {
|
|
1574
|
-
uniforms['fill'].value = fill() ? new THREE.Color(fill()) : uniforms['fill'].value;
|
|
1575
|
-
});
|
|
1576
|
-
effect(() => {
|
|
1577
|
-
uniforms['backfaceStroke'].value = backfaceStroke()
|
|
1578
|
-
? new THREE.Color(backfaceStroke())
|
|
1579
|
-
: uniforms['backfaceStroke'].value;
|
|
1580
|
-
});
|
|
1581
|
-
});
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
244
|
/**
|
|
1585
245
|
* Generated bundle index. Do not edit.
|
|
1586
246
|
*/
|
|
1587
247
|
|
|
1588
|
-
export {
|
|
248
|
+
export { GridMaterial, MeshRefractionMaterial };
|
|
1589
249
|
//# sourceMappingURL=angular-three-soba-shaders.mjs.map
|