BufferGeometryUtils: Let `toTrianglesDrawMode()`modify geometries in-place. by Mugen87 · Pull Request #33878 · mrdoob/three.js · GitHub
Skip to content

BufferGeometryUtils: Let toTrianglesDrawMode()modify geometries in-place.#33878

Open
Mugen87 wants to merge 1 commit into
mrdoob:devfrom
Mugen87:dev1
Open

BufferGeometryUtils: Let toTrianglesDrawMode()modify geometries in-place.#33878
Mugen87 wants to merge 1 commit into
mrdoob:devfrom
Mugen87:dev1

Conversation

@Mugen87

@Mugen87 Mugen87 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Fixed #27926.

Description

The PR makes sure BufferGeometryUtils.toTrianglesDrawMode() does not clone the entire geometry anymore. The conversion of a draw mode only requires a different index so the function modifies the given geometry instead.

This opens up a fix for #27926. By moving the draw mode conversion to loadGeometries() instead, GLTFLoader no longer duplicates attribute data. For the oval.gltf test asset that means:

before after (in-place)
meshes 9928 9928
unique position attribute ids 9612 1
position memory held 4281.7 MB 0.4 MB

Since the PR changes the behavior of toTrianglesDrawMode(), this change must be noted in the migration guide. Apps can easily restore the previous behavior by just cloning the geometry before using toTrianglesDrawMode().

@Mugen87 Mugen87 requested a review from donmccurdy June 25, 2026 09:31
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.

GLTFLoader: Don't duplicate vertex buffers when loading triangle fans and strips

1 participant