three-stdlib 2.25.0 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +116401 -611
- package/index.js +116037 -263
- package/package.json +17 -4
- package/_polyfill/CapsuleGeometry.cjs +0 -22
- package/_polyfill/CapsuleGeometry.js +0 -22
- package/_polyfill/CompressedArrayTexture.cjs +0 -12
- package/_polyfill/CompressedArrayTexture.js +0 -12
- package/_polyfill/Data3DTexture.cjs +0 -17
- package/_polyfill/Data3DTexture.js +0 -17
- package/animation/AnimationClipCreator.cjs +0 -56
- package/animation/AnimationClipCreator.js +0 -56
- package/animation/CCDIKSolver.cjs +0 -269
- package/animation/CCDIKSolver.js +0 -269
- package/animation/MMDAnimationHelper.cjs +0 -688
- package/animation/MMDAnimationHelper.js +0 -688
- package/animation/MMDPhysics.cjs +0 -830
- package/animation/MMDPhysics.js +0 -830
- package/cameras/CinematicCamera.cjs +0 -131
- package/cameras/CinematicCamera.js +0 -131
- package/controls/ArcballControls.cjs +0 -2033
- package/controls/ArcballControls.js +0 -2033
- package/controls/DeviceOrientationControls.cjs +0 -85
- package/controls/DeviceOrientationControls.js +0 -85
- package/controls/DragControls.cjs +0 -182
- package/controls/DragControls.js +0 -182
- package/controls/FirstPersonControls.cjs +0 -229
- package/controls/FirstPersonControls.js +0 -229
- package/controls/FlyControls.cjs +0 -248
- package/controls/FlyControls.js +0 -248
- package/controls/OrbitControls.cjs +0 -791
- package/controls/OrbitControls.js +0 -791
- package/controls/PointerLockControls.cjs +0 -103
- package/controls/PointerLockControls.js +0 -103
- package/controls/TrackballControls.cjs +0 -502
- package/controls/TrackballControls.js +0 -502
- package/controls/TransformControls.cjs +0 -1089
- package/controls/TransformControls.js +0 -1089
- package/controls/experimental/CameraControls.cjs +0 -736
- package/controls/experimental/CameraControls.js +0 -736
- package/csm/CSM.cjs +0 -244
- package/csm/CSM.js +0 -244
- package/csm/CSMFrustum.cjs +0 -75
- package/csm/CSMFrustum.js +0 -75
- package/csm/CSMHelper.cjs +0 -114
- package/csm/CSMHelper.js +0 -114
- package/csm/CSMShader.cjs +0 -261
- package/csm/CSMShader.js +0 -261
- package/curves/CurveExtras.cjs +0 -214
- package/curves/CurveExtras.js +0 -214
- package/curves/NURBSCurve.cjs +0 -35
- package/curves/NURBSCurve.js +0 -35
- package/curves/NURBSSurface.cjs +0 -28
- package/curves/NURBSSurface.js +0 -28
- package/curves/NURBSUtils.cjs +0 -226
- package/curves/NURBSUtils.js +0 -226
- package/deprecated/Geometry.cjs +0 -971
- package/deprecated/Geometry.js +0 -971
- package/effects/AnaglyphEffect.cjs +0 -102
- package/effects/AnaglyphEffect.js +0 -102
- package/effects/AsciiEffect.cjs +0 -155
- package/effects/AsciiEffect.js +0 -155
- package/effects/OutlineEffect.cjs +0 -275
- package/effects/OutlineEffect.js +0 -275
- package/effects/ParallaxBarrierEffect.cjs +0 -65
- package/effects/ParallaxBarrierEffect.js +0 -65
- package/effects/PeppersGhostEffect.cjs +0 -88
- package/effects/PeppersGhostEffect.js +0 -88
- package/effects/StereoEffect.cjs +0 -35
- package/effects/StereoEffect.js +0 -35
- package/environments/RoomEnvironment.cjs +0 -95
- package/environments/RoomEnvironment.js +0 -78
- package/exporters/ColladaExporter.cjs +0 -331
- package/exporters/ColladaExporter.js +0 -331
- package/exporters/DRACOExporter.cjs +0 -141
- package/exporters/DRACOExporter.js +0 -141
- package/exporters/GLTFExporter.cjs +0 -1909
- package/exporters/GLTFExporter.js +0 -1909
- package/exporters/MMDExporter.cjs +0 -131
- package/exporters/MMDExporter.js +0 -131
- package/exporters/OBJExporter.cjs +0 -181
- package/exporters/OBJExporter.js +0 -181
- package/exporters/PLYExporter.cjs +0 -280
- package/exporters/PLYExporter.js +0 -280
- package/exporters/STLExporter.cjs +0 -146
- package/exporters/STLExporter.js +0 -146
- package/exporters/USDZExporter.cjs +0 -340
- package/exporters/USDZExporter.js +0 -340
- package/geometries/BoxLineGeometry.cjs +0 -45
- package/geometries/BoxLineGeometry.js +0 -45
- package/geometries/ConvexGeometry.cjs +0 -26
- package/geometries/ConvexGeometry.js +0 -26
- package/geometries/DecalGeometry.cjs +0 -184
- package/geometries/DecalGeometry.js +0 -184
- package/geometries/LightningStrike.cjs +0 -553
- package/geometries/LightningStrike.js +0 -553
- package/geometries/ParametricGeometries.cjs +0 -130
- package/geometries/ParametricGeometries.js +0 -130
- package/geometries/ParametricGeometry.cjs +0 -63
- package/geometries/ParametricGeometry.js +0 -63
- package/geometries/RoundedBoxGeometry.cjs +0 -91
- package/geometries/RoundedBoxGeometry.js +0 -91
- package/geometries/TeapotGeometry.cjs +0 -1563
- package/geometries/TeapotGeometry.js +0 -1563
- package/geometries/TextGeometry.cjs +0 -27
- package/geometries/TextGeometry.js +0 -27
- package/helpers/LightProbeHelper.cjs +0 -73
- package/helpers/LightProbeHelper.js +0 -73
- package/helpers/PositionalAudioHelper.cjs +0 -68
- package/helpers/PositionalAudioHelper.js +0 -68
- package/helpers/RectAreaLightHelper.cjs +0 -44
- package/helpers/RectAreaLightHelper.js +0 -44
- package/helpers/VertexNormalsHelper.cjs +0 -47
- package/helpers/VertexNormalsHelper.js +0 -47
- package/helpers/VertexTangentsHelper.cjs +0 -43
- package/helpers/VertexTangentsHelper.js +0 -43
- package/interactive/HTMLMesh.cjs +0 -325
- package/interactive/HTMLMesh.js +0 -325
- package/interactive/InteractiveGroup.cjs +0 -68
- package/interactive/InteractiveGroup.js +0 -68
- package/interactive/SelectionBox.cjs +0 -134
- package/interactive/SelectionBox.js +0 -134
- package/interactive/SelectionHelper.cjs +0 -51
- package/interactive/SelectionHelper.js +0 -51
- package/libs/MeshoptDecoder.cjs +0 -221
- package/libs/MeshoptDecoder.js +0 -221
- package/libs/MotionControllers.cjs +0 -325
- package/libs/MotionControllers.js +0 -325
- package/lights/LightProbeGenerator.cjs +0 -145
- package/lights/LightProbeGenerator.js +0 -145
- package/lights/RectAreaLightUniformsLib.cjs +0 -32846
- package/lights/RectAreaLightUniformsLib.js +0 -32846
- package/lines/Line2.cjs +0 -13
- package/lines/Line2.js +0 -13
- package/lines/LineGeometry.cjs +0 -44
- package/lines/LineGeometry.js +0 -44
- package/lines/LineMaterial.cjs +0 -547
- package/lines/LineMaterial.js +0 -547
- package/lines/LineSegments2.cjs +0 -203
- package/lines/LineSegments2.js +0 -203
- package/lines/LineSegmentsGeometry.cjs +0 -124
- package/lines/LineSegmentsGeometry.js +0 -124
- package/lines/Wireframe.cjs +0 -32
- package/lines/Wireframe.js +0 -32
- package/lines/WireframeGeometry2.cjs +0 -13
- package/lines/WireframeGeometry2.js +0 -13
- package/loaders/3DMLoader.cjs +0 -803
- package/loaders/3DMLoader.js +0 -803
- package/loaders/3MFLoader.cjs +0 -854
- package/loaders/3MFLoader.js +0 -854
- package/loaders/AMFLoader.cjs +0 -284
- package/loaders/AMFLoader.js +0 -284
- package/loaders/AssimpLoader.cjs +0 -1434
- package/loaders/AssimpLoader.js +0 -1434
- package/loaders/BVHLoader.cjs +0 -207
- package/loaders/BVHLoader.js +0 -207
- package/loaders/BasisTextureLoader.cjs +0 -489
- package/loaders/BasisTextureLoader.js +0 -489
- package/loaders/ColladaLoader.cjs +0 -2405
- package/loaders/ColladaLoader.js +0 -2405
- package/loaders/DDSLoader.cjs +0 -148
- package/loaders/DDSLoader.js +0 -148
- package/loaders/DRACOLoader.cjs +0 -341
- package/loaders/DRACOLoader.js +0 -341
- package/loaders/EXRLoader.cjs +0 -1356
- package/loaders/EXRLoader.js +0 -1356
- package/loaders/FBXLoader.cjs +0 -2457
- package/loaders/FBXLoader.js +0 -2457
- package/loaders/FontLoader.cjs +0 -123
- package/loaders/FontLoader.js +0 -123
- package/loaders/GCodeLoader.cjs +0 -141
- package/loaders/GCodeLoader.js +0 -141
- package/loaders/GLTFLoader.cjs +0 -2504
- package/loaders/GLTFLoader.js +0 -2504
- package/loaders/HDRCubeTextureLoader.cjs +0 -75
- package/loaders/HDRCubeTextureLoader.js +0 -75
- package/loaders/KMZLoader.cjs +0 -75
- package/loaders/KMZLoader.js +0 -75
- package/loaders/KTX2Loader.cjs +0 -480
- package/loaders/KTX2Loader.js +0 -480
- package/loaders/KTXLoader.cjs +0 -93
- package/loaders/KTXLoader.js +0 -93
- package/loaders/LDrawLoader.cjs +0 -1424
- package/loaders/LDrawLoader.js +0 -1424
- package/loaders/LUT3dlLoader.cjs +0 -103
- package/loaders/LUT3dlLoader.js +0 -103
- package/loaders/LUTCubeLoader.cjs +0 -107
- package/loaders/LUTCubeLoader.js +0 -107
- package/loaders/LWOLoader.cjs +0 -645
- package/loaders/LWOLoader.js +0 -645
- package/loaders/LottieLoader.cjs +0 -47
- package/loaders/LottieLoader.js +0 -47
- package/loaders/MD2Loader.cjs +0 -359
- package/loaders/MD2Loader.js +0 -359
- package/loaders/MDDLoader.cjs +0 -58
- package/loaders/MDDLoader.js +0 -58
- package/loaders/MMDLoader.cjs +0 -1121
- package/loaders/MMDLoader.js +0 -1121
- package/loaders/MTLLoader.cjs +0 -304
- package/loaders/MTLLoader.js +0 -304
- package/loaders/NRRDLoader.cjs +0 -401
- package/loaders/NRRDLoader.js +0 -401
- package/loaders/OBJLoader.cjs +0 -487
- package/loaders/OBJLoader.js +0 -487
- package/loaders/PCDLoader.cjs +0 -248
- package/loaders/PCDLoader.js +0 -248
- package/loaders/PDBLoader.cjs +0 -247
- package/loaders/PDBLoader.js +0 -247
- package/loaders/PLYLoader.cjs +0 -317
- package/loaders/PLYLoader.js +0 -317
- package/loaders/PRWMLoader.cjs +0 -160
- package/loaders/PRWMLoader.js +0 -160
- package/loaders/PVRLoader.cjs +0 -131
- package/loaders/PVRLoader.js +0 -131
- package/loaders/RGBELoader.cjs +0 -252
- package/loaders/RGBELoader.js +0 -252
- package/loaders/RGBMLoader.cjs +0 -1004
- package/loaders/RGBMLoader.js +0 -1004
- package/loaders/STLLoader.cjs +0 -190
- package/loaders/STLLoader.js +0 -190
- package/loaders/SVGLoader.cjs +0 -1712
- package/loaders/SVGLoader.js +0 -1712
- package/loaders/TDSLoader.cjs +0 -650
- package/loaders/TDSLoader.js +0 -650
- package/loaders/TGALoader.cjs +0 -285
- package/loaders/TGALoader.js +0 -285
- package/loaders/TTFLoader.cjs +0 -131
- package/loaders/TTFLoader.js +0 -131
- package/loaders/TiltLoader.cjs +0 -375
- package/loaders/TiltLoader.js +0 -375
- package/loaders/VOXLoader.cjs +0 -432
- package/loaders/VOXLoader.js +0 -432
- package/loaders/VRMLLoader.cjs +0 -2105
- package/loaders/VRMLLoader.js +0 -2105
- package/loaders/VRMLoader.cjs +0 -38
- package/loaders/VRMLoader.js +0 -38
- package/loaders/VTKLoader.cjs +0 -648
- package/loaders/VTKLoader.js +0 -648
- package/loaders/XLoader.cjs +0 -1258
- package/loaders/XLoader.js +0 -1258
- package/loaders/XYZLoader.cjs +0 -60
- package/loaders/XYZLoader.js +0 -60
- package/loaders/lwo/IFFParser.cjs +0 -743
- package/loaders/lwo/IFFParser.js +0 -743
- package/loaders/lwo/LWO2Parser.cjs +0 -312
- package/loaders/lwo/LWO2Parser.js +0 -312
- package/loaders/lwo/LWO3Parser.cjs +0 -282
- package/loaders/lwo/LWO3Parser.js +0 -282
- package/math/Capsule.cjs +0 -98
- package/math/Capsule.js +0 -98
- package/math/ColorConverter.cjs +0 -42
- package/math/ColorConverter.js +0 -42
- package/math/ConvexHull.cjs +0 -596
- package/math/ConvexHull.js +0 -596
- package/math/ImprovedNoise.cjs +0 -304
- package/math/ImprovedNoise.js +0 -304
- package/math/Lut.cjs +0 -137
- package/math/Lut.js +0 -137
- package/math/MeshSurfaceSampler.cjs +0 -103
- package/math/MeshSurfaceSampler.js +0 -103
- package/math/OBB.cjs +0 -242
- package/math/OBB.js +0 -242
- package/math/Octree.cjs +0 -273
- package/math/Octree.js +0 -273
- package/math/SimplexNoise.cjs +0 -440
- package/math/SimplexNoise.js +0 -440
- package/misc/ConvexObjectBreaker.cjs +0 -292
- package/misc/ConvexObjectBreaker.js +0 -292
- package/misc/GPUComputationRenderer.cjs +0 -205
- package/misc/GPUComputationRenderer.js +0 -205
- package/misc/Gyroscope.cjs +0 -33
- package/misc/Gyroscope.js +0 -33
- package/misc/MD2Character.cjs +0 -167
- package/misc/MD2Character.js +0 -167
- package/misc/MD2CharacterComplex.cjs +0 -332
- package/misc/MD2CharacterComplex.js +0 -332
- package/misc/MorphAnimMesh.cjs +0 -40
- package/misc/MorphAnimMesh.js +0 -40
- package/misc/MorphBlendMesh.cjs +0 -179
- package/misc/MorphBlendMesh.js +0 -179
- package/misc/ProgressiveLightmap.cjs +0 -186
- package/misc/ProgressiveLightmap.js +0 -186
- package/misc/RollerCoaster.cjs +0 -353
- package/misc/RollerCoaster.js +0 -353
- package/misc/Timer.cjs +0 -101
- package/misc/Timer.js +0 -101
- package/misc/TubePainter.cjs +0 -123
- package/misc/TubePainter.js +0 -123
- package/misc/Volume.cjs +0 -305
- package/misc/Volume.js +0 -305
- package/misc/VolumeSlice.cjs +0 -114
- package/misc/VolumeSlice.js +0 -114
- package/misc/WebGL.cjs +0 -74
- package/misc/WebGL.js +0 -74
- package/modifiers/CurveModifier.cjs +0 -232
- package/modifiers/CurveModifier.js +0 -232
- package/modifiers/EdgeSplitModifier.cjs +0 -167
- package/modifiers/EdgeSplitModifier.js +0 -168
- package/modifiers/SimplifyModifier.cjs +0 -301
- package/modifiers/SimplifyModifier.js +0 -301
- package/modifiers/TessellateModifier.cjs +0 -214
- package/modifiers/TessellateModifier.js +0 -214
- package/objects/GroundProjectedEnv.cjs +0 -134
- package/objects/GroundProjectedEnv.js +0 -134
- package/objects/Lensflare.cjs +0 -291
- package/objects/Lensflare.js +0 -291
- package/objects/LightningStorm.cjs +0 -110
- package/objects/LightningStorm.js +0 -110
- package/objects/MarchingCubes.cjs +0 -4809
- package/objects/MarchingCubes.js +0 -4809
- package/objects/Reflector.cjs +0 -202
- package/objects/Reflector.js +0 -202
- package/objects/ReflectorForSSRPass.cjs +0 -260
- package/objects/ReflectorForSSRPass.js +0 -260
- package/objects/ReflectorRTT.cjs +0 -10
- package/objects/ReflectorRTT.js +0 -10
- package/objects/Refractor.cjs +0 -215
- package/objects/Refractor.js +0 -215
- package/objects/ShadowMesh.cjs +0 -45
- package/objects/ShadowMesh.js +0 -45
- package/objects/Sky.cjs +0 -200
- package/objects/Sky.js +0 -200
- package/objects/Water.cjs +0 -242
- package/objects/Water.js +0 -242
- package/objects/Water2.cjs +0 -256
- package/objects/Water2.js +0 -256
- package/physics/AmmoPhysics.cjs +0 -166
- package/physics/AmmoPhysics.js +0 -166
- package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
- package/postprocessing/AdaptiveToneMappingPass.js +0 -218
- package/postprocessing/AfterimagePass.cjs +0 -68
- package/postprocessing/AfterimagePass.js +0 -68
- package/postprocessing/BloomPass.cjs +0 -109
- package/postprocessing/BloomPass.js +0 -109
- package/postprocessing/BokehPass.cjs +0 -90
- package/postprocessing/BokehPass.js +0 -90
- package/postprocessing/ClearPass.cjs +0 -36
- package/postprocessing/ClearPass.js +0 -36
- package/postprocessing/CubeTexturePass.cjs +0 -53
- package/postprocessing/CubeTexturePass.js +0 -53
- package/postprocessing/DotScreenPass.cjs +0 -49
- package/postprocessing/DotScreenPass.js +0 -49
- package/postprocessing/EffectComposer.cjs +0 -157
- package/postprocessing/EffectComposer.js +0 -157
- package/postprocessing/FilmPass.cjs +0 -51
- package/postprocessing/FilmPass.js +0 -51
- package/postprocessing/GlitchPass.cjs +0 -84
- package/postprocessing/GlitchPass.js +0 -84
- package/postprocessing/HalftonePass.cjs +0 -53
- package/postprocessing/HalftonePass.js +0 -53
- package/postprocessing/LUTPass.cjs +0 -142
- package/postprocessing/LUTPass.js +0 -142
- package/postprocessing/MaskPass.cjs +0 -69
- package/postprocessing/MaskPass.js +0 -69
- package/postprocessing/OutlinePass.cjs +0 -479
- package/postprocessing/OutlinePass.js +0 -479
- package/postprocessing/Pass.cjs +0 -48
- package/postprocessing/Pass.js +0 -48
- package/postprocessing/RenderPass.cjs +0 -59
- package/postprocessing/RenderPass.js +0 -59
- package/postprocessing/RenderPixelatedPass.cjs +0 -199
- package/postprocessing/RenderPixelatedPass.js +0 -199
- package/postprocessing/SAOPass.cjs +0 -288
- package/postprocessing/SAOPass.js +0 -288
- package/postprocessing/SMAAPass.cjs +0 -112
- package/postprocessing/SMAAPass.js +0 -112
- package/postprocessing/SSAARenderPass.cjs +0 -189
- package/postprocessing/SSAARenderPass.js +0 -189
- package/postprocessing/SSAOPass.cjs +0 -272
- package/postprocessing/SSAOPass.js +0 -272
- package/postprocessing/SSRPass.cjs +0 -411
- package/postprocessing/SSRPass.js +0 -411
- package/postprocessing/SavePass.cjs +0 -38
- package/postprocessing/SavePass.js +0 -38
- package/postprocessing/ShaderPass.cjs +0 -49
- package/postprocessing/ShaderPass.js +0 -49
- package/postprocessing/TAARenderPass.cjs +0 -174
- package/postprocessing/TAARenderPass.js +0 -174
- package/postprocessing/TexturePass.cjs +0 -42
- package/postprocessing/TexturePass.js +0 -42
- package/postprocessing/UnrealBloomPass.cjs +0 -277
- package/postprocessing/UnrealBloomPass.js +0 -277
- package/postprocessing/WaterPass.cjs +0 -72
- package/postprocessing/WaterPass.js +0 -72
- package/renderers/CSS2DRenderer.cjs +0 -122
- package/renderers/CSS2DRenderer.js +0 -122
- package/renderers/CSS3DRenderer.cjs +0 -167
- package/renderers/CSS3DRenderer.js +0 -167
- package/renderers/Projector.cjs +0 -499
- package/renderers/Projector.js +0 -499
- package/renderers/SVGRenderer.cjs +0 -311
- package/renderers/SVGRenderer.js +0 -311
- package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
- package/shaders/ACESFilmicToneMappingShader.js +0 -55
- package/shaders/AfterimageShader.cjs +0 -32
- package/shaders/AfterimageShader.js +0 -32
- package/shaders/BasicShader.cjs +0 -12
- package/shaders/BasicShader.js +0 -12
- package/shaders/BleachBypassShader.cjs +0 -35
- package/shaders/BleachBypassShader.js +0 -35
- package/shaders/BlendShader.cjs +0 -30
- package/shaders/BlendShader.js +0 -30
- package/shaders/BokehShader.cjs +0 -109
- package/shaders/BokehShader.js +0 -109
- package/shaders/BokehShader2.cjs +0 -269
- package/shaders/BokehShader2.js +0 -269
- package/shaders/BrightnessContrastShader.cjs +0 -32
- package/shaders/BrightnessContrastShader.js +0 -32
- package/shaders/ColorCorrectionShader.cjs +0 -30
- package/shaders/ColorCorrectionShader.js +0 -30
- package/shaders/ColorifyShader.cjs +0 -28
- package/shaders/ColorifyShader.js +0 -28
- package/shaders/ConvolutionShader.cjs +0 -55
- package/shaders/ConvolutionShader.js +0 -55
- package/shaders/CopyShader.cjs +0 -25
- package/shaders/CopyShader.js +0 -25
- package/shaders/DOFMipMapShader.cjs +0 -32
- package/shaders/DOFMipMapShader.js +0 -32
- package/shaders/DepthLimitedBlurShader.cjs +0 -114
- package/shaders/DepthLimitedBlurShader.js +0 -114
- package/shaders/DigitalGlitch.cjs +0 -85
- package/shaders/DigitalGlitch.js +0 -85
- package/shaders/DotScreenShader.cjs +0 -39
- package/shaders/DotScreenShader.js +0 -39
- package/shaders/FXAAShader.cjs +0 -1098
- package/shaders/FXAAShader.js +0 -1098
- package/shaders/FilmShader.cjs +0 -53
- package/shaders/FilmShader.js +0 -53
- package/shaders/FocusShader.cjs +0 -55
- package/shaders/FocusShader.js +0 -55
- package/shaders/FreiChenShader.cjs +0 -64
- package/shaders/FreiChenShader.js +0 -64
- package/shaders/FresnelShader.cjs +0 -47
- package/shaders/FresnelShader.js +0 -47
- package/shaders/GammaCorrectionShader.cjs +0 -23
- package/shaders/GammaCorrectionShader.js +0 -23
- package/shaders/GodRaysShader.cjs +0 -183
- package/shaders/GodRaysShader.js +0 -183
- package/shaders/HalftoneShader.cjs +0 -228
- package/shaders/HalftoneShader.js +0 -228
- package/shaders/HorizontalBlurShader.cjs +0 -49
- package/shaders/HorizontalBlurShader.js +0 -49
- package/shaders/HorizontalTiltShiftShader.cjs +0 -37
- package/shaders/HorizontalTiltShiftShader.js +0 -37
- package/shaders/HueSaturationShader.cjs +0 -43
- package/shaders/HueSaturationShader.js +0 -43
- package/shaders/KaleidoShader.cjs +0 -34
- package/shaders/KaleidoShader.js +0 -34
- package/shaders/LuminosityHighPassShader.cjs +0 -37
- package/shaders/LuminosityHighPassShader.js +0 -37
- package/shaders/LuminosityShader.cjs +0 -25
- package/shaders/LuminosityShader.js +0 -25
- package/shaders/MirrorShader.cjs +0 -35
- package/shaders/MirrorShader.js +0 -35
- package/shaders/NormalMapShader.cjs +0 -31
- package/shaders/NormalMapShader.js +0 -31
- package/shaders/ParallaxShader.cjs +0 -133
- package/shaders/ParallaxShader.js +0 -133
- package/shaders/PixelShader.cjs +0 -28
- package/shaders/PixelShader.js +0 -28
- package/shaders/RGBShiftShader.cjs +0 -30
- package/shaders/RGBShiftShader.js +0 -30
- package/shaders/SAOShader.cjs +0 -144
- package/shaders/SAOShader.js +0 -144
- package/shaders/SMAAShader.cjs +0 -358
- package/shaders/SMAAShader.js +0 -358
- package/shaders/SSAOShader.cjs +0 -182
- package/shaders/SSAOShader.js +0 -182
- package/shaders/SSRShader.cjs +0 -342
- package/shaders/SSRShader.js +0 -342
- package/shaders/SepiaShader.cjs +0 -29
- package/shaders/SepiaShader.js +0 -29
- package/shaders/SobelOperatorShader.cjs +0 -54
- package/shaders/SobelOperatorShader.js +0 -54
- package/shaders/SubsurfaceScatteringShader.cjs +0 -98
- package/shaders/SubsurfaceScatteringShader.js +0 -98
- package/shaders/TechnicolorShader.cjs +0 -24
- package/shaders/TechnicolorShader.js +0 -24
- package/shaders/ToneMapShader.cjs +0 -51
- package/shaders/ToneMapShader.js +0 -51
- package/shaders/ToonShader.cjs +0 -188
- package/shaders/ToonShader.js +0 -188
- package/shaders/TriangleBlurShader.cjs +0 -37
- package/shaders/TriangleBlurShader.js +0 -37
- package/shaders/UnpackDepthRGBAShader.cjs +0 -26
- package/shaders/UnpackDepthRGBAShader.js +0 -26
- package/shaders/VerticalBlurShader.cjs +0 -50
- package/shaders/VerticalBlurShader.js +0 -50
- package/shaders/VerticalTiltShiftShader.cjs +0 -37
- package/shaders/VerticalTiltShiftShader.js +0 -37
- package/shaders/VignetteShader.cjs +0 -38
- package/shaders/VignetteShader.js +0 -38
- package/shaders/VolumeShader.cjs +0 -225
- package/shaders/VolumeShader.js +0 -225
- package/shaders/WaterRefractionShader.cjs +0 -59
- package/shaders/WaterRefractionShader.js +0 -59
- package/shaders/types.cjs +0 -1
- package/shaders/types.js +0 -1
- package/textures/FlakesTexture.cjs +0 -30
- package/textures/FlakesTexture.js +0 -30
- package/types/helpers.cjs +0 -4
- package/types/helpers.js +0 -4
- package/utils/BufferGeometryUtils.cjs +0 -636
- package/utils/BufferGeometryUtils.js +0 -636
- package/utils/GeometryCompressionUtils.cjs +0 -573
- package/utils/GeometryCompressionUtils.js +0 -573
- package/utils/GeometryUtils.cjs +0 -109
- package/utils/GeometryUtils.js +0 -109
- package/utils/RoughnessMipmapper.cjs +0 -223
- package/utils/RoughnessMipmapper.js +0 -223
- package/utils/SceneUtils.cjs +0 -36
- package/utils/SceneUtils.js +0 -36
- package/utils/ShadowMapViewer.cjs +0 -111
- package/utils/ShadowMapViewer.js +0 -111
- package/utils/SkeletonUtils.cjs +0 -211
- package/utils/SkeletonUtils.js +0 -211
- package/utils/UVsDebug.cjs +0 -80
- package/utils/UVsDebug.js +0 -80
- package/utils/WorkerPool.cjs +0 -62
- package/utils/WorkerPool.js +0 -62
- package/webxr/ARButton.cjs +0 -119
- package/webxr/ARButton.js +0 -119
- package/webxr/OculusHandModel.cjs +0 -82
- package/webxr/OculusHandModel.js +0 -82
- package/webxr/OculusHandPointerModel.cjs +0 -241
- package/webxr/OculusHandPointerModel.js +0 -224
- package/webxr/Text2D.cjs +0 -48
- package/webxr/Text2D.js +0 -31
- package/webxr/VRButton.cjs +0 -111
- package/webxr/VRButton.js +0 -111
- package/webxr/XRControllerModelFactory.cjs +0 -174
- package/webxr/XRControllerModelFactory.js +0 -174
- package/webxr/XREstimatedLight.cjs +0 -126
- package/webxr/XREstimatedLight.js +0 -126
- package/webxr/XRHandMeshModel.cjs +0 -82
- package/webxr/XRHandMeshModel.js +0 -82
- package/webxr/XRHandModelFactory.cjs +0 -61
- package/webxr/XRHandModelFactory.js +0 -61
- package/webxr/XRHandPrimitiveModel.cjs +0 -68
- package/webxr/XRHandPrimitiveModel.js +0 -68
package/misc/MorphBlendMesh.js
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
import { Mesh, MathUtils } from "three";
|
2
|
-
class MorphBlendMesh extends Mesh {
|
3
|
-
constructor(geometry, material) {
|
4
|
-
super(geometry, material);
|
5
|
-
this.animationsMap = {};
|
6
|
-
this.animationsList = [];
|
7
|
-
const numFrames = Object.keys(this.morphTargetDictionary).length;
|
8
|
-
const name = "__default";
|
9
|
-
const startFrame = 0;
|
10
|
-
const endFrame = numFrames - 1;
|
11
|
-
const fps = numFrames / 1;
|
12
|
-
this.createAnimation(name, startFrame, endFrame, fps);
|
13
|
-
this.setAnimationWeight(name, 1);
|
14
|
-
}
|
15
|
-
createAnimation(name, start, end, fps) {
|
16
|
-
const animation = {
|
17
|
-
start,
|
18
|
-
end,
|
19
|
-
length: end - start + 1,
|
20
|
-
fps,
|
21
|
-
duration: (end - start) / fps,
|
22
|
-
lastFrame: 0,
|
23
|
-
currentFrame: 0,
|
24
|
-
active: false,
|
25
|
-
time: 0,
|
26
|
-
direction: 1,
|
27
|
-
weight: 1,
|
28
|
-
directionBackwards: false,
|
29
|
-
mirroredLoop: false
|
30
|
-
};
|
31
|
-
this.animationsMap[name] = animation;
|
32
|
-
this.animationsList.push(animation);
|
33
|
-
}
|
34
|
-
autoCreateAnimations(fps) {
|
35
|
-
const pattern = /([a-z]+)_?(\d+)/i;
|
36
|
-
let firstAnimation;
|
37
|
-
const frameRanges = {};
|
38
|
-
let i = 0;
|
39
|
-
for (const key in this.morphTargetDictionary) {
|
40
|
-
const chunks = key.match(pattern);
|
41
|
-
if (chunks && chunks.length > 1) {
|
42
|
-
const name = chunks[1];
|
43
|
-
if (!frameRanges[name])
|
44
|
-
frameRanges[name] = { start: Infinity, end: -Infinity };
|
45
|
-
const range = frameRanges[name];
|
46
|
-
if (i < range.start)
|
47
|
-
range.start = i;
|
48
|
-
if (i > range.end)
|
49
|
-
range.end = i;
|
50
|
-
if (!firstAnimation)
|
51
|
-
firstAnimation = name;
|
52
|
-
}
|
53
|
-
i++;
|
54
|
-
}
|
55
|
-
for (const name in frameRanges) {
|
56
|
-
const range = frameRanges[name];
|
57
|
-
this.createAnimation(name, range.start, range.end, fps);
|
58
|
-
}
|
59
|
-
this.firstAnimation = firstAnimation;
|
60
|
-
}
|
61
|
-
setAnimationDirectionForward(name) {
|
62
|
-
const animation = this.animationsMap[name];
|
63
|
-
if (animation) {
|
64
|
-
animation.direction = 1;
|
65
|
-
animation.directionBackwards = false;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
setAnimationDirectionBackward(name) {
|
69
|
-
const animation = this.animationsMap[name];
|
70
|
-
if (animation) {
|
71
|
-
animation.direction = -1;
|
72
|
-
animation.directionBackwards = true;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
setAnimationFPS(name, fps) {
|
76
|
-
const animation = this.animationsMap[name];
|
77
|
-
if (animation) {
|
78
|
-
animation.fps = fps;
|
79
|
-
animation.duration = (animation.end - animation.start) / animation.fps;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
setAnimationDuration(name, duration) {
|
83
|
-
const animation = this.animationsMap[name];
|
84
|
-
if (animation) {
|
85
|
-
animation.duration = duration;
|
86
|
-
animation.fps = (animation.end - animation.start) / animation.duration;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
setAnimationWeight(name, weight) {
|
90
|
-
const animation = this.animationsMap[name];
|
91
|
-
if (animation) {
|
92
|
-
animation.weight = weight;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
setAnimationTime(name, time) {
|
96
|
-
const animation = this.animationsMap[name];
|
97
|
-
if (animation) {
|
98
|
-
animation.time = time;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
getAnimationTime(name) {
|
102
|
-
let time = 0;
|
103
|
-
const animation = this.animationsMap[name];
|
104
|
-
if (animation) {
|
105
|
-
time = animation.time;
|
106
|
-
}
|
107
|
-
return time;
|
108
|
-
}
|
109
|
-
getAnimationDuration(name) {
|
110
|
-
let duration = -1;
|
111
|
-
const animation = this.animationsMap[name];
|
112
|
-
if (animation) {
|
113
|
-
duration = animation.duration;
|
114
|
-
}
|
115
|
-
return duration;
|
116
|
-
}
|
117
|
-
playAnimation(name) {
|
118
|
-
const animation = this.animationsMap[name];
|
119
|
-
if (animation) {
|
120
|
-
animation.time = 0;
|
121
|
-
animation.active = true;
|
122
|
-
} else {
|
123
|
-
console.warn("THREE.MorphBlendMesh: animation[" + name + "] undefined in .playAnimation()");
|
124
|
-
}
|
125
|
-
}
|
126
|
-
stopAnimation(name) {
|
127
|
-
const animation = this.animationsMap[name];
|
128
|
-
if (animation) {
|
129
|
-
animation.active = false;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
update(delta) {
|
133
|
-
for (let i = 0, il = this.animationsList.length; i < il; i++) {
|
134
|
-
const animation = this.animationsList[i];
|
135
|
-
if (!animation.active)
|
136
|
-
continue;
|
137
|
-
const frameTime = animation.duration / animation.length;
|
138
|
-
animation.time += animation.direction * delta;
|
139
|
-
if (animation.mirroredLoop) {
|
140
|
-
if (animation.time > animation.duration || animation.time < 0) {
|
141
|
-
animation.direction *= -1;
|
142
|
-
if (animation.time > animation.duration) {
|
143
|
-
animation.time = animation.duration;
|
144
|
-
animation.directionBackwards = true;
|
145
|
-
}
|
146
|
-
if (animation.time < 0) {
|
147
|
-
animation.time = 0;
|
148
|
-
animation.directionBackwards = false;
|
149
|
-
}
|
150
|
-
}
|
151
|
-
} else {
|
152
|
-
animation.time = animation.time % animation.duration;
|
153
|
-
if (animation.time < 0)
|
154
|
-
animation.time += animation.duration;
|
155
|
-
}
|
156
|
-
const keyframe = animation.start + MathUtils.clamp(Math.floor(animation.time / frameTime), 0, animation.length - 1);
|
157
|
-
const weight = animation.weight;
|
158
|
-
if (keyframe !== animation.currentFrame) {
|
159
|
-
this.morphTargetInfluences[animation.lastFrame] = 0;
|
160
|
-
this.morphTargetInfluences[animation.currentFrame] = 1 * weight;
|
161
|
-
this.morphTargetInfluences[keyframe] = 0;
|
162
|
-
animation.lastFrame = animation.currentFrame;
|
163
|
-
animation.currentFrame = keyframe;
|
164
|
-
}
|
165
|
-
let mix = animation.time % frameTime / frameTime;
|
166
|
-
if (animation.directionBackwards)
|
167
|
-
mix = 1 - mix;
|
168
|
-
if (animation.currentFrame !== animation.lastFrame) {
|
169
|
-
this.morphTargetInfluences[animation.currentFrame] = mix * weight;
|
170
|
-
this.morphTargetInfluences[animation.lastFrame] = (1 - mix) * weight;
|
171
|
-
} else {
|
172
|
-
this.morphTargetInfluences[animation.currentFrame] = weight;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
177
|
-
export {
|
178
|
-
MorphBlendMesh
|
179
|
-
};
|
@@ -1,186 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
-
const THREE = require("three");
|
4
|
-
const potpack = require("potpack");
|
5
|
-
class ProgressiveLightMap {
|
6
|
-
constructor(renderer, res = 1024) {
|
7
|
-
this.renderer = renderer;
|
8
|
-
this.res = res;
|
9
|
-
this.lightMapContainers = [];
|
10
|
-
this.compiled = false;
|
11
|
-
this.scene = new THREE.Scene();
|
12
|
-
this.scene.background = null;
|
13
|
-
this.tinyTarget = new THREE.WebGLRenderTarget(1, 1);
|
14
|
-
this.buffer1Active = false;
|
15
|
-
this.firstUpdate = true;
|
16
|
-
this.warned = false;
|
17
|
-
const format = /(Android|iPad|iPhone|iPod)/g.test(navigator.userAgent) ? alfFloatType : THREE.FloatType;
|
18
|
-
this.progressiveLightMap1 = new THREE.WebGLRenderTarget(this.res, this.res, { type: format });
|
19
|
-
this.progressiveLightMap2 = new THREE.WebGLRenderTarget(this.res, this.res, { type: format });
|
20
|
-
this.uvMat = new THREE.MeshPhongMaterial();
|
21
|
-
this.uvMat.uniforms = {};
|
22
|
-
this.uvMat.onBeforeCompile = (shader) => {
|
23
|
-
shader.vertexShader = "#define USE_LIGHTMAP\n" + shader.vertexShader.slice(0, -1) + " gl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }";
|
24
|
-
const bodyStart = shader.fragmentShader.indexOf("void main() {");
|
25
|
-
shader.fragmentShader = "varying vec2 vUv2;\n" + shader.fragmentShader.slice(0, bodyStart) + " uniform sampler2D previousShadowMap;\n uniform float averagingWindow;\n" + shader.fragmentShader.slice(bodyStart - 1, -1) + `
|
26
|
-
vec3 texelOld = texture2D(previousShadowMap, vUv2).rgb;
|
27
|
-
gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/averagingWindow);
|
28
|
-
}`;
|
29
|
-
shader.uniforms.previousShadowMap = { value: this.progressiveLightMap1.texture };
|
30
|
-
shader.uniforms.averagingWindow = { value: 100 };
|
31
|
-
this.uvMat.uniforms = shader.uniforms;
|
32
|
-
this.uvMat.userData.shader = shader;
|
33
|
-
this.compiled = true;
|
34
|
-
};
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* Sets these objects' materials' lightmaps and modifies their uv2's.
|
38
|
-
* @param {Object3D} objects An array of objects and lights to set up your lightmap.
|
39
|
-
*/
|
40
|
-
addObjectsToLightMap(objects) {
|
41
|
-
this.uv_boxes = [];
|
42
|
-
const padding = 3 / this.res;
|
43
|
-
for (let ob = 0; ob < objects.length; ob++) {
|
44
|
-
const object = objects[ob];
|
45
|
-
if (object.isLight) {
|
46
|
-
this.scene.attach(object);
|
47
|
-
continue;
|
48
|
-
}
|
49
|
-
if (!object.geometry.hasAttribute("uv")) {
|
50
|
-
console.warn("All lightmap objects need UVs!");
|
51
|
-
continue;
|
52
|
-
}
|
53
|
-
if (this.blurringPlane == null) {
|
54
|
-
this._initializeBlurPlane(this.res, this.progressiveLightMap1);
|
55
|
-
}
|
56
|
-
object.material.lightMap = this.progressiveLightMap2.texture;
|
57
|
-
object.material.dithering = true;
|
58
|
-
object.castShadow = true;
|
59
|
-
object.receiveShadow = true;
|
60
|
-
object.renderOrder = 1e3 + ob;
|
61
|
-
this.uv_boxes.push({ w: 1 + padding * 2, h: 1 + padding * 2, index: ob });
|
62
|
-
this.lightMapContainers.push({ basicMat: object.material, object });
|
63
|
-
this.compiled = false;
|
64
|
-
}
|
65
|
-
const dimensions = potpack(this.uv_boxes);
|
66
|
-
this.uv_boxes.forEach((box) => {
|
67
|
-
const uv2 = objects[box.index].geometry.getAttribute("uv").clone();
|
68
|
-
for (let i = 0; i < uv2.array.length; i += uv2.itemSize) {
|
69
|
-
uv2.array[i] = (uv2.array[i] + box.x + padding) / dimensions.w;
|
70
|
-
uv2.array[i + 1] = (uv2.array[i + 1] + box.y + padding) / dimensions.h;
|
71
|
-
}
|
72
|
-
objects[box.index].geometry.setAttribute("uv2", uv2);
|
73
|
-
objects[box.index].geometry.getAttribute("uv2").needsUpdate = true;
|
74
|
-
});
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
* This function renders each mesh one at a time into their respective surface maps
|
78
|
-
* @param {Camera} camera Standard Rendering Camera
|
79
|
-
* @param {number} blendWindow When >1, samples will accumulate over time.
|
80
|
-
* @param {boolean} blurEdges Whether to fix UV Edges via blurring
|
81
|
-
*/
|
82
|
-
update(camera, blendWindow = 100, blurEdges = true) {
|
83
|
-
if (this.blurringPlane == null) {
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
const oldTarget = this.renderer.getRenderTarget();
|
87
|
-
this.blurringPlane.visible = blurEdges;
|
88
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
89
|
-
this.lightMapContainers[l].object.oldScene = this.lightMapContainers[l].object.parent;
|
90
|
-
this.scene.attach(this.lightMapContainers[l].object);
|
91
|
-
}
|
92
|
-
if (this.firstUpdate) {
|
93
|
-
this.renderer.setRenderTarget(this.tinyTarget);
|
94
|
-
this.renderer.render(this.scene, camera);
|
95
|
-
this.firstUpdate = false;
|
96
|
-
}
|
97
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
98
|
-
this.uvMat.uniforms.averagingWindow = { value: blendWindow };
|
99
|
-
this.lightMapContainers[l].object.material = this.uvMat;
|
100
|
-
this.lightMapContainers[l].object.oldFrustumCulled = this.lightMapContainers[l].object.frustumCulled;
|
101
|
-
this.lightMapContainers[l].object.frustumCulled = false;
|
102
|
-
}
|
103
|
-
const activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2;
|
104
|
-
const inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1;
|
105
|
-
this.renderer.setRenderTarget(activeMap);
|
106
|
-
this.uvMat.uniforms.previousShadowMap = { value: inactiveMap.texture };
|
107
|
-
this.blurringPlane.material.uniforms.previousShadowMap = { value: inactiveMap.texture };
|
108
|
-
this.buffer1Active = !this.buffer1Active;
|
109
|
-
this.renderer.render(this.scene, camera);
|
110
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
111
|
-
this.lightMapContainers[l].object.frustumCulled = this.lightMapContainers[l].object.oldFrustumCulled;
|
112
|
-
this.lightMapContainers[l].object.material = this.lightMapContainers[l].basicMat;
|
113
|
-
this.lightMapContainers[l].object.oldScene.attach(this.lightMapContainers[l].object);
|
114
|
-
}
|
115
|
-
this.renderer.setRenderTarget(oldTarget);
|
116
|
-
}
|
117
|
-
/** DEBUG
|
118
|
-
* Draw the lightmap in the main scene. Call this after adding the objects to it.
|
119
|
-
* @param {boolean} visible Whether the debug plane should be visible
|
120
|
-
* @param {Vector3} position Where the debug plane should be drawn
|
121
|
-
*/
|
122
|
-
showDebugLightmap(visible, position = void 0) {
|
123
|
-
if (this.lightMapContainers.length == 0) {
|
124
|
-
if (!this.warned) {
|
125
|
-
console.warn("Call this after adding the objects!");
|
126
|
-
this.warned = true;
|
127
|
-
}
|
128
|
-
return;
|
129
|
-
}
|
130
|
-
if (this.labelMesh == null) {
|
131
|
-
this.labelMaterial = new THREE.MeshBasicMaterial({
|
132
|
-
map: this.progressiveLightMap1.texture,
|
133
|
-
side: THREE.DoubleSide
|
134
|
-
});
|
135
|
-
this.labelPlane = new THREE.PlaneGeometry(100, 100);
|
136
|
-
this.labelMesh = new THREE.Mesh(this.labelPlane, this.labelMaterial);
|
137
|
-
this.labelMesh.position.y = 250;
|
138
|
-
this.lightMapContainers[0].object.parent.add(this.labelMesh);
|
139
|
-
}
|
140
|
-
if (position != void 0) {
|
141
|
-
this.labelMesh.position.copy(position);
|
142
|
-
}
|
143
|
-
this.labelMesh.visible = visible;
|
144
|
-
}
|
145
|
-
/**
|
146
|
-
* INTERNAL Creates the Blurring Plane
|
147
|
-
* @param {number} res The square resolution of this object's lightMap.
|
148
|
-
* @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with.
|
149
|
-
*/
|
150
|
-
_initializeBlurPlane(res, lightMap = null) {
|
151
|
-
const blurMaterial = new THREE.MeshBasicMaterial();
|
152
|
-
blurMaterial.uniforms = {
|
153
|
-
previousShadowMap: { value: null },
|
154
|
-
pixelOffset: { value: 1 / res },
|
155
|
-
polygonOffset: true,
|
156
|
-
polygonOffsetFactor: -1,
|
157
|
-
polygonOffsetUnits: 3
|
158
|
-
};
|
159
|
-
blurMaterial.onBeforeCompile = (shader) => {
|
160
|
-
shader.vertexShader = "#define USE_UV\n" + shader.vertexShader.slice(0, -1) + " gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";
|
161
|
-
const bodyStart = shader.fragmentShader.indexOf("void main() {");
|
162
|
-
shader.fragmentShader = "#define USE_UV\n" + shader.fragmentShader.slice(0, bodyStart) + " uniform sampler2D previousShadowMap;\n uniform float pixelOffset;\n" + shader.fragmentShader.slice(bodyStart - 1, -1) + ` gl_FragColor.rgb = (
|
163
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
|
164
|
-
texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +
|
165
|
-
texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +
|
166
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +
|
167
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
|
168
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +
|
169
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +
|
170
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;
|
171
|
-
}`;
|
172
|
-
shader.uniforms.previousShadowMap = { value: lightMap.texture };
|
173
|
-
shader.uniforms.pixelOffset = { value: 0.5 / res };
|
174
|
-
blurMaterial.uniforms = shader.uniforms;
|
175
|
-
blurMaterial.userData.shader = shader;
|
176
|
-
this.compiled = true;
|
177
|
-
};
|
178
|
-
this.blurringPlane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), blurMaterial);
|
179
|
-
this.blurringPlane.name = "Blurring Plane";
|
180
|
-
this.blurringPlane.frustumCulled = false;
|
181
|
-
this.blurringPlane.renderOrder = 0;
|
182
|
-
this.blurringPlane.material.depthWrite = false;
|
183
|
-
this.scene.add(this.blurringPlane);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
exports.ProgressiveLightMap = ProgressiveLightMap;
|
@@ -1,186 +0,0 @@
|
|
1
|
-
import { Scene, WebGLRenderTarget, FloatType, MeshPhongMaterial, MeshBasicMaterial, DoubleSide, PlaneGeometry, Mesh } from "three";
|
2
|
-
import potpack from "potpack";
|
3
|
-
class ProgressiveLightMap {
|
4
|
-
constructor(renderer, res = 1024) {
|
5
|
-
this.renderer = renderer;
|
6
|
-
this.res = res;
|
7
|
-
this.lightMapContainers = [];
|
8
|
-
this.compiled = false;
|
9
|
-
this.scene = new Scene();
|
10
|
-
this.scene.background = null;
|
11
|
-
this.tinyTarget = new WebGLRenderTarget(1, 1);
|
12
|
-
this.buffer1Active = false;
|
13
|
-
this.firstUpdate = true;
|
14
|
-
this.warned = false;
|
15
|
-
const format = /(Android|iPad|iPhone|iPod)/g.test(navigator.userAgent) ? alfFloatType : FloatType;
|
16
|
-
this.progressiveLightMap1 = new WebGLRenderTarget(this.res, this.res, { type: format });
|
17
|
-
this.progressiveLightMap2 = new WebGLRenderTarget(this.res, this.res, { type: format });
|
18
|
-
this.uvMat = new MeshPhongMaterial();
|
19
|
-
this.uvMat.uniforms = {};
|
20
|
-
this.uvMat.onBeforeCompile = (shader) => {
|
21
|
-
shader.vertexShader = "#define USE_LIGHTMAP\n" + shader.vertexShader.slice(0, -1) + " gl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }";
|
22
|
-
const bodyStart = shader.fragmentShader.indexOf("void main() {");
|
23
|
-
shader.fragmentShader = "varying vec2 vUv2;\n" + shader.fragmentShader.slice(0, bodyStart) + " uniform sampler2D previousShadowMap;\n uniform float averagingWindow;\n" + shader.fragmentShader.slice(bodyStart - 1, -1) + `
|
24
|
-
vec3 texelOld = texture2D(previousShadowMap, vUv2).rgb;
|
25
|
-
gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/averagingWindow);
|
26
|
-
}`;
|
27
|
-
shader.uniforms.previousShadowMap = { value: this.progressiveLightMap1.texture };
|
28
|
-
shader.uniforms.averagingWindow = { value: 100 };
|
29
|
-
this.uvMat.uniforms = shader.uniforms;
|
30
|
-
this.uvMat.userData.shader = shader;
|
31
|
-
this.compiled = true;
|
32
|
-
};
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* Sets these objects' materials' lightmaps and modifies their uv2's.
|
36
|
-
* @param {Object3D} objects An array of objects and lights to set up your lightmap.
|
37
|
-
*/
|
38
|
-
addObjectsToLightMap(objects) {
|
39
|
-
this.uv_boxes = [];
|
40
|
-
const padding = 3 / this.res;
|
41
|
-
for (let ob = 0; ob < objects.length; ob++) {
|
42
|
-
const object = objects[ob];
|
43
|
-
if (object.isLight) {
|
44
|
-
this.scene.attach(object);
|
45
|
-
continue;
|
46
|
-
}
|
47
|
-
if (!object.geometry.hasAttribute("uv")) {
|
48
|
-
console.warn("All lightmap objects need UVs!");
|
49
|
-
continue;
|
50
|
-
}
|
51
|
-
if (this.blurringPlane == null) {
|
52
|
-
this._initializeBlurPlane(this.res, this.progressiveLightMap1);
|
53
|
-
}
|
54
|
-
object.material.lightMap = this.progressiveLightMap2.texture;
|
55
|
-
object.material.dithering = true;
|
56
|
-
object.castShadow = true;
|
57
|
-
object.receiveShadow = true;
|
58
|
-
object.renderOrder = 1e3 + ob;
|
59
|
-
this.uv_boxes.push({ w: 1 + padding * 2, h: 1 + padding * 2, index: ob });
|
60
|
-
this.lightMapContainers.push({ basicMat: object.material, object });
|
61
|
-
this.compiled = false;
|
62
|
-
}
|
63
|
-
const dimensions = potpack(this.uv_boxes);
|
64
|
-
this.uv_boxes.forEach((box) => {
|
65
|
-
const uv2 = objects[box.index].geometry.getAttribute("uv").clone();
|
66
|
-
for (let i = 0; i < uv2.array.length; i += uv2.itemSize) {
|
67
|
-
uv2.array[i] = (uv2.array[i] + box.x + padding) / dimensions.w;
|
68
|
-
uv2.array[i + 1] = (uv2.array[i + 1] + box.y + padding) / dimensions.h;
|
69
|
-
}
|
70
|
-
objects[box.index].geometry.setAttribute("uv2", uv2);
|
71
|
-
objects[box.index].geometry.getAttribute("uv2").needsUpdate = true;
|
72
|
-
});
|
73
|
-
}
|
74
|
-
/**
|
75
|
-
* This function renders each mesh one at a time into their respective surface maps
|
76
|
-
* @param {Camera} camera Standard Rendering Camera
|
77
|
-
* @param {number} blendWindow When >1, samples will accumulate over time.
|
78
|
-
* @param {boolean} blurEdges Whether to fix UV Edges via blurring
|
79
|
-
*/
|
80
|
-
update(camera, blendWindow = 100, blurEdges = true) {
|
81
|
-
if (this.blurringPlane == null) {
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
const oldTarget = this.renderer.getRenderTarget();
|
85
|
-
this.blurringPlane.visible = blurEdges;
|
86
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
87
|
-
this.lightMapContainers[l].object.oldScene = this.lightMapContainers[l].object.parent;
|
88
|
-
this.scene.attach(this.lightMapContainers[l].object);
|
89
|
-
}
|
90
|
-
if (this.firstUpdate) {
|
91
|
-
this.renderer.setRenderTarget(this.tinyTarget);
|
92
|
-
this.renderer.render(this.scene, camera);
|
93
|
-
this.firstUpdate = false;
|
94
|
-
}
|
95
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
96
|
-
this.uvMat.uniforms.averagingWindow = { value: blendWindow };
|
97
|
-
this.lightMapContainers[l].object.material = this.uvMat;
|
98
|
-
this.lightMapContainers[l].object.oldFrustumCulled = this.lightMapContainers[l].object.frustumCulled;
|
99
|
-
this.lightMapContainers[l].object.frustumCulled = false;
|
100
|
-
}
|
101
|
-
const activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2;
|
102
|
-
const inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1;
|
103
|
-
this.renderer.setRenderTarget(activeMap);
|
104
|
-
this.uvMat.uniforms.previousShadowMap = { value: inactiveMap.texture };
|
105
|
-
this.blurringPlane.material.uniforms.previousShadowMap = { value: inactiveMap.texture };
|
106
|
-
this.buffer1Active = !this.buffer1Active;
|
107
|
-
this.renderer.render(this.scene, camera);
|
108
|
-
for (let l = 0; l < this.lightMapContainers.length; l++) {
|
109
|
-
this.lightMapContainers[l].object.frustumCulled = this.lightMapContainers[l].object.oldFrustumCulled;
|
110
|
-
this.lightMapContainers[l].object.material = this.lightMapContainers[l].basicMat;
|
111
|
-
this.lightMapContainers[l].object.oldScene.attach(this.lightMapContainers[l].object);
|
112
|
-
}
|
113
|
-
this.renderer.setRenderTarget(oldTarget);
|
114
|
-
}
|
115
|
-
/** DEBUG
|
116
|
-
* Draw the lightmap in the main scene. Call this after adding the objects to it.
|
117
|
-
* @param {boolean} visible Whether the debug plane should be visible
|
118
|
-
* @param {Vector3} position Where the debug plane should be drawn
|
119
|
-
*/
|
120
|
-
showDebugLightmap(visible, position = void 0) {
|
121
|
-
if (this.lightMapContainers.length == 0) {
|
122
|
-
if (!this.warned) {
|
123
|
-
console.warn("Call this after adding the objects!");
|
124
|
-
this.warned = true;
|
125
|
-
}
|
126
|
-
return;
|
127
|
-
}
|
128
|
-
if (this.labelMesh == null) {
|
129
|
-
this.labelMaterial = new MeshBasicMaterial({
|
130
|
-
map: this.progressiveLightMap1.texture,
|
131
|
-
side: DoubleSide
|
132
|
-
});
|
133
|
-
this.labelPlane = new PlaneGeometry(100, 100);
|
134
|
-
this.labelMesh = new Mesh(this.labelPlane, this.labelMaterial);
|
135
|
-
this.labelMesh.position.y = 250;
|
136
|
-
this.lightMapContainers[0].object.parent.add(this.labelMesh);
|
137
|
-
}
|
138
|
-
if (position != void 0) {
|
139
|
-
this.labelMesh.position.copy(position);
|
140
|
-
}
|
141
|
-
this.labelMesh.visible = visible;
|
142
|
-
}
|
143
|
-
/**
|
144
|
-
* INTERNAL Creates the Blurring Plane
|
145
|
-
* @param {number} res The square resolution of this object's lightMap.
|
146
|
-
* @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with.
|
147
|
-
*/
|
148
|
-
_initializeBlurPlane(res, lightMap = null) {
|
149
|
-
const blurMaterial = new MeshBasicMaterial();
|
150
|
-
blurMaterial.uniforms = {
|
151
|
-
previousShadowMap: { value: null },
|
152
|
-
pixelOffset: { value: 1 / res },
|
153
|
-
polygonOffset: true,
|
154
|
-
polygonOffsetFactor: -1,
|
155
|
-
polygonOffsetUnits: 3
|
156
|
-
};
|
157
|
-
blurMaterial.onBeforeCompile = (shader) => {
|
158
|
-
shader.vertexShader = "#define USE_UV\n" + shader.vertexShader.slice(0, -1) + " gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";
|
159
|
-
const bodyStart = shader.fragmentShader.indexOf("void main() {");
|
160
|
-
shader.fragmentShader = "#define USE_UV\n" + shader.fragmentShader.slice(0, bodyStart) + " uniform sampler2D previousShadowMap;\n uniform float pixelOffset;\n" + shader.fragmentShader.slice(bodyStart - 1, -1) + ` gl_FragColor.rgb = (
|
161
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
|
162
|
-
texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +
|
163
|
-
texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +
|
164
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +
|
165
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
|
166
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +
|
167
|
-
texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +
|
168
|
-
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;
|
169
|
-
}`;
|
170
|
-
shader.uniforms.previousShadowMap = { value: lightMap.texture };
|
171
|
-
shader.uniforms.pixelOffset = { value: 0.5 / res };
|
172
|
-
blurMaterial.uniforms = shader.uniforms;
|
173
|
-
blurMaterial.userData.shader = shader;
|
174
|
-
this.compiled = true;
|
175
|
-
};
|
176
|
-
this.blurringPlane = new Mesh(new PlaneGeometry(1, 1), blurMaterial);
|
177
|
-
this.blurringPlane.name = "Blurring Plane";
|
178
|
-
this.blurringPlane.frustumCulled = false;
|
179
|
-
this.blurringPlane.renderOrder = 0;
|
180
|
-
this.blurringPlane.material.depthWrite = false;
|
181
|
-
this.scene.add(this.blurringPlane);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
export {
|
185
|
-
ProgressiveLightMap
|
186
|
-
};
|