Skip to content

Paint: saved meshes follow the paint, new values without the CSG - #65

Merged
LogicalError merged 4 commits into
RadicalCSG:mainfrom
LogicalError:paint-saved-meshes
Oct 26, 2026
Merged

LogicalError merged 4 commits into
RadicalCSG:mainfrom
LogicalError:paint-saved-meshes

Conversation

@LogicalError

@LogicalError LogicalError commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #63.

Saved meshes follow the paint

  • The hash that decides whether a model keeps the meshes saved with its scene (and so what a player build gets) now has each generator's paint and what the shader of each of its materials takes of paint. Paint changed outside the editor, or a shader that takes paint differently, builds the model when the scene opens instead of keeping meshes with the old paint.
  • What a material takes is compared per material: only a material resolved before whose paint attributes changed has the brushes built again, so models keep their saved meshes when a scene opens.

Painting without the CSG

  • When only values change on the same grids, they are written in place, the hashes of the surfaces they are on are put right in the brushes' cached buffers, and the next update copies the meshes again without building a brush. New grids, a tree that kept its saved meshes, or brushes not built yet still have the brushes built.

Also

  • The hash and the paint manager hold on to no generator after they are done, so a destroyed model's meshes aren't kept loaded.

The hash that decides whether a model keeps the meshes saved with its scene
(and so what a build takes) has each generator's paint and what the shader of
each of its materials takes of paint. Paint changed outside the editor, or a
shader that takes paint differently, builds the model when the scene opens
rather than keeping meshes with the old paint.
When an entity's paint changes only in its values on the same grids, the
values are written in place, the hashes of the surfaces they are on are put
right in the brushes' cached buffers (the paint's part of a surface's hash
is xor-ed in last for that), and the next update copies the meshes again
without building a brush. New grids, a tree that kept its saved meshes, or
brushes not built yet still have the brushes built.
The lists the paint part of the hash is gathered in are cleared after it, so
a destroyed model's meshes aren't kept loaded through them.
Only a material resolved before whose paint attributes changed has every
brush built again; a material resolved for the first time (every one, when
the editor starts) is in the brushes being built with it, so models keep
their saved meshes when a scene opens. The paint manager's work set is a set,
emptied after each update so it holds no generator between updates.
@LogicalError
LogicalError merged commit d9bf2d9 into RadicalCSG:main Oct 26, 2026
2 checks passed
@LogicalError
LogicalError deleted the paint-saved-meshes branch October 26, 2026 11:06
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