three-stdlib 2.22.7 → 2.22.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/_polyfill/CompressedArrayTexture.js +12 -0
- package/dist/_polyfill/CompressedArrayTexture.mjs +12 -0
- package/dist/_polyfill/Data3DTexture.js +17 -0
- package/dist/_polyfill/Data3DTexture.mjs +17 -0
- package/dist/animation/AnimationClipCreator.d.ts +12 -0
- package/dist/animation/AnimationClipCreator.js +57 -0
- package/dist/animation/AnimationClipCreator.mjs +57 -0
- package/dist/animation/CCDIKSolver.d.ts +25 -0
- package/dist/animation/CCDIKSolver.js +224 -0
- package/dist/animation/CCDIKSolver.mjs +224 -0
- package/dist/animation/MMDAnimationHelper.d.ts +93 -0
- package/dist/animation/MMDAnimationHelper.js +590 -0
- package/dist/animation/MMDAnimationHelper.mjs +590 -0
- package/dist/animation/MMDPhysics.d.ts +114 -0
- package/dist/animation/MMDPhysics.js +819 -0
- package/dist/animation/MMDPhysics.mjs +819 -0
- package/dist/cameras/CinematicCamera.d.ts +34 -0
- package/dist/cameras/CinematicCamera.js +131 -0
- package/dist/cameras/CinematicCamera.mjs +131 -0
- package/dist/controls/ArcballControls.d.ts +374 -0
- package/dist/controls/ArcballControls.js +2039 -0
- package/dist/controls/ArcballControls.mjs +2039 -0
- package/dist/controls/DeviceOrientationControls.d.ts +27 -0
- package/dist/controls/DeviceOrientationControls.js +84 -0
- package/dist/controls/DeviceOrientationControls.mjs +84 -0
- package/dist/controls/DragControls.d.ts +34 -0
- package/dist/controls/DragControls.js +182 -0
- package/dist/controls/DragControls.mjs +182 -0
- package/dist/controls/FirstPersonControls.d.ts +48 -0
- package/dist/controls/FirstPersonControls.js +229 -0
- package/dist/controls/FirstPersonControls.mjs +229 -0
- package/dist/controls/FlyControls.d.ts +32 -0
- package/dist/controls/FlyControls.js +248 -0
- package/dist/controls/FlyControls.mjs +248 -0
- package/dist/controls/OrbitControls.d.ts +63 -0
- package/dist/controls/OrbitControls.js +781 -0
- package/dist/controls/OrbitControls.mjs +781 -0
- package/dist/controls/PointerLockControls.d.ts +24 -0
- package/dist/controls/PointerLockControls.js +103 -0
- package/dist/controls/PointerLockControls.mjs +103 -0
- package/dist/controls/TrackballControls.d.ts +95 -0
- package/dist/controls/TrackballControls.js +502 -0
- package/dist/controls/TrackballControls.mjs +502 -0
- package/dist/controls/TransformControls.d.ts +151 -0
- package/dist/controls/TransformControls.js +1089 -0
- package/dist/controls/TransformControls.mjs +1089 -0
- package/dist/controls/experimental/CameraControls.d.ts +212 -0
- package/dist/controls/experimental/CameraControls.js +736 -0
- package/dist/controls/experimental/CameraControls.mjs +736 -0
- package/dist/csm/CSM.d.ts +61 -0
- package/dist/csm/CSM.js +244 -0
- package/dist/csm/CSM.mjs +244 -0
- package/dist/csm/CSMFrustum.d.ts +19 -0
- package/dist/csm/CSMFrustum.js +75 -0
- package/dist/csm/CSMFrustum.mjs +75 -0
- package/dist/csm/CSMHelper.d.ts +26 -0
- package/dist/csm/CSMHelper.js +114 -0
- package/dist/csm/CSMHelper.mjs +114 -0
- package/dist/csm/CSMShader.d.ts +4 -0
- package/dist/csm/CSMShader.js +257 -0
- package/dist/csm/CSMShader.mjs +257 -0
- package/dist/curves/CurveExtras.d.ts +68 -0
- package/dist/curves/CurveExtras.js +224 -0
- package/dist/curves/CurveExtras.mjs +224 -0
- package/dist/curves/NURBSCurve.d.ts +11 -0
- package/dist/curves/NURBSCurve.js +35 -0
- package/dist/curves/NURBSCurve.mjs +35 -0
- package/dist/curves/NURBSSurface.d.ts +13 -0
- package/dist/curves/NURBSSurface.js +28 -0
- package/dist/curves/NURBSSurface.mjs +28 -0
- package/dist/curves/NURBSUtils.d.ts +22 -0
- package/dist/curves/NURBSUtils.js +226 -0
- package/dist/curves/NURBSUtils.mjs +226 -0
- package/dist/custom.d.ts +5 -0
- package/dist/deprecated/Geometry.d.ts +342 -0
- package/dist/deprecated/Geometry.js +971 -0
- package/dist/deprecated/Geometry.mjs +971 -0
- package/dist/effects/AnaglyphEffect.d.ts +11 -0
- package/dist/effects/AnaglyphEffect.js +121 -0
- package/dist/effects/AnaglyphEffect.mjs +121 -0
- package/dist/effects/AsciiEffect.d.ts +18 -0
- package/dist/effects/AsciiEffect.js +173 -0
- package/dist/effects/AsciiEffect.mjs +173 -0
- package/dist/effects/OutlineEffect.d.ts +28 -0
- package/dist/effects/OutlineEffect.js +298 -0
- package/dist/effects/OutlineEffect.mjs +298 -0
- package/dist/effects/ParallaxBarrierEffect.d.ts +8 -0
- package/dist/effects/ParallaxBarrierEffect.js +64 -0
- package/dist/effects/ParallaxBarrierEffect.mjs +64 -0
- package/dist/effects/PeppersGhostEffect.d.ts +10 -0
- package/dist/effects/PeppersGhostEffect.js +85 -0
- package/dist/effects/PeppersGhostEffect.mjs +85 -0
- package/dist/effects/StereoEffect.d.ts +9 -0
- package/dist/effects/StereoEffect.js +32 -0
- package/dist/effects/StereoEffect.mjs +32 -0
- package/dist/environments/RoomEnvironment.d.ts +5 -0
- package/dist/environments/RoomEnvironment.js +95 -0
- package/dist/environments/RoomEnvironment.mjs +78 -0
- package/dist/exporters/ColladaExporter.d.ts +50 -0
- package/dist/exporters/ColladaExporter.js +331 -0
- package/dist/exporters/ColladaExporter.mjs +331 -0
- package/dist/exporters/DRACOExporter.d.ts +23 -0
- package/dist/exporters/DRACOExporter.js +141 -0
- package/dist/exporters/DRACOExporter.mjs +141 -0
- package/dist/exporters/GLTFExporter.d.ts +446 -0
- package/dist/exporters/GLTFExporter.js +1575 -0
- package/dist/exporters/GLTFExporter.mjs +1575 -0
- package/dist/exporters/MMDExporter.d.ts +12 -0
- package/dist/exporters/MMDExporter.js +131 -0
- package/dist/exporters/MMDExporter.mjs +131 -0
- package/dist/exporters/OBJExporter.d.ts +18 -0
- package/dist/exporters/OBJExporter.js +181 -0
- package/dist/exporters/OBJExporter.mjs +181 -0
- package/dist/exporters/PLYExporter.d.ts +23 -0
- package/dist/exporters/PLYExporter.js +280 -0
- package/dist/exporters/PLYExporter.mjs +280 -0
- package/dist/exporters/STLExporter.d.ts +31 -0
- package/dist/exporters/STLExporter.js +146 -0
- package/dist/exporters/STLExporter.mjs +146 -0
- package/dist/exporters/USDZExporter.d.ts +27 -0
- package/dist/exporters/USDZExporter.js +340 -0
- package/dist/exporters/USDZExporter.mjs +340 -0
- package/dist/geometries/BoxLineGeometry.d.ts +12 -0
- package/dist/geometries/BoxLineGeometry.js +45 -0
- package/dist/geometries/BoxLineGeometry.mjs +45 -0
- package/dist/geometries/ConvexGeometry.d.ts +5 -0
- package/dist/geometries/ConvexGeometry.js +29 -0
- package/dist/geometries/ConvexGeometry.mjs +29 -0
- package/dist/geometries/DecalGeometry.d.ts +10 -0
- package/dist/geometries/DecalGeometry.js +184 -0
- package/dist/geometries/DecalGeometry.mjs +184 -0
- package/dist/geometries/LightningStrike.d.ts +108 -0
- package/dist/geometries/LightningStrike.js +548 -0
- package/dist/geometries/LightningStrike.mjs +548 -0
- package/dist/geometries/ParametricGeometries.d.ts +26 -0
- package/dist/geometries/ParametricGeometries.js +129 -0
- package/dist/geometries/ParametricGeometries.mjs +129 -0
- package/dist/geometries/ParametricGeometry.d.ts +18 -0
- package/dist/geometries/ParametricGeometry.js +63 -0
- package/dist/geometries/ParametricGeometry.mjs +63 -0
- package/dist/geometries/RoundedBoxGeometry.d.ts +5 -0
- package/dist/geometries/RoundedBoxGeometry.js +91 -0
- package/dist/geometries/RoundedBoxGeometry.mjs +91 -0
- package/dist/geometries/TeapotGeometry.d.ts +13 -0
- package/dist/geometries/TeapotGeometry.js +1563 -0
- package/dist/geometries/TeapotGeometry.mjs +1563 -0
- package/dist/geometries/TextGeometry.d.ts +18 -0
- package/dist/geometries/TextGeometry.js +27 -0
- package/dist/geometries/TextGeometry.mjs +27 -0
- package/dist/helpers/LightProbeHelper.d.ts +10 -0
- package/dist/helpers/LightProbeHelper.js +73 -0
- package/dist/helpers/LightProbeHelper.mjs +73 -0
- package/dist/helpers/PositionalAudioHelper.d.ts +13 -0
- package/dist/helpers/PositionalAudioHelper.js +68 -0
- package/dist/helpers/PositionalAudioHelper.mjs +68 -0
- package/dist/helpers/RectAreaLightHelper.d.ts +10 -0
- package/dist/helpers/RectAreaLightHelper.js +44 -0
- package/dist/helpers/RectAreaLightHelper.mjs +44 -0
- package/dist/helpers/VertexNormalsHelper.d.ts +10 -0
- package/dist/helpers/VertexNormalsHelper.js +54 -0
- package/dist/helpers/VertexNormalsHelper.mjs +54 -0
- package/dist/helpers/VertexTangentsHelper.d.ts +10 -0
- package/dist/helpers/VertexTangentsHelper.js +45 -0
- package/dist/helpers/VertexTangentsHelper.mjs +45 -0
- package/dist/index.d.ts +325 -0
- package/dist/index.js +978 -0
- package/dist/index.mjs +978 -0
- package/dist/interactive/HTMLMesh.d.ts +6 -0
- package/dist/interactive/HTMLMesh.js +325 -0
- package/dist/interactive/HTMLMesh.mjs +325 -0
- package/dist/interactive/InteractiveGroup.d.ts +5 -0
- package/dist/interactive/InteractiveGroup.js +68 -0
- package/dist/interactive/InteractiveGroup.mjs +68 -0
- package/dist/interactive/SelectionBox.d.ts +15 -0
- package/dist/interactive/SelectionBox.js +137 -0
- package/dist/interactive/SelectionBox.mjs +137 -0
- package/dist/interactive/SelectionHelper.d.ts +17 -0
- package/dist/interactive/SelectionHelper.js +54 -0
- package/dist/interactive/SelectionHelper.mjs +54 -0
- package/dist/libs/MeshoptDecoder.d.ts +12 -0
- package/dist/libs/MeshoptDecoder.js +221 -0
- package/dist/libs/MeshoptDecoder.mjs +221 -0
- package/dist/libs/MotionControllers.d.ts +175 -0
- package/dist/libs/MotionControllers.js +325 -0
- package/dist/libs/MotionControllers.mjs +325 -0
- package/dist/lights/LightProbeGenerator.d.ts +6 -0
- package/dist/lights/LightProbeGenerator.js +145 -0
- package/dist/lights/LightProbeGenerator.mjs +145 -0
- package/dist/lights/RectAreaLightUniformsLib.d.ts +3 -0
- package/dist/lights/RectAreaLightUniformsLib.js +32842 -0
- package/dist/lights/RectAreaLightUniformsLib.mjs +32842 -0
- package/dist/lines/Line2.d.ts +11 -0
- package/dist/lines/Line2.js +13 -0
- package/dist/lines/Line2.mjs +13 -0
- package/dist/lines/LineGeometry.d.ts +10 -0
- package/dist/lines/LineGeometry.js +44 -0
- package/dist/lines/LineGeometry.mjs +44 -0
- package/dist/lines/LineMaterial.d.ts +31 -0
- package/dist/lines/LineMaterial.js +547 -0
- package/dist/lines/LineMaterial.mjs +547 -0
- package/dist/lines/LineSegments2.d.ts +14 -0
- package/dist/lines/LineSegments2.js +203 -0
- package/dist/lines/LineSegments2.mjs +203 -0
- package/dist/lines/LineSegmentsGeometry.d.ts +16 -0
- package/dist/lines/LineSegmentsGeometry.js +124 -0
- package/dist/lines/LineSegmentsGeometry.mjs +124 -0
- package/dist/lines/Wireframe.d.ts +11 -0
- package/dist/lines/Wireframe.js +32 -0
- package/dist/lines/Wireframe.mjs +32 -0
- package/dist/lines/WireframeGeometry2.d.ts +8 -0
- package/dist/lines/WireframeGeometry2.js +13 -0
- package/dist/lines/WireframeGeometry2.mjs +13 -0
- package/dist/loaders/3DMLoader.d.ts +17 -0
- package/dist/loaders/3DMLoader.js +803 -0
- package/dist/loaders/3DMLoader.mjs +803 -0
- package/dist/loaders/3MFLoader.d.ts +16 -0
- package/dist/loaders/3MFLoader.js +854 -0
- package/dist/loaders/3MFLoader.mjs +854 -0
- package/dist/loaders/AMFLoader.d.ts +14 -0
- package/dist/loaders/AMFLoader.js +284 -0
- package/dist/loaders/AMFLoader.mjs +284 -0
- package/dist/loaders/AssimpLoader.js +1396 -0
- package/dist/loaders/AssimpLoader.mjs +1396 -0
- package/dist/loaders/BVHLoader.d.ts +21 -0
- package/dist/loaders/BVHLoader.js +207 -0
- package/dist/loaders/BVHLoader.mjs +207 -0
- package/dist/loaders/BasisTextureLoader.d.ts +32 -0
- package/dist/loaders/BasisTextureLoader.js +480 -0
- package/dist/loaders/BasisTextureLoader.mjs +480 -0
- package/dist/loaders/ColladaLoader.d.ts +20 -0
- package/dist/loaders/ColladaLoader.js +2405 -0
- package/dist/loaders/ColladaLoader.mjs +2405 -0
- package/dist/loaders/DDSLoader.d.ts +16 -0
- package/dist/loaders/DDSLoader.js +148 -0
- package/dist/loaders/DDSLoader.mjs +148 -0
- package/dist/loaders/DRACOLoader.d.ts +18 -0
- package/dist/loaders/DRACOLoader.js +341 -0
- package/dist/loaders/DRACOLoader.mjs +341 -0
- package/dist/loaders/EXRLoader.d.ts +18 -0
- package/dist/loaders/EXRLoader.js +1354 -0
- package/dist/loaders/EXRLoader.mjs +1354 -0
- package/dist/loaders/FBXLoader.d.ts +14 -0
- package/dist/loaders/FBXLoader.js +2457 -0
- package/dist/loaders/FBXLoader.mjs +2457 -0
- package/dist/loaders/FontLoader.d.ts +36 -0
- package/dist/loaders/FontLoader.js +120 -0
- package/dist/loaders/FontLoader.mjs +120 -0
- package/dist/loaders/GCodeLoader.d.ts +15 -0
- package/dist/loaders/GCodeLoader.js +141 -0
- package/dist/loaders/GCodeLoader.mjs +141 -0
- package/dist/loaders/GLTFLoader.d.ts +153 -0
- package/dist/loaders/GLTFLoader.js +2459 -0
- package/dist/loaders/GLTFLoader.mjs +2459 -0
- package/dist/loaders/HDRCubeTextureLoader.d.ts +18 -0
- package/dist/loaders/HDRCubeTextureLoader.js +75 -0
- package/dist/loaders/HDRCubeTextureLoader.mjs +75 -0
- package/dist/loaders/KMZLoader.d.ts +16 -0
- package/dist/loaders/KMZLoader.js +75 -0
- package/dist/loaders/KMZLoader.mjs +75 -0
- package/dist/loaders/KTX2Loader.d.ts +16 -0
- package/dist/loaders/KTX2Loader.js +461 -0
- package/dist/loaders/KTX2Loader.mjs +461 -0
- package/dist/loaders/KTXLoader.d.ts +16 -0
- package/dist/loaders/KTXLoader.js +93 -0
- package/dist/loaders/KTXLoader.mjs +93 -0
- package/dist/loaders/LDrawLoader.d.ts +26 -0
- package/dist/loaders/LDrawLoader.js +1424 -0
- package/dist/loaders/LDrawLoader.mjs +1424 -0
- package/dist/loaders/LUT3dlLoader.d.ts +20 -0
- package/dist/loaders/LUT3dlLoader.js +103 -0
- package/dist/loaders/LUT3dlLoader.mjs +103 -0
- package/dist/loaders/LUTCubeLoader.d.ts +23 -0
- package/dist/loaders/LUTCubeLoader.js +107 -0
- package/dist/loaders/LUTCubeLoader.mjs +107 -0
- package/dist/loaders/LWOLoader.d.ts +26 -0
- package/dist/loaders/LWOLoader.js +645 -0
- package/dist/loaders/LWOLoader.mjs +645 -0
- package/dist/loaders/LottieLoader.d.ts +15 -0
- package/dist/loaders/LottieLoader.js +47 -0
- package/dist/loaders/LottieLoader.mjs +47 -0
- package/dist/loaders/MD2Loader.d.ts +14 -0
- package/dist/loaders/MD2Loader.js +359 -0
- package/dist/loaders/MD2Loader.mjs +359 -0
- package/dist/loaders/MDDLoader.d.ts +19 -0
- package/dist/loaders/MDDLoader.js +58 -0
- package/dist/loaders/MDDLoader.mjs +58 -0
- package/dist/loaders/MMDLoader.d.ts +63 -0
- package/dist/loaders/MMDLoader.js +1121 -0
- package/dist/loaders/MMDLoader.mjs +1121 -0
- package/dist/loaders/MTLLoader.d.ts +100 -0
- package/dist/loaders/MTLLoader.js +304 -0
- package/dist/loaders/MTLLoader.mjs +304 -0
- package/dist/loaders/NRRDLoader.d.ts +21 -0
- package/dist/loaders/NRRDLoader.js +401 -0
- package/dist/loaders/NRRDLoader.mjs +401 -0
- package/dist/loaders/NodeMaterialLoader.js +146 -0
- package/dist/loaders/NodeMaterialLoader.mjs +146 -0
- package/dist/loaders/OBJLoader.d.ts +17 -0
- package/dist/loaders/OBJLoader.js +487 -0
- package/dist/loaders/OBJLoader.mjs +487 -0
- package/dist/loaders/PCDLoader.d.ts +15 -0
- package/dist/loaders/PCDLoader.js +248 -0
- package/dist/loaders/PCDLoader.mjs +248 -0
- package/dist/loaders/PDBLoader.d.ts +22 -0
- package/dist/loaders/PDBLoader.js +247 -0
- package/dist/loaders/PDBLoader.mjs +247 -0
- package/dist/loaders/PLYLoader.d.ts +16 -0
- package/dist/loaders/PLYLoader.js +317 -0
- package/dist/loaders/PLYLoader.mjs +317 -0
- package/dist/loaders/PRWMLoader.d.ts +16 -0
- package/dist/loaders/PRWMLoader.js +160 -0
- package/dist/loaders/PRWMLoader.mjs +160 -0
- package/dist/loaders/PVRLoader.d.ts +16 -0
- package/dist/loaders/PVRLoader.js +131 -0
- package/dist/loaders/PVRLoader.mjs +131 -0
- package/dist/loaders/RGBELoader.d.ts +20 -0
- package/dist/loaders/RGBELoader.js +252 -0
- package/dist/loaders/RGBELoader.mjs +252 -0
- package/dist/loaders/RGBMLoader.d.ts +32 -0
- package/dist/loaders/RGBMLoader.js +998 -0
- package/dist/loaders/RGBMLoader.mjs +998 -0
- package/dist/loaders/STLLoader.d.ts +14 -0
- package/dist/loaders/STLLoader.js +190 -0
- package/dist/loaders/STLLoader.mjs +190 -0
- package/dist/loaders/SVGLoader.d.ts +63 -0
- package/dist/loaders/SVGLoader.js +1712 -0
- package/dist/loaders/SVGLoader.mjs +1712 -0
- package/dist/loaders/TDSLoader.d.ts +42 -0
- package/dist/loaders/TDSLoader.js +650 -0
- package/dist/loaders/TDSLoader.mjs +650 -0
- package/dist/loaders/TGALoader.d.ts +14 -0
- package/dist/loaders/TGALoader.js +285 -0
- package/dist/loaders/TGALoader.mjs +285 -0
- package/dist/loaders/TTFLoader.d.ts +15 -0
- package/dist/loaders/TTFLoader.js +131 -0
- package/dist/loaders/TTFLoader.mjs +131 -0
- package/dist/loaders/TiltLoader.d.ts +14 -0
- package/dist/loaders/TiltLoader.js +373 -0
- package/dist/loaders/TiltLoader.mjs +373 -0
- package/dist/loaders/VOXLoader.d.ts +28 -0
- package/dist/loaders/VOXLoader.js +432 -0
- package/dist/loaders/VOXLoader.mjs +432 -0
- package/dist/loaders/VRMLLoader.d.ts +14 -0
- package/dist/loaders/VRMLLoader.js +2105 -0
- package/dist/loaders/VRMLLoader.mjs +2105 -0
- package/dist/loaders/VRMLoader.js +38 -0
- package/dist/loaders/VRMLoader.mjs +38 -0
- package/dist/loaders/VTKLoader.d.ts +14 -0
- package/dist/loaders/VTKLoader.js +648 -0
- package/dist/loaders/VTKLoader.mjs +648 -0
- package/dist/loaders/XLoader.js +1258 -0
- package/dist/loaders/XLoader.mjs +1258 -0
- package/dist/loaders/XYZLoader.d.ts +14 -0
- package/dist/loaders/XYZLoader.js +60 -0
- package/dist/loaders/XYZLoader.mjs +60 -0
- package/dist/loaders/lwo/IFFParser.js +749 -0
- package/dist/loaders/lwo/IFFParser.mjs +749 -0
- package/dist/loaders/lwo/LWO2Parser.js +327 -0
- package/dist/loaders/lwo/LWO2Parser.mjs +327 -0
- package/dist/loaders/lwo/LWO3Parser.js +298 -0
- package/dist/loaders/lwo/LWO3Parser.mjs +298 -0
- package/dist/math/Capsule.d.ts +27 -0
- package/dist/math/Capsule.js +100 -0
- package/dist/math/Capsule.mjs +100 -0
- package/dist/math/ColorConverter.d.ts +21 -0
- package/dist/math/ColorConverter.js +52 -0
- package/dist/math/ColorConverter.mjs +52 -0
- package/dist/math/ConvexHull.d.ts +89 -0
- package/dist/math/ConvexHull.js +597 -0
- package/dist/math/ConvexHull.mjs +597 -0
- package/dist/math/ImprovedNoise.d.ts +4 -0
- package/dist/math/ImprovedNoise.js +302 -0
- package/dist/math/ImprovedNoise.mjs +302 -0
- package/dist/math/Lut.d.ts +27 -0
- package/dist/math/Lut.js +135 -0
- package/dist/math/Lut.mjs +135 -0
- package/dist/math/MeshSurfaceSampler.d.ts +15 -0
- package/dist/math/MeshSurfaceSampler.js +107 -0
- package/dist/math/MeshSurfaceSampler.mjs +107 -0
- package/dist/math/OBB.d.ts +24 -0
- package/dist/math/OBB.js +262 -0
- package/dist/math/OBB.mjs +262 -0
- package/dist/math/Octree.d.ts +24 -0
- package/dist/math/Octree.js +278 -0
- package/dist/math/Octree.mjs +278 -0
- package/dist/math/SimplexNoise.d.ts +21 -0
- package/dist/math/SimplexNoise.js +440 -0
- package/dist/math/SimplexNoise.mjs +440 -0
- package/dist/misc/ConvexObjectBreaker.d.ts +25 -0
- package/dist/misc/ConvexObjectBreaker.js +298 -0
- package/dist/misc/ConvexObjectBreaker.mjs +298 -0
- package/dist/misc/GPUComputationRenderer.d.ts +52 -0
- package/dist/misc/GPUComputationRenderer.js +171 -0
- package/dist/misc/GPUComputationRenderer.mjs +171 -0
- package/dist/misc/Gyroscope.d.ts +5 -0
- package/dist/misc/Gyroscope.js +35 -0
- package/dist/misc/Gyroscope.mjs +35 -0
- package/dist/misc/MD2Character.d.ts +33 -0
- package/dist/misc/MD2Character.js +165 -0
- package/dist/misc/MD2Character.mjs +165 -0
- package/dist/misc/MD2CharacterComplex.d.ts +47 -0
- package/dist/misc/MD2CharacterComplex.js +331 -0
- package/dist/misc/MD2CharacterComplex.mjs +331 -0
- package/dist/misc/MorphAnimMesh.d.ts +13 -0
- package/dist/misc/MorphAnimMesh.js +40 -0
- package/dist/misc/MorphAnimMesh.mjs +40 -0
- package/dist/misc/MorphBlendMesh.d.ts +21 -0
- package/dist/misc/MorphBlendMesh.js +179 -0
- package/dist/misc/MorphBlendMesh.mjs +179 -0
- package/dist/misc/ProgressiveLightmap.d.ts +61 -0
- package/dist/misc/ProgressiveLightmap.js +186 -0
- package/dist/misc/ProgressiveLightmap.mjs +186 -0
- package/dist/misc/RollerCoaster.d.ts +21 -0
- package/dist/misc/RollerCoaster.js +346 -0
- package/dist/misc/RollerCoaster.mjs +346 -0
- package/dist/misc/Timer.d.ts +27 -0
- package/dist/misc/Timer.js +101 -0
- package/dist/misc/Timer.mjs +101 -0
- package/dist/misc/TubePainter.d.ts +10 -0
- package/dist/misc/TubePainter.js +123 -0
- package/dist/misc/TubePainter.mjs +123 -0
- package/dist/misc/Volume.d.ts +37 -0
- package/dist/misc/Volume.js +302 -0
- package/dist/misc/Volume.mjs +302 -0
- package/dist/misc/VolumeSlice.d.ts +28 -0
- package/dist/misc/VolumeSlice.js +115 -0
- package/dist/misc/VolumeSlice.mjs +115 -0
- package/dist/misc/WebGL.d.ts +5 -0
- package/dist/misc/WebGL.js +74 -0
- package/dist/misc/WebGL.mjs +74 -0
- package/dist/modifiers/CurveModifier.d.ts +91 -0
- package/dist/modifiers/CurveModifier.js +232 -0
- package/dist/modifiers/CurveModifier.mjs +232 -0
- package/dist/modifiers/EdgeSplitModifier.d.ts +19 -0
- package/dist/modifiers/EdgeSplitModifier.js +167 -0
- package/dist/modifiers/EdgeSplitModifier.mjs +168 -0
- package/dist/modifiers/SimplifyModifier.d.ts +19 -0
- package/dist/modifiers/SimplifyModifier.js +300 -0
- package/dist/modifiers/SimplifyModifier.mjs +300 -0
- package/dist/modifiers/TessellateModifier.d.ts +11 -0
- package/dist/modifiers/TessellateModifier.js +214 -0
- package/dist/modifiers/TessellateModifier.mjs +214 -0
- package/dist/nodes/Nodes.js +347 -0
- package/dist/nodes/Nodes.mjs +347 -0
- package/dist/nodes/ShaderNode.js +408 -0
- package/dist/nodes/ShaderNode.mjs +408 -0
- package/dist/nodes/accessors/BufferNode.js +14 -0
- package/dist/nodes/accessors/BufferNode.mjs +15 -0
- package/dist/nodes/accessors/CameraNode.js +43 -0
- package/dist/nodes/accessors/CameraNode.mjs +44 -0
- package/dist/nodes/accessors/CubeTextureNode.js +41 -0
- package/dist/nodes/accessors/CubeTextureNode.mjs +42 -0
- package/dist/nodes/accessors/MaterialNode.js +70 -0
- package/dist/nodes/accessors/MaterialNode.mjs +71 -0
- package/dist/nodes/accessors/MaterialReferenceNode.js +13 -0
- package/dist/nodes/accessors/MaterialReferenceNode.mjs +14 -0
- package/dist/nodes/accessors/ModelNode.js +8 -0
- package/dist/nodes/accessors/ModelNode.mjs +9 -0
- package/dist/nodes/accessors/ModelViewProjectionNode.js +23 -0
- package/dist/nodes/accessors/ModelViewProjectionNode.mjs +24 -0
- package/dist/nodes/accessors/NormalNode.js +61 -0
- package/dist/nodes/accessors/NormalNode.mjs +62 -0
- package/dist/nodes/accessors/Object3DNode.js +75 -0
- package/dist/nodes/accessors/Object3DNode.mjs +76 -0
- package/dist/nodes/accessors/PointUVNode.js +12 -0
- package/dist/nodes/accessors/PointUVNode.mjs +13 -0
- package/dist/nodes/accessors/PositionNode.js +64 -0
- package/dist/nodes/accessors/PositionNode.mjs +65 -0
- package/dist/nodes/accessors/ReferenceNode.js +36 -0
- package/dist/nodes/accessors/ReferenceNode.mjs +37 -0
- package/dist/nodes/accessors/ReflectNode.js +42 -0
- package/dist/nodes/accessors/ReflectNode.mjs +43 -0
- package/dist/nodes/accessors/SkinningNode.js +57 -0
- package/dist/nodes/accessors/SkinningNode.mjs +58 -0
- package/dist/nodes/accessors/TextureNode.js +53 -0
- package/dist/nodes/accessors/TextureNode.mjs +54 -0
- package/dist/nodes/accessors/UVNode.js +22 -0
- package/dist/nodes/accessors/UVNode.mjs +23 -0
- package/dist/nodes/core/ArrayUniformNode.js +13 -0
- package/dist/nodes/core/ArrayUniformNode.mjs +14 -0
- package/dist/nodes/core/AttributeNode.js +29 -0
- package/dist/nodes/core/AttributeNode.mjs +30 -0
- package/dist/nodes/core/BypassNode.js +21 -0
- package/dist/nodes/core/BypassNode.mjs +22 -0
- package/dist/nodes/core/CodeNode.js +27 -0
- package/dist/nodes/core/CodeNode.mjs +28 -0
- package/dist/nodes/core/ConstNode.js +13 -0
- package/dist/nodes/core/ConstNode.mjs +14 -0
- package/dist/nodes/core/ContextNode.js +21 -0
- package/dist/nodes/core/ContextNode.mjs +22 -0
- package/dist/nodes/core/ExpressionNode.js +18 -0
- package/dist/nodes/core/ExpressionNode.mjs +19 -0
- package/dist/nodes/core/FunctionCallNode.js +36 -0
- package/dist/nodes/core/FunctionCallNode.mjs +37 -0
- package/dist/nodes/core/FunctionNode.js +55 -0
- package/dist/nodes/core/FunctionNode.mjs +56 -0
- package/dist/nodes/core/InputNode.js +37 -0
- package/dist/nodes/core/InputNode.mjs +38 -0
- package/dist/nodes/core/Node.js +138 -0
- package/dist/nodes/core/Node.mjs +139 -0
- package/dist/nodes/core/NodeAttribute.js +9 -0
- package/dist/nodes/core/NodeAttribute.mjs +10 -0
- package/dist/nodes/core/NodeBuilder.js +402 -0
- package/dist/nodes/core/NodeBuilder.mjs +402 -0
- package/dist/nodes/core/NodeCode.js +10 -0
- package/dist/nodes/core/NodeCode.mjs +11 -0
- package/dist/nodes/core/NodeFrame.js +34 -0
- package/dist/nodes/core/NodeFrame.mjs +35 -0
- package/dist/nodes/core/NodeFunctionInput.js +12 -0
- package/dist/nodes/core/NodeFunctionInput.mjs +13 -0
- package/dist/nodes/core/NodeKeywords.js +43 -0
- package/dist/nodes/core/NodeKeywords.mjs +44 -0
- package/dist/nodes/core/NodeUniform.js +17 -0
- package/dist/nodes/core/NodeUniform.mjs +18 -0
- package/dist/nodes/core/NodeUtils.js +57 -0
- package/dist/nodes/core/NodeUtils.mjs +57 -0
- package/dist/nodes/core/NodeVar.js +9 -0
- package/dist/nodes/core/NodeVar.mjs +10 -0
- package/dist/nodes/core/NodeVary.js +9 -0
- package/dist/nodes/core/NodeVary.mjs +10 -0
- package/dist/nodes/core/PropertyNode.js +20 -0
- package/dist/nodes/core/PropertyNode.mjs +21 -0
- package/dist/nodes/core/TempNode.js +24 -0
- package/dist/nodes/core/TempNode.mjs +25 -0
- package/dist/nodes/core/UniformNode.js +22 -0
- package/dist/nodes/core/UniformNode.mjs +23 -0
- package/dist/nodes/core/VarNode.js +30 -0
- package/dist/nodes/core/VarNode.mjs +31 -0
- package/dist/nodes/core/VaryNode.js +29 -0
- package/dist/nodes/core/VaryNode.mjs +30 -0
- package/dist/nodes/core/constants.js +24 -0
- package/dist/nodes/core/constants.mjs +24 -0
- package/dist/nodes/display/ColorSpaceNode.js +62 -0
- package/dist/nodes/display/ColorSpaceNode.mjs +62 -0
- package/dist/nodes/display/NormalMapNode.js +53 -0
- package/dist/nodes/display/NormalMapNode.mjs +54 -0
- package/dist/nodes/fog/FogNode.js +14 -0
- package/dist/nodes/fog/FogNode.mjs +15 -0
- package/dist/nodes/fog/FogRangeNode.js +16 -0
- package/dist/nodes/fog/FogRangeNode.mjs +17 -0
- package/dist/nodes/functions/BSDFs.js +64 -0
- package/dist/nodes/functions/BSDFs.mjs +64 -0
- package/dist/nodes/lights/LightContextNode.js +34 -0
- package/dist/nodes/lights/LightContextNode.mjs +35 -0
- package/dist/nodes/lights/LightNode.js +57 -0
- package/dist/nodes/lights/LightNode.mjs +58 -0
- package/dist/nodes/lights/LightsNode.js +58 -0
- package/dist/nodes/lights/LightsNode.mjs +59 -0
- package/dist/nodes/loaders/NodeLoader.js +195 -0
- package/dist/nodes/loaders/NodeLoader.mjs +196 -0
- package/dist/nodes/loaders/NodeMaterialLoader.js +23 -0
- package/dist/nodes/loaders/NodeMaterialLoader.mjs +24 -0
- package/dist/nodes/loaders/NodeObjectLoader.js +39 -0
- package/dist/nodes/loaders/NodeObjectLoader.mjs +40 -0
- package/dist/nodes/materials/LineBasicNodeMaterial.js +26 -0
- package/dist/nodes/materials/LineBasicNodeMaterial.mjs +27 -0
- package/dist/nodes/materials/Materials.js +24 -0
- package/dist/nodes/materials/Materials.mjs +24 -0
- package/dist/nodes/materials/MeshBasicNodeMaterial.js +27 -0
- package/dist/nodes/materials/MeshBasicNodeMaterial.mjs +28 -0
- package/dist/nodes/materials/MeshStandardNodeMaterial.js +40 -0
- package/dist/nodes/materials/MeshStandardNodeMaterial.mjs +41 -0
- package/dist/nodes/materials/NodeMaterial.js +63 -0
- package/dist/nodes/materials/NodeMaterial.mjs +64 -0
- package/dist/nodes/materials/PointsNodeMaterial.js +29 -0
- package/dist/nodes/materials/PointsNodeMaterial.mjs +30 -0
- package/dist/nodes/math/CondNode.js +40 -0
- package/dist/nodes/math/CondNode.mjs +41 -0
- package/dist/nodes/math/MathNode.js +165 -0
- package/dist/nodes/math/MathNode.mjs +166 -0
- package/dist/nodes/math/OperatorNode.js +102 -0
- package/dist/nodes/math/OperatorNode.mjs +103 -0
- package/dist/nodes/procedural/CheckerNode.js +20 -0
- package/dist/nodes/procedural/CheckerNode.mjs +21 -0
- package/dist/nodes/utils/ArrayElementNode.js +18 -0
- package/dist/nodes/utils/ArrayElementNode.mjs +19 -0
- package/dist/nodes/utils/ConvertNode.js +24 -0
- package/dist/nodes/utils/ConvertNode.mjs +25 -0
- package/dist/nodes/utils/JoinNode.js +25 -0
- package/dist/nodes/utils/JoinNode.mjs +26 -0
- package/dist/nodes/utils/MatcapUVNode.js +15 -0
- package/dist/nodes/utils/MatcapUVNode.mjs +16 -0
- package/dist/nodes/utils/OscNode.js +49 -0
- package/dist/nodes/utils/OscNode.mjs +50 -0
- package/dist/nodes/utils/SplitNode.js +44 -0
- package/dist/nodes/utils/SplitNode.mjs +45 -0
- package/dist/nodes/utils/SpriteSheetUVNode.js +39 -0
- package/dist/nodes/utils/SpriteSheetUVNode.mjs +40 -0
- package/dist/nodes/utils/TimerNode.js +43 -0
- package/dist/nodes/utils/TimerNode.mjs +44 -0
- package/dist/objects/GroundProjectedEnv.d.ts +12 -0
- package/dist/objects/GroundProjectedEnv.js +134 -0
- package/dist/objects/GroundProjectedEnv.mjs +134 -0
- package/dist/objects/Lensflare.d.ts +17 -0
- package/dist/objects/Lensflare.js +280 -0
- package/dist/objects/Lensflare.mjs +280 -0
- package/dist/objects/LightningStorm.d.ts +32 -0
- package/dist/objects/LightningStorm.js +110 -0
- package/dist/objects/LightningStorm.mjs +110 -0
- package/dist/objects/MarchingCubes.d.ts +75 -0
- package/dist/objects/MarchingCubes.js +457 -0
- package/dist/objects/MarchingCubes.mjs +457 -0
- package/dist/objects/Reflector.d.ts +19 -0
- package/dist/objects/Reflector.js +175 -0
- package/dist/objects/Reflector.mjs +175 -0
- package/dist/objects/ReflectorForSSRPass.d.ts +48 -0
- package/dist/objects/ReflectorForSSRPass.js +256 -0
- package/dist/objects/ReflectorForSSRPass.mjs +256 -0
- package/dist/objects/ReflectorRTT.js +10 -0
- package/dist/objects/ReflectorRTT.mjs +10 -0
- package/dist/objects/Refractor.d.ts +19 -0
- package/dist/objects/Refractor.js +188 -0
- package/dist/objects/Refractor.mjs +188 -0
- package/dist/objects/ShadowMesh.d.ts +7 -0
- package/dist/objects/ShadowMesh.js +41 -0
- package/dist/objects/ShadowMesh.mjs +41 -0
- package/dist/objects/Sky.d.ts +43 -0
- package/dist/objects/Sky.js +156 -0
- package/dist/objects/Sky.mjs +156 -0
- package/dist/objects/Water.d.ts +22 -0
- package/dist/objects/Water.js +241 -0
- package/dist/objects/Water.mjs +241 -0
- package/dist/objects/Water2.d.ts +22 -0
- package/dist/objects/Water2.js +258 -0
- package/dist/objects/Water2.mjs +258 -0
- package/dist/offscreen/jank.js +26 -0
- package/dist/offscreen/jank.mjs +27 -0
- package/dist/offscreen/offscreen.js +8 -0
- package/dist/offscreen/offscreen.mjs +7 -0
- package/dist/offscreen/scene.js +68 -0
- package/dist/offscreen/scene.mjs +52 -0
- package/dist/physics/AmmoPhysics.d.ts +7 -0
- package/dist/physics/AmmoPhysics.js +166 -0
- package/dist/physics/AmmoPhysics.mjs +166 -0
- package/dist/postprocessing/AdaptiveToneMappingPass.d.ts +29 -0
- package/dist/postprocessing/AdaptiveToneMappingPass.js +225 -0
- package/dist/postprocessing/AdaptiveToneMappingPass.mjs +225 -0
- package/dist/postprocessing/AfterimagePass.d.ts +15 -0
- package/dist/postprocessing/AfterimagePass.js +68 -0
- package/dist/postprocessing/AfterimagePass.mjs +68 -0
- package/dist/postprocessing/BloomPass.d.ts +16 -0
- package/dist/postprocessing/BloomPass.js +109 -0
- package/dist/postprocessing/BloomPass.mjs +109 -0
- package/dist/postprocessing/BokehPass.d.ts +26 -0
- package/dist/postprocessing/BokehPass.js +90 -0
- package/dist/postprocessing/BokehPass.mjs +90 -0
- package/dist/postprocessing/ClearPass.d.ts +10 -0
- package/dist/postprocessing/ClearPass.js +36 -0
- package/dist/postprocessing/ClearPass.mjs +36 -0
- package/dist/postprocessing/CubeTexturePass.d.ts +14 -0
- package/dist/postprocessing/CubeTexturePass.js +49 -0
- package/dist/postprocessing/CubeTexturePass.mjs +49 -0
- package/dist/postprocessing/DotScreenPass.d.ts +10 -0
- package/dist/postprocessing/DotScreenPass.js +49 -0
- package/dist/postprocessing/DotScreenPass.mjs +49 -0
- package/dist/postprocessing/EffectComposer.d.ts +27 -0
- package/dist/postprocessing/EffectComposer.js +156 -0
- package/dist/postprocessing/EffectComposer.mjs +156 -0
- package/dist/postprocessing/FilmPass.d.ts +10 -0
- package/dist/postprocessing/FilmPass.js +51 -0
- package/dist/postprocessing/FilmPass.mjs +51 -0
- package/dist/postprocessing/GlitchPass.d.ts +15 -0
- package/dist/postprocessing/GlitchPass.js +84 -0
- package/dist/postprocessing/GlitchPass.mjs +84 -0
- package/dist/postprocessing/HalftonePass.d.ts +26 -0
- package/dist/postprocessing/HalftonePass.js +53 -0
- package/dist/postprocessing/HalftonePass.mjs +53 -0
- package/dist/postprocessing/LUTPass.d.ts +13 -0
- package/dist/postprocessing/LUTPass.js +142 -0
- package/dist/postprocessing/LUTPass.mjs +142 -0
- package/dist/postprocessing/MaskPass.d.ts +14 -0
- package/dist/postprocessing/MaskPass.js +69 -0
- package/dist/postprocessing/MaskPass.mjs +69 -0
- package/dist/postprocessing/OutlinePass.d.ts +53 -0
- package/dist/postprocessing/OutlinePass.js +479 -0
- package/dist/postprocessing/OutlinePass.mjs +479 -0
- package/dist/postprocessing/Pass.d.ts +20 -0
- package/dist/postprocessing/Pass.js +48 -0
- package/dist/postprocessing/Pass.mjs +48 -0
- package/dist/postprocessing/RenderPass.d.ts +14 -0
- package/dist/postprocessing/RenderPass.js +59 -0
- package/dist/postprocessing/RenderPass.mjs +59 -0
- package/dist/postprocessing/RenderPixelatedPass.js +199 -0
- package/dist/postprocessing/RenderPixelatedPass.mjs +199 -0
- package/dist/postprocessing/SAOPass.d.ts +79 -0
- package/dist/postprocessing/SAOPass.js +282 -0
- package/dist/postprocessing/SAOPass.mjs +282 -0
- package/dist/postprocessing/SMAAPass.d.ts +21 -0
- package/dist/postprocessing/SMAAPass.js +112 -0
- package/dist/postprocessing/SMAAPass.mjs +112 -0
- package/dist/postprocessing/SSAARenderPass.d.ts +17 -0
- package/dist/postprocessing/SSAARenderPass.js +171 -0
- package/dist/postprocessing/SSAARenderPass.mjs +171 -0
- package/dist/postprocessing/SSAOPass.d.ts +71 -0
- package/dist/postprocessing/SSAOPass.js +265 -0
- package/dist/postprocessing/SSAOPass.mjs +265 -0
- package/dist/postprocessing/SSRPass.d.ts +124 -0
- package/dist/postprocessing/SSRPass.js +438 -0
- package/dist/postprocessing/SSRPass.mjs +438 -0
- package/dist/postprocessing/SavePass.d.ts +12 -0
- package/dist/postprocessing/SavePass.js +37 -0
- package/dist/postprocessing/SavePass.mjs +37 -0
- package/dist/postprocessing/ShaderPass.d.ts +13 -0
- package/dist/postprocessing/ShaderPass.js +49 -0
- package/dist/postprocessing/ShaderPass.mjs +49 -0
- package/dist/postprocessing/TAARenderPass.d.ts +8 -0
- package/dist/postprocessing/TAARenderPass.js +89 -0
- package/dist/postprocessing/TAARenderPass.mjs +89 -0
- package/dist/postprocessing/TexturePass.d.ts +12 -0
- package/dist/postprocessing/TexturePass.js +39 -0
- package/dist/postprocessing/TexturePass.mjs +39 -0
- package/dist/postprocessing/UnrealBloomPass.d.ts +31 -0
- package/dist/postprocessing/UnrealBloomPass.js +220 -0
- package/dist/postprocessing/UnrealBloomPass.mjs +220 -0
- package/dist/postprocessing/WaterPass.d.ts +30 -0
- package/dist/postprocessing/WaterPass.js +72 -0
- package/dist/postprocessing/WaterPass.mjs +72 -0
- package/dist/renderers/CSS2DRenderer.d.ts +22 -0
- package/dist/renderers/CSS2DRenderer.js +121 -0
- package/dist/renderers/CSS2DRenderer.mjs +121 -0
- package/dist/renderers/CSS3DRenderer.d.ts +26 -0
- package/dist/renderers/CSS3DRenderer.js +133 -0
- package/dist/renderers/CSS3DRenderer.mjs +133 -0
- package/dist/renderers/Projector.d.ts +60 -0
- package/dist/renderers/Projector.js +511 -0
- package/dist/renderers/Projector.mjs +511 -0
- package/dist/renderers/SVGRenderer.d.ts +25 -0
- package/dist/renderers/SVGRenderer.js +306 -0
- package/dist/renderers/SVGRenderer.mjs +306 -0
- package/dist/renderers/nodes/accessors/CameraNode.js +62 -0
- package/dist/renderers/nodes/accessors/CameraNode.mjs +63 -0
- package/dist/renderers/nodes/accessors/ModelNode.js +60 -0
- package/dist/renderers/nodes/accessors/ModelNode.mjs +61 -0
- package/dist/renderers/nodes/accessors/ModelViewProjectionNode.js +20 -0
- package/dist/renderers/nodes/accessors/ModelViewProjectionNode.mjs +21 -0
- package/dist/renderers/nodes/accessors/NormalNode.js +60 -0
- package/dist/renderers/nodes/accessors/NormalNode.mjs +61 -0
- package/dist/renderers/nodes/accessors/PositionNode.js +29 -0
- package/dist/renderers/nodes/accessors/PositionNode.mjs +30 -0
- package/dist/renderers/nodes/accessors/UVNode.js +12 -0
- package/dist/renderers/nodes/accessors/UVNode.mjs +13 -0
- package/dist/renderers/nodes/core/AttributeNode.js +34 -0
- package/dist/renderers/nodes/core/AttributeNode.mjs +35 -0
- package/dist/renderers/nodes/core/InputNode.js +30 -0
- package/dist/renderers/nodes/core/InputNode.mjs +31 -0
- package/dist/renderers/nodes/core/Node.js +33 -0
- package/dist/renderers/nodes/core/Node.mjs +34 -0
- package/dist/renderers/nodes/core/NodeAttribute.js +9 -0
- package/dist/renderers/nodes/core/NodeAttribute.mjs +10 -0
- package/dist/renderers/nodes/core/NodeBuilder.js +248 -0
- package/dist/renderers/nodes/core/NodeBuilder.mjs +249 -0
- package/dist/renderers/nodes/core/NodeFrame.js +34 -0
- package/dist/renderers/nodes/core/NodeFrame.mjs +35 -0
- package/dist/renderers/nodes/core/NodeSlot.js +9 -0
- package/dist/renderers/nodes/core/NodeSlot.mjs +10 -0
- package/dist/renderers/nodes/core/NodeUniform.js +17 -0
- package/dist/renderers/nodes/core/NodeUniform.mjs +18 -0
- package/dist/renderers/nodes/core/NodeVary.js +10 -0
- package/dist/renderers/nodes/core/NodeVary.mjs +11 -0
- package/dist/renderers/nodes/core/VaryNode.js +21 -0
- package/dist/renderers/nodes/core/VaryNode.mjs +22 -0
- package/dist/renderers/nodes/core/constants.js +22 -0
- package/dist/renderers/nodes/core/constants.mjs +22 -0
- package/dist/renderers/nodes/inputs/ColorNode.js +10 -0
- package/dist/renderers/nodes/inputs/ColorNode.mjs +11 -0
- package/dist/renderers/nodes/inputs/FloatNode.js +10 -0
- package/dist/renderers/nodes/inputs/FloatNode.mjs +11 -0
- package/dist/renderers/nodes/inputs/Matrix3Node.js +11 -0
- package/dist/renderers/nodes/inputs/Matrix3Node.mjs +12 -0
- package/dist/renderers/nodes/inputs/Matrix4Node.js +11 -0
- package/dist/renderers/nodes/inputs/Matrix4Node.mjs +12 -0
- package/dist/renderers/nodes/inputs/TextureNode.js +19 -0
- package/dist/renderers/nodes/inputs/TextureNode.mjs +20 -0
- package/dist/renderers/nodes/inputs/Vector2Node.js +10 -0
- package/dist/renderers/nodes/inputs/Vector2Node.mjs +11 -0
- package/dist/renderers/nodes/inputs/Vector3Node.js +11 -0
- package/dist/renderers/nodes/inputs/Vector3Node.mjs +12 -0
- package/dist/renderers/nodes/inputs/Vector4Node.js +11 -0
- package/dist/renderers/nodes/inputs/Vector4Node.mjs +12 -0
- package/dist/renderers/nodes/math/MathNode.js +54 -0
- package/dist/renderers/nodes/math/MathNode.mjs +55 -0
- package/dist/renderers/nodes/math/OperatorNode.js +41 -0
- package/dist/renderers/nodes/math/OperatorNode.mjs +42 -0
- package/dist/renderers/nodes/utils/SwitchNode.js +19 -0
- package/dist/renderers/nodes/utils/SwitchNode.mjs +20 -0
- package/dist/renderers/nodes/utils/TimerNode.js +13 -0
- package/dist/renderers/nodes/utils/TimerNode.mjs +14 -0
- package/dist/renderers/webgpu/WebGPU.js +23 -0
- package/dist/renderers/webgpu/WebGPU.mjs +24 -0
- package/dist/renderers/webgpu/WebGPUAttributes.js +68 -0
- package/dist/renderers/webgpu/WebGPUAttributes.mjs +69 -0
- package/dist/renderers/webgpu/WebGPUBackground.js +60 -0
- package/dist/renderers/webgpu/WebGPUBackground.mjs +61 -0
- package/dist/renderers/webgpu/WebGPUBinding.js +13 -0
- package/dist/renderers/webgpu/WebGPUBinding.mjs +14 -0
- package/dist/renderers/webgpu/WebGPUBindings.js +154 -0
- package/dist/renderers/webgpu/WebGPUBindings.mjs +155 -0
- package/dist/renderers/webgpu/WebGPUComputePipelines.js +43 -0
- package/dist/renderers/webgpu/WebGPUComputePipelines.mjs +44 -0
- package/dist/renderers/webgpu/WebGPUGeometries.js +40 -0
- package/dist/renderers/webgpu/WebGPUGeometries.mjs +41 -0
- package/dist/renderers/webgpu/WebGPUInfo.js +45 -0
- package/dist/renderers/webgpu/WebGPUInfo.mjs +46 -0
- package/dist/renderers/webgpu/WebGPUObjects.js +24 -0
- package/dist/renderers/webgpu/WebGPUObjects.mjs +25 -0
- package/dist/renderers/webgpu/WebGPUProperties.js +21 -0
- package/dist/renderers/webgpu/WebGPUProperties.mjs +22 -0
- package/dist/renderers/webgpu/WebGPURenderLists.js +118 -0
- package/dist/renderers/webgpu/WebGPURenderLists.mjs +119 -0
- package/dist/renderers/webgpu/WebGPURenderPipelines.js +545 -0
- package/dist/renderers/webgpu/WebGPURenderPipelines.mjs +546 -0
- package/dist/renderers/webgpu/WebGPURenderer.js +596 -0
- package/dist/renderers/webgpu/WebGPURenderer.mjs +575 -0
- package/dist/renderers/webgpu/WebGPUSampledTexture.js +40 -0
- package/dist/renderers/webgpu/WebGPUSampledTexture.mjs +40 -0
- package/dist/renderers/webgpu/WebGPUSampler.js +14 -0
- package/dist/renderers/webgpu/WebGPUSampler.mjs +15 -0
- package/dist/renderers/webgpu/WebGPUStorageBuffer.js +14 -0
- package/dist/renderers/webgpu/WebGPUStorageBuffer.mjs +15 -0
- package/dist/renderers/webgpu/WebGPUTextureRenderer.js +22 -0
- package/dist/renderers/webgpu/WebGPUTextureRenderer.mjs +23 -0
- package/dist/renderers/webgpu/WebGPUTextureUtils.js +97 -0
- package/dist/renderers/webgpu/WebGPUTextureUtils.mjs +98 -0
- package/dist/renderers/webgpu/WebGPUTextures.js +483 -0
- package/dist/renderers/webgpu/WebGPUTextures.mjs +484 -0
- package/dist/renderers/webgpu/WebGPUUniform.js +81 -0
- package/dist/renderers/webgpu/WebGPUUniform.mjs +81 -0
- package/dist/renderers/webgpu/WebGPUUniformsGroup.js +175 -0
- package/dist/renderers/webgpu/WebGPUUniformsGroup.mjs +176 -0
- package/dist/renderers/webgpu/constants.js +241 -0
- package/dist/renderers/webgpu/constants.mjs +241 -0
- package/dist/renderers/webgpu/nodes/ShaderLib.js +41 -0
- package/dist/renderers/webgpu/nodes/ShaderLib.mjs +42 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.js +164 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +165 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.js +73 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +73 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +14 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +15 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodes.js +39 -0
- package/dist/renderers/webgpu/nodes/WebGPUNodes.mjs +40 -0
- package/dist/shaders/ACESFilmicToneMappingShader.d.ts +16 -0
- package/dist/shaders/ACESFilmicToneMappingShader.js +55 -0
- package/dist/shaders/ACESFilmicToneMappingShader.mjs +55 -0
- package/dist/shaders/AfterimageShader.d.ts +15 -0
- package/dist/shaders/AfterimageShader.js +32 -0
- package/dist/shaders/AfterimageShader.mjs +32 -0
- package/dist/shaders/BasicShader.d.ts +8 -0
- package/dist/shaders/BasicShader.js +12 -0
- package/dist/shaders/BasicShader.mjs +12 -0
- package/dist/shaders/BleachBypassShader.d.ts +14 -0
- package/dist/shaders/BleachBypassShader.js +35 -0
- package/dist/shaders/BleachBypassShader.mjs +35 -0
- package/dist/shaders/BlendShader.d.ts +21 -0
- package/dist/shaders/BlendShader.js +30 -0
- package/dist/shaders/BlendShader.mjs +30 -0
- package/dist/shaders/BokehShader.d.ts +24 -0
- package/dist/shaders/BokehShader.js +109 -0
- package/dist/shaders/BokehShader.mjs +109 -0
- package/dist/shaders/BokehShader2.d.ts +50 -0
- package/dist/shaders/BokehShader2.js +269 -0
- package/dist/shaders/BokehShader2.mjs +269 -0
- package/dist/shaders/BrightnessContrastShader.d.ts +21 -0
- package/dist/shaders/BrightnessContrastShader.js +32 -0
- package/dist/shaders/BrightnessContrastShader.mjs +32 -0
- package/dist/shaders/ColorCorrectionShader.d.ts +22 -0
- package/dist/shaders/ColorCorrectionShader.js +30 -0
- package/dist/shaders/ColorCorrectionShader.mjs +30 -0
- package/dist/shaders/ColorifyShader.d.ts +16 -0
- package/dist/shaders/ColorifyShader.js +28 -0
- package/dist/shaders/ColorifyShader.mjs +28 -0
- package/dist/shaders/ConvolutionShader.d.ts +21 -0
- package/dist/shaders/ConvolutionShader.js +55 -0
- package/dist/shaders/ConvolutionShader.mjs +55 -0
- package/dist/shaders/CopyShader.d.ts +12 -0
- package/dist/shaders/CopyShader.js +25 -0
- package/dist/shaders/CopyShader.mjs +25 -0
- package/dist/shaders/DOFMipMapShader.d.ts +23 -0
- package/dist/shaders/DOFMipMapShader.js +32 -0
- package/dist/shaders/DOFMipMapShader.mjs +32 -0
- package/dist/shaders/DepthLimitedBlurShader.d.ts +28 -0
- package/dist/shaders/DepthLimitedBlurShader.js +114 -0
- package/dist/shaders/DepthLimitedBlurShader.mjs +114 -0
- package/dist/shaders/DigitalGlitch.d.ts +39 -0
- package/dist/shaders/DigitalGlitch.js +85 -0
- package/dist/shaders/DigitalGlitch.mjs +85 -0
- package/dist/shaders/DotScreenShader.d.ts +27 -0
- package/dist/shaders/DotScreenShader.js +39 -0
- package/dist/shaders/DotScreenShader.mjs +39 -0
- package/dist/shaders/FXAAShader.d.ts +19 -0
- package/dist/shaders/FXAAShader.js +1098 -0
- package/dist/shaders/FXAAShader.mjs +1098 -0
- package/dist/shaders/FilmShader.d.ts +43 -0
- package/dist/shaders/FilmShader.js +53 -0
- package/dist/shaders/FilmShader.mjs +53 -0
- package/dist/shaders/FocusShader.d.ts +26 -0
- package/dist/shaders/FocusShader.js +55 -0
- package/dist/shaders/FocusShader.mjs +55 -0
- package/dist/shaders/FreiChenShader.d.ts +19 -0
- package/dist/shaders/FreiChenShader.js +64 -0
- package/dist/shaders/FreiChenShader.mjs +64 -0
- package/dist/shaders/FresnelShader.d.ts +24 -0
- package/dist/shaders/FresnelShader.js +47 -0
- package/dist/shaders/FresnelShader.mjs +47 -0
- package/dist/shaders/GammaCorrectionShader.d.ts +12 -0
- package/dist/shaders/GammaCorrectionShader.js +23 -0
- package/dist/shaders/GammaCorrectionShader.mjs +23 -0
- package/dist/shaders/GodRaysShader.d.ts +97 -0
- package/dist/shaders/GodRaysShader.js +183 -0
- package/dist/shaders/GodRaysShader.mjs +183 -0
- package/dist/shaders/HalftoneShader.d.ts +51 -0
- package/dist/shaders/HalftoneShader.js +228 -0
- package/dist/shaders/HalftoneShader.mjs +228 -0
- package/dist/shaders/HorizontalBlurShader.d.ts +18 -0
- package/dist/shaders/HorizontalBlurShader.js +49 -0
- package/dist/shaders/HorizontalBlurShader.mjs +49 -0
- package/dist/shaders/HorizontalTiltShiftShader.d.ts +23 -0
- package/dist/shaders/HorizontalTiltShiftShader.js +37 -0
- package/dist/shaders/HorizontalTiltShiftShader.mjs +37 -0
- package/dist/shaders/HueSaturationShader.d.ts +21 -0
- package/dist/shaders/HueSaturationShader.js +43 -0
- package/dist/shaders/HueSaturationShader.mjs +43 -0
- package/dist/shaders/KaleidoShader.d.ts +24 -0
- package/dist/shaders/KaleidoShader.js +34 -0
- package/dist/shaders/KaleidoShader.mjs +34 -0
- package/dist/shaders/LuminosityHighPassShader.d.ts +27 -0
- package/dist/shaders/LuminosityHighPassShader.js +37 -0
- package/dist/shaders/LuminosityHighPassShader.mjs +37 -0
- package/dist/shaders/LuminosityShader.d.ts +13 -0
- package/dist/shaders/LuminosityShader.js +25 -0
- package/dist/shaders/LuminosityShader.mjs +25 -0
- package/dist/shaders/MirrorShader.d.ts +18 -0
- package/dist/shaders/MirrorShader.js +35 -0
- package/dist/shaders/MirrorShader.mjs +35 -0
- package/dist/shaders/NormalMapShader.d.ts +23 -0
- package/dist/shaders/NormalMapShader.js +31 -0
- package/dist/shaders/NormalMapShader.mjs +31 -0
- package/dist/shaders/ParallaxShader.d.ts +28 -0
- package/dist/shaders/ParallaxShader.js +133 -0
- package/dist/shaders/ParallaxShader.mjs +133 -0
- package/dist/shaders/PixelShader.d.ts +18 -0
- package/dist/shaders/PixelShader.js +28 -0
- package/dist/shaders/PixelShader.mjs +28 -0
- package/dist/shaders/RGBShiftShader.d.ts +24 -0
- package/dist/shaders/RGBShiftShader.js +30 -0
- package/dist/shaders/RGBShiftShader.mjs +30 -0
- package/dist/shaders/SAOShader.d.ts +25 -0
- package/dist/shaders/SAOShader.js +144 -0
- package/dist/shaders/SAOShader.mjs +144 -0
- package/dist/shaders/SMAAShader.d.ts +60 -0
- package/dist/shaders/SMAAShader.js +358 -0
- package/dist/shaders/SMAAShader.mjs +358 -0
- package/dist/shaders/SSAOShader.d.ts +86 -0
- package/dist/shaders/SSAOShader.js +182 -0
- package/dist/shaders/SSAOShader.mjs +182 -0
- package/dist/shaders/SSRShader.d.ts +94 -0
- package/dist/shaders/SSRShader.js +342 -0
- package/dist/shaders/SSRShader.mjs +342 -0
- package/dist/shaders/SepiaShader.d.ts +17 -0
- package/dist/shaders/SepiaShader.js +29 -0
- package/dist/shaders/SepiaShader.mjs +29 -0
- package/dist/shaders/SobelOperatorShader.d.ts +19 -0
- package/dist/shaders/SobelOperatorShader.js +54 -0
- package/dist/shaders/SobelOperatorShader.mjs +54 -0
- package/dist/shaders/SubsurfaceScatteringShader.d.ts +5 -0
- package/dist/shaders/SubsurfaceScatteringShader.js +59 -0
- package/dist/shaders/SubsurfaceScatteringShader.mjs +59 -0
- package/dist/shaders/TechnicolorShader.d.ts +15 -0
- package/dist/shaders/TechnicolorShader.js +24 -0
- package/dist/shaders/TechnicolorShader.mjs +24 -0
- package/dist/shaders/ToneMapShader.d.ts +27 -0
- package/dist/shaders/ToneMapShader.js +51 -0
- package/dist/shaders/ToneMapShader.mjs +51 -0
- package/dist/shaders/ToonShader.d.ts +108 -0
- package/dist/shaders/ToonShader.js +188 -0
- package/dist/shaders/ToonShader.mjs +188 -0
- package/dist/shaders/TriangleBlurShader.d.ts +22 -0
- package/dist/shaders/TriangleBlurShader.js +37 -0
- package/dist/shaders/TriangleBlurShader.mjs +37 -0
- package/dist/shaders/UnpackDepthRGBAShader.d.ts +16 -0
- package/dist/shaders/UnpackDepthRGBAShader.js +26 -0
- package/dist/shaders/UnpackDepthRGBAShader.mjs +26 -0
- package/dist/shaders/VerticalBlurShader.d.ts +18 -0
- package/dist/shaders/VerticalBlurShader.js +50 -0
- package/dist/shaders/VerticalBlurShader.mjs +50 -0
- package/dist/shaders/VerticalTiltShiftShader.d.ts +23 -0
- package/dist/shaders/VerticalTiltShiftShader.js +37 -0
- package/dist/shaders/VerticalTiltShiftShader.mjs +37 -0
- package/dist/shaders/VignetteShader.d.ts +20 -0
- package/dist/shaders/VignetteShader.js +38 -0
- package/dist/shaders/VignetteShader.mjs +38 -0
- package/dist/shaders/VolumeShader.d.ts +30 -0
- package/dist/shaders/VolumeShader.js +225 -0
- package/dist/shaders/VolumeShader.mjs +225 -0
- package/dist/shaders/WaterRefractionShader.d.ts +21 -0
- package/dist/shaders/WaterRefractionShader.js +59 -0
- package/dist/shaders/WaterRefractionShader.mjs +59 -0
- package/dist/shaders/types.d.ts +14 -0
- package/dist/shaders/types.js +1 -0
- package/dist/shaders/types.mjs +1 -0
- package/dist/textures/FlakesTexture.d.ts +4 -0
- package/dist/textures/FlakesTexture.js +30 -0
- package/dist/textures/FlakesTexture.mjs +30 -0
- package/dist/types/helpers.d.ts +1 -0
- package/dist/types/helpers.js +4 -0
- package/dist/types/helpers.mjs +4 -0
- package/dist/types/shared.d.ts +2 -0
- package/dist/types/utils.d.ts +3 -0
- package/dist/utils/BufferGeometryUtils.d.ts +48 -0
- package/dist/utils/BufferGeometryUtils.js +636 -0
- package/dist/utils/BufferGeometryUtils.mjs +636 -0
- package/dist/utils/GeometryCompressionUtils.d.ts +7 -0
- package/dist/utils/GeometryCompressionUtils.js +573 -0
- package/dist/utils/GeometryCompressionUtils.mjs +573 -0
- package/dist/utils/GeometryUtils.d.ts +6 -0
- package/dist/utils/GeometryUtils.js +109 -0
- package/dist/utils/GeometryUtils.mjs +109 -0
- package/dist/utils/LDrawUtils.d.ts +5 -0
- package/dist/utils/RoughnessMipmapper.js +219 -0
- package/dist/utils/RoughnessMipmapper.mjs +219 -0
- package/dist/utils/SceneUtils.d.ts +9 -0
- package/dist/utils/SceneUtils.js +36 -0
- package/dist/utils/SceneUtils.mjs +36 -0
- package/dist/utils/ShadowMapViewer.d.ts +24 -0
- package/dist/utils/ShadowMapViewer.js +114 -0
- package/dist/utils/ShadowMapViewer.mjs +114 -0
- package/dist/utils/SkeletonUtils.d.ts +30 -0
- package/dist/utils/SkeletonUtils.js +292 -0
- package/dist/utils/SkeletonUtils.mjs +292 -0
- package/dist/utils/UVsDebug.d.ts +3 -0
- package/dist/utils/UVsDebug.js +85 -0
- package/dist/utils/UVsDebug.mjs +85 -0
- package/dist/utils/WorkerPool.js +62 -0
- package/dist/utils/WorkerPool.mjs +62 -0
- package/dist/webxr/ARButton.d.ts +5 -0
- package/dist/webxr/ARButton.js +119 -0
- package/dist/webxr/ARButton.mjs +119 -0
- package/dist/webxr/OculusHandModel.d.ts +22 -0
- package/dist/webxr/OculusHandModel.js +82 -0
- package/dist/webxr/OculusHandModel.mjs +82 -0
- package/dist/webxr/OculusHandPointerModel.d.ts +63 -0
- package/dist/webxr/OculusHandPointerModel.js +224 -0
- package/dist/webxr/OculusHandPointerModel.mjs +207 -0
- package/dist/webxr/Text2D.d.ts +3 -0
- package/dist/webxr/Text2D.js +48 -0
- package/dist/webxr/Text2D.mjs +31 -0
- package/dist/webxr/VRButton.d.ts +7 -0
- package/dist/webxr/VRButton.js +111 -0
- package/dist/webxr/VRButton.mjs +111 -0
- package/dist/webxr/XRControllerModelFactory.d.ts +23 -0
- package/dist/webxr/XRControllerModelFactory.js +174 -0
- package/dist/webxr/XRControllerModelFactory.mjs +174 -0
- package/dist/webxr/XREstimatedLight.d.ts +33 -0
- package/dist/webxr/XREstimatedLight.js +126 -0
- package/dist/webxr/XREstimatedLight.mjs +126 -0
- package/dist/webxr/XRHandMeshModel.d.ts +9 -0
- package/dist/webxr/XRHandMeshModel.js +82 -0
- package/dist/webxr/XRHandMeshModel.mjs +82 -0
- package/dist/webxr/XRHandModelFactory.d.ts +25 -0
- package/dist/webxr/XRHandModelFactory.js +61 -0
- package/dist/webxr/XRHandModelFactory.mjs +61 -0
- package/dist/webxr/XRHandPrimitiveModel.d.ts +24 -0
- package/dist/webxr/XRHandPrimitiveModel.js +68 -0
- package/dist/webxr/XRHandPrimitiveModel.mjs +68 -0
- package/package.json +1 -1
@@ -0,0 +1,129 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const THREE = require("three");
|
4
|
+
const ParametricGeometry = require("./ParametricGeometry.js");
|
5
|
+
const ParametricGeometries = {
|
6
|
+
klein: function(v, u, target) {
|
7
|
+
u *= Math.PI;
|
8
|
+
v *= 2 * Math.PI;
|
9
|
+
u = u * 2;
|
10
|
+
let x, z;
|
11
|
+
if (u < Math.PI) {
|
12
|
+
x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(u) * Math.cos(v);
|
13
|
+
z = -8 * Math.sin(u) - 2 * (1 - Math.cos(u) / 2) * Math.sin(u) * Math.cos(v);
|
14
|
+
} else {
|
15
|
+
x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(v + Math.PI);
|
16
|
+
z = -8 * Math.sin(u);
|
17
|
+
}
|
18
|
+
const y = -2 * (1 - Math.cos(u) / 2) * Math.sin(v);
|
19
|
+
target.set(x, y, z);
|
20
|
+
},
|
21
|
+
plane: function(width, height) {
|
22
|
+
return function(u, v, target) {
|
23
|
+
const x = u * width;
|
24
|
+
const y = 0;
|
25
|
+
const z = v * height;
|
26
|
+
target.set(x, y, z);
|
27
|
+
};
|
28
|
+
},
|
29
|
+
mobius: function(u, t, target) {
|
30
|
+
u = u - 0.5;
|
31
|
+
const v = 2 * Math.PI * t;
|
32
|
+
const a = 2;
|
33
|
+
const x = Math.cos(v) * (a + u * Math.cos(v / 2));
|
34
|
+
const y = Math.sin(v) * (a + u * Math.cos(v / 2));
|
35
|
+
const z = u * Math.sin(v / 2);
|
36
|
+
target.set(x, y, z);
|
37
|
+
},
|
38
|
+
mobius3d: function(u, t, target) {
|
39
|
+
u *= Math.PI;
|
40
|
+
t *= 2 * Math.PI;
|
41
|
+
u = u * 2;
|
42
|
+
const phi = u / 2;
|
43
|
+
const major = 2.25, a = 0.125, b = 0.65;
|
44
|
+
let x = a * Math.cos(t) * Math.cos(phi) - b * Math.sin(t) * Math.sin(phi);
|
45
|
+
const z = a * Math.cos(t) * Math.sin(phi) + b * Math.sin(t) * Math.cos(phi);
|
46
|
+
const y = (major + x) * Math.sin(u);
|
47
|
+
x = (major + x) * Math.cos(u);
|
48
|
+
target.set(x, y, z);
|
49
|
+
}
|
50
|
+
};
|
51
|
+
ParametricGeometries.TubeGeometry = class TubeGeometry extends ParametricGeometry.ParametricGeometry {
|
52
|
+
constructor(path, segments = 64, radius = 1, segmentsRadius = 8, closed = false) {
|
53
|
+
const numpoints = segments + 1;
|
54
|
+
const frames = path.computeFrenetFrames(segments, closed), tangents = frames.tangents, normals = frames.normals, binormals = frames.binormals;
|
55
|
+
const position = new THREE.Vector3();
|
56
|
+
function ParametricTube(u, v, target) {
|
57
|
+
v *= 2 * Math.PI;
|
58
|
+
const i = Math.floor(u * (numpoints - 1));
|
59
|
+
path.getPointAt(u, position);
|
60
|
+
const normal = normals[i];
|
61
|
+
const binormal = binormals[i];
|
62
|
+
const cx = -radius * Math.cos(v);
|
63
|
+
const cy = radius * Math.sin(v);
|
64
|
+
position.x += cx * normal.x + cy * binormal.x;
|
65
|
+
position.y += cx * normal.y + cy * binormal.y;
|
66
|
+
position.z += cx * normal.z + cy * binormal.z;
|
67
|
+
target.copy(position);
|
68
|
+
}
|
69
|
+
super(ParametricTube, segments, segmentsRadius);
|
70
|
+
this.tangents = tangents;
|
71
|
+
this.normals = normals;
|
72
|
+
this.binormals = binormals;
|
73
|
+
this.path = path;
|
74
|
+
this.segments = segments;
|
75
|
+
this.radius = radius;
|
76
|
+
this.segmentsRadius = segmentsRadius;
|
77
|
+
this.closed = closed;
|
78
|
+
}
|
79
|
+
};
|
80
|
+
ParametricGeometries.TorusKnotGeometry = class TorusKnotGeometry extends ParametricGeometries.TubeGeometry {
|
81
|
+
constructor(radius = 200, tube = 40, segmentsT = 64, segmentsR = 8, p = 2, q = 3) {
|
82
|
+
class TorusKnotCurve extends THREE.Curve {
|
83
|
+
getPoint(t, optionalTarget = new THREE.Vector3()) {
|
84
|
+
const point = optionalTarget;
|
85
|
+
t *= Math.PI * 2;
|
86
|
+
const r = 0.5;
|
87
|
+
const x = (1 + r * Math.cos(q * t)) * Math.cos(p * t);
|
88
|
+
const y = (1 + r * Math.cos(q * t)) * Math.sin(p * t);
|
89
|
+
const z = r * Math.sin(q * t);
|
90
|
+
return point.set(x, y, z).multiplyScalar(radius);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
const segments = segmentsT;
|
94
|
+
const radiusSegments = segmentsR;
|
95
|
+
const extrudePath = new TorusKnotCurve();
|
96
|
+
super(extrudePath, segments, tube, radiusSegments, true, false);
|
97
|
+
this.radius = radius;
|
98
|
+
this.tube = tube;
|
99
|
+
this.segmentsT = segmentsT;
|
100
|
+
this.segmentsR = segmentsR;
|
101
|
+
this.p = p;
|
102
|
+
this.q = q;
|
103
|
+
}
|
104
|
+
};
|
105
|
+
ParametricGeometries.SphereGeometry = class SphereGeometry extends ParametricGeometry.ParametricGeometry {
|
106
|
+
constructor(size, u, v) {
|
107
|
+
function sphere(u2, v2, target) {
|
108
|
+
u2 *= Math.PI;
|
109
|
+
v2 *= 2 * Math.PI;
|
110
|
+
const x = size * Math.sin(u2) * Math.cos(v2);
|
111
|
+
const y = size * Math.sin(u2) * Math.sin(v2);
|
112
|
+
const z = size * Math.cos(u2);
|
113
|
+
target.set(x, y, z);
|
114
|
+
}
|
115
|
+
super(sphere, u, v);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
ParametricGeometries.PlaneGeometry = class PlaneGeometry extends ParametricGeometry.ParametricGeometry {
|
119
|
+
constructor(width, depth, segmentsWidth, segmentsDepth) {
|
120
|
+
function plane(u, v, target) {
|
121
|
+
const x = u * width;
|
122
|
+
const y = 0;
|
123
|
+
const z = v * depth;
|
124
|
+
target.set(x, y, z);
|
125
|
+
}
|
126
|
+
super(plane, segmentsWidth, segmentsDepth);
|
127
|
+
}
|
128
|
+
};
|
129
|
+
exports.ParametricGeometries = ParametricGeometries;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { Vector3, Curve } from "three";
|
2
|
+
import { ParametricGeometry } from "./ParametricGeometry.mjs";
|
3
|
+
const ParametricGeometries = {
|
4
|
+
klein: function(v, u, target) {
|
5
|
+
u *= Math.PI;
|
6
|
+
v *= 2 * Math.PI;
|
7
|
+
u = u * 2;
|
8
|
+
let x, z;
|
9
|
+
if (u < Math.PI) {
|
10
|
+
x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(u) * Math.cos(v);
|
11
|
+
z = -8 * Math.sin(u) - 2 * (1 - Math.cos(u) / 2) * Math.sin(u) * Math.cos(v);
|
12
|
+
} else {
|
13
|
+
x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(v + Math.PI);
|
14
|
+
z = -8 * Math.sin(u);
|
15
|
+
}
|
16
|
+
const y = -2 * (1 - Math.cos(u) / 2) * Math.sin(v);
|
17
|
+
target.set(x, y, z);
|
18
|
+
},
|
19
|
+
plane: function(width, height) {
|
20
|
+
return function(u, v, target) {
|
21
|
+
const x = u * width;
|
22
|
+
const y = 0;
|
23
|
+
const z = v * height;
|
24
|
+
target.set(x, y, z);
|
25
|
+
};
|
26
|
+
},
|
27
|
+
mobius: function(u, t, target) {
|
28
|
+
u = u - 0.5;
|
29
|
+
const v = 2 * Math.PI * t;
|
30
|
+
const a = 2;
|
31
|
+
const x = Math.cos(v) * (a + u * Math.cos(v / 2));
|
32
|
+
const y = Math.sin(v) * (a + u * Math.cos(v / 2));
|
33
|
+
const z = u * Math.sin(v / 2);
|
34
|
+
target.set(x, y, z);
|
35
|
+
},
|
36
|
+
mobius3d: function(u, t, target) {
|
37
|
+
u *= Math.PI;
|
38
|
+
t *= 2 * Math.PI;
|
39
|
+
u = u * 2;
|
40
|
+
const phi = u / 2;
|
41
|
+
const major = 2.25, a = 0.125, b = 0.65;
|
42
|
+
let x = a * Math.cos(t) * Math.cos(phi) - b * Math.sin(t) * Math.sin(phi);
|
43
|
+
const z = a * Math.cos(t) * Math.sin(phi) + b * Math.sin(t) * Math.cos(phi);
|
44
|
+
const y = (major + x) * Math.sin(u);
|
45
|
+
x = (major + x) * Math.cos(u);
|
46
|
+
target.set(x, y, z);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
ParametricGeometries.TubeGeometry = class TubeGeometry extends ParametricGeometry {
|
50
|
+
constructor(path, segments = 64, radius = 1, segmentsRadius = 8, closed = false) {
|
51
|
+
const numpoints = segments + 1;
|
52
|
+
const frames = path.computeFrenetFrames(segments, closed), tangents = frames.tangents, normals = frames.normals, binormals = frames.binormals;
|
53
|
+
const position = new Vector3();
|
54
|
+
function ParametricTube(u, v, target) {
|
55
|
+
v *= 2 * Math.PI;
|
56
|
+
const i = Math.floor(u * (numpoints - 1));
|
57
|
+
path.getPointAt(u, position);
|
58
|
+
const normal = normals[i];
|
59
|
+
const binormal = binormals[i];
|
60
|
+
const cx = -radius * Math.cos(v);
|
61
|
+
const cy = radius * Math.sin(v);
|
62
|
+
position.x += cx * normal.x + cy * binormal.x;
|
63
|
+
position.y += cx * normal.y + cy * binormal.y;
|
64
|
+
position.z += cx * normal.z + cy * binormal.z;
|
65
|
+
target.copy(position);
|
66
|
+
}
|
67
|
+
super(ParametricTube, segments, segmentsRadius);
|
68
|
+
this.tangents = tangents;
|
69
|
+
this.normals = normals;
|
70
|
+
this.binormals = binormals;
|
71
|
+
this.path = path;
|
72
|
+
this.segments = segments;
|
73
|
+
this.radius = radius;
|
74
|
+
this.segmentsRadius = segmentsRadius;
|
75
|
+
this.closed = closed;
|
76
|
+
}
|
77
|
+
};
|
78
|
+
ParametricGeometries.TorusKnotGeometry = class TorusKnotGeometry extends ParametricGeometries.TubeGeometry {
|
79
|
+
constructor(radius = 200, tube = 40, segmentsT = 64, segmentsR = 8, p = 2, q = 3) {
|
80
|
+
class TorusKnotCurve extends Curve {
|
81
|
+
getPoint(t, optionalTarget = new Vector3()) {
|
82
|
+
const point = optionalTarget;
|
83
|
+
t *= Math.PI * 2;
|
84
|
+
const r = 0.5;
|
85
|
+
const x = (1 + r * Math.cos(q * t)) * Math.cos(p * t);
|
86
|
+
const y = (1 + r * Math.cos(q * t)) * Math.sin(p * t);
|
87
|
+
const z = r * Math.sin(q * t);
|
88
|
+
return point.set(x, y, z).multiplyScalar(radius);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
const segments = segmentsT;
|
92
|
+
const radiusSegments = segmentsR;
|
93
|
+
const extrudePath = new TorusKnotCurve();
|
94
|
+
super(extrudePath, segments, tube, radiusSegments, true, false);
|
95
|
+
this.radius = radius;
|
96
|
+
this.tube = tube;
|
97
|
+
this.segmentsT = segmentsT;
|
98
|
+
this.segmentsR = segmentsR;
|
99
|
+
this.p = p;
|
100
|
+
this.q = q;
|
101
|
+
}
|
102
|
+
};
|
103
|
+
ParametricGeometries.SphereGeometry = class SphereGeometry extends ParametricGeometry {
|
104
|
+
constructor(size, u, v) {
|
105
|
+
function sphere(u2, v2, target) {
|
106
|
+
u2 *= Math.PI;
|
107
|
+
v2 *= 2 * Math.PI;
|
108
|
+
const x = size * Math.sin(u2) * Math.cos(v2);
|
109
|
+
const y = size * Math.sin(u2) * Math.sin(v2);
|
110
|
+
const z = size * Math.cos(u2);
|
111
|
+
target.set(x, y, z);
|
112
|
+
}
|
113
|
+
super(sphere, u, v);
|
114
|
+
}
|
115
|
+
};
|
116
|
+
ParametricGeometries.PlaneGeometry = class PlaneGeometry extends ParametricGeometry {
|
117
|
+
constructor(width, depth, segmentsWidth, segmentsDepth) {
|
118
|
+
function plane(u, v, target) {
|
119
|
+
const x = u * width;
|
120
|
+
const y = 0;
|
121
|
+
const z = v * depth;
|
122
|
+
target.set(x, y, z);
|
123
|
+
}
|
124
|
+
super(plane, segmentsWidth, segmentsDepth);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
export {
|
128
|
+
ParametricGeometries
|
129
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Vector3, BufferGeometry } from 'three'
|
2
|
+
|
3
|
+
export class ParametricGeometry extends BufferGeometry {
|
4
|
+
constructor(func?: (u: number, v: number, target: Vector3) => void, slices?: number, stacks?: number)
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @default 'ParametricGeometry'
|
8
|
+
*/
|
9
|
+
type: string
|
10
|
+
|
11
|
+
parameters: {
|
12
|
+
func: (u: number, v: number, dest: Vector3) => void
|
13
|
+
slices: number
|
14
|
+
stacks: number
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
export { ParametricGeometry as ParametricBufferGeometry }
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const THREE = require("three");
|
4
|
+
class ParametricGeometry extends THREE.BufferGeometry {
|
5
|
+
constructor(func = (u, v, target) => target.set(u, v, Math.cos(u) * Math.sin(v)), slices = 8, stacks = 8) {
|
6
|
+
super();
|
7
|
+
this.type = "ParametricGeometry";
|
8
|
+
this.parameters = {
|
9
|
+
func,
|
10
|
+
slices,
|
11
|
+
stacks
|
12
|
+
};
|
13
|
+
const indices = [];
|
14
|
+
const vertices = [];
|
15
|
+
const normals = [];
|
16
|
+
const uvs = [];
|
17
|
+
const EPS = 1e-5;
|
18
|
+
const normal = new THREE.Vector3();
|
19
|
+
const p0 = new THREE.Vector3(), p1 = new THREE.Vector3();
|
20
|
+
const pu = new THREE.Vector3(), pv = new THREE.Vector3();
|
21
|
+
const sliceCount = slices + 1;
|
22
|
+
for (let i = 0; i <= stacks; i++) {
|
23
|
+
const v = i / stacks;
|
24
|
+
for (let j = 0; j <= slices; j++) {
|
25
|
+
const u = j / slices;
|
26
|
+
func(u, v, p0);
|
27
|
+
vertices.push(p0.x, p0.y, p0.z);
|
28
|
+
if (u - EPS >= 0) {
|
29
|
+
func(u - EPS, v, p1);
|
30
|
+
pu.subVectors(p0, p1);
|
31
|
+
} else {
|
32
|
+
func(u + EPS, v, p1);
|
33
|
+
pu.subVectors(p1, p0);
|
34
|
+
}
|
35
|
+
if (v - EPS >= 0) {
|
36
|
+
func(u, v - EPS, p1);
|
37
|
+
pv.subVectors(p0, p1);
|
38
|
+
} else {
|
39
|
+
func(u, v + EPS, p1);
|
40
|
+
pv.subVectors(p1, p0);
|
41
|
+
}
|
42
|
+
normal.crossVectors(pu, pv).normalize();
|
43
|
+
normals.push(normal.x, normal.y, normal.z);
|
44
|
+
uvs.push(u, v);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
for (let i = 0; i < stacks; i++) {
|
48
|
+
for (let j = 0; j < slices; j++) {
|
49
|
+
const a = i * sliceCount + j;
|
50
|
+
const b = i * sliceCount + j + 1;
|
51
|
+
const c = (i + 1) * sliceCount + j + 1;
|
52
|
+
const d = (i + 1) * sliceCount + j;
|
53
|
+
indices.push(a, b, d);
|
54
|
+
indices.push(b, c, d);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
this.setIndex(indices);
|
58
|
+
this.setAttribute("position", new THREE.Float32BufferAttribute(vertices, 3));
|
59
|
+
this.setAttribute("normal", new THREE.Float32BufferAttribute(normals, 3));
|
60
|
+
this.setAttribute("uv", new THREE.Float32BufferAttribute(uvs, 2));
|
61
|
+
}
|
62
|
+
}
|
63
|
+
exports.ParametricGeometry = ParametricGeometry;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { BufferGeometry, Vector3, Float32BufferAttribute } from "three";
|
2
|
+
class ParametricGeometry extends BufferGeometry {
|
3
|
+
constructor(func = (u, v, target) => target.set(u, v, Math.cos(u) * Math.sin(v)), slices = 8, stacks = 8) {
|
4
|
+
super();
|
5
|
+
this.type = "ParametricGeometry";
|
6
|
+
this.parameters = {
|
7
|
+
func,
|
8
|
+
slices,
|
9
|
+
stacks
|
10
|
+
};
|
11
|
+
const indices = [];
|
12
|
+
const vertices = [];
|
13
|
+
const normals = [];
|
14
|
+
const uvs = [];
|
15
|
+
const EPS = 1e-5;
|
16
|
+
const normal = new Vector3();
|
17
|
+
const p0 = new Vector3(), p1 = new Vector3();
|
18
|
+
const pu = new Vector3(), pv = new Vector3();
|
19
|
+
const sliceCount = slices + 1;
|
20
|
+
for (let i = 0; i <= stacks; i++) {
|
21
|
+
const v = i / stacks;
|
22
|
+
for (let j = 0; j <= slices; j++) {
|
23
|
+
const u = j / slices;
|
24
|
+
func(u, v, p0);
|
25
|
+
vertices.push(p0.x, p0.y, p0.z);
|
26
|
+
if (u - EPS >= 0) {
|
27
|
+
func(u - EPS, v, p1);
|
28
|
+
pu.subVectors(p0, p1);
|
29
|
+
} else {
|
30
|
+
func(u + EPS, v, p1);
|
31
|
+
pu.subVectors(p1, p0);
|
32
|
+
}
|
33
|
+
if (v - EPS >= 0) {
|
34
|
+
func(u, v - EPS, p1);
|
35
|
+
pv.subVectors(p0, p1);
|
36
|
+
} else {
|
37
|
+
func(u, v + EPS, p1);
|
38
|
+
pv.subVectors(p1, p0);
|
39
|
+
}
|
40
|
+
normal.crossVectors(pu, pv).normalize();
|
41
|
+
normals.push(normal.x, normal.y, normal.z);
|
42
|
+
uvs.push(u, v);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
for (let i = 0; i < stacks; i++) {
|
46
|
+
for (let j = 0; j < slices; j++) {
|
47
|
+
const a = i * sliceCount + j;
|
48
|
+
const b = i * sliceCount + j + 1;
|
49
|
+
const c = (i + 1) * sliceCount + j + 1;
|
50
|
+
const d = (i + 1) * sliceCount + j;
|
51
|
+
indices.push(a, b, d);
|
52
|
+
indices.push(b, c, d);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
this.setIndex(indices);
|
56
|
+
this.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
57
|
+
this.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
58
|
+
this.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
59
|
+
}
|
60
|
+
}
|
61
|
+
export {
|
62
|
+
ParametricGeometry
|
63
|
+
};
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const THREE = require("three");
|
4
|
+
const tempNormal = new THREE.Vector3();
|
5
|
+
function getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) {
|
6
|
+
const totArcLength = 2 * Math.PI * radius / 4;
|
7
|
+
const centerLength = Math.max(sideLength - 2 * radius, 0);
|
8
|
+
const halfArc = Math.PI / 4;
|
9
|
+
tempNormal.copy(normal);
|
10
|
+
tempNormal[projectionAxis] = 0;
|
11
|
+
tempNormal.normalize();
|
12
|
+
const arcUvRatio = 0.5 * totArcLength / (totArcLength + centerLength);
|
13
|
+
const arcAngleRatio = 1 - tempNormal.angleTo(faceDirVector) / halfArc;
|
14
|
+
if (Math.sign(tempNormal[uvAxis]) === 1) {
|
15
|
+
return arcAngleRatio * arcUvRatio;
|
16
|
+
} else {
|
17
|
+
const lenUv = centerLength / (totArcLength + centerLength);
|
18
|
+
return lenUv + arcUvRatio + arcUvRatio * (1 - arcAngleRatio);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
class RoundedBoxGeometry extends THREE.BoxGeometry {
|
22
|
+
constructor(width = 1, height = 1, depth = 1, segments = 2, radius = 0.1) {
|
23
|
+
segments = segments * 2 + 1;
|
24
|
+
radius = Math.min(width / 2, height / 2, depth / 2, radius);
|
25
|
+
super(1, 1, 1, segments, segments, segments);
|
26
|
+
if (segments === 1)
|
27
|
+
return;
|
28
|
+
const geometry2 = this.toNonIndexed();
|
29
|
+
this.index = null;
|
30
|
+
this.attributes.position = geometry2.attributes.position;
|
31
|
+
this.attributes.normal = geometry2.attributes.normal;
|
32
|
+
this.attributes.uv = geometry2.attributes.uv;
|
33
|
+
const position = new THREE.Vector3();
|
34
|
+
const normal = new THREE.Vector3();
|
35
|
+
const box = new THREE.Vector3(width, height, depth).divideScalar(2).subScalar(radius);
|
36
|
+
const positions = this.attributes.position.array;
|
37
|
+
const normals = this.attributes.normal.array;
|
38
|
+
const uvs = this.attributes.uv.array;
|
39
|
+
const faceTris = positions.length / 6;
|
40
|
+
const faceDirVector = new THREE.Vector3();
|
41
|
+
const halfSegmentSize = 0.5 / segments;
|
42
|
+
for (let i = 0, j = 0; i < positions.length; i += 3, j += 2) {
|
43
|
+
position.fromArray(positions, i);
|
44
|
+
normal.copy(position);
|
45
|
+
normal.x -= Math.sign(normal.x) * halfSegmentSize;
|
46
|
+
normal.y -= Math.sign(normal.y) * halfSegmentSize;
|
47
|
+
normal.z -= Math.sign(normal.z) * halfSegmentSize;
|
48
|
+
normal.normalize();
|
49
|
+
positions[i + 0] = box.x * Math.sign(position.x) + normal.x * radius;
|
50
|
+
positions[i + 1] = box.y * Math.sign(position.y) + normal.y * radius;
|
51
|
+
positions[i + 2] = box.z * Math.sign(position.z) + normal.z * radius;
|
52
|
+
normals[i + 0] = normal.x;
|
53
|
+
normals[i + 1] = normal.y;
|
54
|
+
normals[i + 2] = normal.z;
|
55
|
+
const side = Math.floor(i / faceTris);
|
56
|
+
switch (side) {
|
57
|
+
case 0:
|
58
|
+
faceDirVector.set(1, 0, 0);
|
59
|
+
uvs[j + 0] = getUv(faceDirVector, normal, "z", "y", radius, depth);
|
60
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "z", radius, height);
|
61
|
+
break;
|
62
|
+
case 1:
|
63
|
+
faceDirVector.set(-1, 0, 0);
|
64
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "z", "y", radius, depth);
|
65
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "z", radius, height);
|
66
|
+
break;
|
67
|
+
case 2:
|
68
|
+
faceDirVector.set(0, 1, 0);
|
69
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "z", radius, width);
|
70
|
+
uvs[j + 1] = getUv(faceDirVector, normal, "z", "x", radius, depth);
|
71
|
+
break;
|
72
|
+
case 3:
|
73
|
+
faceDirVector.set(0, -1, 0);
|
74
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "z", radius, width);
|
75
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "z", "x", radius, depth);
|
76
|
+
break;
|
77
|
+
case 4:
|
78
|
+
faceDirVector.set(0, 0, 1);
|
79
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "y", radius, width);
|
80
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "x", radius, height);
|
81
|
+
break;
|
82
|
+
case 5:
|
83
|
+
faceDirVector.set(0, 0, -1);
|
84
|
+
uvs[j + 0] = getUv(faceDirVector, normal, "x", "y", radius, width);
|
85
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "x", radius, height);
|
86
|
+
break;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
exports.RoundedBoxGeometry = RoundedBoxGeometry;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import { Vector3, BoxGeometry } from "three";
|
2
|
+
const tempNormal = new Vector3();
|
3
|
+
function getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) {
|
4
|
+
const totArcLength = 2 * Math.PI * radius / 4;
|
5
|
+
const centerLength = Math.max(sideLength - 2 * radius, 0);
|
6
|
+
const halfArc = Math.PI / 4;
|
7
|
+
tempNormal.copy(normal);
|
8
|
+
tempNormal[projectionAxis] = 0;
|
9
|
+
tempNormal.normalize();
|
10
|
+
const arcUvRatio = 0.5 * totArcLength / (totArcLength + centerLength);
|
11
|
+
const arcAngleRatio = 1 - tempNormal.angleTo(faceDirVector) / halfArc;
|
12
|
+
if (Math.sign(tempNormal[uvAxis]) === 1) {
|
13
|
+
return arcAngleRatio * arcUvRatio;
|
14
|
+
} else {
|
15
|
+
const lenUv = centerLength / (totArcLength + centerLength);
|
16
|
+
return lenUv + arcUvRatio + arcUvRatio * (1 - arcAngleRatio);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
class RoundedBoxGeometry extends BoxGeometry {
|
20
|
+
constructor(width = 1, height = 1, depth = 1, segments = 2, radius = 0.1) {
|
21
|
+
segments = segments * 2 + 1;
|
22
|
+
radius = Math.min(width / 2, height / 2, depth / 2, radius);
|
23
|
+
super(1, 1, 1, segments, segments, segments);
|
24
|
+
if (segments === 1)
|
25
|
+
return;
|
26
|
+
const geometry2 = this.toNonIndexed();
|
27
|
+
this.index = null;
|
28
|
+
this.attributes.position = geometry2.attributes.position;
|
29
|
+
this.attributes.normal = geometry2.attributes.normal;
|
30
|
+
this.attributes.uv = geometry2.attributes.uv;
|
31
|
+
const position = new Vector3();
|
32
|
+
const normal = new Vector3();
|
33
|
+
const box = new Vector3(width, height, depth).divideScalar(2).subScalar(radius);
|
34
|
+
const positions = this.attributes.position.array;
|
35
|
+
const normals = this.attributes.normal.array;
|
36
|
+
const uvs = this.attributes.uv.array;
|
37
|
+
const faceTris = positions.length / 6;
|
38
|
+
const faceDirVector = new Vector3();
|
39
|
+
const halfSegmentSize = 0.5 / segments;
|
40
|
+
for (let i = 0, j = 0; i < positions.length; i += 3, j += 2) {
|
41
|
+
position.fromArray(positions, i);
|
42
|
+
normal.copy(position);
|
43
|
+
normal.x -= Math.sign(normal.x) * halfSegmentSize;
|
44
|
+
normal.y -= Math.sign(normal.y) * halfSegmentSize;
|
45
|
+
normal.z -= Math.sign(normal.z) * halfSegmentSize;
|
46
|
+
normal.normalize();
|
47
|
+
positions[i + 0] = box.x * Math.sign(position.x) + normal.x * radius;
|
48
|
+
positions[i + 1] = box.y * Math.sign(position.y) + normal.y * radius;
|
49
|
+
positions[i + 2] = box.z * Math.sign(position.z) + normal.z * radius;
|
50
|
+
normals[i + 0] = normal.x;
|
51
|
+
normals[i + 1] = normal.y;
|
52
|
+
normals[i + 2] = normal.z;
|
53
|
+
const side = Math.floor(i / faceTris);
|
54
|
+
switch (side) {
|
55
|
+
case 0:
|
56
|
+
faceDirVector.set(1, 0, 0);
|
57
|
+
uvs[j + 0] = getUv(faceDirVector, normal, "z", "y", radius, depth);
|
58
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "z", radius, height);
|
59
|
+
break;
|
60
|
+
case 1:
|
61
|
+
faceDirVector.set(-1, 0, 0);
|
62
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "z", "y", radius, depth);
|
63
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "z", radius, height);
|
64
|
+
break;
|
65
|
+
case 2:
|
66
|
+
faceDirVector.set(0, 1, 0);
|
67
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "z", radius, width);
|
68
|
+
uvs[j + 1] = getUv(faceDirVector, normal, "z", "x", radius, depth);
|
69
|
+
break;
|
70
|
+
case 3:
|
71
|
+
faceDirVector.set(0, -1, 0);
|
72
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "z", radius, width);
|
73
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "z", "x", radius, depth);
|
74
|
+
break;
|
75
|
+
case 4:
|
76
|
+
faceDirVector.set(0, 0, 1);
|
77
|
+
uvs[j + 0] = 1 - getUv(faceDirVector, normal, "x", "y", radius, width);
|
78
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "x", radius, height);
|
79
|
+
break;
|
80
|
+
case 5:
|
81
|
+
faceDirVector.set(0, 0, -1);
|
82
|
+
uvs[j + 0] = getUv(faceDirVector, normal, "x", "y", radius, width);
|
83
|
+
uvs[j + 1] = 1 - getUv(faceDirVector, normal, "y", "x", radius, height);
|
84
|
+
break;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
export {
|
90
|
+
RoundedBoxGeometry
|
91
|
+
};
|