Skip to content

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
@github-actions
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

@Mugen87 Mugen87 merged commit f6fe356 into mrdoob:dev Apr 29, 2025
12 checks passed
@gkjohnson gkjohnson deleted the box-tojson branch April 29, 2025 16:09
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Box3: Add toJSON, fromJSON

* Object3D: use toJSON

* ObjectLoader: use toJSON
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Box3: Add toJSON, fromJSON

* Object3D: use toJSON

* ObjectLoader: use toJSON
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.

2 participants