Class Camera
Describes a right-handed camera in the scene. An important aspect is that the camera itself is also part of the scenegraph, meaning any values such as the direction vector are not absolute, they can be relative to the coordinate system defined by the node which corresponds to the camera. This allows for camera animations.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public sealed class Camera : IMarshalable<Camera, AiCamera>
Constructors
| Edit this page View SourceCamera()
Constructs a new instance of the Camera class.
Declaration
public Camera()
Properties
| Edit this page View SourceAspectRatio
Gets or sets the screen aspect ratio. This is the ratio between the width and height of the screen. Typical values are 4/3, 1/2, or 1/1. This value is 0 if the aspect ratio is not defined in the source file. The default value is zero.
Declaration
public float AspectRatio { get; set; }
Property Value
Type | Description |
---|---|
float |
ClipPlaneFar
Gets or sets the distance of the far clipping plane from the camera. The far clippling plane must be further than the near clippling plane. The default value is 1000.0f. The ratio between the near and far plane should not be too large (between 1000 - 10000 should be ok) to avoid floating-point inaccuracies which can lead to z-fighting.
Declaration
public float ClipPlaneFar { get; set; }
Property Value
Type | Description |
---|---|
float |
ClipPlaneNear
Gets or sets the distance of the near clipping plane from the camera. The value may not be 0.0f for arithmetic reasons to prevent a division through zero. The default value is 0.1f;
Declaration
public float ClipPlaneNear { get; set; }
Property Value
Type | Description |
---|---|
float |
Direction
Gets or sets the viewing direction of the camera, relative to the coordinate space defined by the corresponding node. The default value is 0|0|1.
Declaration
public Vector3 Direction { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
FieldOfview
Gets or sets the half horizontal field of view angle, in radians. The FoV angle is the angle between the center line of the screen and the left or right border. The default value is 1/4PI.
Declaration
public float FieldOfview { get; set; }
Property Value
Type | Description |
---|---|
float |
Name
Gets or sets the name of the camera. This corresponds to a node in the scenegraph with the same name. This node specifies the position of the camera in the scene hierarchy and can be animated.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Position
Gets or sets the position of the camera relative to the coordinate space defined by the corresponding node. THe default value is 0|0|0.
Declaration
public Vector3 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Up
Gets or sets the 'up' vector of the camera, relative to the coordinate space defined by the corresponding node. The 'right' vector of the camera is the cross product of the up and direction vectors. The default value is 0|1|0.
Declaration
public Vector3 Up { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
ViewMatrix
Gets a right-handed view matrix.
Declaration
public Matrix4x4 ViewMatrix { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Methods
| Edit this page View SourceFreeNative(nint, bool)
Frees unmanaged memory created by ToNative(nint, out Native).
Declaration
public static void FreeNative(nint nativeValue, bool freeNative)
Parameters
Type | Name | Description |
---|---|---|
nint | nativeValue | Native value to free |
bool | freeNative | True if the unmanaged memory should be freed, false otherwise. |