Skip to content

Box3: Add toJSON, fromJSON #31021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Box3: Add toJSON, fromJSON #31021

wants to merge 3 commits into from

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Apr 28, 2025

Related issue: #30965 (comment)

Description

A small prototype to add fromJSON and toJSON to Box3 to normalize the serialization process of these shapes.

Note that fromJSON is currently a member function that modifies the already-created Box3 and returns itself, similar to copy. This could instead be a static member function that returns a new Box3 instance.

If this looks good I'll do the same thing for Sphere in a subsequent PR.

@gkjohnson gkjohnson added this to the r177 milestone Apr 28, 2025
@gkjohnson gkjohnson requested a review from Mugen87 April 28, 2025 20:27
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.33
78.33
336.33
78.33
+0 B
+0 B
WebGPU 547.81
151.89
547.81
151.89
+0 B
+0 B
WebGPU Nodes 547.16
151.73
547.16
151.73
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.78
112.28
465.83
112.29
+50 B
+10 B
WebGPU 622.7
168.46
622.75
168.46
+50 B
+8 B
WebGPU Nodes 577.57
157.72
577.62
157.73
+50 B
+3 B

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.

1 participant