@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/package.json
CHANGED
|
@@ -13,6 +13,9 @@ import { screenCoordinate } from '../display/ScreenNode.js';
|
|
|
13
13
|
import { interleavedGradientNoise, vogelDiskSample } from '../utils/PostProcessingUtils.js';
|
|
14
14
|
import { abs, normalize, cross } from '../math/MathNode.js';
|
|
15
15
|
import { viewZToPerspectiveDepth, viewZToReversedPerspectiveDepth } from '../display/ViewportDepthNode.js';
|
|
16
|
+
// WITH_GENESYS
|
|
17
|
+
import { ProfilerService } from '../../profiler/ProfilerService.js';
|
|
18
|
+
// !WITH_GENESYS
|
|
16
19
|
|
|
17
20
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
18
21
|
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
@@ -261,12 +264,20 @@ class PointShadowNode extends ShadowNode {
|
|
|
261
264
|
// Render each cube face
|
|
262
265
|
for ( let face = 0; face < 6; face ++ ) {
|
|
263
266
|
|
|
267
|
+
// WITH_GENESYS
|
|
268
|
+
const faceLabel = `shadowMap.render.depthPass (face ${face})`;
|
|
269
|
+
// !WITH_GENESYS
|
|
270
|
+
|
|
264
271
|
// Set render target to the specific cube face
|
|
265
272
|
renderer.setRenderTarget( shadowMap, face );
|
|
266
273
|
renderer.clear();
|
|
267
274
|
|
|
268
275
|
// Update shadow camera matrices for this face
|
|
269
276
|
|
|
277
|
+
// WITH_GENESYS
|
|
278
|
+
ProfilerService.begin( 'shadowMap.render.updateMatrices' );
|
|
279
|
+
// !WITH_GENESYS
|
|
280
|
+
|
|
270
281
|
const far = light.distance || camera.far;
|
|
271
282
|
|
|
272
283
|
if ( far !== camera.far ) {
|
|
@@ -290,13 +301,23 @@ class PointShadowNode extends ShadowNode {
|
|
|
290
301
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
291
302
|
shadow._frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );
|
|
292
303
|
|
|
304
|
+
// WITH_GENESYS
|
|
305
|
+
ProfilerService.end( 'shadowMap.render.updateMatrices' );
|
|
306
|
+
// !WITH_GENESYS
|
|
307
|
+
|
|
293
308
|
//
|
|
294
309
|
|
|
295
310
|
const currentSceneName = scene.name;
|
|
296
311
|
|
|
297
312
|
scene.name = `Point Light Shadow [ ${ light.name || 'ID: ' + light.id } ] - Face ${ face + 1 }`;
|
|
298
313
|
|
|
314
|
+
// WITH_GENESYS
|
|
315
|
+
ProfilerService.begin( faceLabel );
|
|
316
|
+
// !WITH_GENESYS
|
|
299
317
|
renderer.render( scene, camera );
|
|
318
|
+
// WITH_GENESYS
|
|
319
|
+
ProfilerService.end( faceLabel );
|
|
320
|
+
// !WITH_GENESYS
|
|
300
321
|
|
|
301
322
|
scene.name = currentSceneName;
|
|
302
323
|
|
|
@@ -680,29 +680,33 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
680
680
|
*/
|
|
681
681
|
renderShadow( frame ) {
|
|
682
682
|
|
|
683
|
-
// WITH_GENESYS
|
|
684
|
-
ProfilerService.begin( 'ShadowNode.renderShadow' );
|
|
685
|
-
// !WITH_GENESYS
|
|
686
|
-
|
|
687
683
|
const { shadow, shadowMap, light } = this;
|
|
688
684
|
const { renderer, scene } = frame;
|
|
689
685
|
|
|
686
|
+
// WITH_GENESYS
|
|
687
|
+
ProfilerService.begin( 'shadowMap.render.updateMatrices' );
|
|
688
|
+
// !WITH_GENESYS
|
|
690
689
|
shadow.updateMatrices( light );
|
|
691
690
|
|
|
692
691
|
shadowMap.setSize( shadow.mapSize.width, shadow.mapSize.height, shadowMap.depth );
|
|
692
|
+
// WITH_GENESYS
|
|
693
|
+
ProfilerService.end( 'shadowMap.render.updateMatrices' );
|
|
694
|
+
// !WITH_GENESYS
|
|
693
695
|
|
|
694
696
|
const currentSceneName = scene.name;
|
|
695
697
|
|
|
696
698
|
scene.name = `Shadow Map [ ${ light.name || 'ID: ' + light.id } ]`;
|
|
697
699
|
|
|
700
|
+
// WITH_GENESYS
|
|
701
|
+
ProfilerService.begin( 'shadowMap.render.depthPass' );
|
|
702
|
+
// !WITH_GENESYS
|
|
698
703
|
renderer.render( scene, shadow.camera );
|
|
699
|
-
|
|
700
|
-
scene.name = currentSceneName;
|
|
701
|
-
|
|
702
704
|
// WITH_GENESYS
|
|
703
|
-
ProfilerService.end( '
|
|
705
|
+
ProfilerService.end( 'shadowMap.render.depthPass' );
|
|
704
706
|
// !WITH_GENESYS
|
|
705
707
|
|
|
708
|
+
scene.name = currentSceneName;
|
|
709
|
+
|
|
706
710
|
}
|
|
707
711
|
|
|
708
712
|
/**
|
|
@@ -715,6 +719,11 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
715
719
|
const { shadowMap, light, shadow } = this;
|
|
716
720
|
const { renderer, scene, camera } = frame;
|
|
717
721
|
|
|
722
|
+
// WITH_GENESYS
|
|
723
|
+
const lightLabel = `shadowMap.render.light (${light.name || light.type})`;
|
|
724
|
+
ProfilerService.begin( lightLabel );
|
|
725
|
+
// !WITH_GENESYS
|
|
726
|
+
|
|
718
727
|
const shadowType = renderer.shadowMap.type;
|
|
719
728
|
|
|
720
729
|
const depthVersion = shadowMap.depthTexture.version;
|
|
@@ -733,6 +742,9 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
733
742
|
const currentMRT = renderer.getMRT();
|
|
734
743
|
const useVelocity = currentMRT ? currentMRT.has( 'velocity' ) : false;
|
|
735
744
|
|
|
745
|
+
// WITH_GENESYS
|
|
746
|
+
ProfilerService.begin( 'shadowMap.render.setupPass' );
|
|
747
|
+
// !WITH_GENESYS
|
|
736
748
|
_rendererState = resetRendererAndSceneState( renderer, scene, _rendererState );
|
|
737
749
|
|
|
738
750
|
scene.overrideMaterial = getShadowMaterial( light );
|
|
@@ -742,6 +754,9 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
742
754
|
renderer.setClearColor( 0x000000, 0 );
|
|
743
755
|
|
|
744
756
|
renderer.setRenderTarget( shadowMap );
|
|
757
|
+
// WITH_GENESYS
|
|
758
|
+
ProfilerService.end( 'shadowMap.render.setupPass' );
|
|
759
|
+
// !WITH_GENESYS
|
|
745
760
|
|
|
746
761
|
this.renderShadow( frame );
|
|
747
762
|
|
|
@@ -751,7 +766,13 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
751
766
|
|
|
752
767
|
if ( shadowType === VSMShadowMap && shadow.isPointLightShadow !== true ) {
|
|
753
768
|
|
|
769
|
+
// WITH_GENESYS
|
|
770
|
+
ProfilerService.begin( 'shadowMap.render.vsmPass' );
|
|
771
|
+
// !WITH_GENESYS
|
|
754
772
|
this.vsmPass( renderer );
|
|
773
|
+
// WITH_GENESYS
|
|
774
|
+
ProfilerService.end( 'shadowMap.render.vsmPass' );
|
|
775
|
+
// !WITH_GENESYS
|
|
755
776
|
|
|
756
777
|
}
|
|
757
778
|
|
|
@@ -759,6 +780,10 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
759
780
|
|
|
760
781
|
restoreRendererAndSceneState( renderer, scene, _rendererState );
|
|
761
782
|
|
|
783
|
+
// WITH_GENESYS
|
|
784
|
+
ProfilerService.end( lightLabel );
|
|
785
|
+
// !WITH_GENESYS
|
|
786
|
+
|
|
762
787
|
}
|
|
763
788
|
|
|
764
789
|
/**
|
|
@@ -768,26 +793,30 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
768
793
|
*/
|
|
769
794
|
vsmPass( renderer ) {
|
|
770
795
|
|
|
771
|
-
// WITH_GENESYS
|
|
772
|
-
ProfilerService.begin( 'ShadowNode.vsmPass' );
|
|
773
|
-
// !WITH_GENESYS
|
|
774
|
-
|
|
775
796
|
const { shadow } = this;
|
|
776
797
|
|
|
777
798
|
const depth = this.shadowMap.depth;
|
|
778
799
|
this.vsmShadowMapVertical.setSize( shadow.mapSize.width, shadow.mapSize.height, depth );
|
|
779
800
|
this.vsmShadowMapHorizontal.setSize( shadow.mapSize.width, shadow.mapSize.height, depth );
|
|
780
801
|
|
|
802
|
+
// WITH_GENESYS
|
|
803
|
+
ProfilerService.begin( 'shadowMap.vsmPass.vertical' );
|
|
804
|
+
// !WITH_GENESYS
|
|
781
805
|
renderer.setRenderTarget( this.vsmShadowMapVertical );
|
|
782
806
|
_quadMesh.material = this.vsmMaterialVertical;
|
|
783
807
|
_quadMesh.render( renderer );
|
|
808
|
+
// WITH_GENESYS
|
|
809
|
+
ProfilerService.end( 'shadowMap.vsmPass.vertical' );
|
|
810
|
+
// !WITH_GENESYS
|
|
784
811
|
|
|
812
|
+
// WITH_GENESYS
|
|
813
|
+
ProfilerService.begin( 'shadowMap.vsmPass.horizontal' );
|
|
814
|
+
// !WITH_GENESYS
|
|
785
815
|
renderer.setRenderTarget( this.vsmShadowMapHorizontal );
|
|
786
816
|
_quadMesh.material = this.vsmMaterialHorizontal;
|
|
787
817
|
_quadMesh.render( renderer );
|
|
788
|
-
|
|
789
818
|
// WITH_GENESYS
|
|
790
|
-
ProfilerService.end( '
|
|
819
|
+
ProfilerService.end( 'shadowMap.vsmPass.horizontal' );
|
|
791
820
|
// !WITH_GENESYS
|
|
792
821
|
|
|
793
822
|
}
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* ProfilerService — per-label CPU timing with ring-buffer aggregation and DevTools integration.
|
|
4
4
|
*
|
|
5
|
-
* Activate via environment variable:
|
|
6
|
-
* PROFILING=1 stats + trace (full profile)
|
|
7
|
-
* PROFILING=stats stats only, no trace accumulation (lower overhead)
|
|
8
|
-
*
|
|
9
5
|
* Quick start (browser console):
|
|
10
6
|
* __gnsx_profiler.enable()
|
|
11
7
|
* // play for a few seconds
|
|
@@ -21,26 +17,12 @@ const FRAME_BUDGET_MS = 1000 / 60;
|
|
|
21
17
|
const MAX_TRACE_EVENTS = 50_000;
|
|
22
18
|
const NOOP = () => {};
|
|
23
19
|
|
|
24
|
-
function _readProfilingEnv() {
|
|
25
|
-
|
|
26
|
-
const raw =
|
|
27
|
-
( typeof process !== 'undefined' ? process.env?.[ 'PROFILING' ] : undefined ) ??
|
|
28
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__gnsx_env__' ]?.[ 'PROFILING' ] : undefined ) ??
|
|
29
|
-
( typeof globalThis !== 'undefined' ? globalThis[ '__GNSX_PROFILING__' ] : undefined );
|
|
30
|
-
|
|
31
|
-
if ( ! raw || raw === '0' || raw === 'false' ) return false;
|
|
32
|
-
if ( raw === 'stats' ) return 'stats';
|
|
33
|
-
return 'full';
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
20
|
class ProfilerServiceClass {
|
|
38
21
|
|
|
39
22
|
constructor() {
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
this._enabled = envProfile !== false;
|
|
24
|
+
this._profile = 'full';
|
|
25
|
+
this._enabled = false;
|
|
44
26
|
|
|
45
27
|
/** @type {Map<string, Float64Array>} */
|
|
46
28
|
this.buffers = new Map();
|
|
@@ -424,8 +406,6 @@ const ProfilerService = new ProfilerServiceClass();
|
|
|
424
406
|
|
|
425
407
|
function applyProfileToMethod( label, descriptor ) {
|
|
426
408
|
|
|
427
|
-
if ( _readProfilingEnv() === false ) return descriptor;
|
|
428
|
-
|
|
429
409
|
const original = descriptor.value;
|
|
430
410
|
|
|
431
411
|
function profiled( ...args ) {
|
|
@@ -54,6 +54,9 @@ import { WebGLUniformsGroups } from './webgl/WebGLUniformsGroups.js';
|
|
|
54
54
|
import { createCanvasElement, probeAsync, error, warn, log } from '../utils.js';
|
|
55
55
|
import { ColorManagement } from '../math/ColorManagement.js';
|
|
56
56
|
import { getDFGLUT } from './shaders/DFGLUTData.js';
|
|
57
|
+
// WITH_GENESYS
|
|
58
|
+
import { ProfilerService } from '../profiler/ProfilerService.js';
|
|
59
|
+
// !WITH_GENESYS
|
|
57
60
|
|
|
58
61
|
/**
|
|
59
62
|
* This renderer uses WebGL 2 to display scenes.
|
|
@@ -1600,14 +1603,28 @@ class WebGLRenderer {
|
|
|
1600
1603
|
*/
|
|
1601
1604
|
this.render = function ( scene, camera ) {
|
|
1602
1605
|
|
|
1606
|
+
// WITH_GENESYS
|
|
1607
|
+
ProfilerService.begin( 'WebGLRenderer.render' );
|
|
1608
|
+
// !WITH_GENESYS
|
|
1609
|
+
|
|
1603
1610
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
1604
1611
|
|
|
1605
1612
|
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
1613
|
+
// WITH_GENESYS
|
|
1614
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
1615
|
+
// !WITH_GENESYS
|
|
1606
1616
|
return;
|
|
1607
1617
|
|
|
1608
1618
|
}
|
|
1609
1619
|
|
|
1610
|
-
if ( _isContextLost === true )
|
|
1620
|
+
if ( _isContextLost === true ) {
|
|
1621
|
+
|
|
1622
|
+
// WITH_GENESYS
|
|
1623
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
1624
|
+
// !WITH_GENESYS
|
|
1625
|
+
return;
|
|
1626
|
+
|
|
1627
|
+
}
|
|
1611
1628
|
|
|
1612
1629
|
// update node builder if available
|
|
1613
1630
|
if ( _nodesHandler !== null ) {
|
|
@@ -1624,7 +1641,13 @@ class WebGLRenderer {
|
|
|
1624
1641
|
|
|
1625
1642
|
// update scene graph
|
|
1626
1643
|
|
|
1644
|
+
// WITH_GENESYS
|
|
1645
|
+
ProfilerService.begin( 'scene.updateMatrixWorld' );
|
|
1646
|
+
// !WITH_GENESYS
|
|
1627
1647
|
if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
|
|
1648
|
+
// WITH_GENESYS
|
|
1649
|
+
ProfilerService.end( 'scene.updateMatrixWorld' );
|
|
1650
|
+
// !WITH_GENESYS
|
|
1628
1651
|
|
|
1629
1652
|
// update camera matrices and frustum
|
|
1630
1653
|
|
|
@@ -1658,6 +1681,10 @@ class WebGLRenderer {
|
|
|
1658
1681
|
|
|
1659
1682
|
renderListStack.push( currentRenderList );
|
|
1660
1683
|
|
|
1684
|
+
// WITH_GENESYS
|
|
1685
|
+
ProfilerService.begin( 'buildRenderList' );
|
|
1686
|
+
// !WITH_GENESYS
|
|
1687
|
+
|
|
1661
1688
|
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
1662
1689
|
|
|
1663
1690
|
const depthSensingMesh = _this.xr.getDepthSensingMesh();
|
|
@@ -1670,16 +1697,34 @@ class WebGLRenderer {
|
|
|
1670
1697
|
|
|
1671
1698
|
}
|
|
1672
1699
|
|
|
1700
|
+
// WITH_GENESYS
|
|
1701
|
+
ProfilerService.begin( 'projectObject' );
|
|
1702
|
+
// !WITH_GENESYS
|
|
1703
|
+
|
|
1673
1704
|
projectObject( scene, camera, 0, _this.sortObjects );
|
|
1674
1705
|
|
|
1706
|
+
// WITH_GENESYS
|
|
1707
|
+
ProfilerService.end( 'projectObject' );
|
|
1708
|
+
// !WITH_GENESYS
|
|
1709
|
+
|
|
1675
1710
|
currentRenderList.finish();
|
|
1676
1711
|
|
|
1677
1712
|
if ( _this.sortObjects === true ) {
|
|
1678
1713
|
|
|
1714
|
+
// WITH_GENESYS
|
|
1715
|
+
ProfilerService.begin( 'sortRenderList' );
|
|
1716
|
+
// !WITH_GENESYS
|
|
1679
1717
|
currentRenderList.sort( _opaqueSort, _transparentSort );
|
|
1718
|
+
// WITH_GENESYS
|
|
1719
|
+
ProfilerService.end( 'sortRenderList' );
|
|
1720
|
+
// !WITH_GENESYS
|
|
1680
1721
|
|
|
1681
1722
|
}
|
|
1682
1723
|
|
|
1724
|
+
// WITH_GENESYS
|
|
1725
|
+
ProfilerService.end( 'buildRenderList' );
|
|
1726
|
+
// !WITH_GENESYS
|
|
1727
|
+
|
|
1683
1728
|
_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
|
|
1684
1729
|
if ( _renderBackground ) {
|
|
1685
1730
|
|
|
@@ -1695,7 +1740,13 @@ class WebGLRenderer {
|
|
|
1695
1740
|
|
|
1696
1741
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
1697
1742
|
|
|
1743
|
+
// WITH_GENESYS
|
|
1744
|
+
ProfilerService.begin( 'shadowMap.render' );
|
|
1745
|
+
// !WITH_GENESYS
|
|
1698
1746
|
shadowMap.render( shadowsArray, scene, camera );
|
|
1747
|
+
// WITH_GENESYS
|
|
1748
|
+
ProfilerService.end( 'shadowMap.render' );
|
|
1749
|
+
// !WITH_GENESYS
|
|
1699
1750
|
|
|
1700
1751
|
if ( _clippingEnabled === true ) clipping.endShadows();
|
|
1701
1752
|
|
|
@@ -1709,6 +1760,10 @@ class WebGLRenderer {
|
|
|
1709
1760
|
|
|
1710
1761
|
if ( skipSceneRender === false ) {
|
|
1711
1762
|
|
|
1763
|
+
// WITH_GENESYS
|
|
1764
|
+
ProfilerService.begin( 'WebGLRenderer.renderScene' );
|
|
1765
|
+
// !WITH_GENESYS
|
|
1766
|
+
|
|
1712
1767
|
const opaqueObjects = currentRenderList.opaque;
|
|
1713
1768
|
const transmissiveObjects = currentRenderList.transmissive;
|
|
1714
1769
|
|
|
@@ -1750,6 +1805,10 @@ class WebGLRenderer {
|
|
|
1750
1805
|
|
|
1751
1806
|
}
|
|
1752
1807
|
|
|
1808
|
+
// WITH_GENESYS
|
|
1809
|
+
ProfilerService.end( 'WebGLRenderer.renderScene' );
|
|
1810
|
+
// !WITH_GENESYS
|
|
1811
|
+
|
|
1753
1812
|
}
|
|
1754
1813
|
|
|
1755
1814
|
//
|
|
@@ -1770,7 +1829,13 @@ class WebGLRenderer {
|
|
|
1770
1829
|
|
|
1771
1830
|
if ( useOutput ) {
|
|
1772
1831
|
|
|
1832
|
+
// WITH_GENESYS
|
|
1833
|
+
ProfilerService.begin( 'WebGLOutput.end' );
|
|
1834
|
+
// !WITH_GENESYS
|
|
1773
1835
|
output.end( _this );
|
|
1836
|
+
// WITH_GENESYS
|
|
1837
|
+
ProfilerService.end( 'WebGLOutput.end' );
|
|
1838
|
+
// !WITH_GENESYS
|
|
1774
1839
|
|
|
1775
1840
|
}
|
|
1776
1841
|
|
|
@@ -1818,6 +1883,10 @@ class WebGLRenderer {
|
|
|
1818
1883
|
|
|
1819
1884
|
}
|
|
1820
1885
|
|
|
1886
|
+
// WITH_GENESYS
|
|
1887
|
+
ProfilerService.end( 'WebGLRenderer.render' );
|
|
1888
|
+
// !WITH_GENESYS
|
|
1889
|
+
|
|
1821
1890
|
};
|
|
1822
1891
|
|
|
1823
1892
|
function projectObject( object, camera, groupOrder, sortObjects ) {
|
|
@@ -1964,10 +2033,17 @@ class WebGLRenderer {
|
|
|
1964
2033
|
|
|
1965
2034
|
function renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {
|
|
1966
2035
|
|
|
2036
|
+
// WITH_GENESYS
|
|
2037
|
+
ProfilerService.begin( 'WebGLRenderer.renderTransmissionPass' );
|
|
2038
|
+
// !WITH_GENESYS
|
|
2039
|
+
|
|
1967
2040
|
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
1968
2041
|
|
|
1969
2042
|
if ( overrideMaterial !== null ) {
|
|
1970
2043
|
|
|
2044
|
+
// WITH_GENESYS
|
|
2045
|
+
ProfilerService.end( 'WebGLRenderer.renderTransmissionPass' );
|
|
2046
|
+
// !WITH_GENESYS
|
|
1971
2047
|
return;
|
|
1972
2048
|
|
|
1973
2049
|
}
|
|
@@ -2084,10 +2160,19 @@ class WebGLRenderer {
|
|
|
2084
2160
|
|
|
2085
2161
|
_this.toneMapping = currentToneMapping;
|
|
2086
2162
|
|
|
2163
|
+
// WITH_GENESYS
|
|
2164
|
+
ProfilerService.end( 'WebGLRenderer.renderTransmissionPass' );
|
|
2165
|
+
// !WITH_GENESYS
|
|
2166
|
+
|
|
2087
2167
|
}
|
|
2088
2168
|
|
|
2089
2169
|
function renderObjects( renderList, scene, camera ) {
|
|
2090
2170
|
|
|
2171
|
+
// WITH_GENESYS
|
|
2172
|
+
const renderObjectsLabel = `renderObjects (${renderList.length})`;
|
|
2173
|
+
ProfilerService.begin( renderObjectsLabel );
|
|
2174
|
+
// !WITH_GENESYS
|
|
2175
|
+
|
|
2091
2176
|
const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
|
|
2092
2177
|
|
|
2093
2178
|
for ( let i = 0, l = renderList.length; i < l; i ++ ) {
|
|
@@ -2111,6 +2196,10 @@ class WebGLRenderer {
|
|
|
2111
2196
|
|
|
2112
2197
|
}
|
|
2113
2198
|
|
|
2199
|
+
// WITH_GENESYS
|
|
2200
|
+
ProfilerService.end( renderObjectsLabel );
|
|
2201
|
+
// !WITH_GENESYS
|
|
2202
|
+
|
|
2114
2203
|
}
|
|
2115
2204
|
|
|
2116
2205
|
function renderObject( object, scene, camera, geometry, material, group ) {
|
|
@@ -17,6 +17,9 @@ import { CubeDepthTexture } from '../../textures/CubeDepthTexture.js';
|
|
|
17
17
|
import * as vsm from '../shaders/ShaderLib/vsm.glsl.js';
|
|
18
18
|
import { warn } from '../../utils.js';
|
|
19
19
|
import { Vector3 } from '../../math/Vector3.js';
|
|
20
|
+
// WITH_GENESYS
|
|
21
|
+
import { ProfilerService } from '../../profiler/ProfilerService.js';
|
|
22
|
+
// !WITH_GENESYS
|
|
20
23
|
|
|
21
24
|
const _cubeDirections = [
|
|
22
25
|
/*@__PURE__*/ new Vector3( 1, 0, 0 ), /*@__PURE__*/ new Vector3( - 1, 0, 0 ), /*@__PURE__*/ new Vector3( 0, 1, 0 ),
|
|
@@ -133,6 +136,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
133
136
|
// (sampler2DShadow for PCF vs sampler2D for Basic)
|
|
134
137
|
if ( typeChanged ) {
|
|
135
138
|
|
|
139
|
+
// WITH_GENESYS
|
|
140
|
+
ProfilerService.begin( 'shadowMap.render.typeChangeMaterialUpdate' );
|
|
141
|
+
// !WITH_GENESYS
|
|
142
|
+
|
|
136
143
|
scene.traverse( function ( object ) {
|
|
137
144
|
|
|
138
145
|
if ( object.material ) {
|
|
@@ -151,6 +158,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
151
158
|
|
|
152
159
|
} );
|
|
153
160
|
|
|
161
|
+
// WITH_GENESYS
|
|
162
|
+
ProfilerService.end( 'shadowMap.render.typeChangeMaterialUpdate' );
|
|
163
|
+
// !WITH_GENESYS
|
|
164
|
+
|
|
154
165
|
}
|
|
155
166
|
|
|
156
167
|
// render depth map
|
|
@@ -160,14 +171,29 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
160
171
|
const light = lights[ i ];
|
|
161
172
|
const shadow = light.shadow;
|
|
162
173
|
|
|
174
|
+
// WITH_GENESYS
|
|
175
|
+
const lightLabel = `shadowMap.render.light (${light.name || light.type})`;
|
|
176
|
+
ProfilerService.begin( lightLabel );
|
|
177
|
+
// !WITH_GENESYS
|
|
178
|
+
|
|
163
179
|
if ( shadow === undefined ) {
|
|
164
180
|
|
|
165
181
|
warn( 'WebGLShadowMap:', light, 'has no shadow.' );
|
|
182
|
+
// WITH_GENESYS
|
|
183
|
+
ProfilerService.end( lightLabel );
|
|
184
|
+
// !WITH_GENESYS
|
|
166
185
|
continue;
|
|
167
186
|
|
|
168
187
|
}
|
|
169
188
|
|
|
170
|
-
if ( shadow.autoUpdate === false && shadow.needsUpdate === false )
|
|
189
|
+
if ( shadow.autoUpdate === false && shadow.needsUpdate === false ) {
|
|
190
|
+
|
|
191
|
+
// WITH_GENESYS
|
|
192
|
+
ProfilerService.end( lightLabel );
|
|
193
|
+
// !WITH_GENESYS
|
|
194
|
+
continue;
|
|
195
|
+
|
|
196
|
+
}
|
|
171
197
|
|
|
172
198
|
_shadowMapSize.copy( shadow.mapSize );
|
|
173
199
|
|
|
@@ -202,6 +228,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
202
228
|
|
|
203
229
|
if ( shadow.map === null || typeChanged === true ) {
|
|
204
230
|
|
|
231
|
+
// WITH_GENESYS
|
|
232
|
+
ProfilerService.begin( 'shadowMap.render.setupMap' );
|
|
233
|
+
// !WITH_GENESYS
|
|
234
|
+
|
|
205
235
|
if ( shadow.map !== null ) {
|
|
206
236
|
|
|
207
237
|
if ( shadow.map.depthTexture !== null ) {
|
|
@@ -220,6 +250,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
220
250
|
if ( light.isPointLight ) {
|
|
221
251
|
|
|
222
252
|
warn( 'WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.' );
|
|
253
|
+
// WITH_GENESYS
|
|
254
|
+
ProfilerService.end( 'shadowMap.render.setupMap' );
|
|
255
|
+
ProfilerService.end( lightLabel );
|
|
256
|
+
// !WITH_GENESYS
|
|
223
257
|
continue;
|
|
224
258
|
|
|
225
259
|
}
|
|
@@ -276,6 +310,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
276
310
|
|
|
277
311
|
shadow.camera.updateProjectionMatrix();
|
|
278
312
|
|
|
313
|
+
// WITH_GENESYS
|
|
314
|
+
ProfilerService.end( 'shadowMap.render.setupMap' );
|
|
315
|
+
// !WITH_GENESYS
|
|
316
|
+
|
|
279
317
|
}
|
|
280
318
|
|
|
281
319
|
// For cube render targets (PointLights), render all 6 faces. Otherwise, render once.
|
|
@@ -283,6 +321,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
283
321
|
|
|
284
322
|
for ( let face = 0; face < faceCount; face ++ ) {
|
|
285
323
|
|
|
324
|
+
// WITH_GENESYS
|
|
325
|
+
const faceLabel = faceCount > 1 ? `shadowMap.render.depthPass (face ${face})` : 'shadowMap.render.depthPass';
|
|
326
|
+
// !WITH_GENESYS
|
|
327
|
+
|
|
286
328
|
// For cube render targets, render to each face separately
|
|
287
329
|
if ( shadow.map.isWebGLCubeRenderTarget ) {
|
|
288
330
|
|
|
@@ -312,6 +354,10 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
312
354
|
|
|
313
355
|
}
|
|
314
356
|
|
|
357
|
+
// WITH_GENESYS
|
|
358
|
+
ProfilerService.begin( 'shadowMap.render.updateMatrices' );
|
|
359
|
+
// !WITH_GENESYS
|
|
360
|
+
|
|
315
361
|
if ( light.isPointLight ) {
|
|
316
362
|
|
|
317
363
|
const camera = shadow.camera;
|
|
@@ -346,9 +392,19 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
346
392
|
|
|
347
393
|
}
|
|
348
394
|
|
|
395
|
+
// WITH_GENESYS
|
|
396
|
+
ProfilerService.end( 'shadowMap.render.updateMatrices' );
|
|
397
|
+
// !WITH_GENESYS
|
|
398
|
+
|
|
349
399
|
_frustum = shadow.getFrustum();
|
|
350
400
|
|
|
401
|
+
// WITH_GENESYS
|
|
402
|
+
ProfilerService.begin( faceLabel );
|
|
403
|
+
// !WITH_GENESYS
|
|
351
404
|
renderObject( scene, camera, shadow.camera, light, this.type );
|
|
405
|
+
// WITH_GENESYS
|
|
406
|
+
ProfilerService.end( faceLabel );
|
|
407
|
+
// !WITH_GENESYS
|
|
352
408
|
|
|
353
409
|
}
|
|
354
410
|
|
|
@@ -356,12 +412,22 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
356
412
|
|
|
357
413
|
if ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {
|
|
358
414
|
|
|
415
|
+
// WITH_GENESYS
|
|
416
|
+
ProfilerService.begin( 'shadowMap.render.vsmPass' );
|
|
417
|
+
// !WITH_GENESYS
|
|
359
418
|
VSMPass( shadow, camera );
|
|
419
|
+
// WITH_GENESYS
|
|
420
|
+
ProfilerService.end( 'shadowMap.render.vsmPass' );
|
|
421
|
+
// !WITH_GENESYS
|
|
360
422
|
|
|
361
423
|
}
|
|
362
424
|
|
|
363
425
|
shadow.needsUpdate = false;
|
|
364
426
|
|
|
427
|
+
// WITH_GENESYS
|
|
428
|
+
ProfilerService.end( lightLabel );
|
|
429
|
+
// !WITH_GENESYS
|
|
430
|
+
|
|
365
431
|
}
|
|
366
432
|
|
|
367
433
|
_previousType = this.type;
|
|
@@ -397,21 +463,33 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
397
463
|
|
|
398
464
|
// vertical pass - read from native depth texture
|
|
399
465
|
|
|
466
|
+
// WITH_GENESYS
|
|
467
|
+
ProfilerService.begin( 'shadowMap.vsmPass.vertical' );
|
|
468
|
+
// !WITH_GENESYS
|
|
400
469
|
shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.depthTexture;
|
|
401
470
|
shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
|
|
402
471
|
shadowMaterialVertical.uniforms.radius.value = shadow.radius;
|
|
403
472
|
renderer.setRenderTarget( shadow.mapPass );
|
|
404
473
|
renderer.clear();
|
|
405
474
|
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
|
|
475
|
+
// WITH_GENESYS
|
|
476
|
+
ProfilerService.end( 'shadowMap.vsmPass.vertical' );
|
|
477
|
+
// !WITH_GENESYS
|
|
406
478
|
|
|
407
479
|
// horizontal pass
|
|
408
480
|
|
|
481
|
+
// WITH_GENESYS
|
|
482
|
+
ProfilerService.begin( 'shadowMap.vsmPass.horizontal' );
|
|
483
|
+
// !WITH_GENESYS
|
|
409
484
|
shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
|
|
410
485
|
shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
|
|
411
486
|
shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
|
|
412
487
|
renderer.setRenderTarget( shadow.map );
|
|
413
488
|
renderer.clear();
|
|
414
489
|
renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );
|
|
490
|
+
// WITH_GENESYS
|
|
491
|
+
ProfilerService.end( 'shadowMap.vsmPass.horizontal' );
|
|
492
|
+
// !WITH_GENESYS
|
|
415
493
|
|
|
416
494
|
}
|
|
417
495
|
|