Vixen
02b45cc4
csharp
public struct PunctualLightData

One light exactly as PunctualLight in Lighting.rvn declares it.

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

Remarks

Eighty bytes with no padding anywhere, and that is the whole reason the field order is what it is: each float3 is followed by a float, so every member lands on its natural std140 sixteen-byte boundary. Reordered so that two vectors are adjacent, the same values cost far more and every offset moves.

Because it matches, an upload is a blit. Writing this array to a buffer is one MemoryMarshal.AsBytes and no per-field packing — which is the only reason a per-object light list is affordable at all. A test asserts the size and the offsets rather than trusting the comment, because the failure is silent: the shader reads whatever bytes are there and shades with them.

Fields and properties (12)

  • public Vector3 Position

    Where the light is.

  • public float Kind

    Which LightKind it is, as a float.

  • public Vector3 Colour

    Its radiance — colour already multiplied by intensity.

  • public float Range

    Where its contribution reaches zero.

  • public Vector3 Direction

    Which way it points.

  • public float CosInner

    The cosine of the inner cone half-angle.

  • public float Radius

    Its sphere radius.

  • public float CosOuter

    The cosine of the outer cone half-angle.

  • public float ShadowIndex

    Which tile of the punctual shadow atlas shadows it, or −1 for none.

  • public float Padding

    One float of tail padding the shader declares and never reads.

  • public Vector3 Tangent

    A shaped light's axis: along a tube, or across a rectangle's width.

  • public float HalfLength

    Half a tube's length, or half a rectangle's width.

Used by (8)

  • BufferTransferDeviceTestsVixen.Graphics.Golden.Tests
  • ClusterCullingDeviceTestsVixen.Graphics.Golden.Tests
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • ForwardLightingRenderFeatureVixen.Rendering
  • ForwardLightingTestsVixen.Rendering.Tests
  • IrradianceBounceDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests
  • RenderLightVixen.Rendering