opal-js_wrap-three 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/lib/opal/js_wrap/three/version.rb +1 -1
- data/lib-opal/js_wrap/three/WebGL.js +102 -0
- data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
- data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
- data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
- data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
- data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
- data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
- data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
- data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
- data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
- data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
- data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
- data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
- data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
- data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
- data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
- data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
- data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
- data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
- data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
- data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
- data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
- data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
- data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
- data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
- data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
- data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
- data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
- data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
- data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
- data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
- data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
- data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
- data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
- data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
- data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
- data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
- data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
- data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
- data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
- data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
- data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
- data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
- data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
- data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
- data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
- data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
- data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
- data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
- data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
- data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
- data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
- data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
- data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
- data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
- data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
- data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
- data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
- data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
- data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
- data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
- data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
- data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
- data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
- data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
- data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
- data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
- data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
- data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
- data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
- data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
- data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
- data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
- data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
- data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
- data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
- data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
- data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
- data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
- data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
- data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
- data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
- data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
- data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
- data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
- data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
- data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
- data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
- data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
- data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
- data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
- data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
- data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
- data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
- data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
- data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
- data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
- data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
- data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
- data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
- data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
- data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
- data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
- data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
- data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
- data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
- data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
- data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
- data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
- data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
- data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
- data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
- data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
- data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
- data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
- data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
- data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
- data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
- data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
- data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
- data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
- data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
- data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
- data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
- data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
- data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
- data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
- data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
- data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
- data/lib-opal/js_wrap/three/math/Lut.js +170 -0
- data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
- data/lib-opal/js_wrap/three/math/OBB.js +345 -0
- data/lib-opal/js_wrap/three/math/Octree.js +409 -0
- data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
- data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
- data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
- data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
- data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
- data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
- data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
- data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
- data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
- data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
- data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
- data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
- data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
- data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
- data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
- data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
- data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
- data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
- data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
- data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
- data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
- data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
- data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
- data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
- data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
- data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
- data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
- data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
- data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
- data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
- data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
- data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
- data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
- data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
- data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
- data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
- data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
- data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
- data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
- data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
- data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
- data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
- data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
- data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
- data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
- data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
- data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
- data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
- data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
- data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
- data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
- data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
- data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
- data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
- data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
- data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
- data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
- data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
- data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
- data/lib-opal/js_wrap/three/objects/Water.js +246 -0
- data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
- data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
- data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
- data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
- data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
- data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
- data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
- data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
- data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
- data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
- data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
- data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
- data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
- data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
- data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
- data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
- data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
- data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
- data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
- data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
- data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
- data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
- data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
- data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
- data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
- data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
- data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
- data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
- data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
- data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
- data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
- data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
- data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
- data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
- data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
- data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
- data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
- data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
- data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
- data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
- data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
- data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
- data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
- data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
- data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
- data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
- data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
- data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
- data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
- data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
- data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
- data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
- data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
- data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
- data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
- data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
- data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
- data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
- data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
- data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
- data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
- data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
- data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
- data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
- data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
- data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
- data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
- data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
- data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
- data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
- data/opal-js_wrap-three.gemspec +4 -4
- metadata +502 -5
@@ -0,0 +1,140 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three);
|
11
|
+
global.GodRaysShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.GodRaysGenerateShader = _exports.GodRaysFakeSunShader = _exports.GodRaysDepthMaskShader = _exports.GodRaysCombineShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* God-rays (crepuscular rays)
|
23
|
+
*
|
24
|
+
* Similar implementation to the one used by Crytek for CryEngine 2 [Sousa2008].
|
25
|
+
* Blurs a mask generated from the depth map along radial lines emanating from the light
|
26
|
+
* source. The blur repeatedly applies a blur filter of increasing support but constant
|
27
|
+
* sample count to produce a blur filter with large support.
|
28
|
+
*
|
29
|
+
* My implementation performs 3 passes, similar to the implementation from Sousa. I found
|
30
|
+
* just 6 samples per pass produced acceptible results. The blur is applied three times,
|
31
|
+
* with decreasing filter support. The result is equivalent to a single pass with
|
32
|
+
* 6*6*6 = 216 samples.
|
33
|
+
*
|
34
|
+
* References:
|
35
|
+
*
|
36
|
+
* Sousa2008 - Crysis Next Gen Effects, GDC2008, http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt
|
37
|
+
*/
|
38
|
+
var GodRaysDepthMaskShader = {
|
39
|
+
uniforms: {
|
40
|
+
tInput: {
|
41
|
+
value: null
|
42
|
+
}
|
43
|
+
},
|
44
|
+
vertexShader:
|
45
|
+
/* glsl */
|
46
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t vUv = uv;\n\t\t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t }",
|
47
|
+
fragmentShader:
|
48
|
+
/* glsl */
|
49
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D tInput;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );\n\n\t\t}"
|
50
|
+
};
|
51
|
+
/**
|
52
|
+
* The god-ray generation shader.
|
53
|
+
*
|
54
|
+
* First pass:
|
55
|
+
*
|
56
|
+
* The depth map is blurred along radial lines towards the "sun". The
|
57
|
+
* output is written to a temporary render target (I used a 1/4 sized
|
58
|
+
* target).
|
59
|
+
*
|
60
|
+
* Pass two & three:
|
61
|
+
*
|
62
|
+
* The results of the previous pass are re-blurred, each time with a
|
63
|
+
* decreased distance between samples.
|
64
|
+
*/
|
65
|
+
|
66
|
+
_exports.GodRaysDepthMaskShader = GodRaysDepthMaskShader;
|
67
|
+
var GodRaysGenerateShader = {
|
68
|
+
uniforms: {
|
69
|
+
tInput: {
|
70
|
+
value: null
|
71
|
+
},
|
72
|
+
fStepSize: {
|
73
|
+
value: 1.0
|
74
|
+
},
|
75
|
+
vSunPositionScreenSpace: {
|
76
|
+
value: new _three.Vector3()
|
77
|
+
}
|
78
|
+
},
|
79
|
+
vertexShader:
|
80
|
+
/* glsl */
|
81
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t vUv = uv;\n\t\t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t }",
|
82
|
+
fragmentShader:
|
83
|
+
/* glsl */
|
84
|
+
"\n\n\t\t#define TAPS_PER_PASS 6.0\n\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D tInput;\n\n\t\tuniform vec3 vSunPositionScreenSpace;\n\t\tuniform float fStepSize; // filter step size\n\n\t\tvoid main() {\n\n\t\t// delta from current pixel to \"sun\" position\n\n\t\t\tvec2 delta = vSunPositionScreenSpace.xy - vUv;\n\t\t\tfloat dist = length( delta );\n\n\t\t// Step vector (uv space)\n\n\t\t\tvec2 stepv = fStepSize * delta / dist;\n\n\t\t// Number of iterations between pixel and sun\n\n\t\t\tfloat iters = dist/fStepSize;\n\n\t\t\tvec2 uv = vUv.xy;\n\t\t\tfloat col = 0.0;\n\n\t\t// This breaks ANGLE in Chrome 22\n\t\t//\t- see http://code.google.com/p/chromium/issues/detail?id=153105\n\n\t\t/*\n\t\t// Unrolling didnt do much on my hardware (ATI Mobility Radeon 3450),\n\t\t// so i've just left the loop\n\n\t\t\"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {\",\n\n\t\t// Accumulate samples, making sure we dont walk past the light source.\n\n\t\t// The check for uv.y < 1 would not be necessary with \"border\" UV wrap\n\t\t// mode, with a black border color. I don't think this is currently\n\t\t// exposed by three.js. As a result there might be artifacts when the\n\t\t// sun is to the left, right or bottom of screen as these cases are\n\t\t// not specifically handled.\n\n\t\t\"\tcol += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );\",\n\t\t\"\tuv += stepv;\",\n\n\t\t\"}\",\n\t\t*/\n\n\t\t// Unrolling loop manually makes it work in ANGLE\n\n\t\t\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) ); // used to fade out godrays\n\n\t\t\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\n\t\t\tuv += stepv;\n\n\t\t// Should technically be dividing by 'iters but 'TAPS_PER_PASS' smooths out\n\t\t// objectionable artifacts, in particular near the sun position. The side\n\t\t// effect is that the result is darker than it should be around the sun, as\n\t\t// TAPS_PER_PASS is greater than the number of samples actually accumulated.\n\t\t// When the result is inverted (in the shader 'godrays_combine this produces\n\t\t// a slight bright spot at the position of the sun, even when it is occluded.\n\n\t\t\tgl_FragColor = vec4( col/TAPS_PER_PASS );\n\t\t\tgl_FragColor.a = 1.0;\n\n\t\t}"
|
85
|
+
};
|
86
|
+
/**
|
87
|
+
* Additively applies god rays from texture tGodRays to a background (tColors).
|
88
|
+
* fGodRayIntensity attenuates the god rays.
|
89
|
+
*/
|
90
|
+
|
91
|
+
_exports.GodRaysGenerateShader = GodRaysGenerateShader;
|
92
|
+
var GodRaysCombineShader = {
|
93
|
+
uniforms: {
|
94
|
+
tColors: {
|
95
|
+
value: null
|
96
|
+
},
|
97
|
+
tGodRays: {
|
98
|
+
value: null
|
99
|
+
},
|
100
|
+
fGodRayIntensity: {
|
101
|
+
value: 0.69
|
102
|
+
}
|
103
|
+
},
|
104
|
+
vertexShader:
|
105
|
+
/* glsl */
|
106
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
107
|
+
fragmentShader:
|
108
|
+
/* glsl */
|
109
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D tColors;\n\t\tuniform sampler2D tGodRays;\n\n\t\tuniform float fGodRayIntensity;\n\n\t\tvoid main() {\n\n\t\t// Since THREE.MeshDepthMaterial renders foreground objects white and background\n\t\t// objects black, the god-rays will be white streaks. Therefore value is inverted\n\t\t// before being combined with tColors\n\n\t\t\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );\n\t\t\tgl_FragColor.a = 1.0;\n\n\t\t}"
|
110
|
+
};
|
111
|
+
/**
|
112
|
+
* A dodgy sun/sky shader. Makes a bright spot at the sun location. Would be
|
113
|
+
* cheaper/faster/simpler to implement this as a simple sun sprite.
|
114
|
+
*/
|
115
|
+
|
116
|
+
_exports.GodRaysCombineShader = GodRaysCombineShader;
|
117
|
+
var GodRaysFakeSunShader = {
|
118
|
+
uniforms: {
|
119
|
+
vSunPositionScreenSpace: {
|
120
|
+
value: new _three.Vector3()
|
121
|
+
},
|
122
|
+
fAspect: {
|
123
|
+
value: 1.0
|
124
|
+
},
|
125
|
+
sunColor: {
|
126
|
+
value: new _three.Color(0xffee00)
|
127
|
+
},
|
128
|
+
bgColor: {
|
129
|
+
value: new _three.Color(0x000000)
|
130
|
+
}
|
131
|
+
},
|
132
|
+
vertexShader:
|
133
|
+
/* glsl */
|
134
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
135
|
+
fragmentShader:
|
136
|
+
/* glsl */
|
137
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tuniform vec3 vSunPositionScreenSpace;\n\t\tuniform float fAspect;\n\n\t\tuniform vec3 sunColor;\n\t\tuniform vec3 bgColor;\n\n\t\tvoid main() {\n\n\t\t\tvec2 diff = vUv - vSunPositionScreenSpace.xy;\n\n\t\t// Correct for aspect ratio\n\n\t\t\tdiff.x *= fAspect;\n\n\t\t\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );\n\t\t\tprop = 0.35 * pow( 1.0 - prop, 3.0 );\n\n\t\t\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;\n\t\t\tgl_FragColor.w = 1.0;\n\n\t\t}"
|
138
|
+
};
|
139
|
+
_exports.GodRaysFakeSunShader = GodRaysFakeSunShader;
|
140
|
+
});
|
@@ -0,0 +1,77 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.HalftoneShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.HalftoneShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* RGB Halftone shader for three.js.
|
23
|
+
* NOTE:
|
24
|
+
* Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square)
|
25
|
+
* Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker)
|
26
|
+
*/
|
27
|
+
var HalftoneShader = {
|
28
|
+
uniforms: {
|
29
|
+
'tDiffuse': {
|
30
|
+
value: null
|
31
|
+
},
|
32
|
+
'shape': {
|
33
|
+
value: 1
|
34
|
+
},
|
35
|
+
'radius': {
|
36
|
+
value: 4
|
37
|
+
},
|
38
|
+
'rotateR': {
|
39
|
+
value: Math.PI / 12 * 1
|
40
|
+
},
|
41
|
+
'rotateG': {
|
42
|
+
value: Math.PI / 12 * 2
|
43
|
+
},
|
44
|
+
'rotateB': {
|
45
|
+
value: Math.PI / 12 * 3
|
46
|
+
},
|
47
|
+
'scatter': {
|
48
|
+
value: 0
|
49
|
+
},
|
50
|
+
'width': {
|
51
|
+
value: 1
|
52
|
+
},
|
53
|
+
'height': {
|
54
|
+
value: 1
|
55
|
+
},
|
56
|
+
'blending': {
|
57
|
+
value: 1
|
58
|
+
},
|
59
|
+
'blendingMode': {
|
60
|
+
value: 1
|
61
|
+
},
|
62
|
+
'greyscale': {
|
63
|
+
value: false
|
64
|
+
},
|
65
|
+
'disable': {
|
66
|
+
value: false
|
67
|
+
}
|
68
|
+
},
|
69
|
+
vertexShader:
|
70
|
+
/* glsl */
|
71
|
+
"\n\n\t\tvarying vec2 vUV;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\n\t\t}",
|
72
|
+
fragmentShader:
|
73
|
+
/* glsl */
|
74
|
+
"\n\n\t\t#define SQRT2_MINUS_ONE 0.41421356\n\t\t#define SQRT2_HALF_MINUS_ONE 0.20710678\n\t\t#define PI2 6.28318531\n\t\t#define SHAPE_DOT 1\n\t\t#define SHAPE_ELLIPSE 2\n\t\t#define SHAPE_LINE 3\n\t\t#define SHAPE_SQUARE 4\n\t\t#define BLENDING_LINEAR 1\n\t\t#define BLENDING_MULTIPLY 2\n\t\t#define BLENDING_ADD 3\n\t\t#define BLENDING_LIGHTER 4\n\t\t#define BLENDING_DARKER 5\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float radius;\n\t\tuniform float rotateR;\n\t\tuniform float rotateG;\n\t\tuniform float rotateB;\n\t\tuniform float scatter;\n\t\tuniform float width;\n\t\tuniform float height;\n\t\tuniform int shape;\n\t\tuniform bool disable;\n\t\tuniform float blending;\n\t\tuniform int blendingMode;\n\t\tvarying vec2 vUV;\n\t\tuniform bool greyscale;\n\t\tconst int samples = 8;\n\n\t\tfloat blend( float a, float b, float t ) {\n\n\t\t// linear blend\n\t\t\treturn a * ( 1.0 - t ) + b * t;\n\n\t\t}\n\n\t\tfloat hypot( float x, float y ) {\n\n\t\t// vector magnitude\n\t\t\treturn sqrt( x * x + y * y );\n\n\t\t}\n\n\t\tfloat rand( vec2 seed ){\n\n\t\t// get pseudo-random number\n\t\t\treturn fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );\n\n\t\t}\n\n\t\tfloat distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {\n\n\t\t// apply shape-specific transforms\n\t\t\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );\n\t\t\tfloat rad = channel;\n\n\t\t\tif ( shape == SHAPE_DOT ) {\n\n\t\t\t\trad = pow( abs( rad ), 1.125 ) * rad_max;\n\n\t\t\t} else if ( shape == SHAPE_ELLIPSE ) {\n\n\t\t\t\trad = pow( abs( rad ), 1.125 ) * rad_max;\n\n\t\t\t\tif ( dist != 0.0 ) {\n\t\t\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );\n\t\t\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;\n\t\t\t\t}\n\n\t\t\t} else if ( shape == SHAPE_LINE ) {\n\n\t\t\t\trad = pow( abs( rad ), 1.5) * rad_max;\n\t\t\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;\n\t\t\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );\n\n\t\t\t} else if ( shape == SHAPE_SQUARE ) {\n\n\t\t\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;\n\t\t\t\tfloat sin_t = abs( sin( theta ) );\n\t\t\t\tfloat cos_t = abs( cos( theta ) );\n\t\t\t\trad = pow( abs( rad ), 1.4 );\n\t\t\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );\n\n\t\t\t}\n\n\t\t\treturn rad - dist;\n\n\t\t}\n\n\t\tstruct Cell {\n\n\t\t// grid sample positions\n\t\t\tvec2 normal;\n\t\t\tvec2 p1;\n\t\t\tvec2 p2;\n\t\t\tvec2 p3;\n\t\t\tvec2 p4;\n\t\t\tfloat samp2;\n\t\t\tfloat samp1;\n\t\t\tfloat samp3;\n\t\t\tfloat samp4;\n\n\t\t};\n\n\t\tvec4 getSample( vec2 point ) {\n\n\t\t// multi-sampled point\n\t\t\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );\n\t\t\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;\n\t\t\tfloat step = PI2 / float( samples );\n\t\t\tfloat dist = radius * 0.66;\n\n\t\t\tfor ( int i = 0; i < samples; ++i ) {\n\n\t\t\t\tfloat r = base + step * float( i );\n\t\t\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );\n\t\t\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );\n\n\t\t\t}\n\n\t\t\ttex /= float( samples ) + 1.0;\n\t\t\treturn tex;\n\n\t\t}\n\n\t\tfloat getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {\n\n\t\t// get colour for given point\n\t\t\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;\n\n\t\t\tif ( channel == 0 ) {\n\n\t\t\t\tc.samp1 = getSample( c.p1 ).r;\n\t\t\t\tc.samp2 = getSample( c.p2 ).r;\n\t\t\t\tc.samp3 = getSample( c.p3 ).r;\n\t\t\t\tc.samp4 = getSample( c.p4 ).r;\n\n\t\t\t} else if (channel == 1) {\n\n\t\t\t\tc.samp1 = getSample( c.p1 ).g;\n\t\t\t\tc.samp2 = getSample( c.p2 ).g;\n\t\t\t\tc.samp3 = getSample( c.p3 ).g;\n\t\t\t\tc.samp4 = getSample( c.p4 ).g;\n\n\t\t\t} else {\n\n\t\t\t\tc.samp1 = getSample( c.p1 ).b;\n\t\t\t\tc.samp3 = getSample( c.p3 ).b;\n\t\t\t\tc.samp2 = getSample( c.p2 ).b;\n\t\t\t\tc.samp4 = getSample( c.p4 ).b;\n\n\t\t\t}\n\n\t\t\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );\n\t\t\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );\n\t\t\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );\n\t\t\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );\n\t\t\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;\n\t\t\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;\n\t\t\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;\n\t\t\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;\n\t\t\tres = clamp( res, 0.0, 1.0 );\n\n\t\t\treturn res;\n\n\t\t}\n\n\t\tCell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {\n\n\t\t// get containing cell\n\t\t\tCell c;\n\n\t\t// calc grid\n\t\t\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );\n\t\t\tfloat threshold = step * 0.5;\n\t\t\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );\n\t\t\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );\n\t\t\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );\n\t\t\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );\n\t\t\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;\n\t\t\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;\n\t\t\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );\n\t\t\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;\n\t\t\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;\n\n\t\t// get closest corner\n\t\t\tc.normal = n;\n\t\t\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;\n\t\t\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;\n\n\t\t// scatter\n\t\t\tif ( scatter != 0.0 ) {\n\n\t\t\t\tfloat off_mag = scatter * threshold * 0.5;\n\t\t\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;\n\t\t\t\tc.p1.x += cos( off_angle ) * off_mag;\n\t\t\t\tc.p1.y += sin( off_angle ) * off_mag;\n\n\t\t\t}\n\n\t\t// find corners\n\t\t\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );\n\t\t\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );\n\t\t\tc.p2.x = c.p1.x - n.x * normal_step;\n\t\t\tc.p2.y = c.p1.y - n.y * normal_step;\n\t\t\tc.p3.x = c.p1.x + n.y * line_step;\n\t\t\tc.p3.y = c.p1.y - n.x * line_step;\n\t\t\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;\n\t\t\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;\n\n\t\t\treturn c;\n\n\t\t}\n\n\t\tfloat blendColour( float a, float b, float t ) {\n\n\t\t// blend colours\n\t\t\tif ( blendingMode == BLENDING_LINEAR ) {\n\t\t\t\treturn blend( a, b, 1.0 - t );\n\t\t\t} else if ( blendingMode == BLENDING_ADD ) {\n\t\t\t\treturn blend( a, min( 1.0, a + b ), t );\n\t\t\t} else if ( blendingMode == BLENDING_MULTIPLY ) {\n\t\t\t\treturn blend( a, max( 0.0, a * b ), t );\n\t\t\t} else if ( blendingMode == BLENDING_LIGHTER ) {\n\t\t\t\treturn blend( a, max( a, b ), t );\n\t\t\t} else if ( blendingMode == BLENDING_DARKER ) {\n\t\t\t\treturn blend( a, min( a, b ), t );\n\t\t\t} else {\n\t\t\t\treturn blend( a, b, 1.0 - t );\n\t\t\t}\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tif ( ! disable ) {\n\n\t\t// setup\n\t\t\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );\n\t\t\t\tvec2 origin = vec2( 0, 0 );\n\t\t\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;\n\n\t\t// get channel samples\n\t\t\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );\n\t\t\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );\n\t\t\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );\n\t\t\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );\n\t\t\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );\n\t\t\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );\n\n\t\t// blend with original\n\t\t\t\tvec4 colour = texture2D( tDiffuse, vUV );\n\t\t\t\tr = blendColour( r, colour.r, blending );\n\t\t\t\tg = blendColour( g, colour.g, blending );\n\t\t\t\tb = blendColour( b, colour.b, blending );\n\n\t\t\t\tif ( greyscale ) {\n\t\t\t\t\tr = g = b = (r + b + g) / 3.0;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4( r, g, b, 1.0 );\n\n\t\t\t} else {\n\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUV );\n\n\t\t\t}\n\n\t\t}"
|
75
|
+
};
|
76
|
+
_exports.HalftoneShader = HalftoneShader;
|
77
|
+
});
|
@@ -0,0 +1,47 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.HorizontalBlurShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.HorizontalBlurShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Two pass Gaussian blur filter (horizontal and vertical blur shaders)
|
23
|
+
* - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
|
24
|
+
* and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
|
25
|
+
*
|
26
|
+
* - 9 samples per pass
|
27
|
+
* - standard deviation 2.7
|
28
|
+
* - "h" and "v" parameters should be set to "1 / width" and "1 / height"
|
29
|
+
*/
|
30
|
+
var HorizontalBlurShader = {
|
31
|
+
uniforms: {
|
32
|
+
'tDiffuse': {
|
33
|
+
value: null
|
34
|
+
},
|
35
|
+
'h': {
|
36
|
+
value: 1.0 / 512.0
|
37
|
+
}
|
38
|
+
},
|
39
|
+
vertexShader:
|
40
|
+
/* glsl */
|
41
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
42
|
+
fragmentShader:
|
43
|
+
/* glsl */
|
44
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"
|
45
|
+
};
|
46
|
+
_exports.HorizontalBlurShader = HorizontalBlurShader;
|
47
|
+
});
|
@@ -0,0 +1,49 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.HorizontalTiltShiftShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.HorizontalTiltShiftShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
|
23
|
+
*
|
24
|
+
* - 9 samples per pass
|
25
|
+
* - standard deviation 2.7
|
26
|
+
* - "h" and "v" parameters should be set to "1 / width" and "1 / height"
|
27
|
+
* - "r" parameter control where "focused" horizontal line lies
|
28
|
+
*/
|
29
|
+
var HorizontalTiltShiftShader = {
|
30
|
+
uniforms: {
|
31
|
+
'tDiffuse': {
|
32
|
+
value: null
|
33
|
+
},
|
34
|
+
'h': {
|
35
|
+
value: 1.0 / 512.0
|
36
|
+
},
|
37
|
+
'r': {
|
38
|
+
value: 0.35
|
39
|
+
}
|
40
|
+
},
|
41
|
+
vertexShader:
|
42
|
+
/* glsl */
|
43
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
44
|
+
fragmentShader:
|
45
|
+
/* glsl */
|
46
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tuniform float r;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tfloat hh = h * abs( r - vUv.y );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"
|
47
|
+
};
|
48
|
+
_exports.HorizontalTiltShiftShader = HorizontalTiltShiftShader;
|
49
|
+
});
|
@@ -0,0 +1,47 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.HueSaturationShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.HueSaturationShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Hue and saturation adjustment
|
23
|
+
* https://github.com/evanw/glfx.js
|
24
|
+
* hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.
|
25
|
+
* saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
|
26
|
+
*/
|
27
|
+
var HueSaturationShader = {
|
28
|
+
uniforms: {
|
29
|
+
'tDiffuse': {
|
30
|
+
value: null
|
31
|
+
},
|
32
|
+
'hue': {
|
33
|
+
value: 0
|
34
|
+
},
|
35
|
+
'saturation': {
|
36
|
+
value: 0
|
37
|
+
}
|
38
|
+
},
|
39
|
+
vertexShader:
|
40
|
+
/* glsl */
|
41
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
42
|
+
fragmentShader:
|
43
|
+
/* glsl */
|
44
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float hue;\n\t\tuniform float saturation;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// hue\n\t\t\tfloat angle = hue * 3.14159265;\n\t\t\tfloat s = sin(angle), c = cos(angle);\n\t\t\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n\t\t\tfloat len = length(gl_FragColor.rgb);\n\t\t\tgl_FragColor.rgb = vec3(\n\t\t\t\tdot(gl_FragColor.rgb, weights.xyz),\n\t\t\t\tdot(gl_FragColor.rgb, weights.zxy),\n\t\t\t\tdot(gl_FragColor.rgb, weights.yzx)\n\t\t\t);\n\n\t\t\t// saturation\n\t\t\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;\n\t\t\tif (saturation > 0.0) {\n\t\t\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));\n\t\t\t} else {\n\t\t\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);\n\t\t\t}\n\n\t\t}"
|
45
|
+
};
|
46
|
+
_exports.HueSaturationShader = HueSaturationShader;
|
47
|
+
});
|
@@ -0,0 +1,50 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.KaleidoShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.KaleidoShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Kaleidoscope Shader
|
23
|
+
* Radial reflection around center point
|
24
|
+
* Ported from: http://pixelshaders.com/editor/
|
25
|
+
* by Toby Schachman / http://tobyschachman.com/
|
26
|
+
*
|
27
|
+
* sides: number of reflections
|
28
|
+
* angle: initial angle in radians
|
29
|
+
*/
|
30
|
+
var KaleidoShader = {
|
31
|
+
uniforms: {
|
32
|
+
'tDiffuse': {
|
33
|
+
value: null
|
34
|
+
},
|
35
|
+
'sides': {
|
36
|
+
value: 6.0
|
37
|
+
},
|
38
|
+
'angle': {
|
39
|
+
value: 0.0
|
40
|
+
}
|
41
|
+
},
|
42
|
+
vertexShader:
|
43
|
+
/* glsl */
|
44
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
45
|
+
fragmentShader:
|
46
|
+
/* glsl */
|
47
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float sides;\n\t\tuniform float angle;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec2 p = vUv - 0.5;\n\t\t\tfloat r = length(p);\n\t\t\tfloat a = atan(p.y, p.x) + angle;\n\t\t\tfloat tau = 2. * 3.1416 ;\n\t\t\ta = mod(a, tau/sides);\n\t\t\ta = abs(a - tau/sides/2.) ;\n\t\t\tp = r * vec2(cos(a), sin(a));\n\t\t\tvec4 color = texture2D(tDiffuse, p + 0.5);\n\t\t\tgl_FragColor = color;\n\n\t\t}"
|
48
|
+
};
|
49
|
+
_exports.KaleidoShader = KaleidoShader;
|
50
|
+
});
|
@@ -0,0 +1,52 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three);
|
11
|
+
global.LuminosityHighPassShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.LuminosityHighPassShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Luminosity
|
23
|
+
* http://en.wikipedia.org/wiki/Luminosity
|
24
|
+
*/
|
25
|
+
var LuminosityHighPassShader = {
|
26
|
+
shaderID: 'luminosityHighPass',
|
27
|
+
uniforms: {
|
28
|
+
'tDiffuse': {
|
29
|
+
value: null
|
30
|
+
},
|
31
|
+
'luminosityThreshold': {
|
32
|
+
value: 1.0
|
33
|
+
},
|
34
|
+
'smoothWidth': {
|
35
|
+
value: 1.0
|
36
|
+
},
|
37
|
+
'defaultColor': {
|
38
|
+
value: new _three.Color(0x000000)
|
39
|
+
},
|
40
|
+
'defaultOpacity': {
|
41
|
+
value: 0.0
|
42
|
+
}
|
43
|
+
},
|
44
|
+
vertexShader:
|
45
|
+
/* glsl */
|
46
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
47
|
+
fragmentShader:
|
48
|
+
/* glsl */
|
49
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"
|
50
|
+
};
|
51
|
+
_exports.LuminosityHighPassShader = LuminosityHighPassShader;
|
52
|
+
});
|
@@ -0,0 +1,39 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.LuminosityShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.LuminosityShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Luminosity
|
23
|
+
* http://en.wikipedia.org/wiki/Luminosity
|
24
|
+
*/
|
25
|
+
var LuminosityShader = {
|
26
|
+
uniforms: {
|
27
|
+
'tDiffuse': {
|
28
|
+
value: null
|
29
|
+
}
|
30
|
+
},
|
31
|
+
vertexShader:
|
32
|
+
/* glsl */
|
33
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
34
|
+
fragmentShader:
|
35
|
+
/* glsl */
|
36
|
+
"\n\n\t\t#include <common>\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tfloat l = linearToRelativeLuminance( texel.rgb );\n\n\t\t\tgl_FragColor = vec4( l, l, l, texel.w );\n\n\t\t}"
|
37
|
+
};
|
38
|
+
_exports.LuminosityShader = LuminosityShader;
|
39
|
+
});
|
@@ -0,0 +1,48 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three);
|
11
|
+
global.MMDToonShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.MMDToonShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* MMD Toon Shader
|
23
|
+
*
|
24
|
+
* This shader is extended from MeshPhongMaterial, and merged algorithms with
|
25
|
+
* MeshToonMaterial and MeshMetcapMaterial.
|
26
|
+
* Ideas came from https://github.com/mrdoob/three.js/issues/19609
|
27
|
+
*
|
28
|
+
* Combining steps:
|
29
|
+
* * Declare matcap uniform.
|
30
|
+
* * Add gradientmap_pars_fragment.
|
31
|
+
* * Use gradient irradiances instead of dotNL irradiance from MeshPhongMaterial.
|
32
|
+
* (Replace lights_phong_pars_fragment with lights_mmd_toon_pars_fragment)
|
33
|
+
* * Add mmd_toon_matcap_fragment.
|
34
|
+
*/
|
35
|
+
var lights_mmd_toon_pars_fragment = "\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n";
|
36
|
+
var mmd_toon_matcap_fragment = "\n#ifdef USE_MATCAP\n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\n\t#ifdef MATCAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight *= matcapColor.rgb;\n\n\t#elif defined( MATCAP_BLENDING_ADD )\n\n\t\toutgoingLight += matcapColor.rgb;\n\n\t#endif\n\n#endif\n";
|
37
|
+
var MMDToonShader = {
|
38
|
+
defines: {
|
39
|
+
TOON: true,
|
40
|
+
MATCAP: true,
|
41
|
+
MATCAP_BLENDING_ADD: true
|
42
|
+
},
|
43
|
+
uniforms: _three.UniformsUtils.merge([_three.ShaderLib.toon.uniforms, _three.ShaderLib.phong.uniforms, _three.ShaderLib.matcap.uniforms]),
|
44
|
+
vertexShader: _three.ShaderLib.phong.vertexShader,
|
45
|
+
fragmentShader: _three.ShaderLib.phong.fragmentShader.replace('#include <common>', "\n\t\t\t\t\t#ifdef USE_MATCAP\n\t\t\t\t\t\tuniform sampler2D matcap;\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#include <common>\n\t\t\t\t").replace('#include <envmap_common_pars_fragment>', "\n\t\t\t\t\t#include <gradientmap_pars_fragment>\n\t\t\t\t\t#include <envmap_common_pars_fragment>\n\t\t\t\t").replace('#include <lights_phong_pars_fragment>', lights_mmd_toon_pars_fragment).replace('#include <envmap_fragment>', "\n\t\t\t\t\t#include <envmap_fragment>\n\t\t\t\t\t".concat(mmd_toon_matcap_fragment, "\n\t\t\t\t"))
|
46
|
+
};
|
47
|
+
_exports.MMDToonShader = MMDToonShader;
|
48
|
+
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.MirrorShader = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.MirrorShader = void 0;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Mirror Shader
|
23
|
+
* Copies half the input to the other half
|
24
|
+
*
|
25
|
+
* side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom)
|
26
|
+
*/
|
27
|
+
var MirrorShader = {
|
28
|
+
uniforms: {
|
29
|
+
'tDiffuse': {
|
30
|
+
value: null
|
31
|
+
},
|
32
|
+
'side': {
|
33
|
+
value: 1
|
34
|
+
}
|
35
|
+
},
|
36
|
+
vertexShader:
|
37
|
+
/* glsl */
|
38
|
+
"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",
|
39
|
+
fragmentShader:
|
40
|
+
/* glsl */
|
41
|
+
"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform int side;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec2 p = vUv;\n\t\t\tif (side == 0){\n\t\t\t\tif (p.x > 0.5) p.x = 1.0 - p.x;\n\t\t\t}else if (side == 1){\n\t\t\t\tif (p.x < 0.5) p.x = 1.0 - p.x;\n\t\t\t}else if (side == 2){\n\t\t\t\tif (p.y < 0.5) p.y = 1.0 - p.y;\n\t\t\t}else if (side == 3){\n\t\t\t\tif (p.y > 0.5) p.y = 1.0 - p.y;\n\t\t\t}\n\t\t\tvec4 color = texture2D(tDiffuse, p);\n\t\t\tgl_FragColor = color;\n\n\t\t}"
|
42
|
+
};
|
43
|
+
_exports.MirrorShader = MirrorShader;
|
44
|
+
});
|