CAST II Game Engine

   DESCRIPTION       FEATURES       SCREENSHOTS       FORUMS       DOCUMENTATION       DOWNLOADS       CONTACTS   
Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Enumerations
Variables
Constants
Functions and Procedures
Identifiers

Class TCamera

Unit

Cast2

Declaration

type TCamera = class(TProcessing)

Description

Camera

Hierarchy

TProcessing > TBaseProcessing > TItem > TBaseItem

Fields

 NameDescription
PublicClearSettingsDetermines what and when should be cleared
PublicClipPlanesUser-defined clip planes
PublicColorFormatCurrent rendering color format. Updated by renderer
PublicDefaultCullModeDefault cull mode for the camera
PublicDefaultFillModeDefault fill mode for the camera
PublicDepthFormatCurrent rendering depth format. Updated by renderer
PublicDepthRenderTargetDetermines if a depth-stencil surface instead of color surface should be used when the camera applied as a texture
ProtectedFInvViewMatrixInverse view matrix
ProtectedFProjMatrixProjection matrix
PublicFrameSkipDetermines how many frames should be skipped between render target texture updates
ProtectedFRenderHeightCurrent render height
ProtectedFRenderWidthCurrent render width
ProtectedFTotalMatrixView * projection matrix
ProtectedFViewMatrixView matrix
PublicGroupMaskDetermines which passes can be visible through the camera
PublicRenderTargetHeightHeight of a render target texture used if the camera will be used as a texture
PublicRenderTargetIndexprivate
PublicRenderTargetWidthWidth of a render target texture used if the camera will be used as a texture

Methods

Overview

Publicconstructor Create(AManager: TItemsManager); override;
Publicdestructor Destroy; override;
Publicprocedure AddProperties(const Result: Props.TProperties); override;
Protectedprocedure ComputeViewMatrix; virtual;
Publicfunction GetPickRay(ScreenX, ScreenY: Single): TVector3s; virtual;
Publicfunction GetPickRayInWorld(ScreenX, ScreenY: Single): TVector3s; virtual;
Publicprocedure InitProjMatrix(AZNear, AZFar, AHFoV, AAspectRatio: Single); virtual;
Protectedprocedure InvalidateTransform; override;
Publicfunction IsSpehereVisible(const Center: TVector3s; Radius: Single): TFrustumCheckResult;
Publicprocedure Move(XD, YD, ZD: Single); virtual;
Publicprocedure OnApply(const OldCamera: TCamera); virtual;
Publicfunction Project(const Vec: TVector3s): TVector4s;
Publicprocedure Rotate(XA, YA, ZA: Single); virtual;
Publicprocedure SetClearState(AClearFlags: TClearFlagsSet; AClearColor: BaseTypes.TColor; AClearZ: Single; AClearStencil: Cardinal); virtual;
Publicprocedure SetProperties(Properties: Props.TProperties); override;
Publicprocedure SetScreenDimensions(Width, Height: Integer);

Description

Publicconstructor Create(AManager: TItemsManager); override;

 

Publicdestructor Destroy; override;

 

Publicprocedure AddProperties(const Result: Props.TProperties); override;

This procedure is called (by editor for example) to retrieve a list of item's properties and their values. Any TItem descendant class should override this method in order to add its own properties.

Protectedprocedure ComputeViewMatrix; virtual;

 

Publicfunction GetPickRay(ScreenX, ScreenY: Single): TVector3s; virtual;

Returns not normalized direction of a ray in view space which starts from the camera and passes through the given point on screen

Publicfunction GetPickRayInWorld(ScreenX, ScreenY: Single): TVector3s; virtual;

Returns not normalized direction of a ray in world space which starts from the camera and passes through the given point on screen

Publicprocedure InitProjMatrix(AZNear, AZFar, AHFoV, AAspectRatio: Single); virtual;

Sets up the camera's projection matrix with the given near and far Z planes, horizontal field of view and aspect ratio

Protectedprocedure InvalidateTransform; override;

Calling this method will tell the engine that FTransform became invalid and should be recomputed before next use

Publicfunction IsSpehereVisible(const Center: TVector3s; Radius: Single): TFrustumCheckResult;

Performs a frustrum visibility check against a sphere with the given center and radius

Publicprocedure Move(XD, YD, ZD: Single); virtual;

Moves the camera by the specified distance in camera space

Publicprocedure OnApply(const OldCamera: TCamera); virtual;

Renderer calls this event right before the camera apply

Publicfunction Project(const Vec: TVector3s): TVector4s;

Returns the given vector after projection with the camera

Publicprocedure Rotate(XA, YA, ZA: Single); virtual;

Rotates the camera by the specified angles

Publicprocedure SetClearState(AClearFlags: TClearFlagsSet; AClearColor: BaseTypes.TColor; AClearZ: Single; AClearStencil: Cardinal); virtual;

Sets the ClearSettings

Publicprocedure SetProperties(Properties: Props.TProperties); override;

This procedure is called (by editor for example) to set values of item's properties. Any TItem descendant class should override this method to allow its own properties to be set.

Publicprocedure SetScreenDimensions(Width, Height: Integer);

Sets render dimensions and recalculates projection matrix. Normally called by renderer when render window size changes.

Properties

Overview

Publicproperty AspectRatio: Single;
Publicproperty CurrentAspectRatio: Single;
Publicproperty HFoV: Single;
Publicproperty InvViewMatrix: TMatrix4s;
Publicproperty LookDir: TVector3s;
Publicproperty ProjMatrix: TMatrix4s;
Publicproperty RenderHeight: Integer;
Publicproperty RenderWidth: Integer;
Publicproperty RightDir: TVector3s;
Publicproperty RTColorFormat: Integer;
Publicproperty RTDepthFormat: Integer;
Publicproperty TotalMatrix: TMatrix4s;
Publicproperty UpDir: TVector3s;
Publicproperty ViewMatrix: TMatrix4s;
Publicproperty ViewOrigin: TVector3s;
Publicproperty ZFar: Single;
Publicproperty ZNear: Single;

Description

Publicproperty AspectRatio: Single;

Initial aspect ratio. Can change

Publicproperty CurrentAspectRatio: Single;

Current aspect ratio

Publicproperty HFoV: Single;

Horizontal field of view in radians

Publicproperty InvViewMatrix: TMatrix4s;

Inverse view matrix

Publicproperty LookDir: TVector3s;

View direction of the camera in world space

Publicproperty ProjMatrix: TMatrix4s;

Projection matrix

Publicproperty RenderHeight: Integer;

Current render height

Publicproperty RenderWidth: Integer;

Current render width

Publicproperty RightDir: TVector3s;

Right direction of the camera in world space

Publicproperty RTColorFormat: Integer;

Color format which will be used in case of use of this camera as a texture

Publicproperty RTDepthFormat: Integer;

Depth format which will be used in case of use of this camera as a texture

Publicproperty TotalMatrix: TMatrix4s;

View * projection matrix

Publicproperty UpDir: TVector3s;

Up direction of the camera in world space

Publicproperty ViewMatrix: TMatrix4s;

View matrix

Publicproperty ViewOrigin: TVector3s;

Position of the camera's view point in world space

Publicproperty ZFar: Single;

Far Z plane distance

Publicproperty ZNear: Single;

Near Z plane distance

Last modified: 4 Jul, 2008
Copyright (C) 2006-2008, casteng.com