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,1169 @@
|
|
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.RGBMLoader = 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.RGBMLoader = 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
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
28
|
+
|
29
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
30
|
+
|
31
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
32
|
+
|
33
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
34
|
+
|
35
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
36
|
+
|
37
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
38
|
+
|
39
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
40
|
+
|
41
|
+
var RGBMLoader = /*#__PURE__*/function (_DataTextureLoader) {
|
42
|
+
_inherits(RGBMLoader, _DataTextureLoader);
|
43
|
+
|
44
|
+
var _super = _createSuper(RGBMLoader);
|
45
|
+
|
46
|
+
function RGBMLoader() {
|
47
|
+
_classCallCheck(this, RGBMLoader);
|
48
|
+
|
49
|
+
return _super.apply(this, arguments);
|
50
|
+
}
|
51
|
+
|
52
|
+
_createClass(RGBMLoader, [{
|
53
|
+
key: "loadCubemap",
|
54
|
+
value: function loadCubemap(urls, onLoad, onProgress, onError) {
|
55
|
+
var texture = new _three.CubeTexture();
|
56
|
+
var loaded = 0;
|
57
|
+
var scope = this;
|
58
|
+
|
59
|
+
function loadTexture(i) {
|
60
|
+
scope.load(urls[i], function (image) {
|
61
|
+
texture.images[i] = image;
|
62
|
+
loaded++;
|
63
|
+
|
64
|
+
if (loaded === 6) {
|
65
|
+
texture.needsUpdate = true;
|
66
|
+
if (onLoad) onLoad(texture);
|
67
|
+
}
|
68
|
+
}, undefined, onError);
|
69
|
+
}
|
70
|
+
|
71
|
+
for (var i = 0; i < urls.length; ++i) {
|
72
|
+
loadTexture(i);
|
73
|
+
}
|
74
|
+
|
75
|
+
texture.encoding = _three.RGBM7Encoding;
|
76
|
+
texture.format = _three.RGBAFormat;
|
77
|
+
texture.minFilter = _three.LinearFilter;
|
78
|
+
texture.generateMipmaps = false;
|
79
|
+
return texture;
|
80
|
+
}
|
81
|
+
}, {
|
82
|
+
key: "parse",
|
83
|
+
value: function parse(buffer) {
|
84
|
+
var img = UPNG.decode(buffer);
|
85
|
+
var rgba = UPNG.toRGBA8(img)[0];
|
86
|
+
return {
|
87
|
+
width: img.width,
|
88
|
+
height: img.height,
|
89
|
+
data: new Uint8Array(rgba),
|
90
|
+
format: _three.RGBAFormat,
|
91
|
+
type: _three.UnsignedByteType,
|
92
|
+
flipY: true,
|
93
|
+
encoding: _three.RGBM7Encoding
|
94
|
+
};
|
95
|
+
}
|
96
|
+
}]);
|
97
|
+
|
98
|
+
return RGBMLoader;
|
99
|
+
}(_three.DataTextureLoader); // from https://github.com/photopea/UPNG.js (MIT License)
|
100
|
+
|
101
|
+
|
102
|
+
_exports.RGBMLoader = RGBMLoader;
|
103
|
+
var UPNG = {};
|
104
|
+
|
105
|
+
UPNG.toRGBA8 = function (out) {
|
106
|
+
var w = out.width,
|
107
|
+
h = out.height;
|
108
|
+
if (out.tabs.acTL == null) return [UPNG.toRGBA8.decodeImage(out.data, w, h, out).buffer];
|
109
|
+
var frms = [];
|
110
|
+
if (out.frames[0].data == null) out.frames[0].data = out.data;
|
111
|
+
var len = w * h * 4,
|
112
|
+
img = new Uint8Array(len),
|
113
|
+
empty = new Uint8Array(len),
|
114
|
+
prev = new Uint8Array(len);
|
115
|
+
|
116
|
+
for (var i = 0; i < out.frames.length; i++) {
|
117
|
+
var frm = out.frames[i];
|
118
|
+
var fx = frm.rect.x,
|
119
|
+
fy = frm.rect.y,
|
120
|
+
fw = frm.rect.width,
|
121
|
+
fh = frm.rect.height;
|
122
|
+
var fdata = UPNG.toRGBA8.decodeImage(frm.data, fw, fh, out);
|
123
|
+
if (i != 0) for (var j = 0; j < len; j++) {
|
124
|
+
prev[j] = img[j];
|
125
|
+
}
|
126
|
+
if (frm.blend == 0) UPNG._copyTile(fdata, fw, fh, img, w, h, fx, fy, 0);else if (frm.blend == 1) UPNG._copyTile(fdata, fw, fh, img, w, h, fx, fy, 1);
|
127
|
+
frms.push(img.buffer.slice(0));
|
128
|
+
|
129
|
+
if (frm.dispose == 0) {} else if (frm.dispose == 1) UPNG._copyTile(empty, fw, fh, img, w, h, fx, fy, 0);else if (frm.dispose == 2) for (var j = 0; j < len; j++) {
|
130
|
+
img[j] = prev[j];
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
return frms;
|
135
|
+
};
|
136
|
+
|
137
|
+
UPNG.toRGBA8.decodeImage = function (data, w, h, out) {
|
138
|
+
var area = w * h,
|
139
|
+
bpp = UPNG.decode._getBPP(out);
|
140
|
+
|
141
|
+
var bpl = Math.ceil(w * bpp / 8); // bytes per line
|
142
|
+
|
143
|
+
var bf = new Uint8Array(area * 4),
|
144
|
+
bf32 = new Uint32Array(bf.buffer);
|
145
|
+
var ctype = out.ctype,
|
146
|
+
depth = out.depth;
|
147
|
+
var rs = UPNG._bin.readUshort;
|
148
|
+
|
149
|
+
if (ctype == 6) {
|
150
|
+
// RGB + alpha
|
151
|
+
var qarea = area << 2;
|
152
|
+
if (depth == 8) for (var i = 0; i < qarea; i += 4) {
|
153
|
+
bf[i] = data[i];
|
154
|
+
bf[i + 1] = data[i + 1];
|
155
|
+
bf[i + 2] = data[i + 2];
|
156
|
+
bf[i + 3] = data[i + 3];
|
157
|
+
}
|
158
|
+
if (depth == 16) for (var i = 0; i < qarea; i++) {
|
159
|
+
bf[i] = data[i << 1];
|
160
|
+
}
|
161
|
+
} else if (ctype == 2) {
|
162
|
+
// RGB
|
163
|
+
var ts = out.tabs['tRNS'];
|
164
|
+
|
165
|
+
if (ts == null) {
|
166
|
+
if (depth == 8) for (var i = 0; i < area; i++) {
|
167
|
+
var ti = i * 3;
|
168
|
+
bf32[i] = 255 << 24 | data[ti + 2] << 16 | data[ti + 1] << 8 | data[ti];
|
169
|
+
}
|
170
|
+
if (depth == 16) for (var i = 0; i < area; i++) {
|
171
|
+
var ti = i * 6;
|
172
|
+
bf32[i] = 255 << 24 | data[ti + 4] << 16 | data[ti + 2] << 8 | data[ti];
|
173
|
+
}
|
174
|
+
} else {
|
175
|
+
var tr = ts[0],
|
176
|
+
tg = ts[1],
|
177
|
+
tb = ts[2];
|
178
|
+
if (depth == 8) for (var i = 0; i < area; i++) {
|
179
|
+
var qi = i << 2,
|
180
|
+
ti = i * 3;
|
181
|
+
bf32[i] = 255 << 24 | data[ti + 2] << 16 | data[ti + 1] << 8 | data[ti];
|
182
|
+
if (data[ti] == tr && data[ti + 1] == tg && data[ti + 2] == tb) bf[qi + 3] = 0;
|
183
|
+
}
|
184
|
+
if (depth == 16) for (var i = 0; i < area; i++) {
|
185
|
+
var qi = i << 2,
|
186
|
+
ti = i * 6;
|
187
|
+
bf32[i] = 255 << 24 | data[ti + 4] << 16 | data[ti + 2] << 8 | data[ti];
|
188
|
+
if (rs(data, ti) == tr && rs(data, ti + 2) == tg && rs(data, ti + 4) == tb) bf[qi + 3] = 0;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
} else if (ctype == 3) {
|
192
|
+
// palette
|
193
|
+
var p = out.tabs['PLTE'],
|
194
|
+
ap = out.tabs['tRNS'],
|
195
|
+
tl = ap ? ap.length : 0; //console.log(p, ap);
|
196
|
+
|
197
|
+
if (depth == 1) for (var y = 0; y < h; y++) {
|
198
|
+
var s0 = y * bpl,
|
199
|
+
t0 = y * w;
|
200
|
+
|
201
|
+
for (var i = 0; i < w; i++) {
|
202
|
+
var qi = t0 + i << 2,
|
203
|
+
j = data[s0 + (i >> 3)] >> 7 - ((i & 7) << 0) & 1,
|
204
|
+
cj = 3 * j;
|
205
|
+
bf[qi] = p[cj];
|
206
|
+
bf[qi + 1] = p[cj + 1];
|
207
|
+
bf[qi + 2] = p[cj + 2];
|
208
|
+
bf[qi + 3] = j < tl ? ap[j] : 255;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
if (depth == 2) for (var y = 0; y < h; y++) {
|
212
|
+
var s0 = y * bpl,
|
213
|
+
t0 = y * w;
|
214
|
+
|
215
|
+
for (var i = 0; i < w; i++) {
|
216
|
+
var qi = t0 + i << 2,
|
217
|
+
j = data[s0 + (i >> 2)] >> 6 - ((i & 3) << 1) & 3,
|
218
|
+
cj = 3 * j;
|
219
|
+
bf[qi] = p[cj];
|
220
|
+
bf[qi + 1] = p[cj + 1];
|
221
|
+
bf[qi + 2] = p[cj + 2];
|
222
|
+
bf[qi + 3] = j < tl ? ap[j] : 255;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
if (depth == 4) for (var y = 0; y < h; y++) {
|
226
|
+
var s0 = y * bpl,
|
227
|
+
t0 = y * w;
|
228
|
+
|
229
|
+
for (var i = 0; i < w; i++) {
|
230
|
+
var qi = t0 + i << 2,
|
231
|
+
j = data[s0 + (i >> 1)] >> 4 - ((i & 1) << 2) & 15,
|
232
|
+
cj = 3 * j;
|
233
|
+
bf[qi] = p[cj];
|
234
|
+
bf[qi + 1] = p[cj + 1];
|
235
|
+
bf[qi + 2] = p[cj + 2];
|
236
|
+
bf[qi + 3] = j < tl ? ap[j] : 255;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
if (depth == 8) for (var i = 0; i < area; i++) {
|
240
|
+
var qi = i << 2,
|
241
|
+
j = data[i],
|
242
|
+
cj = 3 * j;
|
243
|
+
bf[qi] = p[cj];
|
244
|
+
bf[qi + 1] = p[cj + 1];
|
245
|
+
bf[qi + 2] = p[cj + 2];
|
246
|
+
bf[qi + 3] = j < tl ? ap[j] : 255;
|
247
|
+
}
|
248
|
+
} else if (ctype == 4) {
|
249
|
+
// gray + alpha
|
250
|
+
if (depth == 8) for (var i = 0; i < area; i++) {
|
251
|
+
var qi = i << 2,
|
252
|
+
di = i << 1,
|
253
|
+
gr = data[di];
|
254
|
+
bf[qi] = gr;
|
255
|
+
bf[qi + 1] = gr;
|
256
|
+
bf[qi + 2] = gr;
|
257
|
+
bf[qi + 3] = data[di + 1];
|
258
|
+
}
|
259
|
+
if (depth == 16) for (var i = 0; i < area; i++) {
|
260
|
+
var qi = i << 2,
|
261
|
+
di = i << 2,
|
262
|
+
gr = data[di];
|
263
|
+
bf[qi] = gr;
|
264
|
+
bf[qi + 1] = gr;
|
265
|
+
bf[qi + 2] = gr;
|
266
|
+
bf[qi + 3] = data[di + 2];
|
267
|
+
}
|
268
|
+
} else if (ctype == 0) {
|
269
|
+
// gray
|
270
|
+
var tr = out.tabs['tRNS'] ? out.tabs['tRNS'] : -1;
|
271
|
+
|
272
|
+
for (var y = 0; y < h; y++) {
|
273
|
+
var off = y * bpl,
|
274
|
+
to = y * w;
|
275
|
+
if (depth == 1) for (var x = 0; x < w; x++) {
|
276
|
+
var gr = 255 * (data[off + (x >>> 3)] >>> 7 - (x & 7) & 1),
|
277
|
+
al = gr == tr * 255 ? 0 : 255;
|
278
|
+
bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr;
|
279
|
+
} else if (depth == 2) for (var x = 0; x < w; x++) {
|
280
|
+
var gr = 85 * (data[off + (x >>> 2)] >>> 6 - ((x & 3) << 1) & 3),
|
281
|
+
al = gr == tr * 85 ? 0 : 255;
|
282
|
+
bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr;
|
283
|
+
} else if (depth == 4) for (var x = 0; x < w; x++) {
|
284
|
+
var gr = 17 * (data[off + (x >>> 1)] >>> 4 - ((x & 1) << 2) & 15),
|
285
|
+
al = gr == tr * 17 ? 0 : 255;
|
286
|
+
bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr;
|
287
|
+
} else if (depth == 8) for (var x = 0; x < w; x++) {
|
288
|
+
var gr = data[off + x],
|
289
|
+
al = gr == tr ? 0 : 255;
|
290
|
+
bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr;
|
291
|
+
} else if (depth == 16) for (var x = 0; x < w; x++) {
|
292
|
+
var gr = data[off + (x << 1)],
|
293
|
+
al = rs(data, off + (x << 1)) == tr ? 0 : 255;
|
294
|
+
bf32[to + x] = al << 24 | gr << 16 | gr << 8 | gr;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
} //console.log(Date.now()-time);
|
298
|
+
|
299
|
+
|
300
|
+
return bf;
|
301
|
+
};
|
302
|
+
|
303
|
+
UPNG.decode = function (buff) {
|
304
|
+
var data = new Uint8Array(buff),
|
305
|
+
offset = 8,
|
306
|
+
bin = UPNG._bin,
|
307
|
+
rUs = bin.readUshort,
|
308
|
+
rUi = bin.readUint;
|
309
|
+
var out = {
|
310
|
+
tabs: {},
|
311
|
+
frames: []
|
312
|
+
};
|
313
|
+
var dd = new Uint8Array(data.length),
|
314
|
+
doff = 0; // put all IDAT data into it
|
315
|
+
|
316
|
+
var fd,
|
317
|
+
foff = 0; // frames
|
318
|
+
|
319
|
+
var mgck = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
320
|
+
|
321
|
+
for (var i = 0; i < 8; i++) {
|
322
|
+
if (data[i] != mgck[i]) throw 'The input is not a PNG file!';
|
323
|
+
}
|
324
|
+
|
325
|
+
while (offset < data.length) {
|
326
|
+
var len = bin.readUint(data, offset);
|
327
|
+
offset += 4;
|
328
|
+
var type = bin.readASCII(data, offset, 4);
|
329
|
+
offset += 4; //console.log(type,len);
|
330
|
+
|
331
|
+
if (type == 'IHDR') {
|
332
|
+
UPNG.decode._IHDR(data, offset, out);
|
333
|
+
} else if (type == 'CgBI') {
|
334
|
+
out.tabs[type] = data.slice(offset, offset + 4);
|
335
|
+
} else if (type == 'IDAT') {
|
336
|
+
for (var i = 0; i < len; i++) {
|
337
|
+
dd[doff + i] = data[offset + i];
|
338
|
+
}
|
339
|
+
|
340
|
+
doff += len;
|
341
|
+
} else if (type == 'acTL') {
|
342
|
+
out.tabs[type] = {
|
343
|
+
num_frames: rUi(data, offset),
|
344
|
+
num_plays: rUi(data, offset + 4)
|
345
|
+
};
|
346
|
+
fd = new Uint8Array(data.length);
|
347
|
+
} else if (type == 'fcTL') {
|
348
|
+
if (foff != 0) {
|
349
|
+
var fr = out.frames[out.frames.length - 1];
|
350
|
+
fr.data = UPNG.decode._decompress(out, fd.slice(0, foff), fr.rect.width, fr.rect.height);
|
351
|
+
foff = 0;
|
352
|
+
}
|
353
|
+
|
354
|
+
var rct = {
|
355
|
+
x: rUi(data, offset + 12),
|
356
|
+
y: rUi(data, offset + 16),
|
357
|
+
width: rUi(data, offset + 4),
|
358
|
+
height: rUi(data, offset + 8)
|
359
|
+
};
|
360
|
+
var del = rUs(data, offset + 22);
|
361
|
+
del = rUs(data, offset + 20) / (del == 0 ? 100 : del);
|
362
|
+
var frm = {
|
363
|
+
rect: rct,
|
364
|
+
delay: Math.round(del * 1000),
|
365
|
+
dispose: data[offset + 24],
|
366
|
+
blend: data[offset + 25]
|
367
|
+
}; //console.log(frm);
|
368
|
+
|
369
|
+
out.frames.push(frm);
|
370
|
+
} else if (type == 'fdAT') {
|
371
|
+
for (var i = 0; i < len - 4; i++) {
|
372
|
+
fd[foff + i] = data[offset + i + 4];
|
373
|
+
}
|
374
|
+
|
375
|
+
foff += len - 4;
|
376
|
+
} else if (type == 'pHYs') {
|
377
|
+
out.tabs[type] = [bin.readUint(data, offset), bin.readUint(data, offset + 4), data[offset + 8]];
|
378
|
+
} else if (type == 'cHRM') {
|
379
|
+
out.tabs[type] = [];
|
380
|
+
|
381
|
+
for (var i = 0; i < 8; i++) {
|
382
|
+
out.tabs[type].push(bin.readUint(data, offset + i * 4));
|
383
|
+
}
|
384
|
+
} else if (type == 'tEXt' || type == 'zTXt') {
|
385
|
+
if (out.tabs[type] == null) out.tabs[type] = {};
|
386
|
+
var nz = bin.nextZero(data, offset);
|
387
|
+
var keyw = bin.readASCII(data, offset, nz - offset);
|
388
|
+
var text,
|
389
|
+
tl = offset + len - nz - 1;
|
390
|
+
if (type == 'tEXt') text = bin.readASCII(data, nz + 1, tl);else {
|
391
|
+
var bfr = UPNG.decode._inflate(data.slice(nz + 2, nz + 2 + tl));
|
392
|
+
|
393
|
+
text = bin.readUTF8(bfr, 0, bfr.length);
|
394
|
+
}
|
395
|
+
out.tabs[type][keyw] = text;
|
396
|
+
} else if (type == 'iTXt') {
|
397
|
+
if (out.tabs[type] == null) out.tabs[type] = {};
|
398
|
+
var nz = 0,
|
399
|
+
off = offset;
|
400
|
+
nz = bin.nextZero(data, off);
|
401
|
+
var keyw = bin.readASCII(data, off, nz - off);
|
402
|
+
off = nz + 1;
|
403
|
+
var cflag = data[off];
|
404
|
+
off += 2;
|
405
|
+
nz = bin.nextZero(data, off);
|
406
|
+
bin.readASCII(data, off, nz - off);
|
407
|
+
off = nz + 1;
|
408
|
+
nz = bin.nextZero(data, off);
|
409
|
+
bin.readUTF8(data, off, nz - off);
|
410
|
+
off = nz + 1;
|
411
|
+
var text,
|
412
|
+
tl = len - (off - offset);
|
413
|
+
if (cflag == 0) text = bin.readUTF8(data, off, tl);else {
|
414
|
+
var bfr = UPNG.decode._inflate(data.slice(off, off + tl));
|
415
|
+
|
416
|
+
text = bin.readUTF8(bfr, 0, bfr.length);
|
417
|
+
}
|
418
|
+
out.tabs[type][keyw] = text;
|
419
|
+
} else if (type == 'PLTE') {
|
420
|
+
out.tabs[type] = bin.readBytes(data, offset, len);
|
421
|
+
} else if (type == 'hIST') {
|
422
|
+
var pl = out.tabs['PLTE'].length / 3;
|
423
|
+
out.tabs[type] = [];
|
424
|
+
|
425
|
+
for (var i = 0; i < pl; i++) {
|
426
|
+
out.tabs[type].push(rUs(data, offset + i * 2));
|
427
|
+
}
|
428
|
+
} else if (type == 'tRNS') {
|
429
|
+
if (out.ctype == 3) out.tabs[type] = bin.readBytes(data, offset, len);else if (out.ctype == 0) out.tabs[type] = rUs(data, offset);else if (out.ctype == 2) out.tabs[type] = [rUs(data, offset), rUs(data, offset + 2), rUs(data, offset + 4)]; //else console.log("tRNS for unsupported color type",out.ctype, len);
|
430
|
+
} else if (type == 'gAMA') out.tabs[type] = bin.readUint(data, offset) / 100000;else if (type == 'sRGB') out.tabs[type] = data[offset];else if (type == 'bKGD') {
|
431
|
+
if (out.ctype == 0 || out.ctype == 4) out.tabs[type] = [rUs(data, offset)];else if (out.ctype == 2 || out.ctype == 6) out.tabs[type] = [rUs(data, offset), rUs(data, offset + 2), rUs(data, offset + 4)];else if (out.ctype == 3) out.tabs[type] = data[offset];
|
432
|
+
} else if (type == 'IEND') {
|
433
|
+
break;
|
434
|
+
} //else { console.log("unknown chunk type", type, len); out.tabs[type]=data.slice(offset,offset+len); }
|
435
|
+
|
436
|
+
|
437
|
+
offset += len;
|
438
|
+
bin.readUint(data, offset);
|
439
|
+
offset += 4;
|
440
|
+
}
|
441
|
+
|
442
|
+
if (foff != 0) {
|
443
|
+
var fr = out.frames[out.frames.length - 1];
|
444
|
+
fr.data = UPNG.decode._decompress(out, fd.slice(0, foff), fr.rect.width, fr.rect.height);
|
445
|
+
}
|
446
|
+
|
447
|
+
out.data = UPNG.decode._decompress(out, dd, out.width, out.height);
|
448
|
+
delete out.compress;
|
449
|
+
delete out.interlace;
|
450
|
+
delete out.filter;
|
451
|
+
return out;
|
452
|
+
};
|
453
|
+
|
454
|
+
UPNG.decode._decompress = function (out, dd, w, h) {
|
455
|
+
var bpp = UPNG.decode._getBPP(out),
|
456
|
+
bpl = Math.ceil(w * bpp / 8),
|
457
|
+
buff = new Uint8Array((bpl + 1 + out.interlace) * h);
|
458
|
+
|
459
|
+
if (out.tabs['CgBI']) dd = UPNG.inflateRaw(dd, buff);else dd = UPNG.decode._inflate(dd, buff);
|
460
|
+
if (out.interlace == 0) dd = UPNG.decode._filterZero(dd, out, 0, w, h);else if (out.interlace == 1) dd = UPNG.decode._readInterlace(dd, out);
|
461
|
+
return dd;
|
462
|
+
};
|
463
|
+
|
464
|
+
UPNG.decode._inflate = function (data, buff) {
|
465
|
+
var out = UPNG['inflateRaw'](new Uint8Array(data.buffer, 2, data.length - 6), buff);
|
466
|
+
return out;
|
467
|
+
};
|
468
|
+
|
469
|
+
UPNG.inflateRaw = function () {
|
470
|
+
var H = {};
|
471
|
+
H.H = {};
|
472
|
+
|
473
|
+
H.H.N = function (N, W) {
|
474
|
+
var R = Uint8Array,
|
475
|
+
i = 0,
|
476
|
+
m = 0,
|
477
|
+
J = 0,
|
478
|
+
h = 0,
|
479
|
+
Q = 0,
|
480
|
+
X = 0,
|
481
|
+
u = 0,
|
482
|
+
w = 0,
|
483
|
+
d = 0,
|
484
|
+
v,
|
485
|
+
C;
|
486
|
+
if (N[0] == 3 && N[1] == 0) return W ? W : new R(0);
|
487
|
+
var V = H.H,
|
488
|
+
n = V.b,
|
489
|
+
A = V.e,
|
490
|
+
l = V.R,
|
491
|
+
M = V.n,
|
492
|
+
I = V.A,
|
493
|
+
e = V.Z,
|
494
|
+
b = V.m,
|
495
|
+
Z = W == null;
|
496
|
+
if (Z) W = new R(N.length >>> 2 << 5);
|
497
|
+
|
498
|
+
while (i == 0) {
|
499
|
+
i = n(N, d, 1);
|
500
|
+
m = n(N, d + 1, 2);
|
501
|
+
d += 3;
|
502
|
+
|
503
|
+
if (m == 0) {
|
504
|
+
if ((d & 7) != 0) d += 8 - (d & 7);
|
505
|
+
var D = (d >>> 3) + 4,
|
506
|
+
q = N[D - 4] | N[D - 3] << 8;
|
507
|
+
if (Z) W = H.H.W(W, w + q);
|
508
|
+
W.set(new R(N.buffer, N.byteOffset + D, q), w);
|
509
|
+
d = D + q << 3;
|
510
|
+
w += q;
|
511
|
+
continue;
|
512
|
+
}
|
513
|
+
|
514
|
+
if (Z) W = H.H.W(W, w + (1 << 17));
|
515
|
+
|
516
|
+
if (m == 1) {
|
517
|
+
v = b.J;
|
518
|
+
C = b.h;
|
519
|
+
X = (1 << 9) - 1;
|
520
|
+
u = (1 << 5) - 1;
|
521
|
+
}
|
522
|
+
|
523
|
+
if (m == 2) {
|
524
|
+
J = A(N, d, 5) + 257;
|
525
|
+
h = A(N, d + 5, 5) + 1;
|
526
|
+
Q = A(N, d + 10, 4) + 4;
|
527
|
+
d += 14;
|
528
|
+
var j = 1;
|
529
|
+
|
530
|
+
for (var c = 0; c < 38; c += 2) {
|
531
|
+
b.Q[c] = 0;
|
532
|
+
b.Q[c + 1] = 0;
|
533
|
+
}
|
534
|
+
|
535
|
+
for (var c = 0; c < Q; c++) {
|
536
|
+
var K = A(N, d + c * 3, 3);
|
537
|
+
b.Q[(b.X[c] << 1) + 1] = K;
|
538
|
+
if (K > j) j = K;
|
539
|
+
}
|
540
|
+
|
541
|
+
d += 3 * Q;
|
542
|
+
M(b.Q, j);
|
543
|
+
I(b.Q, j, b.u);
|
544
|
+
v = b.w;
|
545
|
+
C = b.d;
|
546
|
+
d = l(b.u, (1 << j) - 1, J + h, N, d, b.v);
|
547
|
+
var r = V.V(b.v, 0, J, b.C);
|
548
|
+
X = (1 << r) - 1;
|
549
|
+
var S = V.V(b.v, J, h, b.D);
|
550
|
+
u = (1 << S) - 1;
|
551
|
+
M(b.C, r);
|
552
|
+
I(b.C, r, v);
|
553
|
+
M(b.D, S);
|
554
|
+
I(b.D, S, C);
|
555
|
+
}
|
556
|
+
|
557
|
+
while (!0) {
|
558
|
+
var T = v[e(N, d) & X];
|
559
|
+
d += T & 15;
|
560
|
+
var p = T >>> 4;
|
561
|
+
|
562
|
+
if (p >>> 8 == 0) {
|
563
|
+
W[w++] = p;
|
564
|
+
} else if (p == 256) {
|
565
|
+
break;
|
566
|
+
} else {
|
567
|
+
var z = w + p - 254;
|
568
|
+
|
569
|
+
if (p > 264) {
|
570
|
+
var _ = b.q[p - 257];
|
571
|
+
z = w + (_ >>> 3) + A(N, d, _ & 7);
|
572
|
+
d += _ & 7;
|
573
|
+
}
|
574
|
+
|
575
|
+
var $ = C[e(N, d) & u];
|
576
|
+
d += $ & 15;
|
577
|
+
var s = $ >>> 4,
|
578
|
+
Y = b.c[s],
|
579
|
+
a = (Y >>> 4) + n(N, d, Y & 15);
|
580
|
+
d += Y & 15;
|
581
|
+
|
582
|
+
while (w < z) {
|
583
|
+
W[w] = W[w++ - a];
|
584
|
+
W[w] = W[w++ - a];
|
585
|
+
W[w] = W[w++ - a];
|
586
|
+
W[w] = W[w++ - a];
|
587
|
+
}
|
588
|
+
|
589
|
+
w = z;
|
590
|
+
}
|
591
|
+
}
|
592
|
+
}
|
593
|
+
|
594
|
+
return W.length == w ? W : W.slice(0, w);
|
595
|
+
};
|
596
|
+
|
597
|
+
H.H.W = function (N, W) {
|
598
|
+
var R = N.length;
|
599
|
+
if (W <= R) return N;
|
600
|
+
var V = new Uint8Array(R << 1);
|
601
|
+
V.set(N, 0);
|
602
|
+
return V;
|
603
|
+
};
|
604
|
+
|
605
|
+
H.H.R = function (N, W, R, V, n, A) {
|
606
|
+
var l = H.H.e,
|
607
|
+
M = H.H.Z,
|
608
|
+
I = 0;
|
609
|
+
|
610
|
+
while (I < R) {
|
611
|
+
var e = N[M(V, n) & W];
|
612
|
+
n += e & 15;
|
613
|
+
var b = e >>> 4;
|
614
|
+
|
615
|
+
if (b <= 15) {
|
616
|
+
A[I] = b;
|
617
|
+
I++;
|
618
|
+
} else {
|
619
|
+
var Z = 0,
|
620
|
+
m = 0;
|
621
|
+
|
622
|
+
if (b == 16) {
|
623
|
+
m = 3 + l(V, n, 2);
|
624
|
+
n += 2;
|
625
|
+
Z = A[I - 1];
|
626
|
+
} else if (b == 17) {
|
627
|
+
m = 3 + l(V, n, 3);
|
628
|
+
n += 3;
|
629
|
+
} else if (b == 18) {
|
630
|
+
m = 11 + l(V, n, 7);
|
631
|
+
n += 7;
|
632
|
+
}
|
633
|
+
|
634
|
+
var J = I + m;
|
635
|
+
|
636
|
+
while (I < J) {
|
637
|
+
A[I] = Z;
|
638
|
+
I++;
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}
|
642
|
+
|
643
|
+
return n;
|
644
|
+
};
|
645
|
+
|
646
|
+
H.H.V = function (N, W, R, V) {
|
647
|
+
var n = 0,
|
648
|
+
A = 0,
|
649
|
+
l = V.length >>> 1;
|
650
|
+
|
651
|
+
while (A < R) {
|
652
|
+
var M = N[A + W];
|
653
|
+
V[A << 1] = 0;
|
654
|
+
V[(A << 1) + 1] = M;
|
655
|
+
if (M > n) n = M;
|
656
|
+
A++;
|
657
|
+
}
|
658
|
+
|
659
|
+
while (A < l) {
|
660
|
+
V[A << 1] = 0;
|
661
|
+
V[(A << 1) + 1] = 0;
|
662
|
+
A++;
|
663
|
+
}
|
664
|
+
|
665
|
+
return n;
|
666
|
+
};
|
667
|
+
|
668
|
+
H.H.n = function (N, W) {
|
669
|
+
var R = H.H.m,
|
670
|
+
V = N.length,
|
671
|
+
n,
|
672
|
+
A,
|
673
|
+
l,
|
674
|
+
M,
|
675
|
+
I,
|
676
|
+
e = R.j;
|
677
|
+
|
678
|
+
for (var M = 0; M <= W; M++) {
|
679
|
+
e[M] = 0;
|
680
|
+
}
|
681
|
+
|
682
|
+
for (M = 1; M < V; M += 2) {
|
683
|
+
e[N[M]]++;
|
684
|
+
}
|
685
|
+
|
686
|
+
var b = R.K;
|
687
|
+
n = 0;
|
688
|
+
e[0] = 0;
|
689
|
+
|
690
|
+
for (A = 1; A <= W; A++) {
|
691
|
+
n = n + e[A - 1] << 1;
|
692
|
+
b[A] = n;
|
693
|
+
}
|
694
|
+
|
695
|
+
for (l = 0; l < V; l += 2) {
|
696
|
+
I = N[l + 1];
|
697
|
+
|
698
|
+
if (I != 0) {
|
699
|
+
N[l] = b[I];
|
700
|
+
b[I]++;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
};
|
704
|
+
|
705
|
+
H.H.A = function (N, W, R) {
|
706
|
+
var V = N.length,
|
707
|
+
n = H.H.m,
|
708
|
+
A = n.r;
|
709
|
+
|
710
|
+
for (var l = 0; l < V; l += 2) {
|
711
|
+
if (N[l + 1] != 0) {
|
712
|
+
var M = l >> 1,
|
713
|
+
I = N[l + 1],
|
714
|
+
e = M << 4 | I,
|
715
|
+
b = W - I,
|
716
|
+
Z = N[l] << b,
|
717
|
+
m = Z + (1 << b);
|
718
|
+
|
719
|
+
while (Z != m) {
|
720
|
+
var J = A[Z] >>> 15 - W;
|
721
|
+
R[J] = e;
|
722
|
+
Z++;
|
723
|
+
}
|
724
|
+
}
|
725
|
+
}
|
726
|
+
};
|
727
|
+
|
728
|
+
H.H.l = function (N, W) {
|
729
|
+
var R = H.H.m.r,
|
730
|
+
V = 15 - W;
|
731
|
+
|
732
|
+
for (var n = 0; n < N.length; n += 2) {
|
733
|
+
var A = N[n] << W - N[n + 1];
|
734
|
+
N[n] = R[A] >>> V;
|
735
|
+
}
|
736
|
+
};
|
737
|
+
|
738
|
+
H.H.M = function (N, W, R) {
|
739
|
+
R = R << (W & 7);
|
740
|
+
var V = W >>> 3;
|
741
|
+
N[V] |= R;
|
742
|
+
N[V + 1] |= R >>> 8;
|
743
|
+
};
|
744
|
+
|
745
|
+
H.H.I = function (N, W, R) {
|
746
|
+
R = R << (W & 7);
|
747
|
+
var V = W >>> 3;
|
748
|
+
N[V] |= R;
|
749
|
+
N[V + 1] |= R >>> 8;
|
750
|
+
N[V + 2] |= R >>> 16;
|
751
|
+
};
|
752
|
+
|
753
|
+
H.H.e = function (N, W, R) {
|
754
|
+
return (N[W >>> 3] | N[(W >>> 3) + 1] << 8) >>> (W & 7) & (1 << R) - 1;
|
755
|
+
};
|
756
|
+
|
757
|
+
H.H.b = function (N, W, R) {
|
758
|
+
return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16) >>> (W & 7) & (1 << R) - 1;
|
759
|
+
};
|
760
|
+
|
761
|
+
H.H.Z = function (N, W) {
|
762
|
+
return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16) >>> (W & 7);
|
763
|
+
};
|
764
|
+
|
765
|
+
H.H.i = function (N, W) {
|
766
|
+
return (N[W >>> 3] | N[(W >>> 3) + 1] << 8 | N[(W >>> 3) + 2] << 16 | N[(W >>> 3) + 3] << 24) >>> (W & 7);
|
767
|
+
};
|
768
|
+
|
769
|
+
H.H.m = function () {
|
770
|
+
var N = Uint16Array,
|
771
|
+
W = Uint32Array;
|
772
|
+
return {
|
773
|
+
K: new N(16),
|
774
|
+
j: new N(16),
|
775
|
+
X: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15],
|
776
|
+
S: [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999],
|
777
|
+
T: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0],
|
778
|
+
q: new N(32),
|
779
|
+
p: [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 65535, 65535],
|
780
|
+
z: [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0],
|
781
|
+
c: new W(32),
|
782
|
+
J: new N(512),
|
783
|
+
_: [],
|
784
|
+
h: new N(32),
|
785
|
+
$: [],
|
786
|
+
w: new N(32768),
|
787
|
+
C: [],
|
788
|
+
v: [],
|
789
|
+
d: new N(32768),
|
790
|
+
D: [],
|
791
|
+
u: new N(512),
|
792
|
+
Q: [],
|
793
|
+
r: new N(1 << 15),
|
794
|
+
s: new W(286),
|
795
|
+
Y: new W(30),
|
796
|
+
a: new W(19),
|
797
|
+
t: new W(15e3),
|
798
|
+
k: new N(1 << 16),
|
799
|
+
g: new N(1 << 15)
|
800
|
+
};
|
801
|
+
}();
|
802
|
+
|
803
|
+
(function () {
|
804
|
+
var N = H.H.m,
|
805
|
+
W = 1 << 15;
|
806
|
+
|
807
|
+
for (var R = 0; R < W; R++) {
|
808
|
+
var V = R;
|
809
|
+
V = (V & 2863311530) >>> 1 | (V & 1431655765) << 1;
|
810
|
+
V = (V & 3435973836) >>> 2 | (V & 858993459) << 2;
|
811
|
+
V = (V & 4042322160) >>> 4 | (V & 252645135) << 4;
|
812
|
+
V = (V & 4278255360) >>> 8 | (V & 16711935) << 8;
|
813
|
+
N.r[R] = (V >>> 16 | V << 16) >>> 17;
|
814
|
+
}
|
815
|
+
|
816
|
+
function n(A, l, M) {
|
817
|
+
while (l-- != 0) {
|
818
|
+
A.push(0, M);
|
819
|
+
}
|
820
|
+
}
|
821
|
+
|
822
|
+
for (var R = 0; R < 32; R++) {
|
823
|
+
N.q[R] = N.S[R] << 3 | N.T[R];
|
824
|
+
N.c[R] = N.p[R] << 4 | N.z[R];
|
825
|
+
}
|
826
|
+
|
827
|
+
n(N._, 144, 8);
|
828
|
+
n(N._, 255 - 143, 9);
|
829
|
+
n(N._, 279 - 255, 7);
|
830
|
+
n(N._, 287 - 279, 8);
|
831
|
+
H.H.n(N._, 9);
|
832
|
+
H.H.A(N._, 9, N.J);
|
833
|
+
H.H.l(N._, 9);
|
834
|
+
n(N.$, 32, 5);
|
835
|
+
H.H.n(N.$, 5);
|
836
|
+
H.H.A(N.$, 5, N.h);
|
837
|
+
H.H.l(N.$, 5);
|
838
|
+
n(N.Q, 19, 0);
|
839
|
+
n(N.C, 286, 0);
|
840
|
+
n(N.D, 30, 0);
|
841
|
+
n(N.v, 320, 0);
|
842
|
+
})();
|
843
|
+
|
844
|
+
return H.H.N;
|
845
|
+
}();
|
846
|
+
|
847
|
+
UPNG.decode._readInterlace = function (data, out) {
|
848
|
+
var w = out.width,
|
849
|
+
h = out.height;
|
850
|
+
|
851
|
+
var bpp = UPNG.decode._getBPP(out),
|
852
|
+
cbpp = bpp >> 3,
|
853
|
+
bpl = Math.ceil(w * bpp / 8);
|
854
|
+
|
855
|
+
var img = new Uint8Array(h * bpl);
|
856
|
+
var di = 0;
|
857
|
+
var starting_row = [0, 0, 4, 0, 2, 0, 1];
|
858
|
+
var starting_col = [0, 4, 0, 2, 0, 1, 0];
|
859
|
+
var row_increment = [8, 8, 8, 4, 4, 2, 2];
|
860
|
+
var col_increment = [8, 8, 4, 4, 2, 2, 1];
|
861
|
+
var pass = 0;
|
862
|
+
|
863
|
+
while (pass < 7) {
|
864
|
+
var ri = row_increment[pass],
|
865
|
+
ci = col_increment[pass];
|
866
|
+
var sw = 0,
|
867
|
+
sh = 0;
|
868
|
+
var cr = starting_row[pass];
|
869
|
+
|
870
|
+
while (cr < h) {
|
871
|
+
cr += ri;
|
872
|
+
sh++;
|
873
|
+
}
|
874
|
+
|
875
|
+
var cc = starting_col[pass];
|
876
|
+
|
877
|
+
while (cc < w) {
|
878
|
+
cc += ci;
|
879
|
+
sw++;
|
880
|
+
}
|
881
|
+
|
882
|
+
var bpll = Math.ceil(sw * bpp / 8);
|
883
|
+
|
884
|
+
UPNG.decode._filterZero(data, out, di, sw, sh);
|
885
|
+
|
886
|
+
var y = 0,
|
887
|
+
row = starting_row[pass];
|
888
|
+
|
889
|
+
while (row < h) {
|
890
|
+
var col = starting_col[pass];
|
891
|
+
var cdi = di + y * bpll << 3;
|
892
|
+
|
893
|
+
while (col < w) {
|
894
|
+
if (bpp == 1) {
|
895
|
+
var val = data[cdi >> 3];
|
896
|
+
val = val >> 7 - (cdi & 7) & 1;
|
897
|
+
img[row * bpl + (col >> 3)] |= val << 7 - ((col & 7) << 0);
|
898
|
+
}
|
899
|
+
|
900
|
+
if (bpp == 2) {
|
901
|
+
var val = data[cdi >> 3];
|
902
|
+
val = val >> 6 - (cdi & 7) & 3;
|
903
|
+
img[row * bpl + (col >> 2)] |= val << 6 - ((col & 3) << 1);
|
904
|
+
}
|
905
|
+
|
906
|
+
if (bpp == 4) {
|
907
|
+
var val = data[cdi >> 3];
|
908
|
+
val = val >> 4 - (cdi & 7) & 15;
|
909
|
+
img[row * bpl + (col >> 1)] |= val << 4 - ((col & 1) << 2);
|
910
|
+
}
|
911
|
+
|
912
|
+
if (bpp >= 8) {
|
913
|
+
var ii = row * bpl + col * cbpp;
|
914
|
+
|
915
|
+
for (var j = 0; j < cbpp; j++) {
|
916
|
+
img[ii + j] = data[(cdi >> 3) + j];
|
917
|
+
}
|
918
|
+
}
|
919
|
+
|
920
|
+
cdi += bpp;
|
921
|
+
col += ci;
|
922
|
+
}
|
923
|
+
|
924
|
+
y++;
|
925
|
+
row += ri;
|
926
|
+
}
|
927
|
+
|
928
|
+
if (sw * sh != 0) di += sh * (1 + bpll);
|
929
|
+
pass = pass + 1;
|
930
|
+
}
|
931
|
+
|
932
|
+
return img;
|
933
|
+
};
|
934
|
+
|
935
|
+
UPNG.decode._getBPP = function (out) {
|
936
|
+
var noc = [1, null, 3, 1, 2, null, 4][out.ctype];
|
937
|
+
return noc * out.depth;
|
938
|
+
};
|
939
|
+
|
940
|
+
UPNG.decode._filterZero = function (data, out, off, w, h) {
|
941
|
+
var bpp = UPNG.decode._getBPP(out),
|
942
|
+
bpl = Math.ceil(w * bpp / 8),
|
943
|
+
paeth = UPNG.decode._paeth;
|
944
|
+
|
945
|
+
bpp = Math.ceil(bpp / 8);
|
946
|
+
var i,
|
947
|
+
di,
|
948
|
+
type = data[off],
|
949
|
+
x = 0;
|
950
|
+
if (type > 1) data[off] = [0, 0, 1][type - 2];
|
951
|
+
if (type == 3) for (x = bpp; x < bpl; x++) {
|
952
|
+
data[x + 1] = data[x + 1] + (data[x + 1 - bpp] >>> 1) & 255;
|
953
|
+
}
|
954
|
+
|
955
|
+
for (var y = 0; y < h; y++) {
|
956
|
+
i = off + y * bpl;
|
957
|
+
di = i + y + 1;
|
958
|
+
type = data[di - 1];
|
959
|
+
x = 0;
|
960
|
+
if (type == 0) for (; x < bpl; x++) {
|
961
|
+
data[i + x] = data[di + x];
|
962
|
+
} else if (type == 1) {
|
963
|
+
for (; x < bpp; x++) {
|
964
|
+
data[i + x] = data[di + x];
|
965
|
+
}
|
966
|
+
|
967
|
+
for (; x < bpl; x++) {
|
968
|
+
data[i + x] = data[di + x] + data[i + x - bpp];
|
969
|
+
}
|
970
|
+
} else if (type == 2) {
|
971
|
+
for (; x < bpl; x++) {
|
972
|
+
data[i + x] = data[di + x] + data[i + x - bpl];
|
973
|
+
}
|
974
|
+
} else if (type == 3) {
|
975
|
+
for (; x < bpp; x++) {
|
976
|
+
data[i + x] = data[di + x] + (data[i + x - bpl] >>> 1);
|
977
|
+
}
|
978
|
+
|
979
|
+
for (; x < bpl; x++) {
|
980
|
+
data[i + x] = data[di + x] + (data[i + x - bpl] + data[i + x - bpp] >>> 1);
|
981
|
+
}
|
982
|
+
} else {
|
983
|
+
for (; x < bpp; x++) {
|
984
|
+
data[i + x] = data[di + x] + paeth(0, data[i + x - bpl], 0);
|
985
|
+
}
|
986
|
+
|
987
|
+
for (; x < bpl; x++) {
|
988
|
+
data[i + x] = data[di + x] + paeth(data[i + x - bpp], data[i + x - bpl], data[i + x - bpp - bpl]);
|
989
|
+
}
|
990
|
+
}
|
991
|
+
}
|
992
|
+
|
993
|
+
return data;
|
994
|
+
};
|
995
|
+
|
996
|
+
UPNG.decode._paeth = function (a, b, c) {
|
997
|
+
var p = a + b - c,
|
998
|
+
pa = p - a,
|
999
|
+
pb = p - b,
|
1000
|
+
pc = p - c;
|
1001
|
+
if (pa * pa <= pb * pb && pa * pa <= pc * pc) return a;else if (pb * pb <= pc * pc) return b;
|
1002
|
+
return c;
|
1003
|
+
};
|
1004
|
+
|
1005
|
+
UPNG.decode._IHDR = function (data, offset, out) {
|
1006
|
+
var bin = UPNG._bin;
|
1007
|
+
out.width = bin.readUint(data, offset);
|
1008
|
+
offset += 4;
|
1009
|
+
out.height = bin.readUint(data, offset);
|
1010
|
+
offset += 4;
|
1011
|
+
out.depth = data[offset];
|
1012
|
+
offset++;
|
1013
|
+
out.ctype = data[offset];
|
1014
|
+
offset++;
|
1015
|
+
out.compress = data[offset];
|
1016
|
+
offset++;
|
1017
|
+
out.filter = data[offset];
|
1018
|
+
offset++;
|
1019
|
+
out.interlace = data[offset];
|
1020
|
+
offset++;
|
1021
|
+
};
|
1022
|
+
|
1023
|
+
UPNG._bin = {
|
1024
|
+
nextZero: function nextZero(data, p) {
|
1025
|
+
while (data[p] != 0) {
|
1026
|
+
p++;
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
return p;
|
1030
|
+
},
|
1031
|
+
readUshort: function readUshort(buff, p) {
|
1032
|
+
return buff[p] << 8 | buff[p + 1];
|
1033
|
+
},
|
1034
|
+
writeUshort: function writeUshort(buff, p, n) {
|
1035
|
+
buff[p] = n >> 8 & 255;
|
1036
|
+
buff[p + 1] = n & 255;
|
1037
|
+
},
|
1038
|
+
readUint: function readUint(buff, p) {
|
1039
|
+
return buff[p] * (256 * 256 * 256) + (buff[p + 1] << 16 | buff[p + 2] << 8 | buff[p + 3]);
|
1040
|
+
},
|
1041
|
+
writeUint: function writeUint(buff, p, n) {
|
1042
|
+
buff[p] = n >> 24 & 255;
|
1043
|
+
buff[p + 1] = n >> 16 & 255;
|
1044
|
+
buff[p + 2] = n >> 8 & 255;
|
1045
|
+
buff[p + 3] = n & 255;
|
1046
|
+
},
|
1047
|
+
readASCII: function readASCII(buff, p, l) {
|
1048
|
+
var s = '';
|
1049
|
+
|
1050
|
+
for (var i = 0; i < l; i++) {
|
1051
|
+
s += String.fromCharCode(buff[p + i]);
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
return s;
|
1055
|
+
},
|
1056
|
+
writeASCII: function writeASCII(data, p, s) {
|
1057
|
+
for (var i = 0; i < s.length; i++) {
|
1058
|
+
data[p + i] = s.charCodeAt(i);
|
1059
|
+
}
|
1060
|
+
},
|
1061
|
+
readBytes: function readBytes(buff, p, l) {
|
1062
|
+
var arr = [];
|
1063
|
+
|
1064
|
+
for (var i = 0; i < l; i++) {
|
1065
|
+
arr.push(buff[p + i]);
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
return arr;
|
1069
|
+
},
|
1070
|
+
pad: function pad(n) {
|
1071
|
+
return n.length < 2 ? '0' + n : n;
|
1072
|
+
},
|
1073
|
+
readUTF8: function readUTF8(buff, p, l) {
|
1074
|
+
var s = '',
|
1075
|
+
ns;
|
1076
|
+
|
1077
|
+
for (var i = 0; i < l; i++) {
|
1078
|
+
s += '%' + UPNG._bin.pad(buff[p + i].toString(16));
|
1079
|
+
}
|
1080
|
+
|
1081
|
+
try {
|
1082
|
+
ns = decodeURIComponent(s);
|
1083
|
+
} catch (e) {
|
1084
|
+
return UPNG._bin.readASCII(buff, p, l);
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
return ns;
|
1088
|
+
}
|
1089
|
+
};
|
1090
|
+
|
1091
|
+
UPNG._copyTile = function (sb, sw, sh, tb, tw, th, xoff, yoff, mode) {
|
1092
|
+
var w = Math.min(sw, tw),
|
1093
|
+
h = Math.min(sh, th);
|
1094
|
+
var si = 0,
|
1095
|
+
ti = 0;
|
1096
|
+
|
1097
|
+
for (var y = 0; y < h; y++) {
|
1098
|
+
for (var x = 0; x < w; x++) {
|
1099
|
+
if (xoff >= 0 && yoff >= 0) {
|
1100
|
+
si = y * sw + x << 2;
|
1101
|
+
ti = (yoff + y) * tw + xoff + x << 2;
|
1102
|
+
} else {
|
1103
|
+
si = (-yoff + y) * sw - xoff + x << 2;
|
1104
|
+
ti = y * tw + x << 2;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
if (mode == 0) {
|
1108
|
+
tb[ti] = sb[si];
|
1109
|
+
tb[ti + 1] = sb[si + 1];
|
1110
|
+
tb[ti + 2] = sb[si + 2];
|
1111
|
+
tb[ti + 3] = sb[si + 3];
|
1112
|
+
} else if (mode == 1) {
|
1113
|
+
var fa = sb[si + 3] * (1 / 255),
|
1114
|
+
fr = sb[si] * fa,
|
1115
|
+
fg = sb[si + 1] * fa,
|
1116
|
+
fb = sb[si + 2] * fa;
|
1117
|
+
var ba = tb[ti + 3] * (1 / 255),
|
1118
|
+
br = tb[ti] * ba,
|
1119
|
+
bg = tb[ti + 1] * ba,
|
1120
|
+
bb = tb[ti + 2] * ba;
|
1121
|
+
var ifa = 1 - fa,
|
1122
|
+
oa = fa + ba * ifa,
|
1123
|
+
ioa = oa == 0 ? 0 : 1 / oa;
|
1124
|
+
tb[ti + 3] = 255 * oa;
|
1125
|
+
tb[ti + 0] = (fr + br * ifa) * ioa;
|
1126
|
+
tb[ti + 1] = (fg + bg * ifa) * ioa;
|
1127
|
+
tb[ti + 2] = (fb + bb * ifa) * ioa;
|
1128
|
+
} else if (mode == 2) {
|
1129
|
+
// copy only differences, otherwise zero
|
1130
|
+
var fa = sb[si + 3],
|
1131
|
+
fr = sb[si],
|
1132
|
+
fg = sb[si + 1],
|
1133
|
+
fb = sb[si + 2];
|
1134
|
+
var ba = tb[ti + 3],
|
1135
|
+
br = tb[ti],
|
1136
|
+
bg = tb[ti + 1],
|
1137
|
+
bb = tb[ti + 2];
|
1138
|
+
|
1139
|
+
if (fa == ba && fr == br && fg == bg && fb == bb) {
|
1140
|
+
tb[ti] = 0;
|
1141
|
+
tb[ti + 1] = 0;
|
1142
|
+
tb[ti + 2] = 0;
|
1143
|
+
tb[ti + 3] = 0;
|
1144
|
+
} else {
|
1145
|
+
tb[ti] = fr;
|
1146
|
+
tb[ti + 1] = fg;
|
1147
|
+
tb[ti + 2] = fb;
|
1148
|
+
tb[ti + 3] = fa;
|
1149
|
+
}
|
1150
|
+
} else if (mode == 3) {
|
1151
|
+
// check if can be blended
|
1152
|
+
var fa = sb[si + 3],
|
1153
|
+
fr = sb[si],
|
1154
|
+
fg = sb[si + 1],
|
1155
|
+
fb = sb[si + 2];
|
1156
|
+
var ba = tb[ti + 3],
|
1157
|
+
br = tb[ti],
|
1158
|
+
bg = tb[ti + 1],
|
1159
|
+
bb = tb[ti + 2];
|
1160
|
+
if (fa == ba && fr == br && fg == bg && fb == bb) continue; //if(fa!=255 && ba!=0) return false;
|
1161
|
+
|
1162
|
+
if (fa < 220 && ba > 20) return false;
|
1163
|
+
}
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
return true;
|
1168
|
+
};
|
1169
|
+
});
|