super-three 0.162.0 → 0.164.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 (187) hide show
  1. package/build/three.cjs +847 -1226
  2. package/build/three.module.js +846 -1225
  3. package/build/three.module.min.js +2 -2
  4. package/examples/jsm/animation/CCDIKSolver.js +4 -2
  5. package/examples/jsm/controls/TransformControls.js +3 -3
  6. package/examples/jsm/exporters/GLTFExporter.js +66 -5
  7. package/examples/jsm/exporters/USDZExporter.js +22 -1
  8. package/examples/jsm/geometries/TextGeometry.js +10 -2
  9. package/examples/jsm/interactive/HTMLMesh.js +7 -9
  10. package/examples/jsm/libs/draco/README.md +2 -2
  11. package/examples/jsm/libs/fflate.module.js +694 -496
  12. package/examples/jsm/lines/LineMaterial.js +0 -2
  13. package/examples/jsm/loaders/3MFLoader.js +2 -0
  14. package/examples/jsm/loaders/EXRLoader.js +351 -97
  15. package/examples/jsm/loaders/FBXLoader.js +1 -1
  16. package/examples/jsm/loaders/GLTFLoader.js +59 -0
  17. package/examples/jsm/loaders/KTX2Loader.js +3 -10
  18. package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
  19. package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
  20. package/examples/jsm/loaders/LUTImageLoader.js +0 -14
  21. package/examples/jsm/loaders/RGBMLoader.js +16 -0
  22. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  23. package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
  24. package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
  25. package/examples/jsm/math/Octree.js +26 -20
  26. package/examples/jsm/misc/GPUComputationRenderer.js +0 -6
  27. package/examples/jsm/nodes/Nodes.js +10 -4
  28. package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
  29. package/examples/jsm/nodes/accessors/BatchNode.js +78 -0
  30. package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
  31. package/examples/jsm/nodes/accessors/InstanceNode.js +25 -2
  32. package/examples/jsm/nodes/accessors/MaterialNode.js +107 -3
  33. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +1 -1
  34. package/examples/jsm/nodes/accessors/MorphNode.js +13 -3
  35. package/examples/jsm/nodes/accessors/NormalNode.js +12 -2
  36. package/examples/jsm/nodes/accessors/ReferenceNode.js +1 -1
  37. package/examples/jsm/nodes/accessors/RendererReferenceNode.js +29 -0
  38. package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
  39. package/examples/jsm/nodes/accessors/TextureNode.js +51 -10
  40. package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
  41. package/examples/jsm/nodes/code/FunctionNode.js +0 -8
  42. package/examples/jsm/nodes/core/Node.js +63 -4
  43. package/examples/jsm/nodes/core/NodeBuilder.js +26 -25
  44. package/examples/jsm/nodes/core/NodeFrame.js +10 -10
  45. package/examples/jsm/nodes/core/NodeUtils.js +2 -2
  46. package/examples/jsm/nodes/core/OutputStructNode.js +2 -1
  47. package/examples/jsm/nodes/core/PropertyNode.js +10 -0
  48. package/examples/jsm/nodes/core/UniformNode.js +20 -0
  49. package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
  50. package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
  51. package/examples/jsm/nodes/display/PassNode.js +17 -1
  52. package/examples/jsm/nodes/display/ToneMappingNode.js +8 -4
  53. package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
  54. package/examples/jsm/nodes/display/ViewportNode.js +4 -2
  55. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -0
  56. package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
  57. package/examples/jsm/nodes/fog/FogExp2Node.js +4 -5
  58. package/examples/jsm/nodes/fog/FogNode.js +13 -3
  59. package/examples/jsm/nodes/fog/FogRangeNode.js +4 -3
  60. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
  61. package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
  62. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
  63. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
  64. package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
  65. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +164 -10
  66. package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
  67. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +19 -5
  68. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
  69. package/examples/jsm/nodes/lighting/EnvironmentNode.js +22 -70
  70. package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
  71. package/examples/jsm/nodes/lighting/LightsNode.js +11 -1
  72. package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
  73. package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
  74. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +10 -6
  75. package/examples/jsm/nodes/materials/Materials.js +1 -0
  76. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
  77. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
  78. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +76 -5
  79. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
  80. package/examples/jsm/nodes/materials/NodeMaterial.js +55 -43
  81. package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
  82. package/examples/jsm/nodes/pmrem/PMREMNode.js +193 -0
  83. package/examples/jsm/nodes/pmrem/PMREMUtils.js +288 -0
  84. package/examples/jsm/nodes/shadernode/ShaderNode.js +3 -9
  85. package/examples/jsm/nodes/utils/EquirectUVNode.js +1 -1
  86. package/examples/jsm/objects/QuadMesh.js +7 -23
  87. package/examples/jsm/physics/JoltPhysics.js +281 -0
  88. package/examples/jsm/physics/RapierPhysics.js +4 -4
  89. package/examples/jsm/postprocessing/GlitchPass.js +0 -3
  90. package/examples/jsm/postprocessing/LUTPass.js +5 -71
  91. package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
  92. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  93. package/examples/jsm/postprocessing/SSAOPass.js +0 -3
  94. package/examples/jsm/renderers/common/Animation.js +3 -0
  95. package/examples/jsm/renderers/common/Background.js +8 -8
  96. package/examples/jsm/renderers/common/ClippingContext.js +1 -1
  97. package/examples/jsm/renderers/common/Info.js +11 -19
  98. package/examples/jsm/renderers/common/PostProcessing.js +12 -4
  99. package/examples/jsm/renderers/common/RenderContext.js +1 -1
  100. package/examples/jsm/renderers/common/RenderList.js +1 -1
  101. package/examples/jsm/renderers/common/RenderObject.js +47 -5
  102. package/examples/jsm/renderers/common/RenderObjects.js +1 -1
  103. package/examples/jsm/renderers/common/Renderer.js +153 -21
  104. package/examples/jsm/renderers/common/Textures.js +1 -1
  105. package/examples/jsm/renderers/common/extras/PMREMGenerator.js +773 -0
  106. package/examples/jsm/renderers/common/nodes/Nodes.js +34 -63
  107. package/examples/jsm/renderers/webgl/WebGLBackend.js +146 -36
  108. package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +145 -0
  109. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +9 -3
  110. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +1 -1
  111. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +1 -0
  112. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +64 -7
  113. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +6 -23
  114. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +77 -60
  115. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -4
  116. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +29 -1
  117. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -4
  118. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +92 -18
  119. package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
  120. package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
  121. package/examples/jsm/utils/GPUStatsPanel.js +10 -45
  122. package/examples/jsm/utils/SceneUtils.js +60 -1
  123. package/examples/jsm/utils/TextureUtils.js +1 -1
  124. package/examples/jsm/webxr/OculusHandModel.js +3 -2
  125. package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
  126. package/package.json +1 -1
  127. package/src/Three.js +0 -1
  128. package/src/animation/AnimationClip.js +1 -1
  129. package/src/constants.js +3 -3
  130. package/src/core/Object3D.js +10 -7
  131. package/src/core/RenderTarget.js +8 -0
  132. package/src/extras/PMREMGenerator.js +21 -11
  133. package/src/loaders/FileLoader.js +1 -1
  134. package/src/loaders/MaterialLoader.js +1 -0
  135. package/src/loaders/ObjectLoader.js +2 -0
  136. package/src/materials/Material.js +2 -0
  137. package/src/materials/MeshPhysicalMaterial.js +20 -0
  138. package/src/materials/ShaderMaterial.js +0 -4
  139. package/src/math/Spherical.js +4 -5
  140. package/src/objects/BatchedMesh.js +27 -3
  141. package/src/objects/InstancedMesh.js +10 -0
  142. package/src/objects/Line.js +66 -43
  143. package/src/renderers/WebGLRenderer.js +130 -158
  144. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
  145. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
  146. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
  147. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  148. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
  149. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
  150. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +32 -22
  151. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
  152. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  153. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
  154. package/src/renderers/shaders/ShaderChunk.js +0 -2
  155. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
  156. package/src/renderers/shaders/ShaderLib.js +2 -1
  157. package/src/renderers/shaders/UniformsUtils.js +10 -1
  158. package/src/renderers/webgl/WebGLAttributes.js +6 -33
  159. package/src/renderers/webgl/WebGLBackground.js +18 -3
  160. package/src/renderers/webgl/WebGLBindingStates.js +14 -51
  161. package/src/renderers/webgl/WebGLBufferRenderer.js +35 -21
  162. package/src/renderers/webgl/WebGLCapabilities.js +35 -13
  163. package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
  164. package/src/renderers/webgl/WebGLExtensions.js +4 -19
  165. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +35 -21
  166. package/src/renderers/webgl/WebGLLights.js +6 -32
  167. package/src/renderers/webgl/WebGLMaterials.js +8 -3
  168. package/src/renderers/webgl/WebGLMorphtargets.js +79 -217
  169. package/src/renderers/webgl/WebGLProgram.js +21 -52
  170. package/src/renderers/webgl/WebGLPrograms.js +24 -31
  171. package/src/renderers/webgl/WebGLRenderStates.js +13 -7
  172. package/src/renderers/webgl/WebGLShadowMap.js +25 -25
  173. package/src/renderers/webgl/WebGLState.js +15 -59
  174. package/src/renderers/webgl/WebGLTextures.js +138 -292
  175. package/src/renderers/webgl/WebGLUniformsGroups.js +1 -1
  176. package/src/renderers/webgl/WebGLUtils.js +9 -78
  177. package/src/renderers/webxr/WebXRDepthSensing.js +2 -3
  178. package/src/renderers/webxr/WebXRManager.js +4 -6
  179. package/src/scenes/Scene.js +7 -1
  180. package/src/textures/Texture.js +11 -1
  181. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
  182. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -320
  183. package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
  184. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -794
  185. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
  186. package/src/renderers/WebGL1Renderer.js +0 -7
  187. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
@@ -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;
@@ -136,33 +101,15 @@ function WebGLUtils( gl, extensions, capabilities ) {
136
101
 
137
102
  }
138
103
 
139
- // ETC1
140
-
141
- if ( p === RGB_ETC1_Format ) {
142
-
143
- extension = extensions.get( 'WEBGL_compressed_texture_etc1' );
144
-
145
- if ( extension !== null ) {
146
-
147
- return extension.COMPRESSED_RGB_ETC1_WEBGL;
148
-
149
- } else {
150
-
151
- return null;
152
-
153
- }
154
-
155
- }
156
-
157
- // ETC2
104
+ // ETC
158
105
 
159
- if ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
106
+ if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {
160
107
 
161
108
  extension = extensions.get( 'WEBGL_compressed_texture_etc' );
162
109
 
163
110
  if ( extension !== null ) {
164
111
 
165
- if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
112
+ if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
166
113
  if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
167
114
 
168
115
  } else {
@@ -251,23 +198,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
251
198
 
252
199
  //
253
200
 
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
- }
201
+ if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
271
202
 
272
203
  // if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
273
204
 
@@ -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,
@@ -361,7 +361,8 @@ class WebXRManager extends EventDispatcher {
361
361
  depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
362
362
  stencilBuffer: attributes.stencil,
363
363
  colorSpace: renderer.outputColorSpace,
364
- samples: attributes.antialias ? 4 : 0
364
+ samples: attributes.antialias ? 4 : 0,
365
+ resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
365
366
  };
366
367
 
367
368
  if ( scope.isMultiview ) {
@@ -381,9 +382,6 @@ class WebXRManager extends EventDispatcher {
381
382
 
382
383
  }
383
384
 
384
- const renderTargetProperties = renderer.properties.get( newRenderTarget );
385
- renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;
386
-
387
385
  }
388
386
 
389
387
  newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278
@@ -18,6 +18,8 @@ class Scene extends Object3D {
18
18
  this.backgroundBlurriness = 0;
19
19
  this.backgroundIntensity = 1;
20
20
  this.backgroundRotation = new Euler();
21
+
22
+ this.environmentIntensity = 1;
21
23
  this.environmentRotation = new Euler();
22
24
 
23
25
  this.overrideMaterial = null;
@@ -41,6 +43,8 @@ class Scene extends Object3D {
41
43
  this.backgroundBlurriness = source.backgroundBlurriness;
42
44
  this.backgroundIntensity = source.backgroundIntensity;
43
45
  this.backgroundRotation.copy( source.backgroundRotation );
46
+
47
+ this.environmentIntensity = source.environmentIntensity;
44
48
  this.environmentRotation.copy( source.environmentRotation );
45
49
 
46
50
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
@@ -56,10 +60,12 @@ class Scene extends Object3D {
56
60
  const data = super.toJSON( meta );
57
61
 
58
62
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
63
+
59
64
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
60
65
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
61
-
62
66
  data.object.backgroundRotation = this.backgroundRotation.toArray();
67
+
68
+ if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
63
69
  data.object.environmentRotation = this.environmentRotation.toArray();
64
70
 
65
71
  return data;
@@ -70,7 +70,7 @@ class Texture extends EventDispatcher {
70
70
  this.onUpdate = null;
71
71
 
72
72
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
73
- 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)
74
74
 
75
75
  }
76
76
 
@@ -301,6 +301,16 @@ class Texture extends EventDispatcher {
301
301
 
302
302
  }
303
303
 
304
+ set needsPMREMUpdate( value ) {
305
+
306
+ if ( value === true ) {
307
+
308
+ this.pmremVersion ++;
309
+
310
+ }
311
+
312
+ }
313
+
304
314
  }
305
315
 
306
316
  Texture.DEFAULT_IMAGE = null;
@@ -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,320 +0,0 @@
1
- import { MathNode, GLSLNodeParser, NodeBuilder } from '../../../nodes/Nodes.js';
2
-
3
- const glslMethods = {
4
- [ MathNode.ATAN2 ]: 'atan'
5
- };
6
-
7
- const precisionLib = {
8
- low: 'lowp',
9
- medium: 'mediump',
10
- high: 'highp'
11
- };
12
-
13
- class GLSL1NodeBuilder extends NodeBuilder {
14
-
15
- constructor( object, renderer, scene = null ) {
16
-
17
- super( object, renderer, new GLSLNodeParser(), scene );
18
-
19
- }
20
-
21
- getMethod( method ) {
22
-
23
- return glslMethods[ method ] || method;
24
-
25
- }
26
-
27
- getTexture( texture, textureProperty, uvSnippet ) {
28
-
29
- if ( texture.isTextureCube ) {
30
-
31
- return `textureCube( ${textureProperty}, ${uvSnippet} )`;
32
-
33
- } else {
34
-
35
- return `texture2D( ${textureProperty}, ${uvSnippet} )`;
36
-
37
- }
38
-
39
- }
40
-
41
- getTextureBias( texture, textureProperty, uvSnippet, biasSnippet ) {
42
-
43
- if ( this.material.extensions !== undefined ) this.material.extensions.shaderTextureLOD = true;
44
-
45
- return `textureLod( ${textureProperty}, ${uvSnippet}, ${biasSnippet} )`;
46
-
47
- }
48
-
49
- getVars( shaderStage ) {
50
-
51
- const snippets = [];
52
-
53
- const vars = this.vars[ shaderStage ];
54
-
55
- for ( const variable of vars ) {
56
-
57
- snippets.push( `${ this.getVar( variable.type, variable.name ) };` );
58
-
59
- }
60
-
61
- return snippets.join( '\n\t' );
62
-
63
- }
64
-
65
- getUniforms( shaderStage ) {
66
-
67
- const uniforms = this.uniforms[ shaderStage ];
68
-
69
- let output = '';
70
-
71
- for ( const uniform of uniforms ) {
72
-
73
- let snippet = null;
74
-
75
- if ( uniform.type === 'texture' ) {
76
-
77
- snippet = `sampler2D ${uniform.name};\n`;
78
-
79
- } else if ( uniform.type === 'cubeTexture' ) {
80
-
81
- snippet = `samplerCube ${uniform.name};\n`;
82
-
83
- } else {
84
-
85
- const vectorType = this.getVectorType( uniform.type );
86
-
87
- snippet = `${vectorType} ${uniform.name};\n`;
88
-
89
- }
90
-
91
- const precision = uniform.node.precision;
92
-
93
- if ( precision !== null ) {
94
-
95
- snippet = 'uniform ' + precisionLib[ precision ] + ' ' + snippet;
96
-
97
- } else {
98
-
99
- snippet = 'uniform ' + snippet;
100
-
101
- }
102
-
103
- output += snippet;
104
-
105
- }
106
-
107
- return output;
108
-
109
- }
110
-
111
- getAttributes( shaderStage ) {
112
-
113
- let snippet = '';
114
-
115
- if ( shaderStage === 'vertex' ) {
116
-
117
- const attributes = this.attributes;
118
-
119
- for ( const attribute of attributes ) {
120
-
121
- snippet += `attribute ${attribute.type} ${attribute.name};\n`;
122
-
123
- }
124
-
125
- }
126
-
127
- return snippet;
128
-
129
- }
130
-
131
- getVaryings( shaderStage ) {
132
-
133
- let snippet = '';
134
-
135
- const varyings = this.varyings;
136
-
137
- if ( shaderStage === 'vertex' ) {
138
-
139
- for ( const varying of varyings ) {
140
-
141
- snippet += `${varying.needsInterpolation ? 'varying' : '/*varying*/'} ${varying.type} ${varying.name};\n`;
142
-
143
- }
144
-
145
- } else if ( shaderStage === 'fragment' ) {
146
-
147
- for ( const varying of varyings ) {
148
-
149
- if ( varying.needsInterpolation ) {
150
-
151
- snippet += `varying ${varying.type} ${varying.name};\n`;
152
-
153
- }
154
-
155
- }
156
-
157
- }
158
-
159
- return snippet;
160
-
161
- }
162
-
163
- getVertexIndex() {
164
-
165
- return 'gl_VertexID';
166
-
167
- }
168
-
169
- getFrontFacing() {
170
-
171
- return 'gl_FrontFacing';
172
-
173
- }
174
-
175
- getFragCoord() {
176
-
177
- return 'gl_FragCoord';
178
-
179
- }
180
-
181
- isFlipY() {
182
-
183
- return true;
184
-
185
- }
186
-
187
- _getGLSLVertexCode( shaderData ) {
188
-
189
- return `${ this.getSignature() }
190
-
191
- // uniforms
192
- ${shaderData.uniforms}
193
-
194
- // varyings
195
- ${shaderData.varyings}
196
-
197
- // attributes
198
- ${shaderData.attributes}
199
-
200
- // codes
201
- ${shaderData.codes}
202
-
203
- void main() {
204
-
205
- // vars
206
- ${shaderData.vars}
207
-
208
- // flow
209
- ${shaderData.flow}
210
-
211
- }
212
- `;
213
-
214
- }
215
-
216
- _getGLSLFragmentCode( shaderData ) {
217
-
218
- return `${ this.getSignature() }
219
-
220
- // precision
221
- precision highp float;
222
- precision highp int;
223
-
224
- // uniforms
225
- ${shaderData.uniforms}
226
-
227
- // varyings
228
- ${shaderData.varyings}
229
-
230
- // codes
231
- ${shaderData.codes}
232
-
233
- void main() {
234
-
235
- // vars
236
- ${shaderData.vars}
237
-
238
- // flow
239
- ${shaderData.flow}
240
-
241
- }
242
- `;
243
-
244
- }
245
-
246
- buildCode() {
247
-
248
- const shadersData = this.material !== null ? { fragment: {}, vertex: {} } : { compute: {} };
249
-
250
- for ( const shaderStage in shadersData ) {
251
-
252
- let flow = '// code\n\n';
253
- flow += this.flowCode[ shaderStage ];
254
-
255
- const flowNodes = this.flowNodes[ shaderStage ];
256
- const mainNode = flowNodes[ flowNodes.length - 1 ];
257
-
258
- for ( const node of flowNodes ) {
259
-
260
- const flowSlotData = this.getFlowData( node/*, shaderStage*/ );
261
- const slotName = node.name;
262
-
263
- if ( slotName ) {
264
-
265
- if ( flow.length > 0 ) flow += '\n';
266
-
267
- flow += `\t// flow -> ${ slotName }\n\t`;
268
-
269
- }
270
-
271
- flow += `${ flowSlotData.code }\n\t`;
272
-
273
- if ( node === mainNode && shaderStage !== 'compute' ) {
274
-
275
- flow += '// result\n\t';
276
-
277
- if ( shaderStage === 'vertex' ) {
278
-
279
- flow += 'gl_Position = ';
280
-
281
- } else if ( shaderStage === 'fragment' ) {
282
-
283
- flow += 'gl_FragColor = ';
284
-
285
- }
286
-
287
- flow += `${ flowSlotData.result };`;
288
-
289
- }
290
-
291
- }
292
-
293
- const stageData = shadersData[ shaderStage ];
294
-
295
- stageData.uniforms = this.getUniforms( shaderStage );
296
- stageData.attributes = this.getAttributes( shaderStage );
297
- stageData.varyings = this.getVaryings( shaderStage );
298
- stageData.vars = this.getVars( shaderStage );
299
- stageData.codes = this.getCodes( shaderStage );
300
- stageData.flow = flow;
301
-
302
- }
303
-
304
- if ( this.material !== null ) {
305
-
306
- this.vertexShader = this._getGLSLVertexCode( shadersData.vertex );
307
- this.fragmentShader = this._getGLSLFragmentCode( shadersData.fragment );
308
-
309
- } else {
310
-
311
- console.warn( 'GLSLNodeBuilder: compute shaders are not supported.' );
312
- //this.computeShader = this._getGLSLComputeCode( shadersData.compute );
313
-
314
- }
315
-
316
- }
317
-
318
- }
319
-
320
- export default GLSL1NodeBuilder;
@@ -1,26 +0,0 @@
1
- import { Node } from '../../../nodes/Nodes.js';
2
-
3
- class SlotNode extends Node {
4
-
5
- constructor( params ) {
6
-
7
- super( params.nodeType );
8
-
9
- this.node = null;
10
- this.source = null;
11
- this.target = null;
12
- this.inclusionType = 'replace';
13
-
14
- Object.assign( this, params );
15
-
16
- }
17
-
18
- generate( builder ) {
19
-
20
- return this.node.build( builder, this.getNodeType( builder ) );
21
-
22
- }
23
-
24
- }
25
-
26
- export default SlotNode;