-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
currently, the API for Mesh.Collection<T> increments the version of the mesh whenever any of this functions are used, or properties or indexers. in the case of doing the following every frame, it's very inefficient:
float x = MathF.Sin(time);
float y = MathF.Cos(time);
Mesh.Collection<Vector3> positions = mesh.GetPositions();
positions[0] = new(x + 0, y + 0, 0);
positions[1] = new(x + 1, y + 0, 0);
positions[2] = new(x + 1, y + 1, 0);
positions[3] = new(x + 0, y + 1, 0);when instead it could be chunked. not sure how exactly, but perhaps this could be done by fetching a temporary view of the mesh, updating that then submitting it:
Mesh mesh = ...
Mesh.Modification changes = mesh.BeginChanges();
changes[0].position = new(x + 0, y + 0, 0);
changes[1].position = new(x + 1, y + 0, 0);
changes[2].position = new(x + 1, y + 1, 0);
changes[3].position = new(x + 0, y + 1, 0);
mesh.SubmitChanges(changes);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels