Use Geometry#calculateTangents in procedural geometry subclasses - #9253
Merged
Conversation
All eight procedural geometry classes inlined the calculateTangents utility call even though their base class already exposes exactly that as Geometry#calculateTangents, reading the same positions, normals, uvs and indices fields the constructors assign immediately beforehand. Each subclass now calls the inherited method and drops its geometry-utils import. Verified byte-identical output: all eight geometries constructed with calculateTangents enabled and non-default segment counts produce identical positions, normals, uvs, uvs1, indices and tangents streams before and after the change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Public API reportThis PR changes the public API surface (+9 / −0), per the docs' rules (@ignore / @Private / undocumented are excluded). Show API diff+BoxGeometry.tangents: ArrayLike<number> | undefined
+CapsuleGeometry.tangents: ArrayLike<number> | undefined
+CircleGeometry.tangents: ArrayLike<number> | undefined
+ConeGeometry.tangents: ArrayLike<number> | undefined
+CylinderGeometry.tangents: ArrayLike<number> | undefined
+DomeGeometry.tangents: ArrayLike<number> | undefined
+PlaneGeometry.tangents: ArrayLike<number> | undefined
+SphereGeometry.tangents: ArrayLike<number> | undefined
+TorusGeometry.tangents: ArrayLike<number> | undefinedInformational only — this never fails the build. |
Build size reportThis PR changes the size of the minified bundles.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
All eight procedural geometry classes (
BoxGeometry,CircleGeometry,SphereGeometry,PlaneGeometry,TorusGeometry,CapsuleGeometry,ConeGeometry,CylinderGeometry) inline thecalculateTangentsutility call in their constructors:But the base class already exposes exactly this as
Geometry#calculateTangents(), which reads the samepositions/normals/uvs/indicesfields each constructor assigns immediately beforehand. Each subclass now calls the inherited method and drops itsgeometry-utils.jsimport:Net −8 lines and eight fewer import bindings; the standalone
calculateTangents/calculateNormalsexports are unchanged. The base method'sDebug.assertguards are satisfied at every call site (fields assigned just above, or by theConeBaseGeometrysuper constructor) and are stripped from release builds anyway.Verified byte-identical output: all eight geometries constructed with
calculateTangents: trueand non-default segment counts produce identicalpositions,normals,uvs,uvs1,indicesandtangentsstreams before and after the change (SHA-256 over every stream). Lint clean; full unit suite at 2337 passing with failures identical to themainbaseline (pre-existing jsdom resource-loading timeouts).Checklist
🤖 Generated with Claude Code