Skip to content

feat: introduce MaterialHandle and zCMaterialManager#406

Open
kirides wants to merge 10 commits into
masterfrom
feat/material-handle
Open

feat: introduce MaterialHandle and zCMaterialManager#406
kirides wants to merge 10 commits into
masterfrom
feat/material-handle

Conversation

@kirides

@kirides kirides commented Jul 7, 2026

Copy link
Copy Markdown
Owner
  • MaterialHandle represents a generationally tracked index into a flat zCMaterial* vector.
  • zCMaterialManager holds and validates any Handles.
  • Engine uses MaterialHandle for geometry and vobs which live for a long time. Things like PolyStrips are knowingly excluded as they are short lived and their material will likely always be valid.
  • MeshKey uses MaterialHandle to ensure any left-over and overriden zCMaterial* with the same pointer but different value are ignored.
  • Workaround for G2 where the engine constantly creates new zCCamera and with that new zCMesh and zCMaterial just to grab the "default" NearPlane value of a freshly constructed camera.
    instead we just grab the fresh NearPlane of any zCCamera that gets created and store that and provide it to the engine.

@kirides

kirides commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

@Krystian12421 do you want to take a look at this? After your cleanup of the resources.

This PR allows actually tracking the lifetime and count of zCMaterial* instances and ensures out-of-date handles never reach the rendering part

@Krystian12421

Copy link
Copy Markdown

@Krystian12421 do you want to take a look at this? After your cleanup of the resources.

This PR allows actually tracking the lifetime and count of zCMaterial* instances and ensures out-of-date handles never reach the rendering part

I can test it tomorrow

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.

2 participants