super-three 0.161.0 → 0.163.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 (206) hide show
  1. package/build/three.cjs +822 -1332
  2. package/build/three.module.js +820 -1328
  3. package/build/three.module.min.js +1 -1
  4. package/examples/jsm/controls/DragControls.js +91 -30
  5. package/examples/jsm/controls/OrbitControls.js +32 -6
  6. package/examples/jsm/controls/TransformControls.js +9 -9
  7. package/examples/jsm/exporters/GLTFExporter.js +30 -3
  8. package/examples/jsm/exporters/USDZExporter.js +15 -0
  9. package/examples/jsm/geometries/TextGeometry.js +10 -2
  10. package/examples/jsm/interactive/HTMLMesh.js +7 -9
  11. package/examples/jsm/interactive/InteractiveGroup.js +15 -25
  12. package/examples/jsm/libs/fflate.module.js +694 -496
  13. package/examples/jsm/libs/rhino3dm/rhino3dm.js +1 -8723
  14. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +1 -8734
  15. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  16. package/examples/jsm/libs/tween.module.js +32 -14
  17. package/examples/jsm/lines/LineMaterial.js +0 -2
  18. package/examples/jsm/loaders/3DMLoader.js +13 -21
  19. package/examples/jsm/loaders/3MFLoader.js +2 -0
  20. package/examples/jsm/loaders/EXRLoader.js +89 -19
  21. package/examples/jsm/loaders/FBXLoader.js +1 -1
  22. package/examples/jsm/loaders/GLTFLoader.js +6 -0
  23. package/examples/jsm/loaders/KTX2Loader.js +2 -6
  24. package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
  25. package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
  26. package/examples/jsm/loaders/LUTImageLoader.js +0 -14
  27. package/examples/jsm/loaders/RGBMLoader.js +16 -0
  28. package/examples/jsm/loaders/VOXLoader.js +9 -2
  29. package/examples/jsm/loaders/VRMLLoader.js +6 -2
  30. package/examples/jsm/misc/GPUComputationRenderer.js +0 -6
  31. package/examples/jsm/misc/ProgressiveLightMap.js +1 -0
  32. package/examples/jsm/nodes/Nodes.js +15 -8
  33. package/examples/jsm/nodes/accessors/AccessorsUtils.js +10 -0
  34. package/examples/jsm/nodes/accessors/BatchNode.js +78 -0
  35. package/examples/jsm/nodes/accessors/ClippingNode.js +144 -0
  36. package/examples/jsm/nodes/accessors/InstanceNode.js +25 -2
  37. package/examples/jsm/nodes/accessors/MaterialNode.js +2 -2
  38. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -12
  39. package/examples/jsm/nodes/accessors/MorphNode.js +20 -10
  40. package/examples/jsm/nodes/accessors/NormalNode.js +12 -2
  41. package/examples/jsm/nodes/accessors/ReferenceNode.js +87 -29
  42. package/examples/jsm/nodes/accessors/RendererReferenceNode.js +29 -0
  43. package/examples/jsm/nodes/accessors/SkinningNode.js +31 -10
  44. package/examples/jsm/nodes/accessors/StorageBufferNode.js +18 -0
  45. package/examples/jsm/nodes/accessors/TangentNode.js +8 -2
  46. package/examples/jsm/nodes/accessors/TextureNode.js +30 -7
  47. package/examples/jsm/nodes/accessors/UniformsNode.js +140 -0
  48. package/examples/jsm/nodes/code/CodeNode.js +6 -0
  49. package/examples/jsm/nodes/core/AssignNode.js +68 -12
  50. package/examples/jsm/nodes/core/Node.js +67 -6
  51. package/examples/jsm/nodes/core/NodeBuilder.js +23 -24
  52. package/examples/jsm/nodes/core/NodeFrame.js +8 -8
  53. package/examples/jsm/nodes/core/NodeUtils.js +2 -2
  54. package/examples/jsm/nodes/core/TempNode.js +1 -1
  55. package/examples/jsm/nodes/core/UniformNode.js +20 -0
  56. package/examples/jsm/nodes/display/BlendModeNode.js +30 -1
  57. package/examples/jsm/nodes/display/NormalMapNode.js +3 -5
  58. package/examples/jsm/nodes/display/PassNode.js +17 -1
  59. package/examples/jsm/nodes/display/ToneMappingNode.js +8 -4
  60. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -0
  61. package/examples/jsm/nodes/fog/FogExp2Node.js +4 -5
  62. package/examples/jsm/nodes/fog/FogNode.js +13 -3
  63. package/examples/jsm/nodes/fog/FogRangeNode.js +4 -3
  64. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +1 -1
  65. package/examples/jsm/nodes/lighting/EnvironmentNode.js +12 -69
  66. package/examples/jsm/nodes/materials/NodeMaterial.js +70 -17
  67. package/examples/jsm/nodes/math/CondNode.js +42 -7
  68. package/examples/jsm/nodes/math/MathNode.js +20 -0
  69. package/examples/jsm/nodes/pmrem/PMREMNode.js +193 -0
  70. package/examples/jsm/nodes/pmrem/PMREMUtils.js +288 -0
  71. package/examples/jsm/nodes/shadernode/ShaderNode.js +1 -1
  72. package/examples/jsm/nodes/utils/ArrayElementNode.js +0 -6
  73. package/examples/jsm/nodes/utils/EquirectUVNode.js +1 -1
  74. package/examples/jsm/nodes/utils/LoopNode.js +2 -0
  75. package/examples/jsm/nodes/utils/StorageArrayElementNode.js +91 -0
  76. package/examples/jsm/objects/QuadMesh.js +7 -23
  77. package/examples/jsm/physics/RapierPhysics.js +4 -4
  78. package/examples/jsm/postprocessing/GlitchPass.js +0 -3
  79. package/examples/jsm/postprocessing/LUTPass.js +5 -71
  80. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  81. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  82. package/examples/jsm/postprocessing/SSAOPass.js +0 -3
  83. package/examples/jsm/renderers/common/Animation.js +3 -0
  84. package/examples/jsm/renderers/common/Background.js +3 -3
  85. package/examples/jsm/renderers/common/ClippingContext.js +165 -0
  86. package/examples/jsm/renderers/common/Info.js +11 -19
  87. package/examples/jsm/renderers/common/PostProcessing.js +12 -4
  88. package/examples/jsm/renderers/common/RenderContext.js +3 -1
  89. package/examples/jsm/renderers/common/RenderContexts.js +2 -13
  90. package/examples/jsm/renderers/common/RenderObject.js +46 -3
  91. package/examples/jsm/renderers/common/RenderObjects.js +2 -0
  92. package/examples/jsm/renderers/common/Renderer.js +113 -39
  93. package/examples/jsm/renderers/common/StorageBufferAttribute.js +2 -2
  94. package/examples/jsm/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  95. package/examples/jsm/renderers/common/Textures.js +3 -13
  96. package/examples/jsm/renderers/common/UniformsGroup.js +6 -4
  97. package/examples/jsm/renderers/common/extras/PMREMGenerator.js +777 -0
  98. package/examples/jsm/renderers/common/nodes/NodeStorageBuffer.js +23 -0
  99. package/examples/jsm/renderers/common/nodes/NodeUniformBuffer.js +23 -0
  100. package/examples/jsm/renderers/common/nodes/Nodes.js +6 -18
  101. package/examples/jsm/renderers/webgl/WebGLBackend.js +174 -30
  102. package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +141 -0
  103. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +136 -11
  104. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +8 -2
  105. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +1 -0
  106. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +90 -0
  107. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -1
  108. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -2
  109. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -2
  110. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +67 -37
  111. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +20 -43
  112. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +32 -1
  113. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -4
  114. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +94 -20
  115. package/examples/jsm/shaders/OutputShader.js +4 -0
  116. package/examples/jsm/utils/GPUStatsPanel.js +10 -45
  117. package/examples/jsm/utils/SkeletonUtils.js +14 -3
  118. package/examples/jsm/utils/TextureUtils.js +1 -1
  119. package/examples/jsm/webxr/VRButton.js +13 -5
  120. package/examples/jsm/webxr/XRButton.js +0 -1
  121. package/examples/jsm/webxr/XRControllerModelFactory.js +8 -0
  122. package/package.json +4 -3
  123. package/src/Three.Legacy.js +20 -0
  124. package/src/Three.js +0 -2
  125. package/src/animation/AnimationClip.js +1 -1
  126. package/src/constants.js +4 -7
  127. package/src/core/BufferAttribute.js +0 -11
  128. package/src/core/BufferGeometry.js +23 -29
  129. package/src/core/Object3D.js +21 -7
  130. package/src/core/Raycaster.js +18 -4
  131. package/src/core/RenderTarget.js +44 -21
  132. package/src/extras/PMREMGenerator.js +11 -0
  133. package/src/extras/curves/EllipseCurve.js +2 -2
  134. package/src/helpers/SpotLightHelper.js +18 -1
  135. package/src/loaders/DataTextureLoader.js +0 -4
  136. package/src/loaders/MaterialLoader.js +1 -0
  137. package/src/loaders/ObjectLoader.js +4 -1
  138. package/src/materials/Material.js +2 -1
  139. package/src/materials/MeshBasicMaterial.js +3 -0
  140. package/src/materials/MeshLambertMaterial.js +3 -0
  141. package/src/materials/MeshPhongMaterial.js +3 -0
  142. package/src/materials/MeshStandardMaterial.js +3 -0
  143. package/src/materials/ShaderMaterial.js +0 -4
  144. package/src/math/Quaternion.js +13 -12
  145. package/src/math/Spherical.js +4 -5
  146. package/src/math/Vector3.js +7 -7
  147. package/src/objects/BatchedMesh.js +4 -3
  148. package/src/objects/InstancedMesh.js +63 -0
  149. package/src/objects/Mesh.js +0 -1
  150. package/src/renderers/WebGLCubeRenderTarget.js +1 -10
  151. package/src/renderers/WebGLRenderer.js +70 -136
  152. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -0
  153. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  154. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  155. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
  156. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  157. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
  158. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
  159. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +1 -1
  160. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  161. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +11 -2
  162. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +32 -22
  163. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +23 -0
  164. package/src/renderers/shaders/ShaderChunk.js +2 -0
  165. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +3 -2
  166. package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
  167. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
  168. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +1 -0
  169. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -0
  170. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +1 -0
  171. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -0
  172. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -0
  173. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +1 -0
  174. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -0
  175. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +1 -0
  176. package/src/renderers/shaders/ShaderLib/points.glsl.js +1 -0
  177. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
  178. package/src/renderers/shaders/ShaderLib.js +3 -2
  179. package/src/renderers/shaders/UniformsLib.js +1 -0
  180. package/src/renderers/shaders/UniformsUtils.js +10 -1
  181. package/src/renderers/webgl/WebGLAttributes.js +6 -33
  182. package/src/renderers/webgl/WebGLBackground.js +18 -0
  183. package/src/renderers/webgl/WebGLBindingStates.js +14 -51
  184. package/src/renderers/webgl/WebGLBufferRenderer.js +3 -25
  185. package/src/renderers/webgl/WebGLCapabilities.js +2 -12
  186. package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
  187. package/src/renderers/webgl/WebGLExtensions.js +4 -19
  188. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +3 -25
  189. package/src/renderers/webgl/WebGLLights.js +6 -32
  190. package/src/renderers/webgl/WebGLMaterials.js +26 -4
  191. package/src/renderers/webgl/WebGLMorphtargets.js +79 -210
  192. package/src/renderers/webgl/WebGLProgram.js +30 -48
  193. package/src/renderers/webgl/WebGLPrograms.js +5 -14
  194. package/src/renderers/webgl/WebGLRenderStates.js +8 -6
  195. package/src/renderers/webgl/WebGLState.js +21 -75
  196. package/src/renderers/webgl/WebGLTextures.js +143 -275
  197. package/src/renderers/webgl/WebGLUniformsGroups.js +1 -1
  198. package/src/renderers/webgl/WebGLUtils.js +6 -57
  199. package/src/renderers/webxr/WebXRDepthSensing.js +2 -3
  200. package/src/renderers/webxr/WebXRManager.js +2 -2
  201. package/src/scenes/Scene.js +14 -0
  202. package/src/textures/Texture.js +6 -24
  203. package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
  204. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
  205. package/src/renderers/WebGL1Renderer.js +0 -7
  206. package/src/renderers/WebGLMultipleRenderTargets.js +0 -82
@@ -4,7 +4,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
4
4
  let updateList = {};
5
5
  let allocatedBindingPoints = [];
6
6
 
7
- const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program
7
+ const maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program
8
8
 
9
9
  function bind( uniformsGroup, program ) {
10
10
 
@@ -1,9 +1,7 @@
1
- import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, _SRGBAFormat, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer } from '../../constants.js';
1
+ import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
2
2
  import { ColorManagement } from '../../math/ColorManagement.js';
3
3
 
4
- function WebGLUtils( gl, extensions, capabilities ) {
5
-
6
- const isWebGL2 = capabilities.isWebGL2;
4
+ function WebGLUtils( gl, extensions ) {
7
5
 
8
6
  function convert( p, colorSpace = NoColorSpace ) {
9
7
 
@@ -14,6 +12,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
14
12
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
15
13
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
16
14
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
15
+ if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
17
16
 
18
17
  if ( p === ByteType ) return gl.BYTE;
19
18
  if ( p === ShortType ) return gl.SHORT;
@@ -21,50 +20,16 @@ function WebGLUtils( gl, extensions, capabilities ) {
21
20
  if ( p === IntType ) return gl.INT;
22
21
  if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
23
22
  if ( p === FloatType ) return gl.FLOAT;
24
-
25
- if ( p === HalfFloatType ) {
26
-
27
- if ( isWebGL2 ) return gl.HALF_FLOAT;
28
-
29
- extension = extensions.get( 'OES_texture_half_float' );
30
-
31
- if ( extension !== null ) {
32
-
33
- return extension.HALF_FLOAT_OES;
34
-
35
- } else {
36
-
37
- return null;
38
-
39
- }
40
-
41
- }
23
+ if ( p === HalfFloatType ) return gl.HALF_FLOAT;
42
24
 
43
25
  if ( p === AlphaFormat ) return gl.ALPHA;
26
+ if ( p === RGBFormat ) return gl.RGB;
44
27
  if ( p === RGBAFormat ) return gl.RGBA;
45
28
  if ( p === LuminanceFormat ) return gl.LUMINANCE;
46
29
  if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
47
30
  if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
48
31
  if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
49
32
 
50
- // WebGL 1 sRGB fallback
51
-
52
- if ( p === _SRGBAFormat ) {
53
-
54
- extension = extensions.get( 'EXT_sRGB' );
55
-
56
- if ( extension !== null ) {
57
-
58
- return extension.SRGB_ALPHA_EXT;
59
-
60
- } else {
61
-
62
- return null;
63
-
64
- }
65
-
66
- }
67
-
68
33
  // WebGL2 formats.
69
34
 
70
35
  if ( p === RedFormat ) return gl.RED;
@@ -251,23 +216,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
251
216
 
252
217
  //
253
218
 
254
- if ( p === UnsignedInt248Type ) {
255
-
256
- if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
257
-
258
- extension = extensions.get( 'WEBGL_depth_texture' );
259
-
260
- if ( extension !== null ) {
261
-
262
- return extension.UNSIGNED_INT_24_8_WEBGL;
263
-
264
- } else {
265
-
266
- return null;
267
-
268
- }
269
-
270
- }
219
+ if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
271
220
 
272
221
  // if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
273
222
 
@@ -21,11 +21,11 @@ void main() {
21
21
 
22
22
  if ( coord.x >= 1.0 ) {
23
23
 
24
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
24
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
25
25
 
26
26
  } else {
27
27
 
28
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
28
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
29
29
 
30
30
  }
31
31
 
@@ -73,7 +73,6 @@ class WebXRDepthSensing {
73
73
 
74
74
  const viewport = cameraXR.cameras[ 0 ].viewport;
75
75
  const material = new ShaderMaterial( {
76
- extensions: { fragDepth: true },
77
76
  vertexShader: _occlusion_vertex,
78
77
  fragmentShader: _occlusion_fragment,
79
78
  uniforms: {
@@ -290,10 +290,10 @@ class WebXRManager extends EventDispatcher {
290
290
  currentPixelRatio = renderer.getPixelRatio();
291
291
  renderer.getSize( currentSize );
292
292
 
293
- if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
293
+ if ( session.renderState.layers === undefined ) {
294
294
 
295
295
  const layerInit = {
296
- antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
296
+ antialias: attributes.antialias,
297
297
  alpha: true,
298
298
  depth: attributes.depth,
299
299
  stencil: attributes.stencil,
@@ -1,4 +1,5 @@
1
1
  import { Object3D } from '../core/Object3D.js';
2
+ import { Euler } from '../math/Euler.js';
2
3
 
3
4
  class Scene extends Object3D {
4
5
 
@@ -16,6 +17,10 @@ class Scene extends Object3D {
16
17
 
17
18
  this.backgroundBlurriness = 0;
18
19
  this.backgroundIntensity = 1;
20
+ this.backgroundRotation = new Euler();
21
+
22
+ this.environmentIntensity = 1;
23
+ this.environmentRotation = new Euler();
19
24
 
20
25
  this.overrideMaterial = null;
21
26
 
@@ -37,6 +42,10 @@ class Scene extends Object3D {
37
42
 
38
43
  this.backgroundBlurriness = source.backgroundBlurriness;
39
44
  this.backgroundIntensity = source.backgroundIntensity;
45
+ this.backgroundRotation.copy( source.backgroundRotation );
46
+
47
+ this.environmentIntensity = source.environmentIntensity;
48
+ this.environmentRotation.copy( source.environmentRotation );
40
49
 
41
50
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
42
51
 
@@ -51,8 +60,13 @@ class Scene extends Object3D {
51
60
  const data = super.toJSON( meta );
52
61
 
53
62
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
63
+
54
64
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
55
65
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
66
+ data.object.backgroundRotation = this.backgroundRotation.toArray();
67
+
68
+ if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
69
+ data.object.environmentRotation = this.environmentRotation.toArray();
56
70
 
57
71
  return data;
58
72
 
@@ -8,16 +8,12 @@ import {
8
8
  LinearMipmapLinearFilter,
9
9
  LinearFilter,
10
10
  UVMapping,
11
- sRGBEncoding,
12
- SRGBColorSpace,
13
11
  NoColorSpace,
14
- LinearEncoding
15
12
  } from '../constants.js';
16
13
  import * as MathUtils from '../math/MathUtils.js';
17
14
  import { Vector2 } from '../math/Vector2.js';
18
15
  import { Matrix3 } from '../math/Matrix3.js';
19
16
  import { Source } from './Source.js';
20
- import { warnOnce } from '../utils.js';
21
17
 
22
18
  let _textureId = 0;
23
19
 
@@ -66,17 +62,7 @@ class Texture extends EventDispatcher {
66
62
  this.flipY = true;
67
63
  this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
68
64
 
69
- if ( typeof colorSpace === 'string' ) {
70
-
71
- this.colorSpace = colorSpace;
72
-
73
- } else { // @deprecated, r152
74
-
75
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
76
- this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
77
-
78
- }
79
-
65
+ this.colorSpace = colorSpace;
80
66
 
81
67
  this.userData = {};
82
68
 
@@ -84,7 +70,7 @@ class Texture extends EventDispatcher {
84
70
  this.onUpdate = null;
85
71
 
86
72
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
87
- this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
73
+ this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
88
74
 
89
75
  }
90
76
 
@@ -315,17 +301,13 @@ class Texture extends EventDispatcher {
315
301
 
316
302
  }
317
303
 
318
- get encoding() { // @deprecated, r152
319
-
320
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
321
- return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
304
+ set needsPMREMUpdate( value ) {
322
305
 
323
- }
306
+ if ( value === true ) {
324
307
 
325
- set encoding( encoding ) { // @deprecated, r152
308
+ this.pmremVersion ++;
326
309
 
327
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
328
- this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
310
+ }
329
311
 
330
312
  }
331
313
 
@@ -1,26 +0,0 @@
1
- import UniformNode from './UniformNode.js';
2
- import { addNodeClass } from './Node.js';
3
-
4
- class ArrayUniformNode extends UniformNode {
5
-
6
- constructor( nodes = [] ) {
7
-
8
- super();
9
-
10
- this.isArrayUniformNode = true;
11
-
12
- this.nodes = nodes;
13
-
14
- }
15
-
16
- getNodeType( builder ) {
17
-
18
- return this.nodes[ 0 ].getNodeType( builder );
19
-
20
- }
21
-
22
- }
23
-
24
- export default ArrayUniformNode;
25
-
26
- addNodeClass( 'ArrayUniformNode', ArrayUniformNode );
@@ -1,37 +0,0 @@
1
- import Node, { addNodeClass } from '../core/Node.js';
2
- import { maxMipLevel } from './MaxMipLevelNode.js';
3
- import { nodeProxy } from '../shadernode/ShaderNode.js';
4
-
5
- class SpecularMIPLevelNode extends Node {
6
-
7
- constructor( textureNode, roughnessNode = null ) {
8
-
9
- super( 'float' );
10
-
11
- this.textureNode = textureNode;
12
- this.roughnessNode = roughnessNode;
13
-
14
- }
15
-
16
- setup() {
17
-
18
- const { textureNode, roughnessNode } = this;
19
-
20
- // taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html
21
-
22
- const maxMIPLevelScalar = maxMipLevel( textureNode );
23
-
24
- const sigma = roughnessNode.mul( roughnessNode ).mul( Math.PI ).div( roughnessNode.add( 1.0 ) );
25
- const desiredMIPLevel = maxMIPLevelScalar.add( sigma.log2() );
26
-
27
- return desiredMIPLevel.clamp( 0.0, maxMIPLevelScalar );
28
-
29
- }
30
-
31
- }
32
-
33
- export default SpecularMIPLevelNode;
34
-
35
- export const specularMIPLevel = nodeProxy( SpecularMIPLevelNode );
36
-
37
- addNodeClass( 'SpecularMIPLevelNode', SpecularMIPLevelNode );
@@ -1,7 +0,0 @@
1
- import { WebGLRenderer } from './WebGLRenderer.js';
2
-
3
- class WebGL1Renderer extends WebGLRenderer {}
4
-
5
- WebGL1Renderer.prototype.isWebGL1Renderer = true;
6
-
7
- export { WebGL1Renderer };
@@ -1,82 +0,0 @@
1
- import { WebGLRenderTarget } from './WebGLRenderTarget.js';
2
-
3
- class WebGLMultipleRenderTargets extends WebGLRenderTarget {
4
-
5
- constructor( width = 1, height = 1, count = 1, options = {} ) {
6
-
7
- super( width, height, options );
8
-
9
- this.isWebGLMultipleRenderTargets = true;
10
-
11
- const texture = this.texture;
12
-
13
- this.texture = [];
14
-
15
- for ( let i = 0; i < count; i ++ ) {
16
-
17
- this.texture[ i ] = texture.clone();
18
- this.texture[ i ].isRenderTargetTexture = true;
19
-
20
- }
21
-
22
- }
23
-
24
- setSize( width, height, depth = 1 ) {
25
-
26
- if ( this.width !== width || this.height !== height || this.depth !== depth ) {
27
-
28
- this.width = width;
29
- this.height = height;
30
- this.depth = depth;
31
-
32
- for ( let i = 0, il = this.texture.length; i < il; i ++ ) {
33
-
34
- this.texture[ i ].image.width = width;
35
- this.texture[ i ].image.height = height;
36
- this.texture[ i ].image.depth = depth;
37
-
38
- }
39
-
40
- this.dispose();
41
-
42
- }
43
-
44
- this.viewport.set( 0, 0, width, height );
45
- this.scissor.set( 0, 0, width, height );
46
-
47
- }
48
-
49
- copy( source ) {
50
-
51
- this.dispose();
52
-
53
- this.width = source.width;
54
- this.height = source.height;
55
- this.depth = source.depth;
56
-
57
- this.scissor.copy( source.scissor );
58
- this.scissorTest = source.scissorTest;
59
-
60
- this.viewport.copy( source.viewport );
61
-
62
- this.depthBuffer = source.depthBuffer;
63
- this.stencilBuffer = source.stencilBuffer;
64
-
65
- if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
66
-
67
- this.texture.length = 0;
68
-
69
- for ( let i = 0, il = source.texture.length; i < il; i ++ ) {
70
-
71
- this.texture[ i ] = source.texture[ i ].clone();
72
- this.texture[ i ].isRenderTargetTexture = true;
73
-
74
- }
75
-
76
- return this;
77
-
78
- }
79
-
80
- }
81
-
82
- export { WebGLMultipleRenderTargets };