Vixen
02b45cc4
csharp
public sealed class ProjectSurfaceSource

The look of the materials a scene names, read out of the project's own import cache.

Read the guide page for this →

Remarks

ProjectMeshSource's twin, down to the reason it exists. A game resolves a material through a catalog and a bundle; the editor has neither and does not want them — it has the chunks the last import wrote, in a store on disk beside the project. Waiting for a content build to see what colour a wall is would make the viewport a function of the build rather than of the files.

It reads the compiled chunk and not the .vxmat. MaterialImporter already parses the YAML and writes a MaterialContent, so reading the text again here would be a second parser for one format — and the editor's MaterialAsset binding it separately is exactly the arrangement MaterialContent's own remarks call the part worth watching. One reader, and it is the one the build uses.

⚠ A material that has not been imported yet is a miss, and a miss is grey rather than invisible. That is the asymmetry with the mesh source and it is deliberate — see ISurfaceSource. An entity whose geometry has not arrived draws nothing, because the alternative is a scene whose shape depends on disk speed; an entity whose material has not arrived draws in the neutral surface, because the alternative is a level that disappears while its materials are read.

Fields and properties (2)

  • public int Requested

    How many distinct materials have been asked for.

  • public int Loaded

    How many of them were read.

Methods (3)

  • public ProjectSurfaceSource(ProjectWorkspace workspace)

    Builds a source over a project.

  • public void Invalidate()

    Forgets what has been read, so a re-import is picked up.

  • public bool TryGet(AssetReference reference, out MaterialSurface surface)

    The surface a material reference names.

Used by (2)

  • ContentTasksVixen.Editor.App
  • EditorApplicationVixen.Editor.App