Class TCastleCamera
Unit
Declaration
type TCastleCamera = class(TCastleTransform)
Description
Camera determines viewer position and orientation in the viewport.
You can create instances of this class yourself, and add them to TCastleViewport.Items, and set them as TCastleViewport.Camera.
Note that this class does not handle any user input to modify the camera. For this, see TCastleNavigation descendants.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleTransform
- TCastleCamera
Overview
Fields
InternalOnSceneBoundViewpointChanged: TNotifyEvent; |
|
InternalOnSceneBoundViewpointVectorsChanged: TNotifyEvent; |
|
InternalOnSceneBoundNavigationInfoChanged: TNotifyEvent; |
|
InternalOnCameraChanged: TNotifyEvent; |
Methods
function InternalBuildNodeInside: TObject; override; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure Assign(Source: TPersistent); override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure DesignerInfo(const SList: TStrings); override; |
|
procedure LocalRender(const Params: TRenderParams); override; |
|
procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
|
function Matrix: TMatrix4; |
|
function MatrixInverse: TMatrix4; |
|
function RotationMatrix: TMatrix4; |
|
procedure CustomRay( const ViewportRect: TFloatRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); |
|
procedure AnimateTo(const OtherCamera: TCastleCamera; const Time: TFloatTime); overload; |
|
procedure AnimateTo(const APos, ADir, AUp: TVector3; const Time: TFloatTime); overload; |
|
function Animation: boolean; |
|
procedure Init(const AInitialPosition, AInitialDirection, AInitialUp, AGravityUp: TVector3); deprecated 'use SetWorldView, set GravityUp directly'; |
|
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
function EffectiveProjectionNear: Single; |
|
function EffectiveProjectionFar: Single; |
|
procedure VisibleChangeHere(const Changes: TVisibleChanges); override; |
Properties
property GravityUp: TVector3 read FGravityUp write SetGravityUp; |
|
property Frustum: TFrustum read FFrustum; |
|
property ProjectionMatrix: TMatrix4
read FProjectionMatrix write SetProjectionMatrix; |
|
property Orientation default TCastleTransform.DefaultCameraOrientation; |
|
property ProjectionNear: Single read FProjectionNear write SetProjectionNear default 0; |
|
property ProjectionFar: Single read FProjectionFar write SetProjectionFar default 0; |
|
property ProjectionType: TProjectionType
read FProjectionType write SetProjectionType default ptPerspective; |
|
property Perspective: TCastlePerspective read FPerspective; |
|
property Orthographic: TCastleOrthographic read FOrthographic; |
|
property GravityUpPersistent: TCastleVector3Persistent read FGravityUpPersistent ; |
Description
Fields
InternalOnSceneBoundViewpointChanged: TNotifyEvent; |
|
This item has no description. |
InternalOnSceneBoundViewpointVectorsChanged: TNotifyEvent; |
|
This item has no description. |
InternalOnSceneBoundNavigationInfoChanged: TNotifyEvent; |
|
This item has no description. |
InternalOnCameraChanged: TNotifyEvent; |
|
This item has no description. |
Methods
function InternalBuildNodeInside: TObject; override; |
|
This item has no description. Showing description inherited from TCastleTransform.InternalBuildNodeInside.
Helper for InternalBuildNode. Result must be TAbstractChildNode or |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
procedure Assign(Source: TPersistent); override; |
|
This item has no description. |
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
This item has no description. Showing description inherited from TCastleComponent.PropertySections. Section where to show property in the editor. |
procedure DesignerInfo(const SList: TStrings); override; |
|
This item has no description. Showing description inherited from TCastleComponent.DesignerInfo.
Override to add information that should be visible at design-time. Call |
procedure LocalRender(const Params: TRenderParams); override; |
|
This item has no description. Showing description inherited from TCastleTransform.LocalRender. Collect the things to be rendered now. Override this method if you need to perform custom rendering, by direct OpenGL(ES) calls. Never call this method yourself – the rendering of TCastleViewport will call it when needed. Warning: It is an advanced topic how to make such rendering work, and make it work in a cross-platform way. You will need to understand how OpenGL(ES) works, and you will need to account for how the engine renders things too, to not conflict with the engine – e.g. you will have to use RenderContext for some things. If you're not ready for this, then you're better off not overriding this method, instead just rely on the engine built-in rendering, done by TCastleScene and other components. This method gets parameters (Params) including a full transformation of this scene. In return, it should add the things to be rendered in this frame using Params.AddRenderEvent. Internally: TCastleScene also adds X3D shapes to be rendered to TRenderParams.Collector. But you should not need to deal with TRenderParams.Collector in your own code. TODO: The names |
procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
|
This item has no description. Showing description inherited from TCastleComponent.CustomSerialization. Override this method to call various methods of SerializationProcess, which in turn allows to serialize/deserialize things that are not published. This allows to serialize/deserialize with more freedom, e.g. to serialize/deserialize some private field. |
function Matrix: TMatrix4; |
|
Camera matrix, transforming from world space into camera space. |
function MatrixInverse: TMatrix4; |
|
Inverse of Matrix, transforming from camera space into world space. |
function RotationMatrix: TMatrix4; |
|
Extract only rotation from your current camera Matrix. This is useful for rendering skybox in 3D programs (e.g. for VRML/X3D Background node) and generally to transform directions between world and camera space. It's guaranteed that this is actually only 3x3 matrix, the 4th row and 4th column are all zero except the lowest right item which is 1.0. |
procedure CustomRay( const ViewportRect: TFloatRectangle; const WindowPosition: TVector2; const Projection: TProjection; out RayOrigin, RayDirection: TVector3); |
|
Calculate a ray picked by WindowPosition position on the viewport, assuming current viewport dimensions are as given. This doesn't look at our container sizes at all. Projection (read-only here) describe projection, required for calculating the ray properly. Resulting RayDirection is always normalized. WindowPosition is given in the same style as TCastleContainer.MousePosition: (0, 0) is bottom-left. |
procedure AnimateTo(const OtherCamera: TCastleCamera; const Time: TFloatTime); overload; |
|
Animate a camera smoothly into another camera settings. This will gradually change our settings (position, direction, up) to match the target vectors (in world coordinate space). If you use overload with OtherCamera: Current OtherCamera settings will be internally copied during this call. So you can even free OtherCamera instance immediately after calling this. Calling AnimateTo while the previous animation didn't finish yet is OK. This simply cancels the previous animation, and starts the new animation from the current position. Check Animation to see if we're currently during the camera animation. |
procedure AnimateTo(const APos, ADir, AUp: TVector3; const Time: TFloatTime); overload; |
|
This item has no description. |
function Animation: boolean; |
|
Are we currently during animation (caused by AnimateTo). |
procedure Init(const AInitialPosition, AInitialDirection, AInitialUp, AGravityUp: TVector3); deprecated 'use SetWorldView, set GravityUp directly'; |
|
Warning: this symbol is deprecated: use SetWorldView, set GravityUp directly This item has no description. |
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
This item has no description. Showing description inherited from TCastleTransform.Update. Continuously occuring event, for various tasks. Executed only on instances that have Exists (no need to check this in overridden Update implementation). |
function EffectiveProjectionNear: Single; |
|
Currently used projection near. Derived from ProjectionNear and possibly scene sizes. |
function EffectiveProjectionFar: Single; |
|
Currently used projection far. Derived from ProjectionFar and possibly scene sizes. May be equal ZFarInfinity. |
procedure VisibleChangeHere(const Changes: TVisibleChanges); override; |
|
This item has no description. Showing description inherited from TCastleTransform.VisibleChangeHere. Something visible changed inside this object. This is usually called by implementation of this object, to notify others that it changed. Changes is a set describing what changes occurred. See TVisibleChange docs for more information. It must specify all things that possibly changed. Changes can be [], meaning "something tells us to redraw, but no visible change happened yet, maybe something will happen during a redraw" (this is used when e.g. possibly LOD level changed). We still increase TCastleAbstractRootTransform.InternalVisibleStateId even when Changes=[]. The information about visibility changed is passed to TCastleAbstractRootTransform in World. It increases TCastleAbstractRootTransform.InternalVisibleStateId, TCastleAbstractRootTransform.InternalVisibleGeometryStateId, TCastleAbstractRootTransform.InternalVisibleNonGeometryStateId. If you want to react to visibility changes, you should not override this method, instead watch above "state id" variables and react when they change. |
Properties
property GravityUp: TVector3 read FGravityUp write SetGravityUp; |
|
"Up" direction of the world in which player moves. Always normalized (when setting this property, we take care to normalize the provided vector). This determines in which direction TCastleWalkNavigation.Gravity works. This is also the "normal" value for "up" vector in world coordinates. Navigation uses it, e.g. features like PreferGravityUpForRotations and/or PreferGravityUpForMoving. The default value of this vector is (0, 1, 0) (same as the default Up vector). |
property Frustum: TFrustum read FFrustum; |
|
The current camera (viewing frustum, based on ProjectionMatrix (set by you) and Matrix (calculated here). This is recalculated whenever one of these two properties change. Be sure to set ProjectionMatrix before using this. |
property ProjectionMatrix: TMatrix4
read FProjectionMatrix write SetProjectionMatrix; |
|
Projection matrix of the camera. Camera needs to know this to calculate Frustum, which in turn allows rendering code to use frustum culling. In normal circumstances, if you use TCastleViewport for rendering, this is automatically correctly set for you. |
property Orientation default TCastleTransform.DefaultCameraOrientation; |
|
This item has no description. Showing description inherited from TCastleTransform.Orientation. How the direction and up vectors determine transformation. See TOrientationType for values documentation. The default value of this is:
This value determines how you should model your 3D models, like the creatures, the items, and the player weapons. |
property ProjectionNear: Single read FProjectionNear write SetProjectionNear default 0; |
|
Projection near plane distance. 0 (default) means to automatically calculate a correct value. Note that automatic calculation differs between perspective projection (uses DefaultCameraRadius, RadiusToProjectionNear for near, and infinity for far) and orthographic projection (adjusts to scene sizes and distance from camera). For perspective projection, values <= 0 are invalid. So both value = 0 and value < 0 behave the same: they indicate we should automatically calculate the effective For orthographic projection, all values are valid and reasonable. So value < 0 is just used literally, it doesn't cause the effective value to be autocalculated. |
property ProjectionFar: Single read FProjectionFar write SetProjectionFar default 0; |
|
Projection far plane distance. 0 (default) means to automatically calculate a correct value. Note that automatic calculation differs between perspective projection (uses DefaultCameraRadius, RadiusToProjectionNear for near, and infinity for far) and orthographic projection (adjusts to scene sizes and distance from camera). |
property ProjectionType: TProjectionType
read FProjectionType write SetProjectionType default ptPerspective; |
|
Perspective or orthographic projection. Depending on it, we either use Perspective or Orthographic settings. |
property Perspective: TCastlePerspective read FPerspective; |
|
Perspective projection properties, used only if ProjectionType is ptPerspective. |
property Orthographic: TCastleOrthographic read FOrthographic; |
|
Orthographic projection properties, used only if ProjectionType is ptOrthographic. |
property GravityUpPersistent: TCastleVector3Persistent read FGravityUpPersistent ; |
|
GravityUp that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write GravityUp directly. See also
|
Generated by PasDoc 0.16.0-snapshot.