Vixen
02b45cc4
csharp
public readonly record struct RenderCamera

Where the frame is seen from, as one description rather than as several copies of it.

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

Remarks

A RenderView is deliberately not a camera — a frame has a dozen views and one camera, and modelling a shadow cascade as something the game can see through would be wrong. But the camera is one of those views, and more than one thing in a frame needs to know how it was built: the view's own matrix, and the cascade fit that slices its frustum.

Two consumers, one description. Before this, a host set the view's matrix from its camera and separately set seven scalars on the shadow renderer, and nothing checked that they agreed. A cascade fitted to a field of view the camera no longer had is a shadow that covers the wrong part of the scene — visible only as shadows fading in at a distance that does not match the setting, which is the kind of wrong nobody attributes correctly.

Perspective only, because that is what a cascade fit assumes: the slices are cones about the view axis, and an orthographic camera's would be boxes. A projection this cannot describe sets ViewProjection directly and fits its shadows some other way.

Fields and properties (12)

  • public Vector3 Position

    Where the camera is.

  • public Vector3 Forward

    Which way it looks. Normalised on use rather than on construction.

  • public Vector3 Up

    Which way is up, for the view basis.

  • public float FieldOfView

    The vertical field of view, in radians.

  • public float AspectRatio

    Width over height.

  • public float NearPlane

    The near plane's distance.

  • public float FarPlane

    The far plane's distance.

  • public Camera Lens

    The camera component this view was described by, or a zeroed one for a view that is not a scene camera.

  • public static RenderCamera Default

    Looking down −Z from the origin, which is the engine's forward.

  • public Matrix4x4 View

    The view matrix this camera describes.

  • public Matrix4x4 Projection

    The projection matrix this camera describes.

  • public Matrix4x4 ViewProjection

    What a shader and a frustum are both built from.

Methods (1)

  • public RenderCamera(Vector3 Position, Vector3 Forward, Vector3 Up, float FieldOfView, float AspectRatio, float NearPlane, float FarPlane)

    Where the frame is seen from, as one description rather than as several copies of it.

Used by (24)

  • AmbientOcclusionRendererVixen.Rendering.PostFx
  • BufferTransferDeviceTestsVixen.Graphics.Golden.Tests
  • CameraExtractionSystemVixen.Rendering
  • CameraExtractionTestsVixen.Rendering.Tests
  • ClusterCullingDeviceTestsVixen.Graphics.Golden.Tests
  • ClusterGridVixen.Rendering
  • ClusteredLightingTestsVixen.Rendering.Tests
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • CompositorImageTestsVixen.Graphics.Golden.Tests
  • DepthOfFieldRendererVixen.Rendering.PostFx
  • IrradianceBounceDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceShadingDeviceTestsVixen.Graphics.Golden.Tests
  • LensFlareRendererVixen.Rendering.PostFx
  • LocalExposureRendererVixen.Rendering.PostFx
  • MotionBlurRendererVixen.Rendering.PostFx
  • ParticleRenderFeatureVixen.Rendering
  • ParticleSpriteDeviceTestsVixen.Graphics.Golden.Tests
  • PostEffectTestsVixen.Rendering.PostFx.Tests
  • RenderViewVixen.Rendering
  • SceneLightingVixen.Rendering
  • ShadowMapRendererVixen.Rendering
  • ShadowMapRendererTestsVixen.Rendering.Tests
  • TonemapRendererVixen.Rendering.PostFx
  • ViewConstantsVixen.Rendering