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.
Files changed (503) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +4 -4
  4. data/lib/opal/js_wrap/three/version.rb +1 -1
  5. data/lib-opal/js_wrap/three/WebGL.js +102 -0
  6. data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
  7. data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
  8. data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
  9. data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
  10. data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
  11. data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
  12. data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
  13. data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
  14. data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
  15. data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
  16. data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
  17. data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
  18. data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
  19. data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
  20. data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
  21. data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
  22. data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
  23. data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
  24. data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
  25. data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
  26. data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
  27. data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
  28. data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
  29. data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
  30. data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
  31. data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
  32. data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
  33. data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
  34. data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
  35. data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
  36. data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
  37. data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
  38. data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
  39. data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
  40. data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
  41. data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
  42. data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
  43. data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
  44. data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
  45. data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
  46. data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
  47. data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
  48. data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
  49. data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
  50. data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
  51. data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
  52. data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
  53. data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
  54. data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
  55. data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
  56. data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
  57. data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
  58. data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
  59. data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
  60. data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
  61. data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
  62. data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
  63. data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
  64. data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
  65. data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
  66. data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
  67. data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
  68. data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
  69. data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
  70. data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
  71. data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
  72. data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
  73. data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
  74. data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
  75. data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
  76. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
  77. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
  78. data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
  79. data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
  80. data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
  81. data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
  82. data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
  83. data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
  84. data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
  85. data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
  86. data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
  87. data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
  88. data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
  89. data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
  90. data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
  91. data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
  92. data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
  93. data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
  94. data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
  95. data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
  96. data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
  97. data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
  98. data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
  99. data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
  100. data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
  101. data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
  102. data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
  103. data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
  104. data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
  105. data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
  106. data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
  107. data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
  108. data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
  109. data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
  110. data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
  111. data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
  112. data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
  113. data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
  114. data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
  115. data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
  116. data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
  117. data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
  118. data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
  119. data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
  120. data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
  121. data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
  122. data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
  123. data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
  124. data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
  125. data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
  126. data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
  127. data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
  128. data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
  129. data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
  130. data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
  131. data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
  132. data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
  133. data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
  134. data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
  135. data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
  136. data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
  137. data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
  138. data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
  139. data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
  140. data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
  141. data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
  142. data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
  143. data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
  144. data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
  145. data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
  146. data/lib-opal/js_wrap/three/math/Lut.js +170 -0
  147. data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
  148. data/lib-opal/js_wrap/three/math/OBB.js +345 -0
  149. data/lib-opal/js_wrap/three/math/Octree.js +409 -0
  150. data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
  151. data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
  152. data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
  153. data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
  154. data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
  155. data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
  156. data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
  157. data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
  158. data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
  159. data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
  160. data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
  161. data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
  162. data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
  163. data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
  164. data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
  165. data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
  166. data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
  167. data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
  168. data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
  169. data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
  170. data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
  171. data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
  172. data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
  173. data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
  174. data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
  175. data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
  176. data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
  177. data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
  178. data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
  179. data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
  180. data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
  181. data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
  182. data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
  183. data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
  184. data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
  185. data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
  186. data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
  187. data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
  188. data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
  189. data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
  190. data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
  191. data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
  192. data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
  193. data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
  194. data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
  195. data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
  196. data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
  197. data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
  198. data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
  199. data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
  200. data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
  201. data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
  202. data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
  203. data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
  204. data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
  205. data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
  206. data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
  207. data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
  208. data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
  209. data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
  210. data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
  211. data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
  212. data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
  213. data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
  214. data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
  215. data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
  216. data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
  217. data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
  218. data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
  219. data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
  220. data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
  221. data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
  222. data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
  223. data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
  224. data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
  225. data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
  226. data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
  227. data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
  228. data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
  229. data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
  230. data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
  231. data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
  232. data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
  233. data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
  234. data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
  235. data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
  236. data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
  237. data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
  238. data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
  239. data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
  240. data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
  241. data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
  242. data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
  243. data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
  244. data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
  245. data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
  246. data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
  247. data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
  248. data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
  249. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
  250. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
  251. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
  252. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
  253. data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
  254. data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
  255. data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
  256. data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
  257. data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
  258. data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
  259. data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
  260. data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
  261. data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
  262. data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
  263. data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
  264. data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
  265. data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
  266. data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
  267. data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
  268. data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
  269. data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
  270. data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
  271. data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
  272. data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
  273. data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
  274. data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
  275. data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
  276. data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
  277. data/lib-opal/js_wrap/three/objects/Water.js +246 -0
  278. data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
  279. data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
  280. data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
  281. data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
  282. data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
  283. data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
  284. data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
  285. data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
  286. data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
  287. data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
  288. data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
  289. data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
  290. data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
  291. data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
  292. data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
  293. data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
  294. data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
  295. data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
  296. data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
  297. data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
  298. data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
  299. data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
  300. data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
  301. data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
  302. data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
  303. data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
  304. data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
  305. data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
  306. data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
  307. data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
  308. data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
  309. data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
  310. data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
  311. data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
  312. data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
  313. data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
  314. data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
  315. data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
  316. data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
  317. data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
  318. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
  319. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
  320. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
  321. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
  322. data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
  323. data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
  324. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
  325. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
  326. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
  327. data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
  328. data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
  329. data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
  330. data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
  331. data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
  332. data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
  333. data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
  334. data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
  335. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
  336. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
  337. data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
  338. data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
  339. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
  340. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
  341. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
  342. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
  343. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
  344. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
  345. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
  346. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
  347. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
  348. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
  349. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
  350. data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
  351. data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
  352. data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
  353. data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
  354. data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
  355. data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
  356. data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
  357. data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
  358. data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
  359. data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
  360. data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
  361. data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
  362. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
  363. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
  364. data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
  365. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
  366. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
  367. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
  368. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
  369. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
  370. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
  371. data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
  372. data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
  373. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
  374. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
  375. data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
  376. data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
  377. data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
  378. data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
  379. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
  380. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
  381. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
  382. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
  383. data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
  384. data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
  385. data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
  386. data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
  387. data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
  388. data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
  389. data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
  390. data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
  391. data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
  392. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
  393. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
  394. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
  395. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
  396. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
  397. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
  398. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
  399. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
  400. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
  401. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
  402. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
  403. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
  404. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
  405. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
  406. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
  407. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
  408. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
  409. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
  410. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
  411. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
  412. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
  413. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
  414. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
  415. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
  416. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
  417. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
  418. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
  419. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
  420. data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
  421. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
  422. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
  423. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
  424. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
  425. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
  426. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
  427. data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
  428. data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
  429. data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
  430. data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
  431. data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
  432. data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
  433. data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
  434. data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
  435. data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
  436. data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
  437. data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
  438. data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
  439. data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
  440. data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
  441. data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
  442. data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
  443. data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
  444. data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
  445. data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
  446. data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
  447. data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
  448. data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
  449. data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
  450. data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
  451. data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
  452. data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
  453. data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
  454. data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
  455. data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
  456. data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
  457. data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
  458. data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
  459. data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
  460. data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
  461. data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
  462. data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
  463. data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
  464. data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
  465. data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
  466. data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
  467. data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
  468. data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
  469. data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
  470. data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
  471. data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
  472. data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
  473. data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
  474. data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
  475. data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
  476. data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
  477. data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
  478. data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
  479. data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
  480. data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
  481. data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
  482. data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
  483. data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
  484. data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
  485. data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
  486. data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
  487. data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
  488. data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
  489. data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
  490. data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
  491. data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
  492. data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
  493. data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
  494. data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
  495. data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
  496. data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
  497. data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
  498. data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
  499. data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
  500. data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
  501. data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
  502. data/opal-js_wrap-three.gemspec +4 -4
  503. metadata +502 -5
@@ -0,0 +1,391 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "three", "../libs/fflate.module.js"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("three"), require("../libs/fflate.module.js"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.three, global.fflateModule);
11
+ global.TiltLoader = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, fflate) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.TiltLoader = void 0;
20
+ fflate = _interopRequireWildcard(fflate);
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
27
+
28
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+
30
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
+
32
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
33
+
34
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
35
+
36
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37
+
38
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
+
40
+ 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); } }
41
+
42
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
43
+
44
+ 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); }
45
+
46
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
47
+
48
+ 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); }; }
49
+
50
+ 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); }
51
+
52
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
53
+
54
+ 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; } }
55
+
56
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
57
+
58
+ var TiltLoader = /*#__PURE__*/function (_Loader) {
59
+ _inherits(TiltLoader, _Loader);
60
+
61
+ var _super = _createSuper(TiltLoader);
62
+
63
+ function TiltLoader() {
64
+ _classCallCheck(this, TiltLoader);
65
+
66
+ return _super.apply(this, arguments);
67
+ }
68
+
69
+ _createClass(TiltLoader, [{
70
+ key: "load",
71
+ value: function load(url, onLoad, onProgress, onError) {
72
+ var scope = this;
73
+ var loader = new _three.FileLoader(this.manager);
74
+ loader.setPath(this.path);
75
+ loader.setResponseType('arraybuffer');
76
+ loader.setWithCredentials(this.withCredentials);
77
+ loader.load(url, function (buffer) {
78
+ try {
79
+ onLoad(scope.parse(buffer));
80
+ } catch (e) {
81
+ if (onError) {
82
+ onError(e);
83
+ } else {
84
+ console.error(e);
85
+ }
86
+
87
+ scope.manager.itemError(url);
88
+ }
89
+ }, onProgress, onError);
90
+ }
91
+ }, {
92
+ key: "parse",
93
+ value: function parse(buffer) {
94
+ var group = new _three.Group(); // https://docs.google.com/document/d/11ZsHozYn9FnWG7y3s3WAyKIACfbfwb4PbaS8cZ_xjvo/edit#
95
+
96
+ var zip = fflate.unzipSync(new Uint8Array(buffer.slice(16)));
97
+ /*
98
+ const thumbnail = zip[ 'thumbnail.png' ].buffer;
99
+ const img = document.createElement( 'img' );
100
+ img.src = URL.createObjectURL( new Blob( [ thumbnail ] ) );
101
+ document.body.appendChild( img );
102
+ */
103
+
104
+ var metadata = JSON.parse(fflate.strFromU8(zip['metadata.json']));
105
+ /*
106
+ const blob = new Blob( [ zip[ 'data.sketch' ].buffer ], { type: 'application/octet-stream' } );
107
+ window.open( URL.createObjectURL( blob ) );
108
+ */
109
+
110
+ var data = new DataView(zip['data.sketch'].buffer);
111
+ var num_strokes = data.getInt32(16, true);
112
+ var brushes = {};
113
+ var offset = 20;
114
+
115
+ for (var i = 0; i < num_strokes; i++) {
116
+ var brush_index = data.getInt32(offset, true);
117
+ var brush_color = [data.getFloat32(offset + 4, true), data.getFloat32(offset + 8, true), data.getFloat32(offset + 12, true), data.getFloat32(offset + 16, true)];
118
+ var brush_size = data.getFloat32(offset + 20, true);
119
+ var stroke_mask = data.getUint32(offset + 24, true);
120
+ var controlpoint_mask = data.getUint32(offset + 28, true);
121
+ var offset_stroke_mask = 0;
122
+ var offset_controlpoint_mask = 0;
123
+
124
+ for (var j = 0; j < 4; j++) {
125
+ // TOFIX: I don't understand these masks yet
126
+ var byte = 1 << j;
127
+ if ((stroke_mask & byte) > 0) offset_stroke_mask += 4;
128
+ if ((controlpoint_mask & byte) > 0) offset_controlpoint_mask += 4;
129
+ } // console.log( { brush_index, brush_color, brush_size, stroke_mask, controlpoint_mask } );
130
+ // console.log( offset_stroke_mask, offset_controlpoint_mask );
131
+
132
+
133
+ offset = offset + 28 + offset_stroke_mask + 4; // TOFIX: This is wrong
134
+
135
+ var num_control_points = data.getInt32(offset, true); // console.log( { num_control_points } );
136
+
137
+ var positions = new Float32Array(num_control_points * 3);
138
+ var quaternions = new Float32Array(num_control_points * 4);
139
+ offset = offset + 4;
140
+
141
+ for (var _j = 0, k = 0; _j < positions.length; _j += 3, k += 4) {
142
+ positions[_j + 0] = data.getFloat32(offset + 0, true);
143
+ positions[_j + 1] = data.getFloat32(offset + 4, true);
144
+ positions[_j + 2] = data.getFloat32(offset + 8, true);
145
+ quaternions[k + 0] = data.getFloat32(offset + 12, true);
146
+ quaternions[k + 1] = data.getFloat32(offset + 16, true);
147
+ quaternions[k + 2] = data.getFloat32(offset + 20, true);
148
+ quaternions[k + 3] = data.getFloat32(offset + 24, true);
149
+ offset = offset + 28 + offset_controlpoint_mask; // TOFIX: This is wrong
150
+ }
151
+
152
+ if (brush_index in brushes === false) {
153
+ brushes[brush_index] = [];
154
+ }
155
+
156
+ brushes[brush_index].push([positions, quaternions, brush_size, brush_color]);
157
+ }
158
+
159
+ for (var _brush_index in brushes) {
160
+ var geometry = new StrokeGeometry(brushes[_brush_index]);
161
+ var material = getMaterial(metadata.BrushIndex[_brush_index]);
162
+ group.add(new _three.Mesh(geometry, material));
163
+ }
164
+
165
+ return group;
166
+ }
167
+ }]);
168
+
169
+ return TiltLoader;
170
+ }(_three.Loader);
171
+
172
+ _exports.TiltLoader = TiltLoader;
173
+
174
+ var StrokeGeometry = /*#__PURE__*/function (_BufferGeometry) {
175
+ _inherits(StrokeGeometry, _BufferGeometry);
176
+
177
+ var _super2 = _createSuper(StrokeGeometry);
178
+
179
+ function StrokeGeometry(strokes) {
180
+ var _this;
181
+
182
+ _classCallCheck(this, StrokeGeometry);
183
+
184
+ _this = _super2.call(this);
185
+ var vertices = [];
186
+ var colors = [];
187
+ var uvs = [];
188
+ var position = new _three.Vector3();
189
+ var prevPosition = new _three.Vector3();
190
+ var quaternion = new _three.Quaternion();
191
+ var prevQuaternion = new _three.Quaternion();
192
+ var vector1 = new _three.Vector3();
193
+ var vector2 = new _three.Vector3();
194
+ var vector3 = new _three.Vector3();
195
+ var vector4 = new _three.Vector3(); // size = size / 2;
196
+
197
+ for (var k in strokes) {
198
+ var stroke = strokes[k];
199
+ var positions = stroke[0];
200
+ var quaternions = stroke[1];
201
+ var size = stroke[2];
202
+ var color = stroke[3];
203
+ prevPosition.fromArray(positions, 0);
204
+ prevQuaternion.fromArray(quaternions, 0);
205
+
206
+ for (var i = 3, j = 4, l = positions.length; i < l; i += 3, j += 4) {
207
+ position.fromArray(positions, i);
208
+ quaternion.fromArray(quaternions, j);
209
+ vector1.set(-size, 0, 0);
210
+ vector1.applyQuaternion(quaternion);
211
+ vector1.add(position);
212
+ vector2.set(size, 0, 0);
213
+ vector2.applyQuaternion(quaternion);
214
+ vector2.add(position);
215
+ vector3.set(size, 0, 0);
216
+ vector3.applyQuaternion(prevQuaternion);
217
+ vector3.add(prevPosition);
218
+ vector4.set(-size, 0, 0);
219
+ vector4.applyQuaternion(prevQuaternion);
220
+ vector4.add(prevPosition);
221
+ vertices.push(vector1.x, vector1.y, -vector1.z);
222
+ vertices.push(vector2.x, vector2.y, -vector2.z);
223
+ vertices.push(vector4.x, vector4.y, -vector4.z);
224
+ vertices.push(vector2.x, vector2.y, -vector2.z);
225
+ vertices.push(vector3.x, vector3.y, -vector3.z);
226
+ vertices.push(vector4.x, vector4.y, -vector4.z);
227
+ prevPosition.copy(position);
228
+ prevQuaternion.copy(quaternion);
229
+ colors.push.apply(colors, _toConsumableArray(color));
230
+ colors.push.apply(colors, _toConsumableArray(color));
231
+ colors.push.apply(colors, _toConsumableArray(color));
232
+ colors.push.apply(colors, _toConsumableArray(color));
233
+ colors.push.apply(colors, _toConsumableArray(color));
234
+ colors.push.apply(colors, _toConsumableArray(color));
235
+ var p1 = i / l;
236
+ var p2 = (i - 3) / l;
237
+ uvs.push(p1, 0);
238
+ uvs.push(p1, 1);
239
+ uvs.push(p2, 0);
240
+ uvs.push(p1, 1);
241
+ uvs.push(p2, 1);
242
+ uvs.push(p2, 0);
243
+ }
244
+ }
245
+
246
+ _this.setAttribute('position', new _three.BufferAttribute(new Float32Array(vertices), 3));
247
+
248
+ _this.setAttribute('color', new _three.BufferAttribute(new Float32Array(colors), 4));
249
+
250
+ _this.setAttribute('uv', new _three.BufferAttribute(new Float32Array(uvs), 2));
251
+
252
+ return _this;
253
+ }
254
+
255
+ return _createClass(StrokeGeometry);
256
+ }(_three.BufferGeometry);
257
+
258
+ var BRUSH_LIST_ARRAY = {
259
+ '89d104cd-d012-426b-b5b3-bbaee63ac43c': 'Bubbles',
260
+ '700f3aa8-9a7c-2384-8b8a-ea028905dd8c': 'CelVinyl',
261
+ '0f0ff7b2-a677-45eb-a7d6-0cd7206f4816': 'ChromaticWave',
262
+ '1161af82-50cf-47db-9706-0c3576d43c43': 'CoarseBristles',
263
+ '79168f10-6961-464a-8be1-57ed364c5600': 'CoarseBristlesSingleSided',
264
+ '1caa6d7d-f015-3f54-3a4b-8b5354d39f81': 'Comet',
265
+ 'c8313697-2563-47fc-832e-290f4c04b901': 'DiamondHull',
266
+ '4391aaaa-df73-4396-9e33-31e4e4930b27': 'Disco',
267
+ 'd1d991f2-e7a0-4cf1-b328-f57e915e6260': 'DotMarker',
268
+ '6a1cf9f9-032c-45ec-9b1d-a6680bee30f7': 'Dots',
269
+ '0d3889f3-3ede-470c-8af4-f44813306126': 'DoubleTaperedFlat',
270
+ '0d3889f3-3ede-470c-8af4-de4813306126': 'DoubleTaperedMarker',
271
+ 'd0262945-853c-4481-9cbd-88586bed93cb': 'DuctTape',
272
+ '3ca16e2f-bdcd-4da2-8631-dcef342f40f1': 'DuctTapeSingleSided',
273
+ 'f6e85de3-6dcc-4e7f-87fd-cee8c3d25d51': 'Electricity',
274
+ '02ffb866-7fb2-4d15-b761-1012cefb1360': 'Embers',
275
+ 'cb92b597-94ca-4255-b017-0e3f42f12f9e': 'Fire',
276
+ '2d35bcf0-e4d8-452c-97b1-3311be063130': 'Flat',
277
+ '55303bc4-c749-4a72-98d9-d23e68e76e18': 'FlatDeprecated',
278
+ '280c0a7a-aad8-416c-a7d2-df63d129ca70': 'FlatSingleSided',
279
+ 'cf019139-d41c-4eb0-a1d0-5cf54b0a42f3': 'Highlighter',
280
+ '6a1cf9f9-032c-45ec-9b6e-a6680bee32e9': 'HyperGrid',
281
+ 'dce872c2-7b49-4684-b59b-c45387949c5c': 'Hypercolor',
282
+ 'e8ef32b1-baa8-460a-9c2c-9cf8506794f5': 'HypercolorSingleSided',
283
+ '2f212815-f4d3-c1a4-681a-feeaf9c6dc37': 'Icing',
284
+ 'f5c336cf-5108-4b40-ade9-c687504385ab': 'Ink',
285
+ 'c0012095-3ffd-4040-8ee1-fc180d346eaa': 'InkSingleSided',
286
+ '4a76a27a-44d8-4bfe-9a8c-713749a499b0': 'Leaves',
287
+ 'ea19de07-d0c0-4484-9198-18489a3c1487': 'LeavesSingleSided',
288
+ '2241cd32-8ba2-48a5-9ee7-2caef7e9ed62': 'Light',
289
+ '4391aaaa-df81-4396-9e33-31e4e4930b27': 'LightWire',
290
+ 'd381e0f5-3def-4a0d-8853-31e9200bcbda': 'Lofted',
291
+ '429ed64a-4e97-4466-84d3-145a861ef684': 'Marker',
292
+ '79348357-432d-4746-8e29-0e25c112e3aa': 'MatteHull',
293
+ 'b2ffef01-eaaa-4ab5-aa64-95a2c4f5dbc6': 'NeonPulse',
294
+ 'f72ec0e7-a844-4e38-82e3-140c44772699': 'OilPaint',
295
+ 'c515dad7-4393-4681-81ad-162ef052241b': 'OilPaintSingleSided',
296
+ 'f1114e2e-eb8d-4fde-915a-6e653b54e9f5': 'Paper',
297
+ '759f1ebd-20cd-4720-8d41-234e0da63716': 'PaperSingleSided',
298
+ 'e0abbc80-0f80-e854-4970-8924a0863dcc': 'Petal',
299
+ 'c33714d1-b2f9-412e-bd50-1884c9d46336': 'Plasma',
300
+ 'ad1ad437-76e2-450d-a23a-e17f8310b960': 'Rainbow',
301
+ 'faaa4d44-fcfb-4177-96be-753ac0421ba3': 'ShinyHull',
302
+ '70d79cca-b159-4f35-990c-f02193947fe8': 'Smoke',
303
+ 'd902ed8b-d0d1-476c-a8de-878a79e3a34c': 'Snow',
304
+ 'accb32f5-4509-454f-93f8-1df3fd31df1b': 'SoftHighlighter',
305
+ 'cf7f0059-7aeb-53a4-2b67-c83d863a9ffa': 'Spikes',
306
+ '8dc4a70c-d558-4efd-a5ed-d4e860f40dc3': 'Splatter',
307
+ '7a1c8107-50c5-4b70-9a39-421576d6617e': 'SplatterSingleSided',
308
+ '0eb4db27-3f82-408d-b5a1-19ebd7d5b711': 'Stars',
309
+ '44bb800a-fbc3-4592-8426-94ecb05ddec3': 'Streamers',
310
+ '0077f88c-d93a-42f3-b59b-b31c50cdb414': 'Taffy',
311
+ 'b468c1fb-f254-41ed-8ec9-57030bc5660c': 'TaperedFlat',
312
+ 'c8ccb53d-ae13-45ef-8afb-b730d81394eb': 'TaperedFlatSingleSided',
313
+ 'd90c6ad8-af0f-4b54-b422-e0f92abe1b3c': 'TaperedMarker',
314
+ '1a26b8c0-8a07-4f8a-9fac-d2ef36e0cad0': 'TaperedMarker_Flat',
315
+ '75b32cf0-fdd6-4d89-a64b-e2a00b247b0f': 'ThickPaint',
316
+ 'fdf0326a-c0d1-4fed-b101-9db0ff6d071f': 'ThickPaintSingleSided',
317
+ '4391385a-df73-4396-9e33-31e4e4930b27': 'Toon',
318
+ 'a8fea537-da7c-4d4b-817f-24f074725d6d': 'UnlitHull',
319
+ 'd229d335-c334-495a-a801-660ac8a87360': 'VelvetInk',
320
+ '10201aa3-ebc2-42d8-84b7-2e63f6eeb8ab': 'Waveform',
321
+ 'b67c0e81-ce6d-40a8-aeb0-ef036b081aa3': 'WetPaint',
322
+ 'dea67637-cd1a-27e4-c9b1-52f4bbcb84e5': 'WetPaintSingleSided',
323
+ '5347acf0-a8e2-47b6-8346-30c70719d763': 'WigglyGraphite',
324
+ 'e814fef1-97fd-7194-4a2f-50c2bb918be2': 'WigglyGraphiteSingleSided',
325
+ '4391385a-cf83-4396-9e33-31e4e4930b27': 'Wire'
326
+ };
327
+ var common = {
328
+ 'colors': {
329
+ 'BloomColor': "\n\t\t\tvec3 BloomColor(vec3 color, float gain) {\n\t\t\t\t// Guarantee that there's at least a little bit of all 3 channels.\n\t\t\t\t// This makes fully-saturated strokes (which only have 2 non-zero\n\t\t\t\t// color channels) eventually clip to white rather than to a secondary.\n\t\t\t\tfloat cmin = length(color.rgb) * .05;\n\t\t\t\tcolor.rgb = max(color.rgb, vec3(cmin, cmin, cmin));\n\t\t\t\t// If we try to remove this pow() from .a, it brightens up\n\t\t\t\t// pressure-sensitive strokes; looks better as-is.\n\t\t\t\tcolor = pow(color, vec3(2.2));\n\t\t\t\tcolor.rgb *= 2. * exp(gain * 10.);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",
330
+ 'LinearToSrgb': "\n\t\t\tvec3 LinearToSrgb(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 linearColor = color.rgb;\n\t\t\t\tvec3 S1 = sqrt(linearColor);\n\t\t\t\tvec3 S2 = sqrt(S1);\n\t\t\t\tvec3 S3 = sqrt(S2);\n\t\t\t\tcolor.rgb = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * linearColor;\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",
331
+ 'hsv': "\n\t\t\t// uniform sampler2D lookupTex;\n\t\t\tvec4 lookup(vec4 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 lookup(vec3 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb( vec3 hsv ) {\n\t\t\t\tvec3 rgb = clamp( abs(mod(hsv.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );\n\t\t\t\treturn hsv.z * mix( vec3(1.0), rgb, hsv.y);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv( vec3 rgb ) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(rgb.bg, K.wz), vec4(rgb.gb, K.xy), step(rgb.b, rgb.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\t\t",
332
+ 'SrgbToLinear': "\n\t\t\tvec3 SrgbToLinear(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 sRGB = color.rgb;\n\t\t\t\tcolor.rgb = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t"
333
+ }
334
+ };
335
+ var shaders = null;
336
+
337
+ function getShaders() {
338
+ if (shaders === null) {
339
+ var loader = new _three.TextureLoader().setPath('./textures/tiltbrush/');
340
+ shaders = {
341
+ 'Light': {
342
+ uniforms: {
343
+ mainTex: {
344
+ value: loader.load('Light.webp')
345
+ },
346
+ alphaTest: {
347
+ value: 0.067
348
+ },
349
+ emission_gain: {
350
+ value: 0.45
351
+ },
352
+ alpha: {
353
+ value: 1
354
+ }
355
+ },
356
+ vertexShader: "\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tattribute vec2 uv;\n\t\t\t\t\tattribute vec4 color;\n\t\t\t\t\tattribute vec3 position;\n\n\t\t\t\t\tuniform mat4 modelMatrix;\n\t\t\t\t\tuniform mat4 modelViewMatrix;\n\t\t\t\t\tuniform mat4 projectionMatrix;\n\t\t\t\t\tuniform mat4 viewMatrix;\n\t\t\t\t\tuniform mat3 normalMatrix;\n\t\t\t\t\tuniform vec3 cameraPosition;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t".concat(common.colors.LinearToSrgb, "\n\t\t\t\t\t").concat(common.colors.hsv, "\n\n\t\t\t\t\tvoid main() {\n\n\t\t\t\t\t\tvUv = uv;\n\n\t\t\t\t\t\tvColor = lookup(color.rgb);\n\n\t\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t\t}\n\t\t\t\t"),
357
+ fragmentShader: "\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tuniform float emission_gain;\n\n\t\t\t\t\tuniform sampler2D mainTex;\n\t\t\t\t\tuniform float alphaTest;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t".concat(common.colors.BloomColor, "\n\t\t\t\t\t").concat(common.colors.SrgbToLinear, "\n\n\t\t\t\t\tvoid main(){\n\t\t\t\t\t\tvec4 col = texture2D(mainTex, vUv);\n\t\t\t\t\t\tvec3 color = vColor;\n\t\t\t\t\t\tcolor = BloomColor(color, emission_gain);\n\t\t\t\t\t\tcolor = color * col.rgb;\n\t\t\t\t\t\tcolor = color * col.a;\n\t\t\t\t\t\tcolor = SrgbToLinear(color);\n\t\t\t\t\t\tgl_FragColor = vec4(color, 1.0);\n\t\t\t\t\t}\n\t\t\t\t"),
358
+ side: 2,
359
+ transparent: true,
360
+ depthFunc: 2,
361
+ depthWrite: true,
362
+ depthTest: false,
363
+ blending: 5,
364
+ blendDst: 201,
365
+ blendDstAlpha: 201,
366
+ blendEquation: 100,
367
+ blendEquationAlpha: 100,
368
+ blendSrc: 201,
369
+ blendSrcAlpha: 201
370
+ }
371
+ };
372
+ }
373
+
374
+ return shaders;
375
+ }
376
+
377
+ function getMaterial(GUID) {
378
+ var name = BRUSH_LIST_ARRAY[GUID];
379
+
380
+ switch (name) {
381
+ case 'Light':
382
+ return new _three.RawShaderMaterial(getShaders().Light);
383
+
384
+ default:
385
+ return new _three.MeshBasicMaterial({
386
+ vertexColors: true,
387
+ side: _three.DoubleSide
388
+ });
389
+ }
390
+ }
391
+ });
@@ -0,0 +1,272 @@
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.VOXLoader = 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.VOXMesh = _exports.VOXLoader = _exports.VOXDataTexture3D = 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 VOXLoader = /*#__PURE__*/function (_Loader) {
42
+ _inherits(VOXLoader, _Loader);
43
+
44
+ var _super = _createSuper(VOXLoader);
45
+
46
+ function VOXLoader() {
47
+ _classCallCheck(this, VOXLoader);
48
+
49
+ return _super.apply(this, arguments);
50
+ }
51
+
52
+ _createClass(VOXLoader, [{
53
+ key: "load",
54
+ value: function load(url, onLoad, onProgress, onError) {
55
+ var scope = this;
56
+ var loader = new _three.FileLoader(scope.manager);
57
+ loader.setPath(scope.path);
58
+ loader.setResponseType('arraybuffer');
59
+ loader.setRequestHeader(scope.requestHeader);
60
+ loader.load(url, function (buffer) {
61
+ try {
62
+ onLoad(scope.parse(buffer));
63
+ } catch (e) {
64
+ if (onError) {
65
+ onError(e);
66
+ } else {
67
+ console.error(e);
68
+ }
69
+
70
+ scope.manager.itemError(url);
71
+ }
72
+ }, onProgress, onError);
73
+ }
74
+ }, {
75
+ key: "parse",
76
+ value: function parse(buffer) {
77
+ var data = new DataView(buffer);
78
+ var id = data.getUint32(0, true);
79
+ var version = data.getUint32(4, true);
80
+
81
+ if (id !== 542658390 || version !== 150) {
82
+ console.error('Not a valid VOX file');
83
+ return;
84
+ }
85
+
86
+ var DEFAULT_PALETTE = [0x00000000, 0xffffffff, 0xffccffff, 0xff99ffff, 0xff66ffff, 0xff33ffff, 0xff00ffff, 0xffffccff, 0xffccccff, 0xff99ccff, 0xff66ccff, 0xff33ccff, 0xff00ccff, 0xffff99ff, 0xffcc99ff, 0xff9999ff, 0xff6699ff, 0xff3399ff, 0xff0099ff, 0xffff66ff, 0xffcc66ff, 0xff9966ff, 0xff6666ff, 0xff3366ff, 0xff0066ff, 0xffff33ff, 0xffcc33ff, 0xff9933ff, 0xff6633ff, 0xff3333ff, 0xff0033ff, 0xffff00ff, 0xffcc00ff, 0xff9900ff, 0xff6600ff, 0xff3300ff, 0xff0000ff, 0xffffffcc, 0xffccffcc, 0xff99ffcc, 0xff66ffcc, 0xff33ffcc, 0xff00ffcc, 0xffffcccc, 0xffcccccc, 0xff99cccc, 0xff66cccc, 0xff33cccc, 0xff00cccc, 0xffff99cc, 0xffcc99cc, 0xff9999cc, 0xff6699cc, 0xff3399cc, 0xff0099cc, 0xffff66cc, 0xffcc66cc, 0xff9966cc, 0xff6666cc, 0xff3366cc, 0xff0066cc, 0xffff33cc, 0xffcc33cc, 0xff9933cc, 0xff6633cc, 0xff3333cc, 0xff0033cc, 0xffff00cc, 0xffcc00cc, 0xff9900cc, 0xff6600cc, 0xff3300cc, 0xff0000cc, 0xffffff99, 0xffccff99, 0xff99ff99, 0xff66ff99, 0xff33ff99, 0xff00ff99, 0xffffcc99, 0xffcccc99, 0xff99cc99, 0xff66cc99, 0xff33cc99, 0xff00cc99, 0xffff9999, 0xffcc9999, 0xff999999, 0xff669999, 0xff339999, 0xff009999, 0xffff6699, 0xffcc6699, 0xff996699, 0xff666699, 0xff336699, 0xff006699, 0xffff3399, 0xffcc3399, 0xff993399, 0xff663399, 0xff333399, 0xff003399, 0xffff0099, 0xffcc0099, 0xff990099, 0xff660099, 0xff330099, 0xff000099, 0xffffff66, 0xffccff66, 0xff99ff66, 0xff66ff66, 0xff33ff66, 0xff00ff66, 0xffffcc66, 0xffcccc66, 0xff99cc66, 0xff66cc66, 0xff33cc66, 0xff00cc66, 0xffff9966, 0xffcc9966, 0xff999966, 0xff669966, 0xff339966, 0xff009966, 0xffff6666, 0xffcc6666, 0xff996666, 0xff666666, 0xff336666, 0xff006666, 0xffff3366, 0xffcc3366, 0xff993366, 0xff663366, 0xff333366, 0xff003366, 0xffff0066, 0xffcc0066, 0xff990066, 0xff660066, 0xff330066, 0xff000066, 0xffffff33, 0xffccff33, 0xff99ff33, 0xff66ff33, 0xff33ff33, 0xff00ff33, 0xffffcc33, 0xffcccc33, 0xff99cc33, 0xff66cc33, 0xff33cc33, 0xff00cc33, 0xffff9933, 0xffcc9933, 0xff999933, 0xff669933, 0xff339933, 0xff009933, 0xffff6633, 0xffcc6633, 0xff996633, 0xff666633, 0xff336633, 0xff006633, 0xffff3333, 0xffcc3333, 0xff993333, 0xff663333, 0xff333333, 0xff003333, 0xffff0033, 0xffcc0033, 0xff990033, 0xff660033, 0xff330033, 0xff000033, 0xffffff00, 0xffccff00, 0xff99ff00, 0xff66ff00, 0xff33ff00, 0xff00ff00, 0xffffcc00, 0xffcccc00, 0xff99cc00, 0xff66cc00, 0xff33cc00, 0xff00cc00, 0xffff9900, 0xffcc9900, 0xff999900, 0xff669900, 0xff339900, 0xff009900, 0xffff6600, 0xffcc6600, 0xff996600, 0xff666600, 0xff336600, 0xff006600, 0xffff3300, 0xffcc3300, 0xff993300, 0xff663300, 0xff333300, 0xff003300, 0xffff0000, 0xffcc0000, 0xff990000, 0xff660000, 0xff330000, 0xff0000ee, 0xff0000dd, 0xff0000bb, 0xff0000aa, 0xff000088, 0xff000077, 0xff000055, 0xff000044, 0xff000022, 0xff000011, 0xff00ee00, 0xff00dd00, 0xff00bb00, 0xff00aa00, 0xff008800, 0xff007700, 0xff005500, 0xff004400, 0xff002200, 0xff001100, 0xffee0000, 0xffdd0000, 0xffbb0000, 0xffaa0000, 0xff880000, 0xff770000, 0xff550000, 0xff440000, 0xff220000, 0xff110000, 0xffeeeeee, 0xffdddddd, 0xffbbbbbb, 0xffaaaaaa, 0xff888888, 0xff777777, 0xff555555, 0xff444444, 0xff222222, 0xff111111];
87
+ var i = 8;
88
+ var chunk;
89
+ var chunks = [];
90
+
91
+ while (i < data.byteLength) {
92
+ var _id = '';
93
+
94
+ for (var j = 0; j < 4; j++) {
95
+ _id += String.fromCharCode(data.getUint8(i++, true));
96
+ }
97
+
98
+ var chunkSize = data.getUint32(i, true);
99
+ i += 4;
100
+ data.getUint32(i, true);
101
+ i += 4; // childChunks
102
+
103
+ if (_id === 'SIZE') {
104
+ var x = data.getUint32(i, true);
105
+ i += 4;
106
+ var y = data.getUint32(i, true);
107
+ i += 4;
108
+ var z = data.getUint32(i, true);
109
+ i += 4;
110
+ chunk = {
111
+ palette: DEFAULT_PALETTE,
112
+ size: {
113
+ x: x,
114
+ y: y,
115
+ z: z
116
+ }
117
+ };
118
+ chunks.push(chunk);
119
+ i += chunkSize - 3 * 4;
120
+ } else if (_id === 'XYZI') {
121
+ var numVoxels = data.getUint32(i, true);
122
+ i += 4;
123
+ chunk.data = new Uint8Array(buffer, i, numVoxels * 4);
124
+ i += numVoxels * 4;
125
+ } else if (_id === 'RGBA') {
126
+ var palette = [0];
127
+
128
+ for (var _j = 0; _j < 256; _j++) {
129
+ palette[_j + 1] = data.getUint32(i, true);
130
+ i += 4;
131
+ }
132
+
133
+ chunk.palette = palette;
134
+ } else {
135
+ // console.log( id, chunkSize, childChunks );
136
+ i += chunkSize;
137
+ }
138
+ }
139
+
140
+ return chunks;
141
+ }
142
+ }]);
143
+
144
+ return VOXLoader;
145
+ }(_three.Loader);
146
+
147
+ _exports.VOXLoader = VOXLoader;
148
+
149
+ var VOXMesh = /*#__PURE__*/function (_Mesh) {
150
+ _inherits(VOXMesh, _Mesh);
151
+
152
+ var _super2 = _createSuper(VOXMesh);
153
+
154
+ function VOXMesh(chunk) {
155
+ _classCallCheck(this, VOXMesh);
156
+
157
+ var data = chunk.data;
158
+ var size = chunk.size;
159
+ var palette = chunk.palette; //
160
+
161
+ var vertices = [];
162
+ var colors = [];
163
+ var nx = [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1];
164
+ var px = [1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0];
165
+ var py = [0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1];
166
+ var ny = [0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0];
167
+ var nz = [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0];
168
+ var pz = [0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1];
169
+
170
+ function add(tile, x, y, z, r, g, b) {
171
+ x -= size.x / 2;
172
+ y -= size.z / 2;
173
+ z += size.y / 2;
174
+
175
+ for (var i = 0; i < 18; i += 3) {
176
+ vertices.push(tile[i + 0] + x, tile[i + 1] + y, tile[i + 2] + z);
177
+ colors.push(r, g, b);
178
+ }
179
+ } // Store data in a volume for sampling
180
+
181
+
182
+ var offsety = size.x;
183
+ var offsetz = size.x * size.y;
184
+ var array = new Uint8Array(size.x * size.y * size.z);
185
+
186
+ for (var j = 0; j < data.length; j += 4) {
187
+ var x = data[j + 0];
188
+ var y = data[j + 1];
189
+ var z = data[j + 2];
190
+ var index = x + y * offsety + z * offsetz;
191
+ array[index] = 255;
192
+ } // Construct geometry
193
+
194
+
195
+ var hasColors = false;
196
+
197
+ for (var _j2 = 0; _j2 < data.length; _j2 += 4) {
198
+ var _x = data[_j2 + 0];
199
+ var _y = data[_j2 + 1];
200
+ var _z = data[_j2 + 2];
201
+ var c = data[_j2 + 3];
202
+ var hex = palette[c];
203
+ var r = (hex >> 0 & 0xff) / 0xff;
204
+ var g = (hex >> 8 & 0xff) / 0xff;
205
+ var b = (hex >> 16 & 0xff) / 0xff;
206
+ if (r > 0 || g > 0 || b > 0) hasColors = true;
207
+
208
+ var _index = _x + _y * offsety + _z * offsetz;
209
+
210
+ if (array[_index + 1] === 0 || _x === size.x - 1) add(px, _x, _z, -_y, r, g, b);
211
+ if (array[_index - 1] === 0 || _x === 0) add(nx, _x, _z, -_y, r, g, b);
212
+ if (array[_index + offsety] === 0 || _y === size.y - 1) add(ny, _x, _z, -_y, r, g, b);
213
+ if (array[_index - offsety] === 0 || _y === 0) add(py, _x, _z, -_y, r, g, b);
214
+ if (array[_index + offsetz] === 0 || _z === size.z - 1) add(pz, _x, _z, -_y, r, g, b);
215
+ if (array[_index - offsetz] === 0 || _z === 0) add(nz, _x, _z, -_y, r, g, b);
216
+ }
217
+
218
+ var geometry = new _three.BufferGeometry();
219
+ geometry.setAttribute('position', new _three.Float32BufferAttribute(vertices, 3));
220
+ geometry.computeVertexNormals();
221
+ var material = new _three.MeshStandardMaterial();
222
+
223
+ if (hasColors) {
224
+ geometry.setAttribute('color', new _three.Float32BufferAttribute(colors, 3));
225
+ material.vertexColors = true;
226
+ }
227
+
228
+ return _super2.call(this, geometry, material);
229
+ }
230
+
231
+ return _createClass(VOXMesh);
232
+ }(_three.Mesh);
233
+
234
+ _exports.VOXMesh = VOXMesh;
235
+
236
+ var VOXDataTexture3D = /*#__PURE__*/function (_DataTexture3D) {
237
+ _inherits(VOXDataTexture3D, _DataTexture3D);
238
+
239
+ var _super3 = _createSuper(VOXDataTexture3D);
240
+
241
+ function VOXDataTexture3D(chunk) {
242
+ var _this;
243
+
244
+ _classCallCheck(this, VOXDataTexture3D);
245
+
246
+ var data = chunk.data;
247
+ var size = chunk.size;
248
+ var offsety = size.x;
249
+ var offsetz = size.x * size.y;
250
+ var array = new Uint8Array(size.x * size.y * size.z);
251
+
252
+ for (var j = 0; j < data.length; j += 4) {
253
+ var x = data[j + 0];
254
+ var y = data[j + 1];
255
+ var z = data[j + 2];
256
+ var index = x + y * offsety + z * offsetz;
257
+ array[index] = 255;
258
+ }
259
+
260
+ _this = _super3.call(this, array, size.x, size.y, size.z);
261
+ _this.format = _three.RedFormat;
262
+ _this.minFilter = _three.NearestFilter;
263
+ _this.magFilter = _three.LinearFilter;
264
+ _this.unpackAlignment = 1;
265
+ return _this;
266
+ }
267
+
268
+ return _createClass(VOXDataTexture3D);
269
+ }(_three.DataTexture3D);
270
+
271
+ _exports.VOXDataTexture3D = VOXDataTexture3D;
272
+ });