Unit CastleCameras
Description
Camera and navigation (TCastleCamera, TCastleExamineNavigation, TCastleWalkNavigation).
Uses
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
procedure CorrectPreferredHeight(var PreferredHeight: Single; const Radius: Single; const CrouchHeight, HeadBobbing: Single); |
function OrientationFromDirectionUp(const Direction, Up: TVector3): TVector4; |
procedure OrientationFromDirectionUp(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); |
function OrientationFromDirectionUp(const Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TVector4; |
function OrientationToDirection(const OrientationRotation: TVector4): TVector3; |
function OrientationToUp(const OrientationRotation: TVector4): TVector3; |
function CamDirUp2Orient(const Direction, Up: TVector3): TVector4; deprecated 'use OrientationFromDirectionUp'; |
procedure CamDirUp2Orient(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); deprecated 'use OrientationFromDirectionUp'; |
function OrientationQuaternionFromDirectionUp(Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TQuaternion; |
function OrientationQuaternionFromDirectionUp(const Direction, Up: TVector3): TQuaternion; |
function CamDirUp2OrientQuat(const Direction, Up: TVector3): TQuaternion; deprecated 'OrientationQuaternionFromDirectionUp'; |
procedure CameraViewpointForWholeScene(const Box: TBox3D; const WantedDirection, WantedUp: Integer; const WantedDirectionPositive, WantedUpPositive: boolean; out Position, Direction, Up, GravityUp: TVector3); |
procedure CameraOrthoViewpointForWholeScene(const Box: TBox3D; const ViewportWidth, ViewportHeight: Single; const Origin: TVector2; out Position: TVector3; out AProjectionWidth, AProjectionHeight, AProjectionFar: Single); |
procedure Register; |
Types
Constants
Description
Functions and Procedures
procedure CorrectPreferredHeight(var PreferredHeight: Single; const Radius: Single; const CrouchHeight, HeadBobbing: Single); |
|
See TCastleWalkNavigation.CorrectPreferredHeight. This is a global version, sometimes may be useful.
|
function OrientationFromDirectionUp(const Direction, Up: TVector3): TVector4; |
|
Convert camera direction and up vectors into a rotation (X3D "orientation" vector).
Orientation vector expresses Direction and Up as a rotation. First three components of the resulting vector are the Axis (normalized) and the 4th component is the Angle (in radians). If you would rotate the standard direction and up (see DefaultCameraDirection, DefaultCameraUp) around Axis by the Angle, then you would get Direction and Up back.
There is an overloaded version where you can pass your custom DefaultDirection, DefaultUp to be used instead of default DefaultCameraDirection, DefaultCameraUp.
Given here Direction and Up must be orthogonal and non-zero. Their lengths are not relevant (that is, you don't need to normalize them before passing here).
|
procedure OrientationFromDirectionUp(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); |
|
|
function OrientationFromDirectionUp(const Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TVector4; |
|
|
function CamDirUp2Orient(const Direction, Up: TVector3): TVector4; deprecated 'use OrientationFromDirectionUp'; |
|
Warning: this symbol is deprecated: use OrientationFromDirectionUp |
procedure CamDirUp2Orient(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); deprecated 'use OrientationFromDirectionUp'; |
|
Warning: this symbol is deprecated: use OrientationFromDirectionUp |
function OrientationQuaternionFromDirectionUp(Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TQuaternion; |
|
Convert camera direction and up vectors into a "rotation quaternion". Just like OrientationFromDirectionUp, but the result is a quaternion, not an axis-angle vector.
|
function CamDirUp2OrientQuat(const Direction, Up: TVector3): TQuaternion; deprecated 'OrientationQuaternionFromDirectionUp'; |
|
Warning: this symbol is deprecated: OrientationQuaternionFromDirectionUp |
procedure CameraViewpointForWholeScene(const Box: TBox3D; const WantedDirection, WantedUp: Integer; const WantedDirectionPositive, WantedUpPositive: boolean; out Position, Direction, Up, GravityUp: TVector3); |
|
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 = TNavigationInput deprecated 'use TNavigationInput'; |
|
Warning: this symbol is deprecated: use TNavigationInput |
TCameraInputs = TNavigationInputs deprecated 'use TNavigationInputs'; |
|
Warning: this symbol is deprecated: use TNavigationInputs |
TFieldOfViewAxis = (...); |
|
Value of TCastlePerspective.FieldOfViewAxis.
Values
-
faSmallest: TCastlePerspective.FieldOfView specifies the angle along the smaller viewport axis.
E.g. on a full-screen viewport, on a typical desktop screen, with a typical panoramic window (wide, not tall), this will determine the vertical axis angle. The horizontal axis will be adjusted following the aspect ratio.
-
faLargest: TCastlePerspective.FieldOfView specifies the angle along the larger viewport axis. The other axis will be adjusted, following the aspect ratio.
-
faHorizontal: TCastlePerspective.FieldOfView specifies the angle along the horizontal axis. The vertical axis will be adjusted, following the aspect ratio.
-
faVertical: TCastlePerspective.FieldOfView specifies the angle along the vertical axis. The horizontal axis will be adjusted, following the aspect ratio.
|
TUniversalCamera = TCastleNavigation deprecated 'complicated TUniversalCamera class is removed; use TCastleNavigation as base class, or TCastleWalkNavigation or TCastleExamineNavigation for particular type, and Viewport.NavigationType to switch type'; |
|
Warning: this symbol is deprecated: complicated TUniversalCamera class is removed; use TCastleNavigation as base class, or TCastleWalkNavigation or TCastleExamineNavigation for particular type, and Viewport.NavigationType to switch type |
TCamera = TCastleNavigation deprecated 'use TCastleNavigation'; |
|
Warning: this symbol is deprecated: use TCastleNavigation |
TExamineCamera = TCastleExamineNavigation deprecated 'use TCastleExamineNavigation'; |
|
Warning: this symbol is deprecated: use TCastleExamineNavigation |
TWalkCamera = TCastleWalkNavigation deprecated 'use TCastleWalkNavigation'; |
|
Warning: this symbol is deprecated: use TCastleWalkNavigation |
Constants
DefaultCameraUp: TVector3 = (Data: (0, 1, 0)); |
|
|
ciNormal = niNormal deprecated 'use niNormal'; |
|
Warning: this symbol is deprecated: use niNormal |
ciMouseDragging = niMouseDragging deprecated 'use niMouseDragging'; |
|
Warning: this symbol is deprecated: use niMouseDragging |
ciGesture = niGesture deprecated 'use niGesture'; |
|
Warning: this symbol is deprecated: use niGesture |
ci3dMouse = ni3dMouse deprecated 'use ni3dMouse'; |
|
Warning: this symbol is deprecated: use ni3dMouse |
RadiusToProjectionNear = 0.6; |
|
Following X3D spec of NavigationType: "It is recommended that the near clipping plane be set to one-half of the collision radius as specified in the avatarSize field."
|
WorldBoxSizeToProjectionFar = 20.0; |
|
Used when it is necessary to calculate projection far based on world size.
|
RadiusToPreferredHeightMin = 4.0; |
|
Multiply radius by this to get sensible "preferred height".
We need to make "preferred height" much larger than Radius * 2, to allow some space to decrease (e.g. by Input_DecreasePreferredHeight). Remember that CorrectPreferredHeight adds a limit to PreferredHeight, around Radius * 2.
This determines minimal PreferredHeight, it should be used always like Max(DefaultPreferredHeight, Radius * RadiusToPreferredHeightMin) This way, in case of models that are small, but still follow the standard "1 unit = 1 meter", the PreferredHeight will not get weirdly small, it will be DefaultPreferredHeight. Testcase: examples/third_person_camera/data/level/level-dungeon.gltf open with view3dscene.
|
WorldBoxSizeToRadius = 0.005; |
|
Multiply world bounding box AverageSize by this to get sensible radius.
|
Generated by PasDoc 0.16.0.