@gnsx/three 0.186.4 → 0.186.6

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 (27) hide show
  1. package/build/three.webgpu.js +1563 -761
  2. package/build/three.webgpu.nodes.js +1563 -761
  3. package/examples/jsm/inspector/tabs/Settings.js +64 -3
  4. package/package.json +1 -1
  5. package/src/materials/nodes/MeshBasicNodeMaterial.js +13 -0
  6. package/src/materials/nodes/MeshLambertNodeMaterial.js +13 -0
  7. package/src/materials/nodes/MeshMatcapNodeMaterial.js +13 -0
  8. package/src/materials/nodes/MeshPhongNodeMaterial.js +13 -0
  9. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +25 -0
  10. package/src/materials/nodes/MeshSSSNodeMaterial.js +15 -0
  11. package/src/materials/nodes/MeshStandardNodeMaterial.js +13 -0
  12. package/src/materials/nodes/MeshToonNodeMaterial.js +13 -0
  13. package/src/materials/nodes/NodeMaterial.js +107 -7
  14. package/src/materials/nodes/ShadowNodeMaterial.js +13 -0
  15. package/src/materials/nodes/VolumeNodeMaterial.js +13 -0
  16. package/src/nodes/display/BufferDebug.js +143 -0
  17. package/src/nodes/display/ComplexityDebug.js +188 -34
  18. package/src/nodes/display/DrawCallDebug.js +119 -0
  19. package/src/nodes/display/LightingDebug.js +109 -0
  20. package/src/renderers/common/Background.js +5 -2
  21. package/src/renderers/common/RenderObject.js +1 -1
  22. package/src/renderers/common/RenderPipeline.js +34 -5
  23. package/src/renderers/common/Renderer.js +11 -9
  24. package/src/renderers/common/nodes/NodeManager.js +13 -3
  25. package/src/renderers/webgl-fallback/WebGLBackend.js +4 -1
  26. package/src/renderers/webgl-fallback/utils/WebGLState.js +6 -2
  27. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +4 -1
@@ -10,7 +10,7 @@ import { builtin } from '../../../nodes/accessors/BuiltinNode.js';
10
10
  import { CubeUVReflectionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, NoToneMapping } from '../../../constants.js';
11
11
  // WITH_GENESYS
12
12
  import { vec4 } from '../../../nodes/tsl/TSLCore.js';
13
- import { colorizeShaderComplexity, DEBUG_VIEW_SHADER_COMPLEXITY } from '../../../nodes/display/ComplexityDebug.js';
13
+ import { colorizeQuadOverdraw, colorizeShaderComplexity, DEBUG_VIEW_QUAD_OVERDRAW, DEBUG_VIEW_SHADER_COMPLEXITY, DEBUG_VIEW_SHADER_COMPLEXITY_AND_QUADS, SHADER_COMPLEXITY_QUAD_COUNT_SCALE } from '../../../nodes/display/ComplexityDebug.js';
14
14
  // !WITH_GENESYS
15
15
  import { hashArray } from '../../../nodes/core/NodeUtils.js';
16
16
  import { error } from '../../../utils.js';
@@ -1035,9 +1035,19 @@ class NodeManager extends DataMap {
1035
1035
  }
1036
1036
 
1037
1037
  // WITH_GENESYS
1038
- if ( renderer.debug.view === DEBUG_VIEW_SHADER_COMPLEXITY ) {
1038
+ if ( renderer.debug.view === DEBUG_VIEW_SHADER_COMPLEXITY || renderer.debug.view === DEBUG_VIEW_SHADER_COMPLEXITY_AND_QUADS ) {
1039
1039
 
1040
- return vec4( colorizeShaderComplexity( sampled.r ), 1 ).renderOutput( NoToneMapping, renderer.currentColorSpace );
1040
+ const complexity = renderer.debug.view === DEBUG_VIEW_SHADER_COMPLEXITY_AND_QUADS
1041
+ ? sampled.r.mul( sampled.g ).mul( SHADER_COMPLEXITY_QUAD_COUNT_SCALE )
1042
+ : sampled.r;
1043
+
1044
+ return vec4( colorizeShaderComplexity( complexity ), 1 ).renderOutput( NoToneMapping, renderer.currentColorSpace );
1045
+
1046
+ }
1047
+
1048
+ if ( renderer.debug.view === DEBUG_VIEW_QUAD_OVERDRAW ) {
1049
+
1050
+ return vec4( colorizeQuadOverdraw( sampled.r ), 1 ).renderOutput( NoToneMapping, renderer.currentColorSpace );
1041
1051
 
1042
1052
  }
1043
1053
  // !WITH_GENESYS
@@ -1124,7 +1124,10 @@ class WebGLBackend extends Backend {
1124
1124
 
1125
1125
  const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
1126
1126
 
1127
- state.setMaterial( material, frontFaceCW, hardwareClippingPlanes );
1127
+ // WITH_GENESYS
1128
+ state.setMaterial( material, frontFaceCW, hardwareClippingPlanes, object );
1129
+ // !WITH_GENESYS
1130
+ // state.setMaterial( material, frontFaceCW, hardwareClippingPlanes );
1128
1131
 
1129
1132
  if ( context.mrt !== null && context.textures !== null ) {
1130
1133
 
@@ -11,6 +11,9 @@ import {
11
11
  import { Color } from '../../../math/Color.js';
12
12
  import { Vector4 } from '../../../math/Vector4.js';
13
13
  import { error, ReversedDepthFuncs, warnOnce } from '../../../utils.js';
14
+ // WITH_GENESYS
15
+ import { debugDrawAccumulates } from '../../../nodes/display/ComplexityDebug.js';
16
+ // !WITH_GENESYS
14
17
 
15
18
  let equationToGL, factorToGL;
16
19
 
@@ -920,8 +923,9 @@ class WebGLState {
920
923
  * @param {Material} material - The material to configure the state for.
921
924
  * @param {number} frontFaceCW - Whether the front faces are counter-clockwise or not.
922
925
  * @param {number} hardwareClippingPlanes - The number of hardware clipping planes.
926
+ * @param {?Object3D} [object=null] - The object being drawn. Used by the accumulating debug views.
923
927
  */
924
- setMaterial( material, frontFaceCW, hardwareClippingPlanes ) {
928
+ setMaterial( material, frontFaceCW, hardwareClippingPlanes, object = null ) {
925
929
 
926
930
  const { gl } = this;
927
931
 
@@ -936,7 +940,7 @@ class WebGLState {
936
940
 
937
941
  // WITH_GENESYS
938
942
  // WebGL has no cached render pipeline. One+One is applied on each draw instead.
939
- if ( this.backend.renderer.debug.view === 'shaderComplexity' && material.isShadowPassMaterial !== true && this.backend.renderer.isOutputTarget !== true ) {
943
+ if ( debugDrawAccumulates( this.backend.renderer, material, object ) ) {
940
944
 
941
945
  this.setBlending( AdditiveBlending, AddEquation, OneFactor, OneFactor, AddEquation, OneFactor, OneFactor, material.blendColor, material.blendAlpha, true );
942
946
 
@@ -15,6 +15,9 @@ import {
15
15
  } from '../../../constants.js';
16
16
 
17
17
  import { error, ReversedDepthFuncs, warn, warnOnce } from '../../../utils.js';
18
+ // WITH_GENESYS
19
+ import { debugDrawAccumulates } from '../../../nodes/display/ComplexityDebug.js';
20
+ // !WITH_GENESYS
18
21
 
19
22
  import GPUComputePipelineDescriptor from '../descriptors/GPUComputePipelineDescriptor.js';
20
23
  import GPUPipelineLayoutDescriptor from '../descriptors/GPUPipelineLayoutDescriptor.js';
@@ -108,7 +111,7 @@ class WebGPUPipelineUtils {
108
111
 
109
112
  // WITH_GENESYS
110
113
  // Accumulate shader cost with One+One. Opaque materials normally disable blending.
111
- if ( backend.renderer.debug.view === 'shaderComplexity' && material.isShadowPassMaterial !== true && backend.renderer.isOutputTarget !== true ) {
114
+ if ( debugDrawAccumulates( backend.renderer, material, object ) ) {
112
115
 
113
116
  materialBlending = {
114
117
  color: {