csharp
public static class CameraMathThe matrices a Camera and its transform produce.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Free functions rather than properties on the component, because a component is data and these are derived every frame from two components at once. Keeping them out of the struct is also what stops anyone caching a stale one on the entity.
Methods (6)
public static Matrix4x4 View(in WorldTransform transform)The world-to-view matrix: the inverse of where the camera is.
public static Matrix4x4 Projection(in Camera camera, float aspectRatio = 0)The view-to-clip matrix.
public static Matrix4x4 ViewProjection(in Camera camera, in WorldTransform transform, float aspectRatio = 0)The world-to-clip matrix.
public static Vector2 SubpixelJitter(int frameIndex)The sub-pixel offset to take a frame's sample at, in pixels, centred on zero.
public static Matrix4x4 Jittered(in Matrix4x4 matrix, Vector2 jitter)Offsets a projection by a sub-pixel amount, in clip space.
public static BoundingFrustum Frustum(in Camera camera, in WorldTransform transform, float aspectRatio = 0)The volume the camera can see, for culling.
Used by (6)
- CameraExtractionSystemVixen.Rendering
- CameraExtractionTestsVixen.Rendering.Tests
- RenderCameraVixen.Rendering
- SceneAndPrefabTestsVixen.Engine.Tests
- TemporalAntialiasingRendererVixen.Rendering.PostFx
- HostedRendererTestsVixen.App.Tests