@gnsx/three 0.184.11 → 0.184.13

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.
@@ -36,6 +36,7 @@ import { float, vec3, vec4, Fn } from '../../nodes/tsl/TSLCore.js';
36
36
  // WITH_GENESYS
37
37
  import { detachRendererReference } from '../../nodes/accessors/RendererReferenceNode.js';
38
38
  import { toneMappingExposure } from '../../nodes/display/ToneMappingNode.js';
39
+ import { ProfilerService } from '../../profiler/ProfilerService.js';
39
40
  // !WITH_GENESYS
40
41
  import { reference } from '../../nodes/accessors/ReferenceNode.js';
41
42
  import { highpModelNormalViewMatrix, highpModelViewMatrix } from '../../nodes/accessors/ModelNode.js';
@@ -1214,6 +1215,10 @@ class Renderer {
1214
1215
  */
1215
1216
  _renderBundle( bundle, sceneRef, lightsNode ) {
1216
1217
 
1218
+ // WITH_GENESYS
1219
+ ProfilerService.begin( 'renderBundle' );
1220
+ // !WITH_GENESYS
1221
+
1217
1222
  const { bundleGroup, camera, renderList } = bundle;
1218
1223
 
1219
1224
  const renderContext = this._currentRenderContext;
@@ -1280,6 +1285,10 @@ class Renderer {
1280
1285
 
1281
1286
  this.backend.addBundle( renderContext, renderBundle );
1282
1287
 
1288
+ // WITH_GENESYS
1289
+ ProfilerService.end( 'renderBundle' );
1290
+ // !WITH_GENESYS
1291
+
1283
1292
  }
1284
1293
 
1285
1294
  /**
@@ -1299,6 +1308,10 @@ class Renderer {
1299
1308
  */
1300
1309
  render( scene, camera ) {
1301
1310
 
1311
+ // WITH_GENESYS
1312
+ ProfilerService.begin( 'Renderer.render' );
1313
+ // !WITH_GENESYS
1314
+
1302
1315
  if ( this._initialized === false ) {
1303
1316
 
1304
1317
  throw new Error( 'Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.' );
@@ -1307,6 +1320,10 @@ class Renderer {
1307
1320
 
1308
1321
  this._renderScene( scene, camera );
1309
1322
 
1323
+ // WITH_GENESYS
1324
+ ProfilerService.end( 'Renderer.render' );
1325
+ // !WITH_GENESYS
1326
+
1310
1327
  }
1311
1328
 
1312
1329
  /**
@@ -1426,6 +1443,10 @@ class Renderer {
1426
1443
 
1427
1444
  if ( this._isDeviceLost === true ) return;
1428
1445
 
1446
+ // WITH_GENESYS
1447
+ ProfilerService.begin( 'Renderer._renderScene' );
1448
+ // !WITH_GENESYS
1449
+
1429
1450
  //
1430
1451
 
1431
1452
  const frameBufferTarget = useFrameBufferTarget ? this._getFrameBufferTarget() : null;
@@ -1583,7 +1604,13 @@ class Renderer {
1583
1604
 
1584
1605
  //
1585
1606
 
1607
+ // WITH_GENESYS
1608
+ ProfilerService.begin( 'scene.updateMatrixWorld' );
1609
+ // !WITH_GENESYS
1586
1610
  if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
1611
+ // WITH_GENESYS
1612
+ ProfilerService.end( 'scene.updateMatrixWorld' );
1613
+ // !WITH_GENESYS
1587
1614
 
1588
1615
  if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
1589
1616
 
@@ -1647,11 +1674,23 @@ class Renderer {
1647
1674
 
1648
1675
  }
1649
1676
 
1677
+ // WITH_GENESYS
1678
+ ProfilerService.begin( 'buildRenderList' );
1679
+ // !WITH_GENESYS
1680
+
1650
1681
  const renderList = this._renderLists.get( scene, camera );
1651
1682
  renderList.begin();
1652
1683
 
1684
+ // WITH_GENESYS
1685
+ ProfilerService.begin( '_projectObject' );
1686
+ // !WITH_GENESYS
1687
+
1653
1688
  this._projectObject( scene, camera, 0, renderList, renderContext.clippingContext );
1654
1689
 
1690
+ // WITH_GENESYS
1691
+ ProfilerService.end( '_projectObject' );
1692
+ // !WITH_GENESYS
1693
+
1655
1694
  renderList.finish();
1656
1695
 
1657
1696
  if ( this.sortObjects === true ) {
@@ -1660,6 +1699,10 @@ class Renderer {
1660
1699
 
1661
1700
  }
1662
1701
 
1702
+ // WITH_GENESYS
1703
+ ProfilerService.end( 'buildRenderList' );
1704
+ // !WITH_GENESYS
1705
+
1663
1706
  //
1664
1707
 
1665
1708
  if ( renderTarget !== null ) {
@@ -1766,6 +1809,10 @@ class Renderer {
1766
1809
 
1767
1810
  //
1768
1811
 
1812
+ // WITH_GENESYS
1813
+ ProfilerService.end( 'Renderer._renderScene' );
1814
+ // !WITH_GENESYS
1815
+
1769
1816
  return renderContext;
1770
1817
 
1771
1818
  }
@@ -3248,6 +3295,10 @@ class Renderer {
3248
3295
  */
3249
3296
  _renderTransparents( renderList, doublePassList, camera, scene, lightsNode ) {
3250
3297
 
3298
+ // WITH_GENESYS
3299
+ ProfilerService.begin( '_renderTransparents' );
3300
+ // !WITH_GENESYS
3301
+
3251
3302
  if ( doublePassList.length > 0 ) {
3252
3303
 
3253
3304
  // render back side
@@ -3284,6 +3335,10 @@ class Renderer {
3284
3335
 
3285
3336
  }
3286
3337
 
3338
+ // WITH_GENESYS
3339
+ ProfilerService.end( '_renderTransparents' );
3340
+ // !WITH_GENESYS
3341
+
3287
3342
  }
3288
3343
 
3289
3344
  /**
@@ -3298,6 +3353,11 @@ class Renderer {
3298
3353
  */
3299
3354
  _renderObjects( renderList, camera, scene, lightsNode, passId = null ) {
3300
3355
 
3356
+ // WITH_GENESYS
3357
+ const label = `${this._currentRenderObjectFunction?.name || 'renderObject'} (${renderList.length})`;
3358
+ ProfilerService.begin( label );
3359
+ // !WITH_GENESYS
3360
+
3301
3361
  for ( let i = 0, il = renderList.length; i < il; i ++ ) {
3302
3362
 
3303
3363
  const { object, geometry, material, group, clippingContext } = renderList[ i ];
@@ -3306,6 +3366,10 @@ class Renderer {
3306
3366
 
3307
3367
  }
3308
3368
 
3369
+ // WITH_GENESYS
3370
+ ProfilerService.end( label );
3371
+ // !WITH_GENESYS
3372
+
3309
3373
  }
3310
3374
 
3311
3375
  /**