Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Unit CastleCameras
Description
Cameras to navigate in 3D space (TExamineCamera, TWalkCamera, TUniversalCamera).
Uses
Overview
Classes, Interfaces, Objects and Records
Class TCamera |
Handle user navigation in 3D scene. |
Class TExamineCamera |
Navigate the 3D model in examine mode, like you would hold a box with the model inside. |
Class TWalkCamera |
Navigation by walking (first-person-shooter-like moving) in 3D scene. |
Class TUniversalCamera |
Camera that allows any kind of navigation (Examine, Walk). |
Functions and Procedures
Types
Constants
Description
Functions and Procedures
procedure CorrectPreferredHeight(var PreferredHeight: Single; const Radius: Single; const CrouchHeight, HeadBobbing: Single); |
See TWalkCamera.CorrectPreferredHeight. This is a global version, sometimes may be useful.
|
function CamDirUp2Orient(const CamDir, CamUp: TVector3Single): TVector4Single; |
Convert camera direction and up vectors into VRML/X3D "orientation" vector.
Orientation expresses CamDir and CamUp as 4-item vector (SFRotation). First three items are the Axis (normalized) and the 4th is the Angle (in radians). Meaning: if you rotate the standard direction and up (see DefaultCameraDirection, DefaultCameraUp) around Axis by the Angle, then you get CamDir and CamUp.
Given here CamDir and CamUp must be orthogonal and non-zero. Their lengths are not relevant (that is, you don't need to normalize them before passing here).
|
function CamDirUp2OrientQuat(CamDir, CamUp: TVector3Single): TQuaternion; |
Convert camera direction and up vectors into "rotation quaternion" of VRML/X3D "orientation".
VRML orientation expresses camera direction and up as a rotation. This means that you should rotate the standard direction and up (see DefaultCameraDirection, DefaultCameraUp) by this rotation to get CamDir and CamUp.
Given here CamDir and CamUp must be orthogonal and non-zero. Their lengths are not relevant (that is, you don't need to normalize them before passing here).
|
procedure CameraViewpointForWholeScene(const Box: TBox3D; const WantedDirection, WantedUp: Integer; const WantedDirectionPositive, WantedUpPositive: boolean; out Position, Direction, Up, GravityUp: TVector3Single); |
Calculate sensible camera configuration to see the whole Box.
WantedDirection and WantedUp indicate desired look direction/up axis (0, 1 or 2 for X, Y or Z). WantedDirectionPositive and WantedUpPositive indicate if we want the positive axis. Obviously look direction and up cannot be parallel, so WantedDirection must be different than WantedUp.
Returned Direction, Up, GravityUp are normalized.
|
Types
TCameraInput = (...); |
Possible navigation input types in cameras, set in TCamera.Input.
Values
-
ciNormal: Normal input types. This includes all inputs available as Input_Xxx properties in TCamera descendants. They are all fully configurable (as TInputShortcut class), they may be mouse button presses, mouse wheel clicks, or key presses. You can always clear some shortcut (like
WalkCamera.Input_Forward.MakeClear ) to disable a specific shortcut. Excluding ciNormal from TCamera.Input is an easy way to disable all shortcuts.
-
ciMouseDragging: Mouse and touch dragging. Both TExamineCamera and TWalkCamera implement their own, special reactions to mouse dragging, that allows to navigate / rotate while pressing specific mouse buttons.
-
ci3dMouse: Navigation using 3D mouse devices, like the ones from 3dconnexion.
|
TNavigationClass = (...); |
Values
|
TNavigationType = (...); |
Values
-
ntExamine:
-
ntTurntable:
-
ntWalk:
-
ntFly:
-
ntNone:
|
TWalkDragMode = (...); |
How mouse dragging should be performed in Walk camera. It is useful for touch interfaces. DragToWalk moves avatar continously in the direction of mouse drag (default). DragToRotate rotates the head when mouse is moved, and None ignores the dragging at all.
Values
-
cwdmDragToWalk:
-
cwdmDragToRotate:
-
cwdmNone:
|
Constants
DefaultCameraDirection: TVector3Single = (0, 0, -1); |
Default camera direction and up vectors, used to define the meaning of "camera orientation" for CamDirUp2Orient routines. These match VRML/X3D default camera values.
|
Generated by PasDoc 0.13.0 on 2014-04-30 22:06:42
|