super-three 0.157.0 → 0.158.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +6 -4
  2. package/build/three.cjs +1486 -842
  3. package/build/three.js +1486 -842
  4. package/build/three.min.js +1 -1
  5. package/build/three.module.js +1481 -843
  6. package/build/three.module.min.js +1 -1
  7. package/examples/jsm/Addons.js +290 -0
  8. package/examples/jsm/controls/FlyControls.js +26 -0
  9. package/examples/jsm/controls/OrbitControls.js +12 -1
  10. package/examples/jsm/controls/TransformControls.js +27 -11
  11. package/examples/jsm/csm/CSMShader.js +1 -1
  12. package/examples/jsm/exporters/GLTFExporter.js +72 -2
  13. package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
  14. package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
  15. package/examples/jsm/libs/lottie_canvas.module.js +6 -1
  16. package/examples/jsm/libs/opentype.module.js +13 -75
  17. package/examples/jsm/libs/surfaceNet.js +201 -0
  18. package/examples/jsm/loaders/GLTFLoader.js +12 -3
  19. package/examples/jsm/loaders/LUTImageLoader.js +162 -0
  20. package/examples/jsm/loaders/lwo/IFFParser.js +89 -93
  21. package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
  22. package/examples/jsm/math/Capsule.js +0 -55
  23. package/examples/jsm/math/Octree.js +70 -3
  24. package/examples/jsm/modifiers/SimplifyModifier.js +103 -11
  25. package/examples/jsm/modifiers/TessellateModifier.js +3 -3
  26. package/examples/jsm/nodes/Nodes.js +6 -6
  27. package/examples/jsm/nodes/accessors/CubeTextureNode.js +3 -3
  28. package/examples/jsm/nodes/accessors/InstanceNode.js +3 -3
  29. package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
  30. package/examples/jsm/nodes/accessors/MaterialNode.js +68 -31
  31. package/examples/jsm/nodes/accessors/ModelNode.js +1 -2
  32. package/examples/jsm/nodes/accessors/MorphNode.js +5 -5
  33. package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
  34. package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
  35. package/examples/jsm/nodes/accessors/SkinningNode.js +13 -3
  36. package/examples/jsm/nodes/accessors/TextureNode.js +3 -3
  37. package/examples/jsm/nodes/code/FunctionNode.js +1 -1
  38. package/examples/jsm/nodes/core/AssignNode.js +72 -0
  39. package/examples/jsm/nodes/core/LightingModel.js +3 -1
  40. package/examples/jsm/nodes/core/Node.js +7 -12
  41. package/examples/jsm/nodes/core/NodeBuilder.js +126 -16
  42. package/examples/jsm/nodes/core/NodeUtils.js +4 -2
  43. package/examples/jsm/nodes/core/OutputStructNode.js +1 -1
  44. package/examples/jsm/nodes/core/ParameterNode.js +33 -0
  45. package/examples/jsm/nodes/core/PropertyNode.js +4 -10
  46. package/examples/jsm/nodes/core/StackNode.js +7 -17
  47. package/examples/jsm/nodes/core/TempNode.js +1 -1
  48. package/examples/jsm/nodes/core/VarNode.js +6 -35
  49. package/examples/jsm/nodes/core/VaryingNode.js +2 -0
  50. package/examples/jsm/nodes/display/BumpMapNode.js +35 -13
  51. package/examples/jsm/nodes/display/NormalMapNode.js +3 -1
  52. package/examples/jsm/nodes/display/ViewportNode.js +14 -4
  53. package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +20 -6
  54. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -7
  55. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +8 -3
  56. package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +8 -0
  57. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +8 -0
  58. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +93 -43
  59. package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -2
  60. package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
  61. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +19 -5
  62. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +1 -1
  63. package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -6
  64. package/examples/jsm/nodes/lighting/LightingContextNode.js +21 -57
  65. package/examples/jsm/nodes/lighting/LightsNode.js +62 -4
  66. package/examples/jsm/nodes/lighting/PointLightNode.js +1 -1
  67. package/examples/jsm/nodes/lighting/SpotLightNode.js +1 -1
  68. package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
  69. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +70 -71
  70. package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +5 -5
  71. package/examples/jsm/nodes/materials/Materials.js +1 -0
  72. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
  73. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
  74. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +47 -20
  75. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +6 -6
  76. package/examples/jsm/nodes/materials/NodeMaterial.js +17 -20
  77. package/examples/jsm/nodes/materialx/lib/mx_noise.js +5 -5
  78. package/examples/jsm/nodes/math/OperatorNode.js +5 -21
  79. package/examples/jsm/nodes/shadernode/ShaderNode.js +128 -9
  80. package/examples/jsm/nodes/utils/ArrayElementNode.js +2 -0
  81. package/examples/jsm/nodes/utils/DiscardNode.js +3 -2
  82. package/examples/jsm/nodes/utils/JoinNode.js +11 -1
  83. package/examples/jsm/nodes/utils/LoopNode.js +36 -24
  84. package/examples/jsm/nodes/utils/SplitNode.js +2 -0
  85. package/examples/jsm/objects/BatchedMesh.js +586 -0
  86. package/examples/jsm/objects/InstancedPoints.js +21 -0
  87. package/examples/jsm/objects/Lensflare.js +20 -0
  88. package/examples/jsm/objects/ReflectorForSSRPass.js +3 -0
  89. package/examples/jsm/objects/Refractor.js +3 -0
  90. package/examples/jsm/objects/Sky.js +5 -3
  91. package/examples/jsm/objects/Water.js +5 -2
  92. package/examples/jsm/objects/Water2.js +3 -0
  93. package/examples/jsm/physics/AmmoPhysics.js +21 -0
  94. package/examples/jsm/physics/RapierPhysics.js +21 -0
  95. package/examples/jsm/postprocessing/BokehPass.js +3 -2
  96. package/examples/jsm/postprocessing/LUTPass.js +2 -1
  97. package/examples/jsm/postprocessing/OutputPass.js +1 -0
  98. package/examples/jsm/postprocessing/Pass.js +14 -3
  99. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  100. package/examples/jsm/postprocessing/SMAAPass.js +0 -2
  101. package/examples/jsm/postprocessing/TAARenderPass.js +1 -2
  102. package/examples/jsm/renderers/CSS3DRenderer.js +3 -9
  103. package/examples/jsm/renderers/SVGRenderer.js +9 -6
  104. package/examples/jsm/renderers/common/Bindings.js +1 -1
  105. package/examples/jsm/renderers/common/RenderObject.js +8 -1
  106. package/examples/jsm/renderers/common/RenderObjects.js +1 -1
  107. package/examples/jsm/renderers/common/Textures.js +4 -36
  108. package/examples/jsm/renderers/common/nodes/Nodes.js +53 -18
  109. package/examples/jsm/renderers/webgl/WebGLBackend.js +291 -50
  110. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +88 -12
  111. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +40 -5
  112. package/examples/jsm/renderers/webgl/utils/WebGLState.js +14 -2
  113. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +2 -0
  114. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +36 -4
  115. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +2 -0
  116. package/examples/jsm/shaders/AfterimageShader.js +2 -0
  117. package/examples/jsm/shaders/BasicShader.js +2 -0
  118. package/examples/jsm/shaders/BlendShader.js +2 -0
  119. package/examples/jsm/shaders/BokehShader.js +2 -0
  120. package/examples/jsm/shaders/BokehShader2.js +4 -0
  121. package/examples/jsm/shaders/BrightnessContrastShader.js +2 -0
  122. package/examples/jsm/shaders/ColorCorrectionShader.js +2 -0
  123. package/examples/jsm/shaders/DOFMipMapShader.js +2 -0
  124. package/examples/jsm/shaders/DepthLimitedBlurShader.js +5 -0
  125. package/examples/jsm/shaders/FXAAShader.js +2 -0
  126. package/examples/jsm/shaders/FilmShader.js +1 -1
  127. package/examples/jsm/shaders/FocusShader.js +2 -0
  128. package/examples/jsm/shaders/FreiChenShader.js +2 -0
  129. package/examples/jsm/shaders/GodRaysShader.js +8 -0
  130. package/examples/jsm/shaders/HalftoneShader.js +2 -0
  131. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +2 -0
  132. package/examples/jsm/shaders/HueSaturationShader.js +2 -0
  133. package/examples/jsm/shaders/KaleidoShader.js +2 -0
  134. package/examples/jsm/shaders/LuminosityHighPassShader.js +2 -0
  135. package/examples/jsm/shaders/LuminosityShader.js +2 -0
  136. package/examples/jsm/shaders/MMDToonShader.js +2 -0
  137. package/examples/jsm/shaders/MirrorShader.js +2 -0
  138. package/examples/jsm/shaders/NormalMapShader.js +2 -0
  139. package/examples/jsm/shaders/OutputShader.js +4 -5
  140. package/examples/jsm/shaders/SAOShader.js +5 -0
  141. package/examples/jsm/shaders/SMAAShader.js +6 -0
  142. package/examples/jsm/shaders/SSAOShader.js +6 -0
  143. package/examples/jsm/shaders/SSRShader.js +6 -0
  144. package/examples/jsm/shaders/SobelOperatorShader.js +2 -0
  145. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +2 -0
  146. package/examples/jsm/shaders/TechnicolorShader.js +2 -0
  147. package/examples/jsm/shaders/TriangleBlurShader.js +2 -0
  148. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -0
  149. package/examples/jsm/shaders/VelocityShader.js +2 -0
  150. package/examples/jsm/shaders/VerticalTiltShiftShader.js +2 -0
  151. package/examples/jsm/shaders/WaterRefractionShader.js +2 -0
  152. package/examples/jsm/transpiler/AST.js +231 -0
  153. package/examples/jsm/transpiler/GLSLDecoder.js +899 -0
  154. package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
  155. package/examples/jsm/transpiler/TSLEncoder.js +611 -0
  156. package/examples/jsm/transpiler/Transpiler.js +18 -0
  157. package/examples/jsm/webxr/VRButton.js +1 -1
  158. package/examples/jsm/webxr/XRButton.js +7 -5
  159. package/examples/jsm/webxr/XREstimatedLight.js +1 -1
  160. package/package.json +4 -1
  161. package/src/constants.js +7 -1
  162. package/src/extras/PMREMGenerator.js +7 -1
  163. package/src/loaders/MaterialLoader.js +10 -2
  164. package/src/materials/Material.js +27 -13
  165. package/src/math/Box3.js +35 -18
  166. package/src/math/Vector3.js +11 -12
  167. package/src/objects/SkinnedMesh.js +6 -7
  168. package/src/renderers/WebGLMultiviewRenderTarget.js +35 -0
  169. package/src/renderers/WebGLRenderer.js +199 -45
  170. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -0
  171. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -2
  172. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  173. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +8 -6
  174. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -2
  175. package/src/renderers/webgl/WebGLBackground.js +1 -1
  176. package/src/renderers/webgl/WebGLMultiview.js +100 -0
  177. package/src/renderers/webgl/WebGLProgram.js +130 -50
  178. package/src/renderers/webgl/WebGLPrograms.js +8 -0
  179. package/src/renderers/webgl/WebGLState.js +25 -4
  180. package/src/renderers/webgl/WebGLTextures.js +197 -20
  181. package/src/renderers/webxr/WebXRManager.js +36 -12
  182. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -76
  183. package/examples/jsm/nodes/accessors/LineMaterialNode.js +0 -29
@@ -147,7 +147,7 @@ export class XREstimatedLight extends Group {
147
147
  this.directionalLight.intensity = 0;
148
148
  this.add( this.directionalLight );
149
149
 
150
- // Will be set to a cube map in the SessionLightProbe is environment estimation is
150
+ // Will be set to a cube map in the SessionLightProbe if environment estimation is
151
151
  // available and requested.
152
152
  this.environment = null;
153
153
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-three",
3
- "version": "0.157.0",
3
+ "version": "0.158.0",
4
4
  "description": "JavaScript 3D library",
5
5
  "type": "module",
6
6
  "main": "./build/three.js",
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "./examples/fonts/*": "./examples/fonts/*",
14
14
  "./examples/jsm/*": "./examples/jsm/*",
15
+ "./addons": "./examples/jsm/Addons.js",
15
16
  "./addons/*": "./examples/jsm/*",
16
17
  "./src/*": "./src/*",
17
18
  "./nodes": "./examples/jsm/nodes/Nodes.js"
@@ -59,6 +60,7 @@
59
60
  "test-e2e": "node test/e2e/puppeteer.js",
60
61
  "test-e2e-cov": "node test/e2e/check-coverage.js",
61
62
  "test-treeshake": "rollup -c test/rollup.treeshake.config.js",
63
+ "test-circular-deps": "dpdm --no-warning --no-tree --exit-code circular:1 examples/jsm/nodes/Nodes.js",
62
64
  "make-screenshot": "node test/e2e/puppeteer.js --make"
63
65
  },
64
66
  "keywords": [
@@ -89,6 +91,7 @@
89
91
  "@rollup/plugin-terser": "^0.4.0",
90
92
  "chalk": "^5.2.0",
91
93
  "concurrently": "^8.0.1",
94
+ "dpdm": "^3.14.0",
92
95
  "eslint": "^8.37.0",
93
96
  "eslint-config-mdcs": "^5.0.0",
94
97
  "eslint-plugin-compat": "^4.1.2",
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '157';
1
+ export const REVISION = '158';
2
2
 
3
3
  export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
4
4
  export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -36,6 +36,10 @@ export const OneMinusDstAlphaFactor = 207;
36
36
  export const DstColorFactor = 208;
37
37
  export const OneMinusDstColorFactor = 209;
38
38
  export const SrcAlphaSaturateFactor = 210;
39
+ export const ConstantColorFactor = 211;
40
+ export const OneMinusConstantColorFactor = 212;
41
+ export const ConstantAlphaFactor = 213;
42
+ export const OneMinusConstantAlphaFactor = 214;
39
43
  export const NeverDepth = 0;
40
44
  export const AlwaysDepth = 1;
41
45
  export const LessDepth = 2;
@@ -53,6 +57,8 @@ export const ReinhardToneMapping = 2;
53
57
  export const CineonToneMapping = 3;
54
58
  export const ACESFilmicToneMapping = 4;
55
59
  export const CustomToneMapping = 5;
60
+ export const AttachedBindMode = 'attached';
61
+ export const DetachedBindMode = 'detached';
56
62
 
57
63
  export const UVMapping = 300;
58
64
  export const CubeReflectionMapping = 301;
@@ -38,6 +38,8 @@ const MAX_SAMPLES = 20;
38
38
  const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
39
39
  const _clearColor = /*@__PURE__*/ new Color();
40
40
  let _oldTarget = null;
41
+ let _oldActiveCubeFace = 0;
42
+ let _oldActiveMipmapLevel = 0;
41
43
 
42
44
  // Golden Ratio
43
45
  const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
@@ -103,6 +105,8 @@ class PMREMGenerator {
103
105
  fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
104
106
 
105
107
  _oldTarget = this._renderer.getRenderTarget();
108
+ _oldActiveCubeFace = this._renderer.getActiveCubeFace();
109
+ _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
106
110
 
107
111
  this._setSize( 256 );
108
112
 
@@ -215,7 +219,7 @@ class PMREMGenerator {
215
219
 
216
220
  _cleanup( outputTarget ) {
217
221
 
218
- this._renderer.setRenderTarget( _oldTarget );
222
+ this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
219
223
  outputTarget.scissorTest = false;
220
224
  _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
221
225
 
@@ -234,6 +238,8 @@ class PMREMGenerator {
234
238
  }
235
239
 
236
240
  _oldTarget = this._renderer.getRenderTarget();
241
+ _oldActiveCubeFace = this._renderer.getActiveCubeFace();
242
+ _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
237
243
 
238
244
  const cubeUVRenderTarget = renderTarget || this._allocateTargets();
239
245
  this._textureToCubeUV( texture, cubeUVRenderTarget );
@@ -122,11 +122,18 @@ class MaterialLoader extends Loader {
122
122
  if ( json.transparent !== undefined ) material.transparent = json.transparent;
123
123
  if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
124
124
  if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
125
+ if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
125
126
  if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
126
127
  if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
127
128
  if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
128
-
129
- if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
129
+ if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
130
+ if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
131
+ if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
132
+ if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
133
+ if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
134
+ if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
135
+ if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
136
+ if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
130
137
  if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
131
138
  if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
132
139
  if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
@@ -134,6 +141,7 @@ class MaterialLoader extends Loader {
134
141
  if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
135
142
  if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
136
143
  if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
144
+ if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
137
145
 
138
146
  if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
139
147
  if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
@@ -1,3 +1,4 @@
1
+ import { Color } from '../math/Color.js';
1
2
  import { EventDispatcher } from '../core/EventDispatcher.js';
2
3
  import { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
3
4
  import * as MathUtils from '../math/MathUtils.js';
@@ -33,6 +34,8 @@ class Material extends EventDispatcher {
33
34
  this.blendSrcAlpha = null;
34
35
  this.blendDstAlpha = null;
35
36
  this.blendEquationAlpha = null;
37
+ this.blendColor = new Color( 0, 0, 0 );
38
+ this.blendAlpha = 0;
36
39
 
37
40
  this.depthFunc = LessEqualDepth;
38
41
  this.depthTest = true;
@@ -325,19 +328,28 @@ class Material extends EventDispatcher {
325
328
  if ( this.opacity < 1 ) data.opacity = this.opacity;
326
329
  if ( this.transparent === true ) data.transparent = true;
327
330
 
328
- data.depthFunc = this.depthFunc;
329
- data.depthTest = this.depthTest;
330
- data.depthWrite = this.depthWrite;
331
- data.colorWrite = this.colorWrite;
332
-
333
- data.stencilWrite = this.stencilWrite;
334
- data.stencilWriteMask = this.stencilWriteMask;
335
- data.stencilFunc = this.stencilFunc;
336
- data.stencilRef = this.stencilRef;
337
- data.stencilFuncMask = this.stencilFuncMask;
338
- data.stencilFail = this.stencilFail;
339
- data.stencilZFail = this.stencilZFail;
340
- data.stencilZPass = this.stencilZPass;
331
+ if ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;
332
+ if ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;
333
+ if ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;
334
+ if ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;
335
+ if ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;
336
+ if ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;
337
+ if ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();
338
+ if ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;
339
+
340
+ if ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;
341
+ if ( this.depthTest === false ) data.depthTest = this.depthTest;
342
+ if ( this.depthWrite === false ) data.depthWrite = this.depthWrite;
343
+ if ( this.colorWrite === false ) data.colorWrite = this.colorWrite;
344
+
345
+ if ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;
346
+ if ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;
347
+ if ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;
348
+ if ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;
349
+ if ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;
350
+ if ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;
351
+ if ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;
352
+ if ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;
341
353
 
342
354
  // rotation (SpriteMaterial)
343
355
  if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
@@ -429,6 +441,8 @@ class Material extends EventDispatcher {
429
441
  this.blendSrcAlpha = source.blendSrcAlpha;
430
442
  this.blendDstAlpha = source.blendDstAlpha;
431
443
  this.blendEquationAlpha = source.blendEquationAlpha;
444
+ this.blendColor.copy( source.blendColor );
445
+ this.blendAlpha = source.blendAlpha;
432
446
 
433
447
  this.depthFunc = source.depthFunc;
434
448
  this.depthTest = source.depthTest;
package/src/math/Box3.js CHANGED
@@ -159,37 +159,53 @@ class Box3 {
159
159
 
160
160
  object.updateWorldMatrix( false, false );
161
161
 
162
- if ( object.boundingBox !== undefined ) {
162
+ const geometry = object.geometry;
163
163
 
164
- if ( object.boundingBox === null ) {
164
+ if ( geometry !== undefined ) {
165
165
 
166
- object.computeBoundingBox();
166
+ const positionAttribute = geometry.getAttribute( 'position' );
167
167
 
168
- }
168
+ // precise AABB computation based on vertex data requires at least a position attribute.
169
+ // instancing isn't supported so far and uses the normal (conservative) code path.
169
170
 
170
- _box.copy( object.boundingBox );
171
- _box.applyMatrix4( object.matrixWorld );
171
+ if ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {
172
172
 
173
- this.union( _box );
173
+ for ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {
174
174
 
175
- } else {
175
+ if ( object.isMesh === true ) {
176
+
177
+ object.getVertexPosition( i, _vector );
178
+
179
+ } else {
180
+
181
+ _vector.fromBufferAttribute( positionAttribute, i );
182
+
183
+ }
184
+
185
+ _vector.applyMatrix4( object.matrixWorld );
186
+ this.expandByPoint( _vector );
176
187
 
177
- const geometry = object.geometry;
188
+ }
189
+
190
+ } else {
178
191
 
179
- if ( geometry !== undefined ) {
192
+ if ( object.boundingBox !== undefined ) {
180
193
 
181
- if ( precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined ) {
194
+ // object-level bounding box
182
195
 
183
- const position = geometry.attributes.position;
184
- for ( let i = 0, l = position.count; i < l; i ++ ) {
196
+ if ( object.boundingBox === null ) {
185
197
 
186
- _vector.fromBufferAttribute( position, i ).applyMatrix4( object.matrixWorld );
187
- this.expandByPoint( _vector );
198
+ object.computeBoundingBox();
188
199
 
189
200
  }
190
201
 
202
+ _box.copy( object.boundingBox );
203
+
204
+
191
205
  } else {
192
206
 
207
+ // geometry-level bounding box
208
+
193
209
  if ( geometry.boundingBox === null ) {
194
210
 
195
211
  geometry.computeBoundingBox();
@@ -197,12 +213,13 @@ class Box3 {
197
213
  }
198
214
 
199
215
  _box.copy( geometry.boundingBox );
200
- _box.applyMatrix4( object.matrixWorld );
201
-
202
- this.union( _box );
203
216
 
204
217
  }
205
218
 
219
+ _box.applyMatrix4( object.matrixWorld );
220
+
221
+ this.union( _box );
222
+
206
223
  }
207
224
 
208
225
  }
@@ -251,21 +251,20 @@ class Vector3 {
251
251
 
252
252
  applyQuaternion( q ) {
253
253
 
254
- const x = this.x, y = this.y, z = this.z;
255
- const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
254
+ // quaternion q is assumed to have unit length
256
255
 
257
- // calculate quat * vector
258
-
259
- const ix = qw * x + qy * z - qz * y;
260
- const iy = qw * y + qz * x - qx * z;
261
- const iz = qw * z + qx * y - qy * x;
262
- const iw = - qx * x - qy * y - qz * z;
256
+ const vx = this.x, vy = this.y, vz = this.z;
257
+ const qx = q.x, qy = q.y, qz = q.z, qw = q.w;
263
258
 
264
- // calculate result * inverse quat
259
+ // t = 2 * cross( q.xyz, v );
260
+ const tx = 2 * ( qy * vz - qz * vy );
261
+ const ty = 2 * ( qz * vx - qx * vz );
262
+ const tz = 2 * ( qx * vy - qy * vx );
265
263
 
266
- this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;
267
- this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;
268
- this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;
264
+ // v + q.w * t + cross( q.xyz, t );
265
+ this.x = vx + qw * tx + qy * tz - qz * ty;
266
+ this.y = vy + qw * ty + qz * tx - qx * tz;
267
+ this.z = vz + qw * tz + qx * ty - qy * tx;
269
268
 
270
269
  return this;
271
270
 
@@ -5,6 +5,7 @@ import { Sphere } from '../math/Sphere.js';
5
5
  import { Vector3 } from '../math/Vector3.js';
6
6
  import { Vector4 } from '../math/Vector4.js';
7
7
  import { Ray } from '../math/Ray.js';
8
+ import { AttachedBindMode, DetachedBindMode } from '../constants.js';
8
9
 
9
10
  const _basePosition = /*@__PURE__*/ new Vector3();
10
11
 
@@ -29,7 +30,7 @@ class SkinnedMesh extends Mesh {
29
30
 
30
31
  this.type = 'SkinnedMesh';
31
32
 
32
- this.bindMode = 'attached';
33
+ this.bindMode = AttachedBindMode;
33
34
  this.bindMatrix = new Matrix4();
34
35
  this.bindMatrixInverse = new Matrix4();
35
36
 
@@ -54,8 +55,7 @@ class SkinnedMesh extends Mesh {
54
55
 
55
56
  for ( let i = 0; i < positionAttribute.count; i ++ ) {
56
57
 
57
- _vertex.fromBufferAttribute( positionAttribute, i );
58
- this.applyBoneTransform( i, _vertex );
58
+ this.getVertexPosition( i, _vertex );
59
59
  this.boundingBox.expandByPoint( _vertex );
60
60
 
61
61
  }
@@ -78,8 +78,7 @@ class SkinnedMesh extends Mesh {
78
78
 
79
79
  for ( let i = 0; i < positionAttribute.count; i ++ ) {
80
80
 
81
- _vertex.fromBufferAttribute( positionAttribute, i );
82
- this.applyBoneTransform( i, _vertex );
81
+ this.getVertexPosition( i, _vertex );
83
82
  this.boundingSphere.expandByPoint( _vertex );
84
83
 
85
84
  }
@@ -205,11 +204,11 @@ class SkinnedMesh extends Mesh {
205
204
 
206
205
  super.updateMatrixWorld( force );
207
206
 
208
- if ( this.bindMode === 'attached' ) {
207
+ if ( this.bindMode === AttachedBindMode ) {
209
208
 
210
209
  this.bindMatrixInverse.copy( this.matrixWorld ).invert();
211
210
 
212
- } else if ( this.bindMode === 'detached' ) {
211
+ } else if ( this.bindMode === DetachedBindMode ) {
213
212
 
214
213
  this.bindMatrixInverse.copy( this.bindMatrix ).invert();
215
214
 
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @author fernandojsg / http://fernandojsg.com
3
+ * @author Takahiro https://github.com/takahirox
4
+ */
5
+
6
+ import { WebGLRenderTarget } from './WebGLRenderTarget.js';
7
+
8
+ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
9
+
10
+ constructor( width, height, numViews, options = {} ) {
11
+
12
+ super( width, height, options );
13
+
14
+ this.depthBuffer = false;
15
+ this.stencilBuffer = false;
16
+
17
+ this.numViews = numViews;
18
+
19
+ }
20
+
21
+ copy( source ) {
22
+
23
+ super.copy( source );
24
+
25
+ this.numViews = source.numViews;
26
+
27
+ return this;
28
+
29
+ }
30
+
31
+ }
32
+
33
+ WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
34
+
35
+ export { WebGLMultiviewRenderTarget };