public sealed class FallbackMaterialSourceA catalog's materials, with a fallback for the ones it has refused for good.
Remarks
⚠ Without it a mesh whose material the catalog refused does not draw at all, and that is not obvious from either side. TryGet is two-valued and its false means "not yet" — MeshExtractionSystem reads it that way and leaves the entity unsettled, to be asked again next frame. AssetMaterialSource also returns false for a reference it has given up on — one the build did not ship, a handle that failed, a document the compiler rejected — so the entity waits for the life of the process and only Waiting says so. Refused is what separates the two, and this is what asks.
⚠ Both renderers use this one type (#509). WorldRenderer hands it to the extraction Register builds, falling back to Material — what a drawable that names no material is drawn in — so a game after a partial content update draws a crate in the neutral material rather than no crate. The editor's extraction is hand-assembled and Register never runs there, so EditorWorldRenderer.Mount builds its own over its grey fallback. A fix to one renderer only was the shape this issue had for a year.
The fallback is read on each refusal rather than captured, because a host sets Material after Register has made the extraction. With no fallback the refusal stays a refusal: a null material reaching the virtualized path is a dereference, and "draws nothing" is what such a host already sees for every drawable.
⚠ The fallback is not silent. FellBack counts the references that took it, so a host can say "this many materials are not in the catalog" rather than leaving somebody to wonder why one crate is grey.
Fields and properties (2)
public AssetMaterialSource PainterThe source this defers to, for whoever needs the real one.
public int FellBackHow many distinct references the catalog refused and the fallback was drawn for.
Methods (2)
public FallbackMaterialSource(AssetMaterialSource painter, Func<Material?> fallback)Wraps a mounted source.
public bool TryGet(AssetReference reference, out Material material)The material a reference names, if it is ready yet.
Used by (3)
- WorldRendererVixen.Engine.Renderer
- EditorMountTestsVixen.Editor.App.Tests
- EditorWorldRendererVixen.Editor.App