Skip to content

Conversation

@WallanceLee
Copy link

No description provided.

@WallanceLee WallanceLee changed the title feat: primive-outline feat: primive-outline[WIP] Sep 22, 2025
@WallanceLee WallanceLee changed the title feat: primive-outline[WIP] feat: primive-outline Oct 4, 2025
// if we found a sibling edge add it into the vertex array if
// it meets the angle threshold and delete the edge from the map.
if (glvec3.dot(normal, edgeData[reverseHash].normal) <= thresholdAngle) {
vertices.push(v0[0], v0[1], v0[2]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are converting vertices to Float32Array later, make a block-based allocator with typed array could make gc happy.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK as-is for now — it's a new feature and can be optimized later.

Copy link
Owner

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @WallanceLee, and sorry for the slow review! I'd be excited to get this feature merged, and have left some feedback on the PR in comments below. If any of the suggestions are confusing or feel like more than you can do right now, let me know and we'll figure something out. :)

// if we found a sibling edge add it into the vertex array if
// it meets the angle threshold and delete the edge from the map.
if (glvec3.dot(normal, edgeData[reverseHash].normal) <= thresholdAngle) {
vertices.push(v0[0], v0[1], v0[2]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK as-is for now — it's a new feature and can be optimized later.


const edgePrim = document
.createPrimitive()
.setName(prim.getName() + '_edges')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly, glTF primitives do not have names, so this line has no effect on export and can be removed. The .setName() method in glTF Transform exists only as inherited from the Property class.

.createPrimitive()
.setName(prim.getName() + '_edges')
.setMode(Primitive.Mode.LINES)
.setAttribute('POSITION', accesor);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps ideally, all vertex attributes from the source primitive would be preserved in the output, but I recognize that's a fairly tricky change. For example, so that edges of a skinned mesh can be animated along with the rest of the mesh. Feel free to skip it and we can include it as a later improvement!

@donmccurdy donmccurdy added feature New enhancement or request package:functions labels Oct 15, 2025
@donmccurdy donmccurdy modified the milestones: v4.2, 🗄️ Backlog Oct 15, 2025
@WallanceLee
Copy link
Author

OK, I will try my best to optimize the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New enhancement or request package:functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants