@gnsx/three 0.184.12 → 0.184.14

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.
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
  import { Matrix3, Vector2, Color, Vector3, mergeUniforms, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Matrix4, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, warn, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, CubeReflectionMapping, CubeRefractionMapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, error, NoBlending, WebGLRenderTarget, BufferAttribute, LinearSRGBColorSpace, LinearFilter, CubeTexture, LinearMipmapLinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, DataArrayTexture, Vector4, DepthTexture, Float32BufferAttribute, RawShaderMaterial, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, Data3DTexture, GreaterEqualCompare, LessEqualCompare, Texture, GLSL3, VSMShadowMap, PCFShadowMap, AddOperation, MixOperation, MultiplyOperation, LinearTransfer, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, RGFormat, RG11_EAC_Format, RED_GREEN_RGTC2_Format, MeshDepthMaterial, MeshDistanceMaterial, PCFSoftShadowMap, DepthFormat, NearestFilter, CubeDepthTexture, UnsignedIntType, Frustum, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, ReversedDepthFuncs, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, 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, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, DataTexture, createCanvasElement, SRGBColorSpace, REVISION, log, WebGLCoordinateSystem, probeAsync } from './three.core.js';
7
- export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js';
7
+ export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, profile, profileClass, setConsoleFunction } from './three.core.js';
8
8
 
9
9
  function WebGLAnimation() {
10
10
 
@@ -19549,434 +19549,4 @@ class WebGLRenderer {
19549
19549
 
19550
19550
  }
19551
19551
 
19552
- // WITH_GENESYS
19553
- /**
19554
- * ProfilerService — per-label CPU timing with ring-buffer aggregation and DevTools integration.
19555
- *
19556
- * Activate via environment variable:
19557
- * PROFILING=1 stats + trace (full profile)
19558
- * PROFILING=stats stats only, no trace accumulation (lower overhead)
19559
- *
19560
- * Quick start (browser console):
19561
- * __gnsx_profiler.enable()
19562
- * // play for a few seconds
19563
- * __gnsx_profiler.report() // sorted console.table (aggregated stats)
19564
- * __gnsx_profiler.downloadTrace() // download gnsx-trace.json for Speedscope / Perfetto
19565
- * __gnsx_profiler.reset() // clear samples and trace
19566
- * __gnsx_profiler.disable()
19567
- */
19568
-
19569
- const RING_SIZE = 120;
19570
- const FRAME_BUDGET_MS = 1000 / 60;
19571
- /** Max events in the trace log (~50s at 60fps with 8 labels). */
19572
- const MAX_TRACE_EVENTS = 50_000;
19573
- const NOOP = () => {};
19574
-
19575
- function _readProfilingEnv() {
19576
-
19577
- const raw =
19578
- ( typeof process !== 'undefined' ? process.env?.[ 'PROFILING' ] : undefined ) ??
19579
- ( typeof globalThis !== 'undefined' ? globalThis[ '__gnsx_env__' ]?.[ 'PROFILING' ] : undefined ) ??
19580
- ( typeof globalThis !== 'undefined' ? globalThis[ '__GNSX_PROFILING__' ] : undefined );
19581
-
19582
- if ( ! raw || raw === '0' || raw === 'false' ) return false;
19583
- if ( raw === 'stats' ) return 'stats';
19584
- return 'full';
19585
-
19586
- }
19587
-
19588
- class ProfilerServiceClass {
19589
-
19590
- constructor() {
19591
-
19592
- const envProfile = _readProfilingEnv();
19593
- this._profile = envProfile !== false ? envProfile : 'full';
19594
- this._enabled = envProfile !== false;
19595
-
19596
- /** @type {Map<string, Float64Array>} */
19597
- this.buffers = new Map();
19598
- /** @type {Map<string, number>} */
19599
- this.cursors = new Map();
19600
- /** @type {Map<string, number>} */
19601
- this.counts = new Map();
19602
- /** @type {Map<string, number>} */
19603
- this.marks = new Map();
19604
- /** @type {Array<{ name: string, ph: 'X', ts: number, dur: number, pid: 1, tid: 1, cat: 'gnsx' }>} */
19605
- this.traceEvents = [];
19606
- this.traceStartTime = 0;
19607
-
19608
- if ( this._enabled ) {
19609
-
19610
- this.traceStartTime = performance.now();
19611
- this.begin = this._beginImpl.bind( this );
19612
- this.end = this._endImpl.bind( this );
19613
- this._exposeGlobal();
19614
- console.log( `[ProfilerService] auto-started from env (profile: ${this._profile})` );
19615
-
19616
- } else {
19617
-
19618
- this.begin = NOOP;
19619
- this.end = NOOP;
19620
-
19621
- }
19622
-
19623
- }
19624
-
19625
- /**
19626
- * Set the active profile. Must be called before enable() to take effect on the current session.
19627
- *
19628
- * @param {'full'|'stats'} profile
19629
- */
19630
- setProfile( profile ) {
19631
-
19632
- this._profile = profile;
19633
-
19634
- }
19635
-
19636
- /**
19637
- * @return {'full'|'stats'}
19638
- */
19639
- getProfile() {
19640
-
19641
- return this._profile;
19642
-
19643
- }
19644
-
19645
- enable() {
19646
-
19647
- this._clearState();
19648
- this._enabled = true;
19649
- this.begin = this._beginImpl.bind( this );
19650
- this.end = this._endImpl.bind( this );
19651
- this._exposeGlobal();
19652
- console.log( `[ProfilerService] enabled (profile: ${this._profile}) — call __gnsx_profiler.report() or downloadTrace() from the console` );
19653
-
19654
- }
19655
-
19656
- disable() {
19657
-
19658
- this._clearState();
19659
- this._enabled = false;
19660
- this.begin = NOOP;
19661
- this.end = NOOP;
19662
- console.log( '[ProfilerService] disabled' );
19663
-
19664
- }
19665
-
19666
- isEnabled() {
19667
-
19668
- return this._enabled;
19669
-
19670
- }
19671
-
19672
- _exposeGlobal() {
19673
-
19674
- if ( typeof window !== 'undefined' ) {
19675
-
19676
- window.__gnsx_profiler = this;
19677
-
19678
- }
19679
-
19680
- }
19681
-
19682
- /**
19683
- * @param {string} label
19684
- */
19685
- _beginImpl( label ) {
19686
-
19687
- performance.mark( `gnsx:${label}:start` );
19688
- this.marks.set( label, performance.now() );
19689
-
19690
- }
19691
-
19692
- /**
19693
- * @param {string} label
19694
- */
19695
- _endImpl( label ) {
19696
-
19697
- const startTime = this.marks.get( label );
19698
- if ( startTime === undefined ) return;
19699
- this.marks.delete( label );
19700
-
19701
- const now = performance.now();
19702
- const duration = now - startTime;
19703
-
19704
- performance.mark( `gnsx:${label}:end` );
19705
- performance.measure( `gnsx:${label}`, `gnsx:${label}:start`, `gnsx:${label}:end` );
19706
-
19707
- let buffer = this.buffers.get( label );
19708
- if ( ! buffer ) {
19709
-
19710
- buffer = new Float64Array( RING_SIZE );
19711
- this.buffers.set( label, buffer );
19712
- this.cursors.set( label, 0 );
19713
- this.counts.set( label, 0 );
19714
-
19715
- }
19716
-
19717
- const cursor = this.cursors.get( label );
19718
- buffer[ cursor ] = duration;
19719
- this.cursors.set( label, ( cursor + 1 ) % RING_SIZE );
19720
- this.counts.set( label, Math.min( ( this.counts.get( label ) + 1 ), RING_SIZE ) );
19721
-
19722
- if ( this._profile === 'full' && this.traceEvents.length < MAX_TRACE_EVENTS ) {
19723
-
19724
- this.traceEvents.push( {
19725
- name: label,
19726
- ph: 'X',
19727
- ts: Math.round( ( startTime - this.traceStartTime ) * 1000 ),
19728
- dur: Math.max( 1, Math.round( duration * 1000 ) ),
19729
- pid: 1,
19730
- tid: 1,
19731
- cat: 'gnsx',
19732
- } );
19733
-
19734
- }
19735
-
19736
- }
19737
-
19738
- /**
19739
- * @param {string} label
19740
- * @return {number[]}
19741
- */
19742
- getValidSamples( label ) {
19743
-
19744
- const buffer = this.buffers.get( label );
19745
- const count = this.counts.get( label ) ?? 0;
19746
- if ( ! buffer || count === 0 ) return [];
19747
- return count < RING_SIZE
19748
- ? Array.from( buffer.subarray( 0, count ) )
19749
- : Array.from( buffer );
19750
-
19751
- }
19752
-
19753
- /**
19754
- * @param {string} label
19755
- * @return {import('./ProfilerService.js').ProfilerStats|null}
19756
- */
19757
- getStats( label ) {
19758
-
19759
- const samples = this.getValidSamples( label );
19760
- if ( samples.length === 0 ) return null;
19761
-
19762
- const sorted = [ ...samples ].sort( ( a, b ) => a - b );
19763
- const avg = sorted.reduce( ( a, b ) => a + b, 0 ) / sorted.length;
19764
-
19765
- return {
19766
- label,
19767
- samples: samples.length,
19768
- avg,
19769
- min: sorted[ 0 ],
19770
- max: sorted[ sorted.length - 1 ],
19771
- p95: sorted[ Math.floor( sorted.length * 0.95 ) ],
19772
- frameBudget: ( avg / FRAME_BUDGET_MS ) * 100,
19773
- };
19774
-
19775
- }
19776
-
19777
- /**
19778
- * @return {import('./ProfilerService.js').ProfilerStats[]}
19779
- */
19780
- getAllStats() {
19781
-
19782
- return [ ...this.buffers.keys() ]
19783
- .map( label => this.getStats( label ) )
19784
- .filter( s => s !== null );
19785
-
19786
- }
19787
-
19788
- report() {
19789
-
19790
- const stats = this.getAllStats();
19791
- if ( stats.length === 0 ) {
19792
-
19793
- console.log( '[ProfilerService] No data. Enable profiling first and wait a few frames.' );
19794
- return;
19795
-
19796
- }
19797
-
19798
- stats.sort( ( a, b ) => b.avg - a.avg );
19799
- console.table(
19800
- stats.map( s => ( {
19801
- label: s.label,
19802
- 'avg ms': s.avg.toFixed( 3 ),
19803
- 'min ms': s.min.toFixed( 3 ),
19804
- 'max ms': s.max.toFixed( 3 ),
19805
- 'p95 ms': s.p95.toFixed( 3 ),
19806
- 'budget %': s.frameBudget.toFixed( 1 ) + '%',
19807
- samples: s.samples,
19808
- } ) )
19809
- );
19810
-
19811
- }
19812
-
19813
- /**
19814
- * @return {import('./ProfilerService.js').ChromeTrace}
19815
- */
19816
- exportChromeTrace() {
19817
-
19818
- return { traceEvents: [ ...this.traceEvents ] };
19819
-
19820
- }
19821
-
19822
- /**
19823
- * @param {string} [filename='gnsx-trace.json']
19824
- */
19825
- downloadTrace( filename = 'gnsx-trace.json' ) {
19826
-
19827
- if ( typeof document === 'undefined' ) {
19828
-
19829
- console.log( '[ProfilerService] downloadTrace() only works in the browser. Use exportChromeTrace() in Node.js.' );
19830
- return;
19831
-
19832
- }
19833
-
19834
- if ( this._profile !== 'full' ) {
19835
-
19836
- console.log( `[ProfilerService] No trace — current profile is '${this._profile}'. Use setProfile('full') before enabling.` );
19837
- return;
19838
-
19839
- }
19840
-
19841
- if ( this.traceEvents.length === 0 ) {
19842
-
19843
- console.log( '[ProfilerService] No trace events. Enable the profiler and play for a few seconds first.' );
19844
- return;
19845
-
19846
- }
19847
-
19848
- const json = JSON.stringify( this.exportChromeTrace() );
19849
- const blob = new Blob( [ json ], { type: 'application/json' } );
19850
- const url = URL.createObjectURL( blob );
19851
- const a = document.createElement( 'a' );
19852
- a.href = url;
19853
- a.download = filename;
19854
- a.click();
19855
- URL.revokeObjectURL( url );
19856
- console.log( `[ProfilerService] Trace downloaded: ${filename} (${this.traceEvents.length} events)` );
19857
-
19858
- }
19859
-
19860
- /**
19861
- * @return {import('./ProfilerService.js').ProfilerStats[]}
19862
- */
19863
- exportJSON() {
19864
-
19865
- return this.getAllStats();
19866
-
19867
- }
19868
-
19869
- _clearState() {
19870
-
19871
- this.buffers.clear();
19872
- this.cursors.clear();
19873
- this.counts.clear();
19874
- this.marks.clear();
19875
- this.traceEvents = [];
19876
- this.traceStartTime = performance.now();
19877
-
19878
- }
19879
-
19880
- reset() {
19881
-
19882
- this._clearState();
19883
- console.log( '[ProfilerService] data reset' );
19884
-
19885
- }
19886
-
19887
- }
19888
-
19889
- /**
19890
- * @typedef {Object} ProfilerStats
19891
- * @property {string} label
19892
- * @property {number} samples
19893
- * @property {number} avg
19894
- * @property {number} min
19895
- * @property {number} max
19896
- * @property {number} p95
19897
- * @property {number} frameBudget Percentage of a 60 fps frame budget (16.67 ms)
19898
- */
19899
-
19900
- /**
19901
- * @typedef {Object} ChromeTrace
19902
- * @property {Array<{ name: string, ph: 'X', ts: number, dur: number, pid: 1, tid: 1, cat: 'gnsx' }>} traceEvents
19903
- * @property {{ 'clock-offset-since-epoch-ns'?: number }|undefined} [metadata]
19904
- */
19905
-
19906
- /**
19907
- * @typedef {'full'|'stats'} ProfilingProfile
19908
- */
19909
-
19910
- const ProfilerService = new ProfilerServiceClass();
19911
-
19912
- function applyProfileToMethod( label, descriptor ) {
19913
-
19914
- if ( _readProfilingEnv() === false ) return descriptor;
19915
-
19916
- const original = descriptor.value;
19917
-
19918
- function profiled( ...args ) {
19919
-
19920
- ProfilerService.begin( label );
19921
- const result = original.apply( this, args );
19922
- if ( result instanceof Promise ) {
19923
-
19924
- return result.finally( () => ProfilerService.end( label ) );
19925
-
19926
- }
19927
-
19928
- ProfilerService.end( label );
19929
- return result;
19930
-
19931
- }
19932
-
19933
- descriptor.value = profiled;
19934
- return descriptor;
19935
-
19936
- }
19937
-
19938
- /**
19939
- * Method decorator that profiles the decorated method.
19940
- * The label is automatically set to `ClassName.methodName`.
19941
- *
19942
- * @param {Object} target
19943
- * @param {string|symbol} propertyKey
19944
- * @param {PropertyDescriptor} descriptor
19945
- * @return {PropertyDescriptor}
19946
- */
19947
- function profile( target, propertyKey, descriptor ) {
19948
-
19949
- const className = target.constructor?.name ?? 'Unknown';
19950
- return applyProfileToMethod( `${className}.${String( propertyKey )}`, descriptor );
19951
-
19952
- }
19953
-
19954
- /**
19955
- * Class decorator that profiles every method of the decorated class.
19956
- *
19957
- * @template T
19958
- * @param {T} constructor
19959
- * @return {T}
19960
- */
19961
- function profileClass( constructor ) {
19962
-
19963
- const proto = constructor.prototype;
19964
- for ( const key of Object.getOwnPropertyNames( proto ) ) {
19965
-
19966
- if ( key === 'constructor' ) continue;
19967
- const descriptor = Object.getOwnPropertyDescriptor( proto, key );
19968
- if ( ! descriptor || typeof descriptor.value !== 'function' ) continue;
19969
- Object.defineProperty(
19970
- proto,
19971
- key,
19972
- applyProfileToMethod( `${constructor.name}.${key}`, { ...descriptor } )
19973
- );
19974
-
19975
- }
19976
-
19977
- return constructor;
19978
-
19979
- }
19980
- // !WITH_GENESYS
19981
-
19982
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, ExternalTexture, Float32BufferAttribute, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, ProfilerService, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, 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_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement, error, log, profile, profileClass, warn, warnOnce };
19552
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, ExternalTexture, Float32BufferAttribute, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, 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_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement, error, log, warn, warnOnce };