public interface ISurfaceSourceWhere the look of the material a renderable names comes from, for a preview.
Remarks
IMaterialSource's cheaper sibling, and the two are not the same question. That one hands back a Material — a compiled variant, a constant buffer and a descriptor set — which is what a frame graph draws with and what a caller with no compositor cannot use for anything. This one hands back a MaterialSurface: the same material read for its colour, its metalness, its roughness and what it emits.
It exists because the editor viewport is not a frame graph. The viewport draws a scene through one instanced pipeline with a key light and no descriptor sets at all — see MeshInstanceRenderer, whose own remarks call materials the boundary it stops at. Reaching the material system from there would mean giving the viewport a compositor; reading four numbers off the material does not, and is most of what looking at a level needs.
⚠ False is "no material", not "not yet". Unlike IMeshSource, a miss here is not something to wait for and re-ask about: an entity that names no material, or names one that cannot be found, is drawn with Default and looks like a plain surface. A mesh that has not loaded draws nothing because the alternative is an entity whose shape depends on disk speed; a material that has not loaded draws grey, because the alternative is a level that disappears while its materials are read.
Methods (1)
bool TryGet(AssetReference reference, out MaterialSurface surface)The surface a material reference names.
Used by (3)
- ProjectSurfaceSourceVixen.Editor.Assets
- SceneMeshesVixen.Editor.SceneView
- SurfacesVixen.Editor.SceneView.Tests