Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_camera.h File Reference

Represents camera (viewer) in scene graph. More...

Macros

#define KZU_FRUSTUM_PLANE_COUNT
 Number of frustum planes. More...
 

Enumerations

enum  KzuFieldOfViewType { KZU_CAMERA_FIELD_OF_VIEW_HORIZONTAL, KZU_CAMERA_FIELD_OF_VIEW_VERTICAL, KZU_FIELD_OF_VIEW_TYPE_COUNT }
 Enumeration for camera's field of view type. More...
 
enum  KzuProjectionType { KZU_PROJECTION_PERSPECTIVE, KZU_PROJECTION_ORTHOGRAPHIC, KZU_PROJECTION_TYPE_COUNT }
 Enumeration for camera's projection type. More...
 
enum  KzuOrthogonalCoordinateSystem { KZU_ORTHOGONAL_COORDINATE_SYSTEM_ABSOLUTE, KZU_ORTHOGONAL_COORDINATE_SYSTEM_RELATIVE, KZU_ORTHOGONAL_COORDINATE_SYSTEM_COUNT }
 Enumeration for orthogonal coordinate system. More...
 
enum  KzuFrustumPlane {
  KZU_FRUSTUM_PLANE_NEAR, KZU_FRUSTUM_PLANE_FAR, KZU_FRUSTUM_PLANE_TOP, KZU_FRUSTUM_PLANE_BOTTOM,
  KZU_FRUSTUM_PLANE_LEFT, KZU_FRUSTUM_PLANE_RIGHT
}
 Enumeration for defined frustum planes. More...
 

Functions

kzsError kzuCameraNodeCreate (const struct KzcMemoryManager *memoryManager, kzString name, struct KzuUIDomain *uiDomain, struct KzuCameraNode **out_cameraNode)
 Creates new camera node. More...
 
kzsError kzuCameraNodeDelete (const struct KzuCameraNode *cameraNode)
 Deletes a camera node. More...
 
kzsError kzuCameraNodeRegisterToFactory (const struct KzuFactory *factory)
 Registers camera node type to factory. More...
 
struct KzuCameraNodekzuCameraNodeFromObjectNode (const struct KzuObjectNode *objectNode)
 Gets a camera node from object node. More...
 
struct KzuObjectNodekzuCameraNodeToObjectNode (const struct KzuCameraNode *cameraNode)
 Returns an object node from camera node. More...
 
kzsError kzuCameraNodeSetOrthogonalProjection (const struct KzuCameraNode *cameraNode, enum KzuOrthogonalCoordinateSystem coordinateSystem)
 Sets orthogonal projection for camera. More...
 
kzsError kzuCameraNodeSetPerspectiveProjection (const struct KzuCameraNode *cameraNode)
 Sets perspective projection for camera. More...
 
kzsError kzuCameraNodeSetAspectRatio (const struct KzuCameraNode *cameraNode, kzFloat aspectRatio)
 Sets aspect ratio for camera. More...
 
kzFloat kzuCameraNodeGetAspectRatio (const struct KzuCameraNode *cameraNode)
 Gets aspect ratio from camera. More...
 
void kzuCameraNodeSetInheritedAspectRatio (struct KzuCameraNode *cameraNode, kzFloat inheritedAspectRatio)
 Sets inherited aspect ratio value for camera. More...
 
kzsError kzuCameraNodeLookAt (const struct KzuCameraNode *cameraNode, struct KzcVector3 position, struct KzcVector3 lookAtPoint, struct KzcVector3 upVector)
 Creates a look at matrix for camera. More...
 
void kzuCameraNodeCalculateFrustumPlanes (const struct KzuCameraNode *cameraNode, const struct KzcMatrix4x4 *cameraViewMatrix, struct KzcPlane *out_frustumPlanes)
 Creates frustum planes for camera node. More...
 
void kzuCameraNodeCalculateOrthogonalProjectionFromValues (kzFloat left, kzFloat right, kzFloat top, kzFloat bottom, enum KzuOrthogonalCoordinateSystem coordinateSystem, enum KzuFieldOfViewType fovType, kzFloat orthoHeight, kzFloat aspectRatio, struct KzcMatrix4x4 *out_projectionMatrix)
 Utility for calculating ortho projection from values. More...
 
void kzuCameraNodeCalculateOrthogonalProjection (const struct KzuCameraNode *cameraNode, kzFloat left, kzFloat right, kzFloat top, kzFloat bottom, struct KzcMatrix4x4 *out_projectionMatrix)
 Creates a orthogonal projection for camera. More...
 
void kzuCameraNodeCalculateProjectionMatrix (const struct KzuCameraNode *cameraNode, struct KzcMatrix4x4 *out_projectionMatrix)
 Creates a projection for camera. More...
 
kzsError kzuCameraNodeCloneData (const struct KzuCameraNode *sourceCameraNode, struct KzuCameraNode *destinationCameraNode)
 Clones a camera data from source. More...
 

Variables

const KzuObjectType KZU_OBJECT_TYPE_CAMERA
 Object type identifier for camera objects. More...
 

Detailed Description

Represents camera (viewer) in scene graph.

KzuCameraNode inherits from KzuObjectNode.

Camera Messages

KzuCameraNode does not send or receive any messages.

Camera Properties

KZU_PROPERTY_TYPE_CAMERA_PROJECTION_TYPE integer property specifies the camera projection type. The value should be one of KzuProjectionType values. The default value is KZU_PROJECTION_PERSPECTIVE.

KZU_PROPERTY_TYPE_CAMERA_ORTHOGONAL_COORDINATE_SYSTEM_TYPE integer property specifies the orthogonal coordinate system. The value should be one of KzuOrthogonalCoordinateSystem values. The value has an effect only when using an orthogonal projection. In the absolute mode, the camera uses pixel coordinates. In the relative mode, the camera displays an area whose width is -1..1 scaled with KZU_PROPERTY_TYPE_CAMERA_ORTHOGONAL_PLANE_HEIGHT. The default value is KZU_ORTHOGONAL_COORDINATE_SYSTEM_RELATIVE.

KZU_PROPERTY_TYPE_CAMERA_ASPECT_RATIO float property specifies the camera's aspect ratio. This property has an effect only when KZU_PROPERTY_TYPE_CAMERA_DISABLE_ASPECT_RATIO is KZ_FALSE. The default value is 1.666667.

KZU_PROPERTY_TYPE_CAMERA_DISABLE_ASPECT_RATIO Boolean property specifies whether or not to use the aspect ratio setting from the viewport in render pass. If the value is KZ_FALSE, the aspect ratio is read from the KZU_PROPERTY_TYPE_CAMERA_ASPECT_RATIO property of the camera. The default value is KZ_TRUE.

KZU_PROPERTY_TYPE_CAMERA_ZNEAR float property specifies the distance of the near clipping plane from the camera. Objects closer to the camera are not displayed. The default value is 0.1.

KZU_PROPERTY_TYPE_CAMERA_ZFAR float property specifies the distance of the far clipping plane from the camera. Objects that are farther away than the far clipping plane from the camera are not shown. The default value is 100.0.

KZU_PROPERTY_TYPE_CAMERA_ORTHOGONAL_PLANE_HEIGHT float property specifies a value used for scaling the view area of a relative orthographic camera.

KZU_PROPERTY_TYPE_CAMERA_FOV_TYPE integer property specifies whether the KZU_PROPERTY_TYPE_CAMERA_FOV property specifies the field-of-view in horizontal or vertical direction. The default value is KZU_CAMERA_FIELD_OF_VIEW_HORIZONTAL.

KZU_PROPERTY_TYPE_CAMERA_FOV float property specifies the field-of-view angle in degrees. Depending on KZU_PROPERTY_TYPE_CAMERA_FOV_TYPE the value specifies the angle in horizontal or vertical direction. The default value is 45.

KZU_PROPERTY_TYPE_CAMERA_ORIENTATION_ANGLE is not used.

KZU_PROPERTY_TYPE_CAMERA_SCREEN_SPACE_SHIFT KzcVector2 property specifies how much the camera should shift the projected scene in X and Y direction. This can be used for anti-aliasing. The default value is {0, 0}.

See Also
kzu_object.h for KzuObjectNode documentation.

Copyright 2008-2019 by Rightware. All rights reserved.

Macro Definition Documentation

#define KZU_FRUSTUM_PLANE_COUNT

Number of frustum planes.

Enumeration Type Documentation

Enumeration for camera's field of view type.

Enumerator
KZU_CAMERA_FIELD_OF_VIEW_HORIZONTAL 

Horizontal field of view.

KZU_CAMERA_FIELD_OF_VIEW_VERTICAL 

Vertical field of view.

KZU_FIELD_OF_VIEW_TYPE_COUNT 

Last enum value for value validity checks.

Enumeration for camera's projection type.

Enumerator
KZU_PROJECTION_PERSPECTIVE 

Perspective projection.

KZU_PROJECTION_ORTHOGRAPHIC 

Orthogonal projection.

KZU_PROJECTION_TYPE_COUNT 

Last enum value for value validity checks.

Enumeration for orthogonal coordinate system.

Enumerator
KZU_ORTHOGONAL_COORDINATE_SYSTEM_ABSOLUTE 

Absolute orthogonal projection.

KZU_ORTHOGONAL_COORDINATE_SYSTEM_RELATIVE 

Relative orthogonal projection.

KZU_ORTHOGONAL_COORDINATE_SYSTEM_COUNT 

Last enum value for value validity checks.

Enumeration for defined frustum planes.

Enumerator
KZU_FRUSTUM_PLANE_NEAR 

Near frustum plane.

KZU_FRUSTUM_PLANE_FAR 

Far frustum plane.

KZU_FRUSTUM_PLANE_TOP 

Top frustum plane.

KZU_FRUSTUM_PLANE_BOTTOM 

Bottom frustum plane.

KZU_FRUSTUM_PLANE_LEFT 

Left frustum plane.

KZU_FRUSTUM_PLANE_RIGHT 

Right frustum plane.

Function Documentation

kzsError kzuCameraNodeCreate ( const struct KzcMemoryManager memoryManager,
kzString  name,
struct KzuUIDomain uiDomain,
struct KzuCameraNode **  out_cameraNode 
)

Creates new camera node.

kzsError kzuCameraNodeDelete ( const struct KzuCameraNode cameraNode)

Deletes a camera node.

kzsError kzuCameraNodeRegisterToFactory ( const struct KzuFactory factory)

Registers camera node type to factory.

struct KzuCameraNode* kzuCameraNodeFromObjectNode ( const struct KzuObjectNode objectNode)

Gets a camera node from object node.

struct KzuObjectNode* kzuCameraNodeToObjectNode ( const struct KzuCameraNode cameraNode)

Returns an object node from camera node.

kzsError kzuCameraNodeSetOrthogonalProjection ( const struct KzuCameraNode cameraNode,
enum KzuOrthogonalCoordinateSystem  coordinateSystem 
)

Sets orthogonal projection for camera.

kzsError kzuCameraNodeSetPerspectiveProjection ( const struct KzuCameraNode cameraNode)

Sets perspective projection for camera.

kzsError kzuCameraNodeSetAspectRatio ( const struct KzuCameraNode cameraNode,
kzFloat  aspectRatio 
)

Sets aspect ratio for camera.

kzFloat kzuCameraNodeGetAspectRatio ( const struct KzuCameraNode cameraNode)

Gets aspect ratio from camera.

void kzuCameraNodeSetInheritedAspectRatio ( struct KzuCameraNode cameraNode,
kzFloat  inheritedAspectRatio 
)

Sets inherited aspect ratio value for camera.

kzsError kzuCameraNodeLookAt ( const struct KzuCameraNode cameraNode,
struct KzcVector3  position,
struct KzcVector3  lookAtPoint,
struct KzcVector3  upVector 
)

Creates a look at matrix for camera.

void kzuCameraNodeCalculateFrustumPlanes ( const struct KzuCameraNode cameraNode,
const struct KzcMatrix4x4 cameraViewMatrix,
struct KzcPlane out_frustumPlanes 
)

Creates frustum planes for camera node.

void kzuCameraNodeCalculateOrthogonalProjectionFromValues ( kzFloat  left,
kzFloat  right,
kzFloat  top,
kzFloat  bottom,
enum KzuOrthogonalCoordinateSystem  coordinateSystem,
enum KzuFieldOfViewType  fovType,
kzFloat  orthoHeight,
kzFloat  aspectRatio,
struct KzcMatrix4x4 out_projectionMatrix 
)

Utility for calculating ortho projection from values.

void kzuCameraNodeCalculateOrthogonalProjection ( const struct KzuCameraNode cameraNode,
kzFloat  left,
kzFloat  right,
kzFloat  top,
kzFloat  bottom,
struct KzcMatrix4x4 out_projectionMatrix 
)

Creates a orthogonal projection for camera.

void kzuCameraNodeCalculateProjectionMatrix ( const struct KzuCameraNode cameraNode,
struct KzcMatrix4x4 out_projectionMatrix 
)

Creates a projection for camera.

kzsError kzuCameraNodeCloneData ( const struct KzuCameraNode sourceCameraNode,
struct KzuCameraNode destinationCameraNode 
)

Clones a camera data from source.

Variable Documentation

const KzuObjectType KZU_OBJECT_TYPE_CAMERA

Object type identifier for camera objects.