Skip to content

Allow customizing CompactSubGeometry. - #66

Open
player-03 wants to merge 24 commits into
openfl:masterfrom
player-03:VertexDefinition
Open

player-03 wants to merge 24 commits into
openfl:masterfrom
player-03:VertexDefinition

Conversation

@player-03

@player-03 player-03 commented Jul 20, 2025 •

Copy link
Copy Markdown
Collaborator

Most users likely don't need "secondary UVs", for instance, and could save memory by omitting them. Others might want to add a custom 4-length attribute.

Sample usage:

final vertexDefinition:VertexDefinition = new VertexDefinition([
	new AttributeDefinition("position", 3),
	new AttributeDefinition("UV", 2)
]);
final geometry:CompactSubGeometry = new CompactSubGeometry(vertexDefinition);

//Add geometry containing positions and UVs...

view.scene.addChild(new Mesh(geometry));

This sub-geometry allocates only 5 floats per vertex, instead of 13, massively reducing buffer size.

@player-03

Copy link
Copy Markdown
Collaborator Author

Oh, and I wrote this for Haxe 4.3+, so that's another reason it's still a draft.

@player-03
player-03 force-pushed the VertexDefinition branch 2 times, most recently from cf83619 to 2cb91e9 Compare September 21, 2026 02:46
@player-03
player-03 marked this pull request as ready for review October 4, 2026 00:33
…es `CompactSubGeometry` includes.

Most users likely don't need "secondary UVs", for instance, and could save memory by omitting them. Others might want to add a custom 4-length attribute.
Without that, the clone will interpret all its data incorrectly.
This reduces duplicate code and allows activating custom attributes.
Methods can use this to alert other classes that they require certain custom attributes. These attributes will also automatically be tracked and deduplicated.
This version avoids unnecessary allocations, and can be chained.
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