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,782 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three", "./NodeUniform.js", "./NodeUtils.js", "./NodeLib.js", "./FunctionNode.js", "./ConstNode.js", "./StructNode.js", "../inputs/Vector2Node.js", "../inputs/Vector3Node.js", "../inputs/Vector4Node.js", "../inputs/TextureNode.js", "../inputs/CubeTextureNode.js", "../misc/TextureCubeNode.js"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"), require("./NodeUniform.js"), require("./NodeUtils.js"), require("./NodeLib.js"), require("./FunctionNode.js"), require("./ConstNode.js"), require("./StructNode.js"), require("../inputs/Vector2Node.js"), require("../inputs/Vector3Node.js"), require("../inputs/Vector4Node.js"), require("../inputs/TextureNode.js"), require("../inputs/CubeTextureNode.js"), require("../misc/TextureCubeNode.js"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three, global.NodeUniform, global.NodeUtils, global.NodeLib, global.FunctionNode, global.ConstNode, global.StructNode, global.Vector2Node, global.Vector3Node, global.Vector4Node, global.TextureNode, global.CubeTextureNode, global.TextureCubeNode);
|
11
|
+
global.NodeBuilder = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, _NodeUniform, _NodeUtils, _NodeLib, _FunctionNode, _ConstNode, _StructNode, _Vector2Node, _Vector3Node, _Vector4Node, _TextureNode, _CubeTextureNode, _TextureCubeNode) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.NodeBuilder = void 0;
|
20
|
+
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22
|
+
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
24
|
+
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
26
|
+
|
27
|
+
var elements = _NodeUtils.NodeUtils.elements,
|
28
|
+
constructors = ['float', 'vec2', 'vec3', 'vec4'],
|
29
|
+
convertFormatToType = {
|
30
|
+
float: 'f',
|
31
|
+
vec2: 'v2',
|
32
|
+
vec3: 'v3',
|
33
|
+
vec4: 'v4',
|
34
|
+
mat4: 'v4',
|
35
|
+
int: 'i',
|
36
|
+
bool: 'b'
|
37
|
+
},
|
38
|
+
convertTypeToFormat = {
|
39
|
+
t: 'sampler2D',
|
40
|
+
tc: 'samplerCube',
|
41
|
+
b: 'bool',
|
42
|
+
i: 'int',
|
43
|
+
f: 'float',
|
44
|
+
c: 'vec3',
|
45
|
+
v2: 'vec2',
|
46
|
+
v3: 'vec3',
|
47
|
+
v4: 'vec4',
|
48
|
+
m3: 'mat3',
|
49
|
+
m4: 'mat4'
|
50
|
+
};
|
51
|
+
|
52
|
+
var NodeBuilder = /*#__PURE__*/function () {
|
53
|
+
function NodeBuilder() {
|
54
|
+
_classCallCheck(this, NodeBuilder);
|
55
|
+
|
56
|
+
this.slots = [];
|
57
|
+
this.caches = [];
|
58
|
+
this.contexts = [];
|
59
|
+
this.keywords = {};
|
60
|
+
this.nodeData = {};
|
61
|
+
this.requires = {
|
62
|
+
uv: [],
|
63
|
+
color: [],
|
64
|
+
lights: false,
|
65
|
+
fog: false,
|
66
|
+
transparent: false,
|
67
|
+
irradiance: false
|
68
|
+
};
|
69
|
+
this.includes = {
|
70
|
+
consts: [],
|
71
|
+
functions: [],
|
72
|
+
structs: []
|
73
|
+
};
|
74
|
+
this.attributes = {};
|
75
|
+
this.prefixCode =
|
76
|
+
/* glsl */
|
77
|
+
"\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\t#define texCube(a, b) textureCube(a, b)\n\t\t\t\t#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)\n\n\t\t\t\t#define tex2D(a, b) texture2D(a, b)\n\t\t\t\t#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)\n\n\t\t\t#else\n\n\t\t\t\t#define texCube(a, b) textureCube(a, b)\n\t\t\t\t#define texCubeBias(a, b, c) textureCube(a, b, c)\n\n\t\t\t\t#define tex2D(a, b) texture2D(a, b)\n\t\t\t\t#define tex2DBias(a, b, c) texture2D(a, b, c)\n\n\t\t\t#endif\n\n\t\t\t#include <packing>\n\t\t\t#include <common>";
|
78
|
+
this.parsCode = {
|
79
|
+
vertex: '',
|
80
|
+
fragment: ''
|
81
|
+
};
|
82
|
+
this.code = {
|
83
|
+
vertex: '',
|
84
|
+
fragment: ''
|
85
|
+
};
|
86
|
+
this.nodeCode = {
|
87
|
+
vertex: '',
|
88
|
+
fragment: ''
|
89
|
+
};
|
90
|
+
this.resultCode = {
|
91
|
+
vertex: '',
|
92
|
+
fragment: ''
|
93
|
+
};
|
94
|
+
this.finalCode = {
|
95
|
+
vertex: '',
|
96
|
+
fragment: ''
|
97
|
+
};
|
98
|
+
this.inputs = {
|
99
|
+
uniforms: {
|
100
|
+
list: [],
|
101
|
+
vertex: [],
|
102
|
+
fragment: []
|
103
|
+
},
|
104
|
+
vars: {
|
105
|
+
varying: [],
|
106
|
+
vertex: [],
|
107
|
+
fragment: []
|
108
|
+
}
|
109
|
+
}; // send to material
|
110
|
+
|
111
|
+
this.defines = {};
|
112
|
+
this.uniforms = {};
|
113
|
+
this.extensions = {};
|
114
|
+
this.updaters = [];
|
115
|
+
this.nodes = []; // --
|
116
|
+
|
117
|
+
this.analyzing = false;
|
118
|
+
}
|
119
|
+
|
120
|
+
_createClass(NodeBuilder, [{
|
121
|
+
key: "build",
|
122
|
+
value: function build(vertex, fragment) {
|
123
|
+
this.buildShader('vertex', vertex);
|
124
|
+
this.buildShader('fragment', fragment);
|
125
|
+
|
126
|
+
for (var i = 0; i < this.requires.uv.length; i++) {
|
127
|
+
if (this.requires.uv[i]) {
|
128
|
+
var uvIndex = i > 0 ? i + 1 : '';
|
129
|
+
this.addVaryCode('varying vec2 vUv' + uvIndex + ';');
|
130
|
+
|
131
|
+
if (i > 0) {
|
132
|
+
this.addVertexParsCode('attribute vec2 uv' + uvIndex + ';');
|
133
|
+
}
|
134
|
+
|
135
|
+
this.addVertexFinalCode('vUv' + uvIndex + ' = uv' + uvIndex + ';');
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
if (this.requires.color[0]) {
|
140
|
+
this.addVaryCode('varying vec4 vColor;');
|
141
|
+
this.addVertexParsCode('attribute vec4 color;');
|
142
|
+
this.addVertexFinalCode('vColor = color;');
|
143
|
+
}
|
144
|
+
|
145
|
+
if (this.requires.color[1]) {
|
146
|
+
this.addVaryCode('varying vec4 vColor2;');
|
147
|
+
this.addVertexParsCode('attribute vec4 color2;');
|
148
|
+
this.addVertexFinalCode('vColor2 = color2;');
|
149
|
+
}
|
150
|
+
|
151
|
+
if (this.requires.position) {
|
152
|
+
this.addVaryCode('varying vec3 vPosition;');
|
153
|
+
this.addVertexFinalCode('vPosition = transformed;');
|
154
|
+
}
|
155
|
+
|
156
|
+
if (this.requires.worldPosition) {
|
157
|
+
this.addVaryCode('varying vec3 vWPosition;');
|
158
|
+
this.addVertexFinalCode('vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;');
|
159
|
+
}
|
160
|
+
|
161
|
+
if (this.requires.normal) {
|
162
|
+
this.addVaryCode('varying vec3 vObjectNormal;');
|
163
|
+
this.addVertexFinalCode('vObjectNormal = normal;');
|
164
|
+
}
|
165
|
+
|
166
|
+
if (this.requires.worldNormal) {
|
167
|
+
this.addVaryCode('varying vec3 vWNormal;');
|
168
|
+
this.addVertexFinalCode('vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;');
|
169
|
+
}
|
170
|
+
|
171
|
+
return this;
|
172
|
+
}
|
173
|
+
}, {
|
174
|
+
key: "buildShader",
|
175
|
+
value: function buildShader(shader, node) {
|
176
|
+
this.resultCode[shader] = node.build(this.setShader(shader), 'v4');
|
177
|
+
}
|
178
|
+
}, {
|
179
|
+
key: "setMaterial",
|
180
|
+
value: function setMaterial(material, renderer) {
|
181
|
+
this.material = material;
|
182
|
+
this.renderer = renderer;
|
183
|
+
this.requires.lights = material.lights;
|
184
|
+
this.requires.fog = material.fog;
|
185
|
+
this.mergeDefines(material.defines);
|
186
|
+
return this;
|
187
|
+
}
|
188
|
+
}, {
|
189
|
+
key: "addFlow",
|
190
|
+
value: function addFlow(slot, cache, context) {
|
191
|
+
return this.addSlot(slot).addCache(cache).addContext(context);
|
192
|
+
}
|
193
|
+
}, {
|
194
|
+
key: "removeFlow",
|
195
|
+
value: function removeFlow() {
|
196
|
+
return this.removeSlot().removeCache().removeContext();
|
197
|
+
}
|
198
|
+
}, {
|
199
|
+
key: "addCache",
|
200
|
+
value: function addCache(name) {
|
201
|
+
this.cache = name || '';
|
202
|
+
this.caches.push(this.cache);
|
203
|
+
return this;
|
204
|
+
}
|
205
|
+
}, {
|
206
|
+
key: "removeCache",
|
207
|
+
value: function removeCache() {
|
208
|
+
this.caches.pop();
|
209
|
+
this.cache = this.caches[this.caches.length - 1] || '';
|
210
|
+
return this;
|
211
|
+
}
|
212
|
+
}, {
|
213
|
+
key: "addContext",
|
214
|
+
value: function addContext(context) {
|
215
|
+
this.context = Object.assign({}, this.context, context);
|
216
|
+
this.context.extra = this.context.extra || {};
|
217
|
+
this.contexts.push(this.context);
|
218
|
+
return this;
|
219
|
+
}
|
220
|
+
}, {
|
221
|
+
key: "removeContext",
|
222
|
+
value: function removeContext() {
|
223
|
+
this.contexts.pop();
|
224
|
+
this.context = this.contexts[this.contexts.length - 1] || {};
|
225
|
+
return this;
|
226
|
+
}
|
227
|
+
}, {
|
228
|
+
key: "addSlot",
|
229
|
+
value: function addSlot() {
|
230
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
231
|
+
this.slot = name;
|
232
|
+
this.slots.push(this.slot);
|
233
|
+
return this;
|
234
|
+
}
|
235
|
+
}, {
|
236
|
+
key: "removeSlot",
|
237
|
+
value: function removeSlot() {
|
238
|
+
this.slots.pop();
|
239
|
+
this.slot = this.slots[this.slots.length - 1] || '';
|
240
|
+
return this;
|
241
|
+
}
|
242
|
+
}, {
|
243
|
+
key: "addVertexCode",
|
244
|
+
value: function addVertexCode(code) {
|
245
|
+
this.addCode(code, 'vertex');
|
246
|
+
}
|
247
|
+
}, {
|
248
|
+
key: "addFragmentCode",
|
249
|
+
value: function addFragmentCode(code) {
|
250
|
+
this.addCode(code, 'fragment');
|
251
|
+
}
|
252
|
+
}, {
|
253
|
+
key: "addCode",
|
254
|
+
value: function addCode(code, shader) {
|
255
|
+
this.code[shader || this.shader] += code + '\n';
|
256
|
+
}
|
257
|
+
}, {
|
258
|
+
key: "addVertexNodeCode",
|
259
|
+
value: function addVertexNodeCode(code) {
|
260
|
+
this.addNodeCode(code, 'vertex');
|
261
|
+
}
|
262
|
+
}, {
|
263
|
+
key: "addFragmentNodeCode",
|
264
|
+
value: function addFragmentNodeCode(code) {
|
265
|
+
this.addNodeCode(code, 'fragment');
|
266
|
+
}
|
267
|
+
}, {
|
268
|
+
key: "addNodeCode",
|
269
|
+
value: function addNodeCode(code, shader) {
|
270
|
+
this.nodeCode[shader || this.shader] += code + '\n';
|
271
|
+
}
|
272
|
+
}, {
|
273
|
+
key: "clearNodeCode",
|
274
|
+
value: function clearNodeCode(shader) {
|
275
|
+
shader = shader || this.shader;
|
276
|
+
var code = this.nodeCode[shader];
|
277
|
+
this.nodeCode[shader] = '';
|
278
|
+
return code;
|
279
|
+
}
|
280
|
+
}, {
|
281
|
+
key: "clearVertexNodeCode",
|
282
|
+
value: function clearVertexNodeCode() {
|
283
|
+
return this.clearNodeCode('vertex');
|
284
|
+
}
|
285
|
+
}, {
|
286
|
+
key: "clearFragmentNodeCode",
|
287
|
+
value: function clearFragmentNodeCode() {
|
288
|
+
return this.clearNodeCode('fragment');
|
289
|
+
}
|
290
|
+
}, {
|
291
|
+
key: "addVertexFinalCode",
|
292
|
+
value: function addVertexFinalCode(code) {
|
293
|
+
this.addFinalCode(code, 'vertex');
|
294
|
+
}
|
295
|
+
}, {
|
296
|
+
key: "addFragmentFinalCode",
|
297
|
+
value: function addFragmentFinalCode(code) {
|
298
|
+
this.addFinalCode(code, 'fragment');
|
299
|
+
}
|
300
|
+
}, {
|
301
|
+
key: "addFinalCode",
|
302
|
+
value: function addFinalCode(code, shader) {
|
303
|
+
this.finalCode[shader || this.shader] += code + '\n';
|
304
|
+
}
|
305
|
+
}, {
|
306
|
+
key: "addVertexParsCode",
|
307
|
+
value: function addVertexParsCode(code) {
|
308
|
+
this.addParsCode(code, 'vertex');
|
309
|
+
}
|
310
|
+
}, {
|
311
|
+
key: "addFragmentParsCode",
|
312
|
+
value: function addFragmentParsCode(code) {
|
313
|
+
this.addParsCode(code, 'fragment');
|
314
|
+
}
|
315
|
+
}, {
|
316
|
+
key: "addParsCode",
|
317
|
+
value: function addParsCode(code, shader) {
|
318
|
+
this.parsCode[shader || this.shader] += code + '\n';
|
319
|
+
}
|
320
|
+
}, {
|
321
|
+
key: "addVaryCode",
|
322
|
+
value: function addVaryCode(code) {
|
323
|
+
this.addVertexParsCode(code);
|
324
|
+
this.addFragmentParsCode(code);
|
325
|
+
}
|
326
|
+
}, {
|
327
|
+
key: "isCache",
|
328
|
+
value: function isCache(name) {
|
329
|
+
return this.caches.indexOf(name) !== -1;
|
330
|
+
}
|
331
|
+
}, {
|
332
|
+
key: "isSlot",
|
333
|
+
value: function isSlot(name) {
|
334
|
+
return this.slots.indexOf(name) !== -1;
|
335
|
+
}
|
336
|
+
}, {
|
337
|
+
key: "define",
|
338
|
+
value: function define(name, value) {
|
339
|
+
this.defines[name] = value === undefined ? 1 : value;
|
340
|
+
}
|
341
|
+
}, {
|
342
|
+
key: "require",
|
343
|
+
value: function require(name) {
|
344
|
+
this.requires[name] = true;
|
345
|
+
}
|
346
|
+
}, {
|
347
|
+
key: "isDefined",
|
348
|
+
value: function isDefined(name) {
|
349
|
+
return this.defines[name] !== undefined;
|
350
|
+
}
|
351
|
+
}, {
|
352
|
+
key: "getVar",
|
353
|
+
value: function getVar(uuid, type, ns) {
|
354
|
+
var shader = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'varying';
|
355
|
+
var prefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'V';
|
356
|
+
var label = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
|
357
|
+
var vars = this.getVars(shader);
|
358
|
+
var data = vars[uuid];
|
359
|
+
|
360
|
+
if (!data) {
|
361
|
+
var index = vars.length,
|
362
|
+
name = ns ? ns : 'node' + prefix + index + (label ? '_' + label : '');
|
363
|
+
data = {
|
364
|
+
name: name,
|
365
|
+
type: type
|
366
|
+
};
|
367
|
+
vars.push(data);
|
368
|
+
vars[uuid] = data;
|
369
|
+
}
|
370
|
+
|
371
|
+
return data;
|
372
|
+
}
|
373
|
+
}, {
|
374
|
+
key: "getTempVar",
|
375
|
+
value: function getTempVar(uuid, type, ns, label) {
|
376
|
+
return this.getVar(uuid, type, ns, this.shader, 'T', label);
|
377
|
+
}
|
378
|
+
}, {
|
379
|
+
key: "getAttribute",
|
380
|
+
value: function getAttribute(name, type) {
|
381
|
+
if (!this.attributes[name]) {
|
382
|
+
var varying = this.getVar(name, type);
|
383
|
+
this.addVertexParsCode('attribute ' + type + ' ' + name + ';');
|
384
|
+
this.addVertexFinalCode(varying.name + ' = ' + name + ';');
|
385
|
+
this.attributes[name] = {
|
386
|
+
varying: varying,
|
387
|
+
name: name,
|
388
|
+
type: type
|
389
|
+
};
|
390
|
+
}
|
391
|
+
|
392
|
+
return this.attributes[name];
|
393
|
+
}
|
394
|
+
}, {
|
395
|
+
key: "getCode",
|
396
|
+
value: function getCode(shader) {
|
397
|
+
return [this.prefixCode, this.parsCode[shader], this.getVarListCode(this.getVars('varying'), 'varying'), this.getVarListCode(this.inputs.uniforms[shader], 'uniform'), this.getIncludesCode('consts', shader), this.getIncludesCode('structs', shader), this.getIncludesCode('functions', shader), 'void main() {', this.getVarListCode(this.getVars(shader)), this.code[shader], this.resultCode[shader], this.finalCode[shader], '}'].join('\n');
|
398
|
+
}
|
399
|
+
}, {
|
400
|
+
key: "getVarListCode",
|
401
|
+
value: function getVarListCode(vars) {
|
402
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
403
|
+
var code = '';
|
404
|
+
|
405
|
+
for (var i = 0, l = vars.length; i < l; ++i) {
|
406
|
+
var nVar = vars[i],
|
407
|
+
type = nVar.type,
|
408
|
+
name = nVar.name;
|
409
|
+
var formatType = this.getFormatByType(type);
|
410
|
+
|
411
|
+
if (formatType === undefined) {
|
412
|
+
throw new Error('Node pars ' + formatType + ' not found.');
|
413
|
+
}
|
414
|
+
|
415
|
+
code += prefix + ' ' + formatType + ' ' + name + ';\n';
|
416
|
+
}
|
417
|
+
|
418
|
+
return code;
|
419
|
+
}
|
420
|
+
}, {
|
421
|
+
key: "getVars",
|
422
|
+
value: function getVars(shader) {
|
423
|
+
return this.inputs.vars[shader || this.shader];
|
424
|
+
}
|
425
|
+
}, {
|
426
|
+
key: "getNodeData",
|
427
|
+
value: function getNodeData(node) {
|
428
|
+
var uuid = node.isNode ? node.uuid : node;
|
429
|
+
return this.nodeData[uuid] = this.nodeData[uuid] || {};
|
430
|
+
}
|
431
|
+
}, {
|
432
|
+
key: "createUniform",
|
433
|
+
value: function createUniform(shader, type, node, ns, needsUpdate, label) {
|
434
|
+
var uniforms = this.inputs.uniforms,
|
435
|
+
index = uniforms.list.length;
|
436
|
+
var uniform = new _NodeUniform.NodeUniform({
|
437
|
+
type: type,
|
438
|
+
name: ns ? ns : 'nodeU' + index + (label ? '_' + label : ''),
|
439
|
+
node: node,
|
440
|
+
needsUpdate: needsUpdate
|
441
|
+
});
|
442
|
+
uniforms.list.push(uniform);
|
443
|
+
uniforms[shader].push(uniform);
|
444
|
+
uniforms[shader][uniform.name] = uniform;
|
445
|
+
this.uniforms[uniform.name] = uniform;
|
446
|
+
return uniform;
|
447
|
+
}
|
448
|
+
}, {
|
449
|
+
key: "createVertexUniform",
|
450
|
+
value: function createVertexUniform(type, node, ns, needsUpdate, label) {
|
451
|
+
return this.createUniform('vertex', type, node, ns, needsUpdate, label);
|
452
|
+
}
|
453
|
+
}, {
|
454
|
+
key: "createFragmentUniform",
|
455
|
+
value: function createFragmentUniform(type, node, ns, needsUpdate, label) {
|
456
|
+
return this.createUniform('fragment', type, node, ns, needsUpdate, label);
|
457
|
+
}
|
458
|
+
}, {
|
459
|
+
key: "include",
|
460
|
+
value: function include(node, parent, source) {
|
461
|
+
var includesStruct;
|
462
|
+
node = typeof node === 'string' ? _NodeLib.NodeLib.get(node) : node;
|
463
|
+
|
464
|
+
if (this.context.include === false) {
|
465
|
+
return node.name;
|
466
|
+
}
|
467
|
+
|
468
|
+
if (node instanceof _FunctionNode.FunctionNode) {
|
469
|
+
includesStruct = this.includes.functions;
|
470
|
+
} else if (node instanceof _ConstNode.ConstNode) {
|
471
|
+
includesStruct = this.includes.consts;
|
472
|
+
} else if (node instanceof _StructNode.StructNode) {
|
473
|
+
includesStruct = this.includes.structs;
|
474
|
+
}
|
475
|
+
|
476
|
+
var includes = includesStruct[this.shader] = includesStruct[this.shader] || [];
|
477
|
+
|
478
|
+
if (node) {
|
479
|
+
var included = includes[node.name];
|
480
|
+
|
481
|
+
if (!included) {
|
482
|
+
included = includes[node.name] = {
|
483
|
+
node: node,
|
484
|
+
deps: []
|
485
|
+
};
|
486
|
+
includes.push(included);
|
487
|
+
included.src = node.build(this, 'source');
|
488
|
+
}
|
489
|
+
|
490
|
+
if (node instanceof _FunctionNode.FunctionNode && parent && includes[parent.name] && includes[parent.name].deps.indexOf(node) == -1) {
|
491
|
+
includes[parent.name].deps.push(node);
|
492
|
+
|
493
|
+
if (node.includes && node.includes.length) {
|
494
|
+
var i = 0;
|
495
|
+
|
496
|
+
do {
|
497
|
+
this.include(node.includes[i++], parent);
|
498
|
+
} while (i < node.includes.length);
|
499
|
+
}
|
500
|
+
}
|
501
|
+
|
502
|
+
if (source) {
|
503
|
+
included.src = source;
|
504
|
+
}
|
505
|
+
|
506
|
+
return node.name;
|
507
|
+
} else {
|
508
|
+
throw new Error('Include not found.');
|
509
|
+
}
|
510
|
+
}
|
511
|
+
}, {
|
512
|
+
key: "colorToVectorProperties",
|
513
|
+
value: function colorToVectorProperties(color) {
|
514
|
+
return color.replace('r', 'x').replace('g', 'y').replace('b', 'z').replace('a', 'w');
|
515
|
+
}
|
516
|
+
}, {
|
517
|
+
key: "colorToVector",
|
518
|
+
value: function colorToVector(color) {
|
519
|
+
return color.replace(/c/g, 'v3');
|
520
|
+
}
|
521
|
+
}, {
|
522
|
+
key: "getIncludes",
|
523
|
+
value: function getIncludes(type, shader) {
|
524
|
+
return this.includes[type][shader || this.shader];
|
525
|
+
}
|
526
|
+
}, {
|
527
|
+
key: "getIncludesCode",
|
528
|
+
value: function getIncludesCode(type, shader) {
|
529
|
+
var includes = this.getIncludes(type, shader);
|
530
|
+
if (!includes) return '';
|
531
|
+
var code = '';
|
532
|
+
includes = includes.sort(sortByPosition);
|
533
|
+
|
534
|
+
for (var i = 0; i < includes.length; i++) {
|
535
|
+
if (includes[i].src) code += includes[i].src + '\n';
|
536
|
+
}
|
537
|
+
|
538
|
+
return code;
|
539
|
+
}
|
540
|
+
}, {
|
541
|
+
key: "getConstructorFromLength",
|
542
|
+
value: function getConstructorFromLength(len) {
|
543
|
+
return constructors[len - 1];
|
544
|
+
}
|
545
|
+
}, {
|
546
|
+
key: "isTypeMatrix",
|
547
|
+
value: function isTypeMatrix(format) {
|
548
|
+
return /^m/.test(format);
|
549
|
+
}
|
550
|
+
}, {
|
551
|
+
key: "getTypeLength",
|
552
|
+
value: function getTypeLength(type) {
|
553
|
+
if (type === 'f') return 1;
|
554
|
+
return parseInt(this.colorToVector(type).substr(1));
|
555
|
+
}
|
556
|
+
}, {
|
557
|
+
key: "getTypeFromLength",
|
558
|
+
value: function getTypeFromLength(len) {
|
559
|
+
if (len === 1) return 'f';
|
560
|
+
return 'v' + len;
|
561
|
+
}
|
562
|
+
}, {
|
563
|
+
key: "findNode",
|
564
|
+
value: function findNode() {
|
565
|
+
for (var i = 0; i < arguments.length; i++) {
|
566
|
+
var nodeCandidate = arguments[i];
|
567
|
+
|
568
|
+
if (nodeCandidate !== undefined && nodeCandidate.isNode) {
|
569
|
+
return nodeCandidate;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
}
|
573
|
+
}, {
|
574
|
+
key: "resolve",
|
575
|
+
value: function resolve() {
|
576
|
+
for (var i = 0; i < arguments.length; i++) {
|
577
|
+
var nodeCandidate = arguments[i];
|
578
|
+
|
579
|
+
if (nodeCandidate !== undefined) {
|
580
|
+
if (nodeCandidate.isNode) {
|
581
|
+
return nodeCandidate;
|
582
|
+
} else if (nodeCandidate.isTexture) {
|
583
|
+
switch (nodeCandidate.mapping) {
|
584
|
+
case _three.CubeReflectionMapping:
|
585
|
+
case _three.CubeRefractionMapping:
|
586
|
+
return new _CubeTextureNode.CubeTextureNode(nodeCandidate);
|
587
|
+
break;
|
588
|
+
|
589
|
+
case _three.CubeUVReflectionMapping:
|
590
|
+
case _three.CubeUVRefractionMapping:
|
591
|
+
return new _TextureCubeNode.TextureCubeNode(new _TextureNode.TextureNode(nodeCandidate));
|
592
|
+
break;
|
593
|
+
|
594
|
+
default:
|
595
|
+
return new _TextureNode.TextureNode(nodeCandidate);
|
596
|
+
}
|
597
|
+
} else if (nodeCandidate.isVector2) {
|
598
|
+
return new _Vector2Node.Vector2Node(nodeCandidate);
|
599
|
+
} else if (nodeCandidate.isVector3) {
|
600
|
+
return new _Vector3Node.Vector3Node(nodeCandidate);
|
601
|
+
} else if (nodeCandidate.isVector4) {
|
602
|
+
return new _Vector4Node.Vector4Node(nodeCandidate);
|
603
|
+
}
|
604
|
+
}
|
605
|
+
}
|
606
|
+
}
|
607
|
+
}, {
|
608
|
+
key: "format",
|
609
|
+
value: function format(code, from, to) {
|
610
|
+
var typeToType = this.colorToVector(to + ' <- ' + from);
|
611
|
+
|
612
|
+
switch (typeToType) {
|
613
|
+
case 'f <- v2':
|
614
|
+
return code + '.x';
|
615
|
+
|
616
|
+
case 'f <- v3':
|
617
|
+
return code + '.x';
|
618
|
+
|
619
|
+
case 'f <- v4':
|
620
|
+
return code + '.x';
|
621
|
+
|
622
|
+
case 'f <- i':
|
623
|
+
case 'f <- b':
|
624
|
+
return 'float( ' + code + ' )';
|
625
|
+
|
626
|
+
case 'v2 <- f':
|
627
|
+
return 'vec2( ' + code + ' )';
|
628
|
+
|
629
|
+
case 'v2 <- v3':
|
630
|
+
return code + '.xy';
|
631
|
+
|
632
|
+
case 'v2 <- v4':
|
633
|
+
return code + '.xy';
|
634
|
+
|
635
|
+
case 'v2 <- i':
|
636
|
+
case 'v2 <- b':
|
637
|
+
return 'vec2( float( ' + code + ' ) )';
|
638
|
+
|
639
|
+
case 'v3 <- f':
|
640
|
+
return 'vec3( ' + code + ' )';
|
641
|
+
|
642
|
+
case 'v3 <- v2':
|
643
|
+
return 'vec3( ' + code + ', 0.0 )';
|
644
|
+
|
645
|
+
case 'v3 <- v4':
|
646
|
+
return code + '.xyz';
|
647
|
+
|
648
|
+
case 'v3 <- i':
|
649
|
+
case 'v3 <- b':
|
650
|
+
return 'vec2( float( ' + code + ' ) )';
|
651
|
+
|
652
|
+
case 'v4 <- f':
|
653
|
+
return 'vec4( ' + code + ' )';
|
654
|
+
|
655
|
+
case 'v4 <- v2':
|
656
|
+
return 'vec4( ' + code + ', 0.0, 1.0 )';
|
657
|
+
|
658
|
+
case 'v4 <- v3':
|
659
|
+
return 'vec4( ' + code + ', 1.0 )';
|
660
|
+
|
661
|
+
case 'v4 <- i':
|
662
|
+
case 'v4 <- b':
|
663
|
+
return 'vec4( float( ' + code + ' ) )';
|
664
|
+
|
665
|
+
case 'i <- f':
|
666
|
+
case 'i <- b':
|
667
|
+
return 'int( ' + code + ' )';
|
668
|
+
|
669
|
+
case 'i <- v2':
|
670
|
+
return 'int( ' + code + '.x )';
|
671
|
+
|
672
|
+
case 'i <- v3':
|
673
|
+
return 'int( ' + code + '.x )';
|
674
|
+
|
675
|
+
case 'i <- v4':
|
676
|
+
return 'int( ' + code + '.x )';
|
677
|
+
|
678
|
+
case 'b <- f':
|
679
|
+
return '( ' + code + ' != 0.0 )';
|
680
|
+
|
681
|
+
case 'b <- v2':
|
682
|
+
return '( ' + code + ' != vec2( 0.0 ) )';
|
683
|
+
|
684
|
+
case 'b <- v3':
|
685
|
+
return '( ' + code + ' != vec3( 0.0 ) )';
|
686
|
+
|
687
|
+
case 'b <- v4':
|
688
|
+
return '( ' + code + ' != vec4( 0.0 ) )';
|
689
|
+
|
690
|
+
case 'b <- i':
|
691
|
+
return '( ' + code + ' != 0 )';
|
692
|
+
}
|
693
|
+
|
694
|
+
return code;
|
695
|
+
}
|
696
|
+
}, {
|
697
|
+
key: "getTypeByFormat",
|
698
|
+
value: function getTypeByFormat(format) {
|
699
|
+
return convertFormatToType[format] || format;
|
700
|
+
}
|
701
|
+
}, {
|
702
|
+
key: "getFormatByType",
|
703
|
+
value: function getFormatByType(type) {
|
704
|
+
return convertTypeToFormat[type] || type;
|
705
|
+
}
|
706
|
+
}, {
|
707
|
+
key: "getUuid",
|
708
|
+
value: function getUuid(uuid, useCache) {
|
709
|
+
useCache = useCache !== undefined ? useCache : true;
|
710
|
+
if (useCache && this.cache) uuid = this.cache + '-' + uuid;
|
711
|
+
return uuid;
|
712
|
+
}
|
713
|
+
}, {
|
714
|
+
key: "getElementByIndex",
|
715
|
+
value: function getElementByIndex(index) {
|
716
|
+
return elements[index];
|
717
|
+
}
|
718
|
+
}, {
|
719
|
+
key: "getIndexByElement",
|
720
|
+
value: function getIndexByElement(elm) {
|
721
|
+
return elements.indexOf(elm);
|
722
|
+
}
|
723
|
+
}, {
|
724
|
+
key: "isShader",
|
725
|
+
value: function isShader(shader) {
|
726
|
+
return this.shader === shader;
|
727
|
+
}
|
728
|
+
}, {
|
729
|
+
key: "setShader",
|
730
|
+
value: function setShader(shader) {
|
731
|
+
this.shader = shader;
|
732
|
+
return this;
|
733
|
+
}
|
734
|
+
}, {
|
735
|
+
key: "mergeDefines",
|
736
|
+
value: function mergeDefines(defines) {
|
737
|
+
for (var name in defines) {
|
738
|
+
this.defines[name] = defines[name];
|
739
|
+
}
|
740
|
+
|
741
|
+
return this.defines;
|
742
|
+
}
|
743
|
+
}, {
|
744
|
+
key: "mergeUniform",
|
745
|
+
value: function mergeUniform(uniforms) {
|
746
|
+
for (var name in uniforms) {
|
747
|
+
this.uniforms[name] = uniforms[name];
|
748
|
+
}
|
749
|
+
|
750
|
+
return this.uniforms;
|
751
|
+
}
|
752
|
+
}, {
|
753
|
+
key: "getTextureEncodingFromMap",
|
754
|
+
value: function getTextureEncodingFromMap(map) {
|
755
|
+
var encoding;
|
756
|
+
|
757
|
+
if (!map) {
|
758
|
+
encoding = _three.LinearEncoding;
|
759
|
+
} else if (map.isTexture) {
|
760
|
+
encoding = map.encoding;
|
761
|
+
} else if (map.isWebGLRenderTarget) {
|
762
|
+
console.warn('THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.');
|
763
|
+
encoding = map.texture.encoding;
|
764
|
+
}
|
765
|
+
|
766
|
+
if (encoding === _three.LinearEncoding && this.context.gamma) {
|
767
|
+
encoding = _three.GammaEncoding;
|
768
|
+
}
|
769
|
+
|
770
|
+
return encoding;
|
771
|
+
}
|
772
|
+
}]);
|
773
|
+
|
774
|
+
return NodeBuilder;
|
775
|
+
}();
|
776
|
+
|
777
|
+
_exports.NodeBuilder = NodeBuilder;
|
778
|
+
|
779
|
+
function sortByPosition(a, b) {
|
780
|
+
return a.deps.length - b.deps.length;
|
781
|
+
}
|
782
|
+
});
|