Class Camera
This class represent 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
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 jittering effect (TemporalAA).
Declaration
protected static readonly Vector2[] HaltonSequence
Field Value
| Type | Description |
|---|---|
| Vector2[] |
RenderManager
The render manager.
Declaration
[BindSceneManager(false, true)]
protected RenderManager RenderManager
Field Value
| Type | Description |
|---|---|
| RenderManager |
ScreenViewport
The camera viewport.
Declaration
public Viewport ScreenViewport
Field Value
| Type | Description |
|---|---|
| Viewport |
TagFilter
Tag filter. If has 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 value, ResolvedFrameBuffer is equal to this. In other case, the ResolvedFrameBuffer is obtained from the Display.
aperture
The aperture advance parameter to calculate exposure.
Declaration
protected float aperture
Field Value
| Type | Description |
|---|---|
| float |
aspectRatio
The aspect ratio.
Declaration
protected float aspectRatio
Field Value
| Type | Description |
|---|---|
| float |
backgroundColor
Color used to clean 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
Clear 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
Clear the stencil buffer with this value.
Declaration
protected byte clearStencil
Field Value
| Type | Description |
|---|---|
| byte |
compensation
Compensation advance parameter to calculate 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 indicate that the multiview properties has been changed.
Declaration
protected bool dirtyMultiview
Field Value
| Type | Description |
|---|---|
| bool |
dirtyPosition
Flag that indicate if the position must be refreshed.
Declaration
protected bool dirtyPosition
Field Value
| Type | Description |
|---|---|
| bool |
dirtyPreviousViewProjection
Flags 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 indicate if the projection matrix must be refreshed.
Declaration
protected bool dirtyProjection
Field Value
| Type | Description |
|---|---|
| bool |
dirtyView
Flag that indicate if the view matrix must be refreshed.
Declaration
protected bool dirtyView
Field Value
| Type | Description |
|---|---|
| bool |
dirtyViewProjection
Flag that indicate 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 to 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
The height.
Declaration
protected float height
Field Value
| Type | Description |
|---|---|
| float |
jitter
Current camera jittering.
Declaration
protected Vector2 jitter
Field Value
| Type | Description |
|---|---|
| Vector2 |
jitteringEnabled
Indicates the camera has jittering or not.
Declaration
protected bool jitteringEnabled
Field Value
| Type | Description |
|---|---|
| bool |
maxZ
The max Z.
Declaration
protected float maxZ
Field Value
| Type | Description |
|---|---|
| float |
minZ
The min Z.
Declaration
protected float minZ
Field Value
| Type | Description |
|---|---|
| float |
multiviewProperties
Multiview 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 jittering.
Declaration
protected Vector2 previousJitter
Field Value
| Type | Description |
|---|---|
| Vector2 |
previousViewProjectionFlipped
The inverse of 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 projection inverse matrix.
Declaration
protected Matrix4x4 projectionInverse
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
renderProjection
The projection transform when the camera is going to render.
Declaration
protected Matrix4x4 renderProjection
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
renderViewProjection
The view projection transform when the camera is going to render.
Declaration
protected Matrix4x4 renderViewProjection
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
sensitivity
Sensibility 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 to calculate exposure.
Declaration
protected float shutterSpeed
Field Value
| Type | Description |
|---|---|
| float |
unjitteredDirtyViewProjection
Flag that indicate 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 view projection unjittered (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 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 view projection.
Declaration
protected Matrix4x4 viewProjectionInverse
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
viewport
The camera 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 viewport height.
Declaration
protected float viewportHeight
Field Value
| Type | Description |
|---|---|
| float |
viewportWidth
The viewport width.
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 indicate 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 exposition, the aperture setting controls the depth of field.
AutoDepthBounds
Gets or sets a value indicating whether auto depth bound is compute or not.
Declaration
public bool AutoDepthBounds { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
AutoExposureEnabled
Gets or sets a value indicating whether auto exposure is enable 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 it was 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 larger value will be drawn on top of cameras with a smaller 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 clean 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, allow you override the exposure to experiement 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 an 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 for as 18% middle-gray). Applying an exposure compensation EC is a simple as adding an offset to the exposure value, as shown in 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 them 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 display index to Draw associated to the camera.
Declaration
public string DisplayTag { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
DrawContext
Gets the draw context associated to 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 must be flipped.
Declaration
public bool FlipYProjection { get; }
Property Value
| Type | Description |
|---|---|
| bool |
FocalDistance
Gets or sets the focal Distance used with 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. The simulated distance between the lens and the sensor of the camera. Larger values give 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 RenderTarget associated to 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 use 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 deph is in [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 camera jittering.
Declaration
public Vector2 Jitter { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
JitteringEnabled
Gets or sets a value indicating whether the camera has jitter (TemporalAA).
Declaration
public bool JitteringEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LayerMask
Gets visible layers dictionary. This dictionary indicates when 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 was set in linear space, or the RenderManager default background color. |
LogLuminanceRange
Gets or sets the logarithm luminance range.
Declaration
public float LogLuminanceRange { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MinLogLuminance
Gets or sets the minimum logarithm 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 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 position in world space.
Declaration
public Vector3 Position { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
PreviousJitter
Gets the previous frame 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 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 them 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 render projection matrix. |
RenderViewProjection
Gets the view projection.
Declaration
public Matrix4x4 RenderViewProjection { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 |
RenderViewProjectionInverse
Gets the inverse transform of view projection used when there are a.
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 as simply the “ISO” or “ISO setting”. In addition to the exposition, the sensitivity setting controls the amount of noise.
SensorSize
Gets or sets the size of the camera sensor in milimeters (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 opened (it also controls the timing of the sensor shutter(s), whether electronic or mechanical). In addition to the exposition, the shutter speed controls motion blur.
TAU
Gets or sets the TAU (Exponential time constant). Indicate the speed exposure adaptation.
Declaration
public float TAU { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Transform
Gets the camera Transform3D.
Declaration
public Transform3D Transform { get; }
Property Value
| Type | Description |
|---|---|
| Transform3D |
UnjitteredProjection
Gets the projection unjittered matrix.
Declaration
public Matrix4x4 UnjitteredProjection { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 |
UnjitteredViewProjection
Gets the view 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 calculate 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 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>)
Set 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)
Calculate a Ray of a camera from a given 2D screen position.
Declaration
public void CalculateRay(ref Vector2 screenPosition, out Ray ray)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | screenPosition | 2D screen position. |
| Ray | ray | The ray position. |
OnAttached()
Attach the camera to the system.
Declaration
protected override bool OnAttached()
Returns
| Type | Description |
|---|---|
| bool | True if all is OK. |
Overrides
OnDetach()
Detach the camera to the system.
Declaration
protected override void OnDetach()
Overrides
OnPositionChanged()
The transform position is changed.
Declaration
protected virtual void OnPositionChanged()
PostRender()
Called when the current frame render finished.
Declaration
public void PostRender()
PreRender()
Called when the current frame render start.
Declaration
public void PreRender()
RefreshAspectRatio()
Refreshes the aspect ratio.
Declaration
protected void RefreshAspectRatio()
RefreshDimensions()
Refresh the with and height of the camera.
Declaration
protected abstract void RefreshDimensions()
RefreshFrameBuffer()
Refresh the framebuffer.
Declaration
protected virtual void RefreshFrameBuffer()
RefreshPhysicalFieldOfView()
Refresh the FoV with the physical camera parameters.
Declaration
protected void RefreshPhysicalFieldOfView()
RefreshProjection()
Refresh the projection matrix.
Declaration
protected abstract void RefreshProjection()
RefreshStereoProperties()
Set camera stereo properties.
Declaration
protected void RefreshStereoProperties()
RefreshUnjitteredViewProjection()
Refresh the ViewProjection unjittered matrix.
Declaration
protected virtual void RefreshUnjitteredViewProjection()
RefreshView()
Refresh the view matrix.
Declaration
protected abstract void RefreshView()
RefreshViewProjection()
Refresh the ViewProjection matrix.
Declaration
protected virtual void RefreshViewProjection()
ResetCustomProjection()
Reset 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 right-bottom 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 right-bottom 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)
Specify a custom projection to that camera. This methods override the default projection.
Declaration
public void SetCustomProjection(Matrix4x4 customProjection)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | customProjection | The new custom projection. |
SetCustomProjection(ref Matrix4x4)
Specify a custom projection to that camera. This methods override the default projection.
Declaration
public void SetCustomProjection(ref Matrix4x4 customProjection)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | customProjection | The new custom projection. |
SetStereoProperties(ViewProperties[])
Set camera stereo properties.
Declaration
public void SetStereoProperties(ViewProperties[] viewProperties)
Parameters
| Type | Name | Description |
|---|---|---|
| ViewProperties[] | viewProperties | Eye properties. |
SuscribeDisplayEvents()
Subscribe display events.
Declaration
protected void SuscribeDisplayEvents()
UnsuscribeDisplayEvents()
Unsubscribe display events.
Declaration
protected void UnsuscribeDisplayEvents()
UpdateJittering(ref Matrix4x4)
If temporal Anti-aliasing is enabled in drawcontext update de camera projection matrix and remove the jittering whether not.
Declaration
protected void UpdateJittering(ref Matrix4x4 projectionMatrix)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | projectionMatrix | Camera Projection matrix (Stereo or Simple). |
WithinEpsilon(float, float)
Withins 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 right-bottom 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 right-bottom 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 camera order is changed.
Declaration
public event EventHandler<float> OnCameraOrderChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<float> |
OnRenderPathChanged
OnRenderPathChanged is called when the camera set a new RenderPath
Declaration
public event EventHandler<RenderPath> OnRenderPathChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<RenderPath> |