Vixen
02b45cc4
csharp
public struct SurfaceVertex

One vertex of a lit surface, in the layout the shading stages declare.

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

Remarks

Position, normal, tangent, texture coordinate — in that order, and the order is the format. ForwardPlus.rvn's vertex stage takes exactly these four and Locations carries the numbers its reflection reports. A layout that named a location the stage does not declare binds nothing to that attribute and the stage reads whatever the driver left there, which is a mesh drawn with its normals in another slot, on one driver, silently — see VertexLocations.

Interleaved, and one layout rather than a layout per mesh. Every surface goes through one GeometryBuffer so that meshes share a vertex and index buffer and a run of draws can become one command; a buffer has a single stride, so the stride is a decision made once here rather than per asset. MeshData is stored the other way round — parallel typed arrays — because a compiler decides what to keep, and this is where that decision has already been made.

⚠ Forty-eight bytes, uncompressed, and that is not the end state. Half-float texture coordinates and an octahedral normal-tangent pair would make it twenty-four, which is the difference between fitting a level's geometry in a cache and not. Doing that needs the shader side to agree, so it is a change to this struct and to ForwardPlus.rvn together — and it is worth nothing until something is drawing at all.

Fields and properties (7)

  • public Vector3 Position

    Where it is, in the mesh's own space.

  • public Vector3 Normal

    Which way the surface faces.

  • public Vector4 Tangent

    The tangent, with the bitangent's handedness in w.

  • public Vector2 TexCoord

    Where it samples a texture.

  • public static int SizeInBytes

    How many bytes one of these is.

  • public static VertexLocations Locations

    Where each attribute binds, from ForwardPlus's reflected vertex inputs.

  • public static VertexSchema Schema

    These four attributes under the names a Raven vertex stage declares them by.

Used by (5)

  • MeshExtractionTestsVixen.Rendering.Tests
  • SurfaceGeometryVixen.Rendering
  • SurfaceGeometryTestsVixen.Rendering.Tests
  • VirtualGeometryExtractionTestsVixen.Rendering.Tests
  • WorldRendererVixen.Engine.Renderer