Vixen
dd8b0a81
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; this reads the chunks the last import wrote, from a store on disk beside the project. ⚠ This paragraph used to add that the alternative was "waiting for a content build", and see ProjectMeshSource for why that was wrong and what the actual argument is: a catalog is what ships, and it silently omits what a project excludes from shipping.

⚠ Unlike the mesh source, this one is not the whole story and should not be read as it. ISurfaceSource is the tool renderer's seam and reduces a material to four numbers; it is not IMaterialSource, which is what the composed pane's WorldRenderer wants and what only WorldRenderer.Mount builds. So the argument above settles where geometry comes from and settles nothing about textured materials, which the editor cannot draw at all yet — see EditorContent.

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