Vixen
02b45cc4
csharp
public sealed class SceneMeshes

Every shaped entity in a scene, as one instance each.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

SceneLines for surfaces, and the shape of what it hands over is the whole of its design. A frame is one MeshInstance per entity — a transform, a normal matrix, a colour and four style lanes — grouped into runs that share a shape. The geometry itself is registered once with MeshInstanceRenderer and never crosses the bus again; this places it, colours it and groups it.

⚠ This used to transform every vertex of every entity into world space every frame, and that was the thing docs/plan/24-blockout-tools.md § B1 called a blocker rather than a performance concern. The cost was linear in vertices with a cache keyed by PrimitiveKind — so a hundred cubes were cheap and a hundred edited meshes were a hundred rebuilds a frame, and "a drag that redraws at four frames a second is not a slow tool, it is a tool nobody can aim". What crosses the bus now is a hundred and sixty bytes an entity whether the entity is a cube or a corridor.

⚠ Two things that were geometry are now style lanes on an instance, and each was a copy of the shape's vertices before: the wireframe view's edges and the normal view's per-vertex colour. A shaded wireframe of a hundred cubes used to double the frame's vertex count; it now costs one more instance per entity. The hull expansion the lanes also carry was the selection rim, which is gone — see SceneShow — and the lanes are kept because the shader's flat-lit path is what the wires use.

⚠ Built shapes are still cached by kind and not by entity, for the reason the cache always had: rebuilding a sphere's four hundred vertices per entity would be the whole cost of this pass and none of its output. What changed is that the cache is now consulted once per shape rather than once per entity, and only to answer what the geometry is — see Shape, which is what registers it with a device.

Fields and properties (14)

  • public ReadOnlySpan<MeshInstance> Instances

    The frame's entities, one instance each, grouped by Batches.

  • public IReadOnlyList<ShapeBatch> Batches

    Which run of them is which shape.

  • public IMeshSource? Meshes

    Where the geometry a mesh reference names comes from. Null draws no referenced mesh.

  • public ISurfaceSource? Surfaces

    Where an entity's material comes from. Null shades everything neutrally.

  • public int Waiting

    How many entities are waiting for geometry that has not been read yet.

  • public int Count

    How many entities the last build drew.

  • public int Triangles

    How many triangles the last build asked for.

  • public int Revision

    How many times the shape cache has been thrown away.

  • public Color4 ShapeColour

    The colour of a shape that is not selected.

  • public Color4 SelectedColour

    The colour of a selected one.

  • public int Segments

    How many divisions a curved shape is built with.

  • public float Checker

    How big a block-out checker square is, in metres. Zero draws none.

  • public float AxisTint

    How strongly the checker is tinted by which axis a face points along, from zero to one.

  • public Color4 WireColour

    What a wireframe view's edges are drawn in.

Methods (5)

  • public int Build(SceneDocument document)

    Collects a frame's instances, shaded, with everything shown.

  • public int Build(SceneDocument document, SceneViewport? viewport)

    Collects a frame's instances as one pane wants them.

  • public void Invalidate()

    Forgets the geometry and the materials built so far.

  • public MeshData? Shape(SceneShape shape)

    The geometry of one shape, built once and cached.

  • public MeshData Shape(PrimitiveKind kind)

    The geometry of one built-in shape, built once and cached.

Used by (8)

  • BlockoutSurfaceTestsVixen.Editor.Blockout.Tests
  • EditorHostVixen.Editor.Host
  • OutlinerColumnTestsVixen.Editor.App.Tests
  • PrimitiveShapeTestsVixen.Editor.SceneView.Tests
  • SceneMaterialTestsVixen.Editor.SceneView.Tests
  • SceneMeshAssetTestsVixen.Editor.SceneView.Tests
  • ScenePresenterVixen.Editor.App
  • ViewportStateTestsVixen.Editor.SceneView.Tests