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).
procedure CamDirUp2Orient(const CamDir, CamUp: TVector3Single; out OrientAxis: TVector3Single; out OrientRadAngle: Single);
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).
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.
procedure Register;
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.
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:
TMoveAllowedFunc = function(Camera: TWalkCamera; const ProposedNewPos: TVector3Single; out NewPos: TVector3Single; const BecauseOfGravity: boolean): boolean of object;
THeightEvent = function (Camera: TWalkCamera; const Position: TVector3Single; out AboveHeight: Single; out AboveGround: P3DTriangle): boolean of object;
Default camera direction and up vectors, used to define the meaning of "camera orientation" for CamDirUp2Orient routines. These match VRML/X3D default camera values.