Skip to content

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Sep 30, 2025

Description

More inspector usage and RenderInspector revisions.

@sunag sunag added this to the r181 milestone Sep 30, 2025
@sunag sunag marked this pull request as ready for review September 30, 2025 04:44
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.24
79.14
338.24
79.14
+0 B
+0 B
WebGPU 589.39
162.79
589.46
162.82
+70 B
+26 B
WebGPU Nodes 587.99
162.55
588.06
162.58
+70 B
+27 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 469.7
113.74
469.7
113.74
+0 B
+0 B
WebGPU 658.79
178.24
658.79
178.24
+0 B
+0 B
WebGPU Nodes 612.8
167.43
612.8
167.43
+0 B
+0 B

@sunag sunag merged commit 11b9f41 into mrdoob:dev Sep 30, 2025
9 checks passed
@sunag sunag deleted the dev-more-examples branch September 30, 2025 05:04
@Makio64
Copy link
Contributor

Makio64 commented Sep 30, 2025

@sunag I was checking how to use the inspector, i noticed this pattern :

				renderer.inspector = new Inspector();
				//...
				const gui = renderer.inspector.createParameters( 'Settings' );

I think it would be cleaner if inspector variable is created at the global level with scene, camera etc..

let scene, camera, inspector // at top of the files.

				inspector = new Inspector();
				renderer.inspector = inspector; // not sure its necessary ?
				// .... 
				const gui = inspector.createParameters( 'Settings' );

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 30, 2025

inspector = new Inspector();
renderer.inspector = new Inspector();

TBH, it looks confusing to have two constructor calls.

As long as the inspector isn't referenced outside init(), I think the current pattern is appropriate.

@Makio64
Copy link
Contributor

Makio64 commented Sep 30, 2025

sorry for the typo @Mugen87 i updated the code, of course it shoudn't be 2 constructors.

I just feel this renderer.inspector.createParameters( 'Settings' ); should be improve, especially if all examples are migrate to it and there is multiple createParameters.

@sunag
Copy link
Collaborator Author

sunag commented Sep 30, 2025

I like renderer.inspector, unlike scene, camera they are not assigned to the renderer as inspector is but passed as parameters.

The createParameters() function is not mandatory, some examples just want to inspect the performance and nodes and not use it, so what you often need to do is just assign renderer.inspector = new Inspector() with one line.

Nothing against separating this into a variable, but it doesn't seem that necessary.

@Makio64
Copy link
Contributor

Makio64 commented Sep 30, 2025

Thanks @sunag , i will play with it and come back ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants