@gnsx/three 0.184.14 → 0.184.16
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.
- package/build/three.cjs +169 -24
- package/build/three.core.js +2 -22
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +170 -5
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +63 -14
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +63 -14
- package/build/three.webgpu.nodes.min.js +1 -1
- package/package.json +1 -1
- package/src/nodes/lighting/PointShadowNode.js +21 -0
- package/src/nodes/lighting/ShadowNode.js +43 -14
- package/src/profiler/ProfilerService.js +2 -22
- package/src/renderers/WebGLRenderer.js +90 -1
- package/src/renderers/webgl/WebGLShadowMap.js +79 -1
package/build/three.cjs
CHANGED
|
@@ -59691,10 +59691,6 @@ class TextureUtils {
|
|
|
59691
59691
|
/**
|
|
59692
59692
|
* ProfilerService — per-label CPU timing with ring-buffer aggregation and DevTools integration.
|
|
59693
59693
|
*
|
|
59694
|
-
* Activate via environment variable:
|
|
59695
|
-
* PROFILING=1 stats + trace (full profile)
|
|
59696
|
-
* PROFILING=stats stats only, no trace accumulation (lower overhead)
|
|
59697
|
-
*
|
|
59698
59694
|
* Quick start (browser console):
|
|
59699
59695
|
* __gnsx_profiler.enable()
|
|
59700
59696
|
* // play for a few seconds
|
|
@@ -59710,26 +59706,12 @@ const FRAME_BUDGET_MS = 1000 / 60;
|
|
|
59710
59706
|
const MAX_TRACE_EVENTS = 50_000;
|
|
59711
59707
|
const NOOP = () => {};
|
|
59712
59708
|
|
|
59713
|
-
function _readProfilingEnv() {
|
|
59714
|
-
|
|
59715
|
-
const raw =
|
|
59716
|
-
( typeof process !== 'undefined' ? process.env?.[ 'PROFILING' ] : undefined ) ??
|
|
59717
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__gnsx_env__' ]?.[ 'PROFILING' ] : undefined ) ??
|
|
59718
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__GNSX_PROFILING__' ] : undefined );
|
|
59719
|
-
|
|
59720
|
-
if ( ! raw || raw === '0' || raw === 'false' ) return false;
|
|
59721
|
-
if ( raw === 'stats' ) return 'stats';
|
|
59722
|
-
return 'full';
|
|
59723
|
-
|
|
59724
|
-
}
|
|
59725
|
-
|
|
59726
59709
|
class ProfilerServiceClass {
|
|
59727
59710
|
|
|
59728
59711
|
constructor() {
|
|
59729
59712
|
|
|
59730
|
-
|
|
59731
|
-
this.
|
|
59732
|
-
this._enabled = envProfile !== false;
|
|
59713
|
+
this._profile = 'full';
|
|
59714
|
+
this._enabled = false;
|
|
59733
59715
|
|
|
59734
59716
|
/** @type {Map<string, Float64Array>} */
|
|
59735
59717
|
this.buffers = new Map();
|
|
@@ -60113,8 +60095,6 @@ const ProfilerService = new ProfilerServiceClass();
|
|
|
60113
60095
|
|
|
60114
60096
|
function applyProfileToMethod( label, descriptor ) {
|
|
60115
60097
|
|
|
60116
|
-
if ( _readProfilingEnv() === false ) return descriptor;
|
|
60117
|
-
|
|
60118
60098
|
const original = descriptor.value;
|
|
60119
60099
|
|
|
60120
60100
|
function profiled( ...args ) {
|
|
@@ -69263,6 +69243,8 @@ const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
|
|
|
69263
69243
|
|
|
69264
69244
|
const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}";
|
|
69265
69245
|
|
|
69246
|
+
// !WITH_GENESYS
|
|
69247
|
+
|
|
69266
69248
|
const _cubeDirections = [
|
|
69267
69249
|
/*@__PURE__*/ new Vector3( 1, 0, 0 ), /*@__PURE__*/ new Vector3( -1, 0, 0 ), /*@__PURE__*/ new Vector3( 0, 1, 0 ),
|
|
69268
69250
|
/*@__PURE__*/ new Vector3( 0, -1, 0 ), /*@__PURE__*/ new Vector3( 0, 0, 1 ), /*@__PURE__*/ new Vector3( 0, 0, -1 )
|
|
@@ -69378,6 +69360,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69378
69360
|
// (sampler2DShadow for PCF vs sampler2D for Basic)
|
|
69379
69361
|
if ( typeChanged ) {
|
|
69380
69362
|
|
|
69363
|
+
// WITH_GENESYS
|
|
69364
|
+
ProfilerService.begin( 'shadowMap.render.typeChangeMaterialUpdate' );
|
|
69365
|
+
// !WITH_GENESYS
|
|
69366
|
+
|
|
69381
69367
|
scene.traverse( function ( object ) {
|
|
69382
69368
|
|
|
69383
69369
|
if ( object.material ) {
|
|
@@ -69396,6 +69382,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69396
69382
|
|
|
69397
69383
|
} );
|
|
69398
69384
|
|
|
69385
|
+
// WITH_GENESYS
|
|
69386
|
+
ProfilerService.end( 'shadowMap.render.typeChangeMaterialUpdate' );
|
|
69387
|
+
// !WITH_GENESYS
|
|
69388
|
+
|
|
69399
69389
|
}
|
|
69400
69390
|
|
|
69401
69391
|
// render depth map
|
|
@@ -69405,14 +69395,29 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69405
69395
|
const light = lights[ i ];
|
|
69406
69396
|
const shadow = light.shadow;
|
|
69407
69397
|
|
|
69398
|
+
// WITH_GENESYS
|
|
69399
|
+
const lightLabel = `shadowMap.render.light (${light.name || light.type})`;
|
|
69400
|
+
ProfilerService.begin( lightLabel );
|
|
69401
|
+
// !WITH_GENESYS
|
|
69402
|
+
|
|
69408
69403
|
if ( shadow === undefined ) {
|
|
69409
69404
|
|
|
69410
69405
|
warn( 'WebGLShadowMap:', light, 'has no shadow.' );
|
|
69406
|
+
// WITH_GENESYS
|
|
69407
|
+
ProfilerService.end( lightLabel );
|
|
69408
|
+
// !WITH_GENESYS
|
|
69411
69409
|
continue;
|
|
69412
69410
|
|
|
69413
69411
|
}
|
|
69414
69412
|
|
|
69415
|
-
if ( shadow.autoUpdate === false && shadow.needsUpdate === false )
|
|
69413
|
+
if ( shadow.autoUpdate === false && shadow.needsUpdate === false ) {
|
|
69414
|
+
|
|
69415
|
+
// WITH_GENESYS
|
|
69416
|
+
ProfilerService.end( lightLabel );
|
|
69417
|
+
// !WITH_GENESYS
|
|
69418
|
+
continue;
|
|
69419
|
+
|
|
69420
|
+
}
|
|
69416
69421
|
|
|
69417
69422
|
_shadowMapSize.copy( shadow.mapSize );
|
|
69418
69423
|
|
|
@@ -69447,6 +69452,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69447
69452
|
|
|
69448
69453
|
if ( shadow.map === null || typeChanged === true ) {
|
|
69449
69454
|
|
|
69455
|
+
// WITH_GENESYS
|
|
69456
|
+
ProfilerService.begin( 'shadowMap.render.setupMap' );
|
|
69457
|
+
// !WITH_GENESYS
|
|
69458
|
+
|
|
69450
69459
|
if ( shadow.map !== null ) {
|
|
69451
69460
|
|
|
69452
69461
|
if ( shadow.map.depthTexture !== null ) {
|
|
@@ -69465,6 +69474,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69465
69474
|
if ( light.isPointLight ) {
|
|
69466
69475
|
|
|
69467
69476
|
warn( 'WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.' );
|
|
69477
|
+
// WITH_GENESYS
|
|
69478
|
+
ProfilerService.end( 'shadowMap.render.setupMap' );
|
|
69479
|
+
ProfilerService.end( lightLabel );
|
|
69480
|
+
// !WITH_GENESYS
|
|
69468
69481
|
continue;
|
|
69469
69482
|
|
|
69470
69483
|
}
|
|
@@ -69521,6 +69534,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69521
69534
|
|
|
69522
69535
|
shadow.camera.updateProjectionMatrix();
|
|
69523
69536
|
|
|
69537
|
+
// WITH_GENESYS
|
|
69538
|
+
ProfilerService.end( 'shadowMap.render.setupMap' );
|
|
69539
|
+
// !WITH_GENESYS
|
|
69540
|
+
|
|
69524
69541
|
}
|
|
69525
69542
|
|
|
69526
69543
|
// For cube render targets (PointLights), render all 6 faces. Otherwise, render once.
|
|
@@ -69528,6 +69545,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69528
69545
|
|
|
69529
69546
|
for ( let face = 0; face < faceCount; face ++ ) {
|
|
69530
69547
|
|
|
69548
|
+
// WITH_GENESYS
|
|
69549
|
+
const faceLabel = faceCount > 1 ? `shadowMap.render.depthPass (face ${face})` : 'shadowMap.render.depthPass';
|
|
69550
|
+
// !WITH_GENESYS
|
|
69551
|
+
|
|
69531
69552
|
// For cube render targets, render to each face separately
|
|
69532
69553
|
if ( shadow.map.isWebGLCubeRenderTarget ) {
|
|
69533
69554
|
|
|
@@ -69557,6 +69578,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69557
69578
|
|
|
69558
69579
|
}
|
|
69559
69580
|
|
|
69581
|
+
// WITH_GENESYS
|
|
69582
|
+
ProfilerService.begin( 'shadowMap.render.updateMatrices' );
|
|
69583
|
+
// !WITH_GENESYS
|
|
69584
|
+
|
|
69560
69585
|
if ( light.isPointLight ) {
|
|
69561
69586
|
|
|
69562
69587
|
const camera = shadow.camera;
|
|
@@ -69591,9 +69616,19 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69591
69616
|
|
|
69592
69617
|
}
|
|
69593
69618
|
|
|
69619
|
+
// WITH_GENESYS
|
|
69620
|
+
ProfilerService.end( 'shadowMap.render.updateMatrices' );
|
|
69621
|
+
// !WITH_GENESYS
|
|
69622
|
+
|
|
69594
69623
|
_frustum = shadow.getFrustum();
|
|
69595
69624
|
|
|
69625
|
+
// WITH_GENESYS
|
|
69626
|
+
ProfilerService.begin( faceLabel );
|
|
69627
|
+
// !WITH_GENESYS
|
|
69596
69628
|
renderObject( scene, camera, shadow.camera, light, this.type );
|
|
69629
|
+
// WITH_GENESYS
|
|
69630
|
+
ProfilerService.end( faceLabel );
|
|
69631
|
+
// !WITH_GENESYS
|
|
69597
69632
|
|
|
69598
69633
|
}
|
|
69599
69634
|
|
|
@@ -69601,12 +69636,22 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69601
69636
|
|
|
69602
69637
|
if ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {
|
|
69603
69638
|
|
|
69639
|
+
// WITH_GENESYS
|
|
69640
|
+
ProfilerService.begin( 'shadowMap.render.vsmPass' );
|
|
69641
|
+
// !WITH_GENESYS
|
|
69604
69642
|
VSMPass( shadow, camera );
|
|
69643
|
+
// WITH_GENESYS
|
|
69644
|
+
ProfilerService.end( 'shadowMap.render.vsmPass' );
|
|
69645
|
+
// !WITH_GENESYS
|
|
69605
69646
|
|
|
69606
69647
|
}
|
|
69607
69648
|
|
|
69608
69649
|
shadow.needsUpdate = false;
|
|
69609
69650
|
|
|
69651
|
+
// WITH_GENESYS
|
|
69652
|
+
ProfilerService.end( lightLabel );
|
|
69653
|
+
// !WITH_GENESYS
|
|
69654
|
+
|
|
69610
69655
|
}
|
|
69611
69656
|
|
|
69612
69657
|
_previousType = this.type;
|
|
@@ -69642,21 +69687,33 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
69642
69687
|
|
|
69643
69688
|
// vertical pass - read from native depth texture
|
|
69644
69689
|
|
|
69690
|
+
// WITH_GENESYS
|
|
69691
|
+
ProfilerService.begin( 'shadowMap.vsmPass.vertical' );
|
|
69692
|
+
// !WITH_GENESYS
|
|
69645
69693
|
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;
|
|
69646
69694
|
shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
|
|
69647
69695
|
shadowMaterialVertical.uniforms.radius.value = shadow.radius;
|
|
69648
69696
|
renderer.setRenderTarget( shadow.mapPass );
|
|
69649
69697
|
renderer.clear();
|
|
69650
69698
|
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
|
|
69699
|
+
// WITH_GENESYS
|
|
69700
|
+
ProfilerService.end( 'shadowMap.vsmPass.vertical' );
|
|
69701
|
+
// !WITH_GENESYS
|
|
69651
69702
|
|
|
69652
69703
|
// horizontal pass
|
|
69653
69704
|
|
|
69705
|
+
// WITH_GENESYS
|
|
69706
|
+
ProfilerService.begin( 'shadowMap.vsmPass.horizontal' );
|
|
69707
|
+
// !WITH_GENESYS
|
|
69654
69708
|
shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
|
|
69655
69709
|
shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
|
|
69656
69710
|
shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
|
|
69657
69711
|
renderer.setRenderTarget( shadow.map );
|
|
69658
69712
|
renderer.clear();
|
|
69659
69713
|
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );
|
|
69714
|
+
// WITH_GENESYS
|
|
69715
|
+
ProfilerService.end( 'shadowMap.vsmPass.horizontal' );
|
|
69716
|
+
// !WITH_GENESYS
|
|
69660
69717
|
|
|
69661
69718
|
}
|
|
69662
69719
|
|
|
@@ -76204,6 +76261,8 @@ function getDFGLUT() {
|
|
|
76204
76261
|
|
|
76205
76262
|
}
|
|
76206
76263
|
|
|
76264
|
+
// !WITH_GENESYS
|
|
76265
|
+
|
|
76207
76266
|
/**
|
|
76208
76267
|
* This renderer uses WebGL 2 to display scenes.
|
|
76209
76268
|
*
|
|
@@ -77749,14 +77808,28 @@ class WebGLRenderer {
|
|
|
77749
77808
|
*/
|
|
77750
77809
|
this.render = function ( scene, camera ) {
|
|
77751
77810
|
|
|
77811
|
+
// WITH_GENESYS
|
|
77812
|
+
ProfilerService.begin( 'WebGLRenderer.render' );
|
|
77813
|
+
// !WITH_GENESYS
|
|
77814
|
+
|
|
77752
77815
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
77753
77816
|
|
|
77754
77817
|
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
77818
|
+
// WITH_GENESYS
|
|
77819
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
77820
|
+
// !WITH_GENESYS
|
|
77755
77821
|
return;
|
|
77756
77822
|
|
|
77757
77823
|
}
|
|
77758
77824
|
|
|
77759
|
-
if ( _isContextLost === true )
|
|
77825
|
+
if ( _isContextLost === true ) {
|
|
77826
|
+
|
|
77827
|
+
// WITH_GENESYS
|
|
77828
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
77829
|
+
// !WITH_GENESYS
|
|
77830
|
+
return;
|
|
77831
|
+
|
|
77832
|
+
}
|
|
77760
77833
|
|
|
77761
77834
|
// update node builder if available
|
|
77762
77835
|
if ( _nodesHandler !== null ) {
|
|
@@ -77773,7 +77846,13 @@ class WebGLRenderer {
|
|
|
77773
77846
|
|
|
77774
77847
|
// update scene graph
|
|
77775
77848
|
|
|
77849
|
+
// WITH_GENESYS
|
|
77850
|
+
ProfilerService.begin( 'scene.updateMatrixWorld' );
|
|
77851
|
+
// !WITH_GENESYS
|
|
77776
77852
|
if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
|
|
77853
|
+
// WITH_GENESYS
|
|
77854
|
+
ProfilerService.end( 'scene.updateMatrixWorld' );
|
|
77855
|
+
// !WITH_GENESYS
|
|
77777
77856
|
|
|
77778
77857
|
// update camera matrices and frustum
|
|
77779
77858
|
|
|
@@ -77807,6 +77886,10 @@ class WebGLRenderer {
|
|
|
77807
77886
|
|
|
77808
77887
|
renderListStack.push( currentRenderList );
|
|
77809
77888
|
|
|
77889
|
+
// WITH_GENESYS
|
|
77890
|
+
ProfilerService.begin( 'buildRenderList' );
|
|
77891
|
+
// !WITH_GENESYS
|
|
77892
|
+
|
|
77810
77893
|
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
77811
77894
|
|
|
77812
77895
|
const depthSensingMesh = _this.xr.getDepthSensingMesh();
|
|
@@ -77819,16 +77902,34 @@ class WebGLRenderer {
|
|
|
77819
77902
|
|
|
77820
77903
|
}
|
|
77821
77904
|
|
|
77905
|
+
// WITH_GENESYS
|
|
77906
|
+
ProfilerService.begin( 'projectObject' );
|
|
77907
|
+
// !WITH_GENESYS
|
|
77908
|
+
|
|
77822
77909
|
projectObject( scene, camera, 0, _this.sortObjects );
|
|
77823
77910
|
|
|
77911
|
+
// WITH_GENESYS
|
|
77912
|
+
ProfilerService.end( 'projectObject' );
|
|
77913
|
+
// !WITH_GENESYS
|
|
77914
|
+
|
|
77824
77915
|
currentRenderList.finish();
|
|
77825
77916
|
|
|
77826
77917
|
if ( _this.sortObjects === true ) {
|
|
77827
77918
|
|
|
77919
|
+
// WITH_GENESYS
|
|
77920
|
+
ProfilerService.begin( 'sortRenderList' );
|
|
77921
|
+
// !WITH_GENESYS
|
|
77828
77922
|
currentRenderList.sort( _opaqueSort, _transparentSort );
|
|
77923
|
+
// WITH_GENESYS
|
|
77924
|
+
ProfilerService.end( 'sortRenderList' );
|
|
77925
|
+
// !WITH_GENESYS
|
|
77829
77926
|
|
|
77830
77927
|
}
|
|
77831
77928
|
|
|
77929
|
+
// WITH_GENESYS
|
|
77930
|
+
ProfilerService.end( 'buildRenderList' );
|
|
77931
|
+
// !WITH_GENESYS
|
|
77932
|
+
|
|
77832
77933
|
_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
|
|
77833
77934
|
if ( _renderBackground ) {
|
|
77834
77935
|
|
|
@@ -77844,7 +77945,13 @@ class WebGLRenderer {
|
|
|
77844
77945
|
|
|
77845
77946
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
77846
77947
|
|
|
77948
|
+
// WITH_GENESYS
|
|
77949
|
+
ProfilerService.begin( 'shadowMap.render' );
|
|
77950
|
+
// !WITH_GENESYS
|
|
77847
77951
|
shadowMap.render( shadowsArray, scene, camera );
|
|
77952
|
+
// WITH_GENESYS
|
|
77953
|
+
ProfilerService.end( 'shadowMap.render' );
|
|
77954
|
+
// !WITH_GENESYS
|
|
77848
77955
|
|
|
77849
77956
|
if ( _clippingEnabled === true ) clipping.endShadows();
|
|
77850
77957
|
|
|
@@ -77858,6 +77965,10 @@ class WebGLRenderer {
|
|
|
77858
77965
|
|
|
77859
77966
|
if ( skipSceneRender === false ) {
|
|
77860
77967
|
|
|
77968
|
+
// WITH_GENESYS
|
|
77969
|
+
ProfilerService.begin( 'WebGLRenderer.renderScene' );
|
|
77970
|
+
// !WITH_GENESYS
|
|
77971
|
+
|
|
77861
77972
|
const opaqueObjects = currentRenderList.opaque;
|
|
77862
77973
|
const transmissiveObjects = currentRenderList.transmissive;
|
|
77863
77974
|
|
|
@@ -77899,6 +78010,10 @@ class WebGLRenderer {
|
|
|
77899
78010
|
|
|
77900
78011
|
}
|
|
77901
78012
|
|
|
78013
|
+
// WITH_GENESYS
|
|
78014
|
+
ProfilerService.end( 'WebGLRenderer.renderScene' );
|
|
78015
|
+
// !WITH_GENESYS
|
|
78016
|
+
|
|
77902
78017
|
}
|
|
77903
78018
|
|
|
77904
78019
|
//
|
|
@@ -77919,7 +78034,13 @@ class WebGLRenderer {
|
|
|
77919
78034
|
|
|
77920
78035
|
if ( useOutput ) {
|
|
77921
78036
|
|
|
78037
|
+
// WITH_GENESYS
|
|
78038
|
+
ProfilerService.begin( 'WebGLOutput.end' );
|
|
78039
|
+
// !WITH_GENESYS
|
|
77922
78040
|
output.end( _this );
|
|
78041
|
+
// WITH_GENESYS
|
|
78042
|
+
ProfilerService.end( 'WebGLOutput.end' );
|
|
78043
|
+
// !WITH_GENESYS
|
|
77923
78044
|
|
|
77924
78045
|
}
|
|
77925
78046
|
|
|
@@ -77967,6 +78088,10 @@ class WebGLRenderer {
|
|
|
77967
78088
|
|
|
77968
78089
|
}
|
|
77969
78090
|
|
|
78091
|
+
// WITH_GENESYS
|
|
78092
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
78093
|
+
// !WITH_GENESYS
|
|
78094
|
+
|
|
77970
78095
|
};
|
|
77971
78096
|
|
|
77972
78097
|
function projectObject( object, camera, groupOrder, sortObjects ) {
|
|
@@ -78113,10 +78238,17 @@ class WebGLRenderer {
|
|
|
78113
78238
|
|
|
78114
78239
|
function renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {
|
|
78115
78240
|
|
|
78241
|
+
// WITH_GENESYS
|
|
78242
|
+
ProfilerService.begin( 'WebGLRenderer.renderTransmissionPass' );
|
|
78243
|
+
// !WITH_GENESYS
|
|
78244
|
+
|
|
78116
78245
|
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
78117
78246
|
|
|
78118
78247
|
if ( overrideMaterial !== null ) {
|
|
78119
78248
|
|
|
78249
|
+
// WITH_GENESYS
|
|
78250
|
+
ProfilerService.end( 'WebGLRenderer.renderTransmissionPass' );
|
|
78251
|
+
// !WITH_GENESYS
|
|
78120
78252
|
return;
|
|
78121
78253
|
|
|
78122
78254
|
}
|
|
@@ -78233,10 +78365,19 @@ class WebGLRenderer {
|
|
|
78233
78365
|
|
|
78234
78366
|
_this.toneMapping = currentToneMapping;
|
|
78235
78367
|
|
|
78368
|
+
// WITH_GENESYS
|
|
78369
|
+
ProfilerService.end( 'WebGLRenderer.renderTransmissionPass' );
|
|
78370
|
+
// !WITH_GENESYS
|
|
78371
|
+
|
|
78236
78372
|
}
|
|
78237
78373
|
|
|
78238
78374
|
function renderObjects( renderList, scene, camera ) {
|
|
78239
78375
|
|
|
78376
|
+
// WITH_GENESYS
|
|
78377
|
+
const renderObjectsLabel = `renderObjects (${renderList.length})`;
|
|
78378
|
+
ProfilerService.begin( renderObjectsLabel );
|
|
78379
|
+
// !WITH_GENESYS
|
|
78380
|
+
|
|
78240
78381
|
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
78241
78382
|
|
|
78242
78383
|
for ( let i = 0, l = renderList.length; i < l; i ++ ) {
|
|
@@ -78260,6 +78401,10 @@ class WebGLRenderer {
|
|
|
78260
78401
|
|
|
78261
78402
|
}
|
|
78262
78403
|
|
|
78404
|
+
// WITH_GENESYS
|
|
78405
|
+
ProfilerService.end( renderObjectsLabel );
|
|
78406
|
+
// !WITH_GENESYS
|
|
78407
|
+
|
|
78263
78408
|
}
|
|
78264
78409
|
|
|
78265
78410
|
function renderObject( object, scene, camera, geometry, material, group ) {
|
package/build/three.core.js
CHANGED
|
@@ -59711,10 +59711,6 @@ class TextureUtils {
|
|
|
59711
59711
|
/**
|
|
59712
59712
|
* ProfilerService — per-label CPU timing with ring-buffer aggregation and DevTools integration.
|
|
59713
59713
|
*
|
|
59714
|
-
* Activate via environment variable:
|
|
59715
|
-
* PROFILING=1 stats + trace (full profile)
|
|
59716
|
-
* PROFILING=stats stats only, no trace accumulation (lower overhead)
|
|
59717
|
-
*
|
|
59718
59714
|
* Quick start (browser console):
|
|
59719
59715
|
* __gnsx_profiler.enable()
|
|
59720
59716
|
* // play for a few seconds
|
|
@@ -59730,26 +59726,12 @@ const FRAME_BUDGET_MS = 1000 / 60;
|
|
|
59730
59726
|
const MAX_TRACE_EVENTS = 50_000;
|
|
59731
59727
|
const NOOP = () => {};
|
|
59732
59728
|
|
|
59733
|
-
function _readProfilingEnv() {
|
|
59734
|
-
|
|
59735
|
-
const raw =
|
|
59736
|
-
( typeof process !== 'undefined' ? process.env?.[ 'PROFILING' ] : undefined ) ??
|
|
59737
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__gnsx_env__' ]?.[ 'PROFILING' ] : undefined ) ??
|
|
59738
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__GNSX_PROFILING__' ] : undefined );
|
|
59739
|
-
|
|
59740
|
-
if ( ! raw || raw === '0' || raw === 'false' ) return false;
|
|
59741
|
-
if ( raw === 'stats' ) return 'stats';
|
|
59742
|
-
return 'full';
|
|
59743
|
-
|
|
59744
|
-
}
|
|
59745
|
-
|
|
59746
59729
|
class ProfilerServiceClass {
|
|
59747
59730
|
|
|
59748
59731
|
constructor() {
|
|
59749
59732
|
|
|
59750
|
-
|
|
59751
|
-
this.
|
|
59752
|
-
this._enabled = envProfile !== false;
|
|
59733
|
+
this._profile = 'full';
|
|
59734
|
+
this._enabled = false;
|
|
59753
59735
|
|
|
59754
59736
|
/** @type {Map<string, Float64Array>} */
|
|
59755
59737
|
this.buffers = new Map();
|
|
@@ -60133,8 +60115,6 @@ const ProfilerService = new ProfilerServiceClass();
|
|
|
60133
60115
|
|
|
60134
60116
|
function applyProfileToMethod( label, descriptor ) {
|
|
60135
60117
|
|
|
60136
|
-
if ( _readProfilingEnv() === false ) return descriptor;
|
|
60137
|
-
|
|
60138
60118
|
const original = descriptor.value;
|
|
60139
60119
|
|
|
60140
60120
|
function profiled( ...args ) {
|