Class Camera
This class represents a camera in a 3D world. Cameras are the devices that capture and display the world to the player.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public abstract class Camera : Component, IDependencyObject
Constructors
Camera()
Initializes a new instance of the Camera class.
Declaration
public Camera()
Fields
DisplayTagDirty
Indicates if the display tag is dirty.
Declaration
public bool DisplayTagDirty
Field Value
Type | Description |
---|---|
bool |
FrameBufferUpdateCounter
The update counter.
Declaration
public int FrameBufferUpdateCounter
Field Value
Type | Description |
---|---|
int |
HaltonSequence
Halton sequence to generate the camera jitter effect (TemporalAA).
Declaration
protected static readonly Vector2[] HaltonSequence
Field Value
Type | Description |
---|---|
Vector2[] |
RenderManager
The rendering manager.
Declaration
[BindSceneManager(false, true)]
protected RenderManager RenderManager
Field Value
Type | Description |
---|---|
RenderManager |
ScreenViewport
Represents the camera viewport.
Declaration
public Viewport ScreenViewport
Field Value
Type | Description |
---|---|
Viewport |
TagFilter
Tag filter. If it has a value, render only objects with this tag.
Declaration
public string TagFilter
Field Value
Type | Description |
---|---|
string |
TargetFrameBuffer
The resolved frameBuffer. The camera will render in this framebuffer.
Declaration
protected FrameBuffer TargetFrameBuffer
Field Value
Type | Description |
---|---|
FrameBuffer |
Remarks
If the FrameBuffer property has a value, ResolvedFrameBuffer is equal to this. In the other case, the ResolvedFrameBuffer is obtained from the Display.
aperture
The aperture advancement parameter used to calculate exposure.
Declaration
protected float aperture
Field Value
Type | Description |
---|---|
float |
aspectRatio
Represents the aspect ratio.
Declaration
protected float aspectRatio
Field Value
Type | Description |
---|---|
float |
backgroundColor
Color used to clear the background.
Declaration
protected LinearColor backgroundColor
Field Value
Type | Description |
---|---|
LinearColor |
boundingFrustum
The bounding frustum.
Declaration
protected BoundingFrustum boundingFrustum
Field Value
Type | Description |
---|---|
BoundingFrustum |
cachedPosition
Cached position.
Declaration
protected Vector3 cachedPosition
Field Value
Type | Description |
---|---|
Vector3 |
clearDepth
Clears the depth buffer with this value. This value will be clamped between 0 and 1.
Declaration
protected float clearDepth
Field Value
Type | Description |
---|---|
float |
clearFlags
The clear flags.
Declaration
protected ClearFlags clearFlags
Field Value
Type | Description |
---|---|
ClearFlags |
clearStencil
Clears the stencil buffer with this value.
Declaration
protected byte clearStencil
Field Value
Type | Description |
---|---|
byte |
compensation
Compensation advance parameter to calculate the exposure.
Declaration
protected float compensation
Field Value
Type | Description |
---|---|
float |
customProjection
Custom projection specified by the user.
Declaration
protected Matrix4x4? customProjection
Field Value
Type | Description |
---|---|
Matrix4x4? |
dirtyMultiview
Flag that indicates that the multiview properties have been changed.
Declaration
protected bool dirtyMultiview
Field Value
Type | Description |
---|---|
bool |
dirtyPosition
Flag that indicates if the position must be refreshed.
Declaration
protected bool dirtyPosition
Field Value
Type | Description |
---|---|
bool |
dirtyPreviousViewProjection
Flag that indicates the viewProj was modified in the previous frame, so previousViewProjection must be refreshed.
Declaration
protected bool dirtyPreviousViewProjection
Field Value
Type | Description |
---|---|
bool |
dirtyProjection
Flag that indicates if the projection matrix must be refreshed.
Declaration
protected bool dirtyProjection
Field Value
Type | Description |
---|---|
bool |
dirtyView
Flag that indicates if the view matrix must be refreshed.
Declaration
protected bool dirtyView
Field Value
Type | Description |
---|---|
bool |
dirtyViewProjection
Flag that indicates if the viewProj matrix must be refreshed.
Declaration
protected bool dirtyViewProjection
Field Value
Type | Description |
---|---|
bool |
ev100
The exposure value for ISO 100.
Declaration
protected float ev100
Field Value
Type | Description |
---|---|
float |
exposure
The exposure of this camera.
Declaration
protected float exposure
Field Value
Type | Description |
---|---|
float |
farPlane
The far plane.
Declaration
protected float farPlane
Field Value
Type | Description |
---|---|
float |
fieldOfView
The field of view.
Declaration
protected float fieldOfView
Field Value
Type | Description |
---|---|
float |
fieldOfViewAxis
The FOV axis.
Declaration
protected FieldOfViewAxis fieldOfViewAxis
Field Value
Type | Description |
---|---|
FieldOfViewAxis |
focalLength
The focal length (Default: 50).
Declaration
protected float focalLength
Field Value
Type | Description |
---|---|
float |
frameBuffer
The framebuffer instance associated with this camera.
Declaration
protected FrameBuffer frameBuffer
Field Value
Type | Description |
---|---|
FrameBuffer |
graphicsPresenter
The graphics presenter.
Declaration
[BindService(true)]
protected GraphicsPresenter graphicsPresenter
Field Value
Type | Description |
---|---|
GraphicsPresenter |
height
Represents the height.
Declaration
protected float height
Field Value
Type | Description |
---|---|
float |
jitter
Current camera jitter.
Declaration
protected Vector2 jitter
Field Value
Type | Description |
---|---|
Vector2 |
jitteringEnabled
Indicates whether the camera has jittering.
Declaration
protected bool jitteringEnabled
Field Value
Type | Description |
---|---|
bool |
maxZ
The maximum Z value.
Declaration
protected float maxZ
Field Value
Type | Description |
---|---|
float |
minZ
The minimum Z.
Declaration
protected float minZ
Field Value
Type | Description |
---|---|
float |
multiviewProperties
Multi-view properties.
Declaration
protected ViewProperties[] multiviewProperties
Field Value
Type | Description |
---|---|
ViewProperties[] |
nearPlane
The near plane.
Declaration
protected float nearPlane
Field Value
Type | Description |
---|---|
float |
previousJitter
Previous frame camera jitter.
Declaration
protected Vector2 previousJitter
Field Value
Type | Description |
---|---|
Vector2 |
previousViewProjectionFlipped
The inverse of the view projection in the previous frame when the device is in a RenderTarget.
Declaration
protected Matrix4x4 previousViewProjectionFlipped
Field Value
Type | Description |
---|---|
Matrix4x4 |
projection
The projection.
Declaration
protected Matrix4x4 projection
Field Value
Type | Description |
---|---|
Matrix4x4 |
projectionInverse
The inverse of the projection matrix.
Declaration
protected Matrix4x4 projectionInverse
Field Value
Type | Description |
---|---|
Matrix4x4 |
renderProjection
The projection transform when the camera is rendering.
Declaration
protected Matrix4x4 renderProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
renderViewProjection
The view projection transform when the camera is about to render.
Declaration
protected Matrix4x4 renderViewProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
sensitivity
Sensitivity advance parameter to calculate exposure.
Declaration
protected float sensitivity
Field Value
Type | Description |
---|---|
float |
sensorSize
The sensor size (default: 36x24 mm).
Declaration
protected Vector2 sensorSize
Field Value
Type | Description |
---|---|
Vector2 |
shutterSpeed
Shutter speed advance parameter used to calculate exposure.
Declaration
protected float shutterSpeed
Field Value
Type | Description |
---|---|
float |
unjitteredDirtyViewProjection
Flag that indicates whether the viewProj unjittered matrix must be refreshed.
Declaration
protected bool unjitteredDirtyViewProjection
Field Value
Type | Description |
---|---|
bool |
unjitteredProjection
The unjittered projection (TAA).
Declaration
protected Matrix4x4 unjitteredProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
unjitteredViewProjection
The unjittered view projection (TAA).
Declaration
protected Matrix4x4 unjitteredViewProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
view
The view.
Declaration
protected Matrix4x4 view
Field Value
Type | Description |
---|---|
Matrix4x4 |
viewInverse
The inverse matrix view.
Declaration
protected Matrix4x4 viewInverse
Field Value
Type | Description |
---|---|
Matrix4x4 |
viewProjection
The view projection.
Declaration
protected Matrix4x4 viewProjection
Field Value
Type | Description |
---|---|
Matrix4x4 |
viewProjectionInverse
The inverse of the view projection.
Declaration
protected Matrix4x4 viewProjectionInverse
Field Value
Type | Description |
---|---|
Matrix4x4 |
viewport
The camera's viewport.
Declaration
protected Viewport viewport
Field Value
Type | Description |
---|---|
Viewport |
viewportFactor
The viewport/physical scale factor.
Declaration
protected Vector2 viewportFactor
Field Value
Type | Description |
---|---|
Vector2 |
viewportHeight
The height of the viewport.
Declaration
protected float viewportHeight
Field Value
Type | Description |
---|---|
float |
viewportWidth
The width of the viewport.
Declaration
protected float viewportWidth
Field Value
Type | Description |
---|---|
float |
width
The width.
Declaration
protected float width
Field Value
Type | Description |
---|---|
float |
Properties
Aperture
Gets or sets the aperture of the camera in f-stops (Default f/16).
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Aperture", Tooltip = "The aperture of the camera in f-stops (Default f/16)")]
public float Aperture { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
This setting controls how open or closed the camera system's aperture is. Since an f-stop indicates the ratio of the lens' focal length to the diameter of the entrance pupil, high values (ƒ/16) indicate a small aperture and small values (ƒ/1.4) indicate a wide aperture. In addition to the exposure, the aperture setting controls the depth of field.
AutoDepthBounds
Gets or sets a value indicating whether the auto depth bound is computed or not.
Declaration
public bool AutoDepthBounds { get; set; }
Property Value
Type | Description |
---|---|
bool |
AutoExposureEnabled
Gets or sets a value indicating whether auto exposure is enabled or not.
Declaration
public bool AutoExposureEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
BackgroundColor
Gets or sets the color of the background.
Declaration
public Color BackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
Color | The background color of the camera if set, or the RenderManager default background color. |
BoundingFrustum
Gets the camera bounding frustum.
Declaration
public BoundingFrustum BoundingFrustum { get; }
Property Value
Type | Description |
---|---|
BoundingFrustum |
CameraOrder
Gets or sets the camera order. Cameras with a higher value will be drawn on top of cameras with a lower value.
Declaration
public float CameraOrder { get; set; }
Property Value
Type | Description |
---|---|
float |
CameraShouldRender
Gets a value indicating whether this camera should be rendered.
Declaration
public virtual bool CameraShouldRender { get; }
Property Value
Type | Description |
---|---|
bool |
ClearDepth
Gets or sets the clear depth buffer value. This value will be clamped between 0 and 1.
Declaration
[RenderPropertyAsFInput(MinLimit = 0, MaxLimit = 1)]
public float ClearDepth { get; set; }
Property Value
Type | Description |
---|---|
float |
ClearFlags
Gets or sets clear flags used for cleaning the FrameBuffer, stencilBuffer, and ZBuffer.
Declaration
public ClearFlags ClearFlags { get; set; }
Property Value
Type | Description |
---|---|
ClearFlags |
ClearStencil
Gets or sets the clear stencil buffer value.
Declaration
public byte ClearStencil { get; set; }
Property Value
Type | Description |
---|---|
byte |
Compensation
Gets or sets the camera exposure compensation, allowing you to override the exposure to experiment with overexposure or underexposure.
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Compensation", Tooltip = "")]
public float Compensation { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
Even though an exposure value actually indicates combinations of camera settings, it is often used by photographers to describe light intensity. This is why cameras let photographers apply exposure compensation to over or under-expose an image. This setting can be used for artistic control but also to achieve proper exposure (snow, for instance, will be exposed as 18% middle-gray). Applying exposure compensation EC is as simple as adding an offset to the exposure value, as shown in the equation EV′100=EV100−EC(108) This equation uses a negative sign because we are using EC in f-stops to adjust the final exposure. Increasing the EV is akin to closing down the aperture of the lens (or reducing shutter speed or reducing sensitivity). A higher EV will produce darker images.
CullingSystem
Gets or sets the Culling System used for this camera. If null, then the default Culling System of the RenderManager is used.
Declaration
public CullingSystem CullingSystem { get; set; }
Property Value
Type | Description |
---|---|
CullingSystem |
CustomProjection
Gets the custom camera projection.
Declaration
public Matrix4x4? CustomProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4? |
Display
Gets the camera display.
Declaration
public Display Display { get; }
Property Value
Type | Description |
---|---|
Display |
DisplayTag
Gets or sets the display index to draw associated with the camera.
Declaration
public string DisplayTag { get; set; }
Property Value
Type | Description |
---|---|
string |
DrawContext
Gets the draw context associated with this camera.
Declaration
public CameraDrawContext DrawContext { get; }
Property Value
Type | Description |
---|---|
CameraDrawContext |
EV100
Gets the exposure value for ISO 100.
Declaration
public virtual float EV100 { get; }
Property Value
Type | Description |
---|---|
float |
Exposure
Gets or sets the exposure for this camera.
Declaration
public float Exposure { get; set; }
Property Value
Type | Description |
---|---|
float |
EyeCount
Gets the stereo eye count.
Declaration
public int EyeCount { get; }
Property Value
Type | Description |
---|---|
int |
FarPlane
Gets or sets the far plane.
Declaration
public virtual float FarPlane { get; set; }
Property Value
Type | Description |
---|---|
float | The far plane. |
FieldOfView
Gets or sets the field of view.
Declaration
[RenderProperty(typeof(FloatRadianToDegreeConverter), CustomPropertyName = "Field of View", Tooltip = "The field of view of the camera in radians.")]
public virtual float FieldOfView { get; set; }
Property Value
Type | Description |
---|---|
float | The field of view. |
FieldOfViewAxis
Gets or sets the field-of-view axis.
Declaration
public FieldOfViewAxis FieldOfViewAxis { get; set; }
Property Value
Type | Description |
---|---|
FieldOfViewAxis | The field-of-view axis. |
FlipYProjection
Gets a value indicating whether the Y-axis should be flipped.
Declaration
public bool FlipYProjection { get; }
Property Value
Type | Description |
---|---|
bool |
FocalDistance
Gets or sets the focal distance used with the Depth of Field effect to choose the focus distance from the camera (m).
Declaration
public float FocalDistance { get; set; }
Property Value
Type | Description |
---|---|
float |
FocalLength
Gets or sets the focal length. This represents the simulated distance between the lens and the sensor of the camera. Larger values result in a narrower field of view.
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Focal Length", Tooltip = "The simulated distance between the lens and the sensor of the camera. Larger values give a narrower field of view")]
public float FocalLength { get; set; }
Property Value
Type | Description |
---|---|
float |
FrameBuffer
Gets or sets the render target associated with the camera.
Declaration
public virtual FrameBuffer FrameBuffer { get; set; }
Property Value
Type | Description |
---|---|
FrameBuffer | The render target. |
FrustumCullingEnabled
Gets or sets a value indicating whether frustum culling is enabled.
Declaration
public bool FrustumCullingEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
HDREnabled
Gets or sets a value indicating whether the camera uses High Dynamic Range or not.
Declaration
public virtual bool HDREnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsClipDepthZeroToOne
Gets a value indicating whether the clip depth is in the [0, 1] range.
Declaration
public bool IsClipDepthZeroToOne { get; }
Property Value
Type | Description |
---|---|
bool |
IsStereoEnabled
Gets a value indicating whether this camera has stereo enabled.
Declaration
public bool IsStereoEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Jitter
Gets the current frame's camera jittering.
Declaration
public Vector2 Jitter { get; }
Property Value
Type | Description |
---|---|
Vector2 |
JitteringEnabled
Gets or sets a value indicating whether the camera has jitter (Temporal AA).
Declaration
public bool JitteringEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
LayerMask
Gets visible layers dictionary. This dictionary indicates whether a layer is visible for that camera.
Declaration
public IDictionary<int, bool> LayerMask { get; }
Property Value
Type | Description |
---|---|
IDictionary<int, bool> | The layers dictionary. |
LayerMaskDefaultValue
Gets or sets a value indicating whether the layers are drawn by the camera by default.
Declaration
public bool LayerMaskDefaultValue { get; set; }
Property Value
Type | Description |
---|---|
bool |
LinearBackgroundColor
Gets or sets the color of the background in linear space.
Declaration
public LinearColor LinearBackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
LinearColor | The background color of the camera if it is set in linear space, or the RenderManager default background color. |
LogLuminanceRange
Gets or sets the logarithmic luminance range.
Declaration
public float LogLuminanceRange { get; set; }
Property Value
Type | Description |
---|---|
float |
MinLogLuminance
Gets or sets the minimum logarithmic luminance value.
Declaration
public float MinLogLuminance { get; set; }
Property Value
Type | Description |
---|---|
float |
MultiviewPosition
Gets the stereo camera positions.
Declaration
public Vector4[] MultiviewPosition { get; }
Property Value
Type | Description |
---|---|
Vector4[] |
MultiviewProjection
Gets the stereo camera projection matrices.
Declaration
public Matrix4x4[] MultiviewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4[] |
MultiviewProjectionInverse
Gets the stereo camera's inverse view projection matrices.
Declaration
public Matrix4x4[] MultiviewProjectionInverse { get; }
Property Value
Type | Description |
---|---|
Matrix4x4[] |
MultiviewView
Gets the stereo camera view matrices.
Declaration
public Matrix4x4[] MultiviewView { get; }
Property Value
Type | Description |
---|---|
Matrix4x4[] |
MultiviewViewProjection
Gets the stereo camera view projection matrices.
Declaration
public Matrix4x4[] MultiviewViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4[] |
NearPlane
Gets or sets the near plane.
Declaration
public virtual float NearPlane { get; set; }
Property Value
Type | Description |
---|---|
float | The near plane. |
Position
Gets the camera's position in world space.
Declaration
public Vector3 Position { get; }
Property Value
Type | Description |
---|---|
Vector3 |
PreviousJitter
Gets the previous frame's camera jittering.
Declaration
public Vector2 PreviousJitter { get; }
Property Value
Type | Description |
---|---|
Vector2 |
PreviousViewProjection
Gets or sets the view projection in the previous frame.
Declaration
public Matrix4x4 PreviousViewProjection { get; set; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Projection
Gets the projection matrix.
Declaration
public Matrix4x4 Projection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 | The projection matrix. |
ProjectionInverse
Gets the inverse of the projection matrix.
Declaration
public Matrix4x4 ProjectionInverse { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
RenderPath
Gets or sets the render path used for this camera. If null, then the default RenderPath of the RenderManager is used.
Declaration
public CameraRenderPath RenderPath { get; set; }
Property Value
Type | Description |
---|---|
CameraRenderPath |
RenderProjection
Gets the projection matrix used to render this camera.
Declaration
public Matrix4x4 RenderProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 | The rendering projection matrix. |
RenderViewProjection
Gets the view projection.
Declaration
public Matrix4x4 RenderViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
RenderViewProjectionInverse
Gets the inverse transform of the view projection used when there is one.
Declaration
public Matrix4x4 RenderViewProjectionInverse { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Sensitivity
Gets or sets the camera sensitivity, expressed in ISO (Default 100).
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Sensitivity", Tooltip = "The camera sensitivity, expressed in ISO (Default 100)")]
public float Sensitivity { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
This setting controls how the light reaching the sensor is quantized. Because of its unit, this setting is often referred to simply as the “ISO” or “ISO setting”. In addition to the exposure, the sensitivity setting controls the amount of noise.
SensorSize
Gets or sets the size of the camera sensor in millimeters (Default: 36x24 mm).
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Sensor Size", Tooltip = "The size of the camera sensor in milimeters (Default: 36x24 mm)")]
public Vector2 SensorSize { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
ShutterSpeed
Gets or sets the shutter speed of the camera in seconds (Default 1/125 seconds).
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = true, CustomPropertyName = "Shutter Speed", Tooltip = "The shutter speed of the camera in seconds (Default 1/125 seconds)")]
public float ShutterSpeed { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
This setting controls how long the aperture remains open (it also controls the timing of the sensor shutter(s), whether electronic or mechanical). In addition to the exposure, the shutter speed controls motion blur.
TAU
Gets or sets the TAU (Exponential time constant). Indicates the speed of exposure adaptation.
Declaration
public float TAU { get; set; }
Property Value
Type | Description |
---|---|
float |
Transform
Gets the camera's Transform3D.
Declaration
public Transform3D Transform { get; }
Property Value
Type | Description |
---|---|
Transform3D |
UnjitteredProjection
Gets the unjittered projection matrix.
Declaration
public Matrix4x4 UnjitteredProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
UnjitteredViewProjection
Gets the view's unjittered projection.
Declaration
public Matrix4x4 UnjitteredViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
UsePhysicalParameters
Gets or sets a value indicating whether the FOV and Exposure will be calculated with physical camera parameters.
Declaration
[RenderProperty(Tag = 1, CustomPropertyName = "Use Physical Parameters", Tooltip = "Indicating whether the FOV and Exposure will be calculate with physical camera parameters")]
public bool UsePhysicalParameters { get; set; }
Property Value
Type | Description |
---|---|
bool |
View
Gets the camera view matrix.
Declaration
public Matrix4x4 View { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
ViewInverse
Gets the Camera Inverse View Matrix.
Declaration
public Matrix4x4 ViewInverse { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
ViewProjection
Gets the view projection.
Declaration
public Matrix4x4 ViewProjection { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
ViewProjectionInverse
Gets the inverse transform of the view projection.
Declaration
public Matrix4x4 ViewProjectionInverse { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Viewport
Gets or sets the camera viewport.
Declaration
public Viewport Viewport { get; set; }
Property Value
Type | Description |
---|---|
Viewport |
Methods
AddAdditionalDirectives(List<string>)
Sets additional directives.
Declaration
public virtual void AddAdditionalDirectives(List<string> directiveList)
Parameters
Type | Name | Description |
---|---|---|
List<string> | directiveList | The directive list. |
CalculateRay(ref Vector2, out Ray)
Calculates a ray from the camera using the given 2D screen position.
Declaration
public void CalculateRay(ref Vector2 screenPosition, out Ray ray)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | screenPosition | The 2D screen position. |
Ray | ray | The resulting ray. |
OnAttached()
Attaches the camera to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if everything is OK. |
Overrides
OnDetach()
Detaches the camera from the system.
Declaration
protected override void OnDetach()
Overrides
OnPositionChanged()
The transform position has been changed.
Declaration
protected virtual void OnPositionChanged()
PostRender()
Called when the rendering of the current frame is finished.
Declaration
public void PostRender()
PreRender()
Called when the current frame starts rendering.
Declaration
public void PreRender()
RefreshAspectRatio()
Refreshes the aspect ratio.
Declaration
protected void RefreshAspectRatio()
RefreshDimensions()
Refresh the width and height of the camera.
Declaration
protected abstract void RefreshDimensions()
RefreshFrameBuffer()
Refreshes the framebuffer.
Declaration
protected virtual void RefreshFrameBuffer()
RefreshPhysicalFieldOfView()
Refreshes the FoV with the physical camera parameters.
Declaration
protected void RefreshPhysicalFieldOfView()
RefreshProjection()
Refreshes the projection matrix.
Declaration
protected abstract void RefreshProjection()
RefreshStereoProperties()
Sets the camera's stereo properties.
Declaration
protected void RefreshStereoProperties()
RefreshUnjitteredViewProjection()
Refreshes the ViewProjection unjittered matrix.
Declaration
protected virtual void RefreshUnjitteredViewProjection()
RefreshView()
Refreshes the view matrix.
Declaration
protected abstract void RefreshView()
RefreshViewProjection()
Refreshes the ViewProjection matrix.
Declaration
protected virtual void RefreshViewProjection()
ResetCustomProjection()
Resets the custom projection.
Declaration
public void ResetCustomProjection()
ScreenToWorld(ref Vector3)
Transforms a point from screen space into world space. World space coordinates can still be calculated even when provided as an off-screen coordinate, for example, for instantiating an off-screen object near a specific corner of the screen. Screen space is defined in pixels. The top-left of the screen is (0,0); the bottom-right is (pixelWidth, pixelHeight). The z position is in world units from the camera.
Declaration
public Vector3 ScreenToWorld(ref Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | A screen space position in pixels (often mouse x, y), plus a z position for depth in world space (for example, a camera clipping plane). |
Returns
Type | Description |
---|---|
Vector3 | The world space Vector3 created by converting the screen space point at the provided distance z from the camera plane. |
ScreenToWorld(ref Vector3, out Vector3)
Transforms a point from screen space into world space. World space coordinates can still be calculated even when provided as an off-screen coordinate, for example, for instantiating an off-screen object near a specific corner of the screen. Screen space is defined in pixels. The top-left of the screen is (0,0); the bottom-right is (pixelWidth, pixelHeight). The z position is in world units from the camera.
Declaration
public void ScreenToWorld(ref Vector3 position, out Vector3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | A screen space position in pixels (often mouse x, y), plus a z position for depth in world space (for example, a camera clipping plane). |
Vector3 | result | The world space Vector3 created by converting the screen space point at the provided distance z from the camera plane. |
SetCustomProjection(Matrix4x4)
Specifies a custom projection for that camera. This method overrides the default projection.
Declaration
public void SetCustomProjection(Matrix4x4 customProjection)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | customProjection | The new custom projection. |
SetCustomProjection(ref Matrix4x4)
Specifies a custom projection for that camera. This method overrides the default projection.
Declaration
public void SetCustomProjection(ref Matrix4x4 customProjection)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | customProjection | The new custom projection. |
SetStereoProperties(ViewProperties[])
Sets camera stereo properties.
Declaration
public void SetStereoProperties(ViewProperties[] viewProperties)
Parameters
Type | Name | Description |
---|---|---|
ViewProperties[] | viewProperties | Eye properties. |
SuscribeDisplayEvents()
Subscribes to display events.
Declaration
protected void SuscribeDisplayEvents()
UnsuscribeDisplayEvents()
Unsubscribes from display events.
Declaration
protected void UnsuscribeDisplayEvents()
UpdateJittering(ref Matrix4x4)
If temporal Anti-aliasing is enabled in DrawContext, update the camera projection matrix and remove the jittering if not.
Declaration
protected void UpdateJittering(ref Matrix4x4 projectionMatrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix4x4 | projectionMatrix | Camera projection matrix (Stereo or Simple). |
WithinEpsilon(float, float)
Within the epsilon.
Declaration
protected bool WithinEpsilon(float a, float b)
Parameters
Type | Name | Description |
---|---|---|
float | a | First value. |
float | b | Second value. |
Returns
Type | Description |
---|---|
bool | Operation result. |
WorldToScreen(ref Vector3)
Transforms position from world space into screen space. Screen space is defined in pixels. The top-left of the screen is (0,0); the bottom-right is (pixelWidth, pixelHeight). The z position is in world units from the camera.
Declaration
public Vector3 WorldToScreen(ref Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | A world space position. |
Returns
Type | Description |
---|---|
Vector3 | The screen space point Vector3 created by converting the world space position. |
WorldToScreen(ref Vector3, out Vector3)
Transforms position from world space into screen space. Screen space is defined in pixels. The top-left of the screen is (0,0); the bottom-right is (pixelWidth, pixelHeight). The z position is in world units from the camera.
Declaration
public void WorldToScreen(ref Vector3 position, out Vector3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | A world space position. |
Vector3 | result | The screen space point Vector3 created by converting the world space position. |
Events
OnCameraOrderChanged
OnCameraOrderChanged is called when the order of the cameras is changed.
Declaration
public event EventHandler<float> OnCameraOrderChanged
Event Type
Type | Description |
---|---|
EventHandler<float> |
OnRenderPathChanged
OnRenderPathChanged is called when the camera sets a new RenderPath.
Declaration
public event EventHandler<RenderPath> OnRenderPathChanged
Event Type
Type | Description |
---|---|
EventHandler<RenderPath> |