Unit CastleTransform

Description

Group and transform scenes (TCastleTransform).

Source: transform/castletransform.pas (line 16).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class ECannotAddToAnotherWorld  
Class ETransformParentUndefined  
Class EMultipleReferencesInWorld  
Class ENotAddedToWorld  
Class EPhysicsError  
Class TBaseShadowVolumeRenderer Shadow volumes helper, not depending on OpenGL.
Record TRayCollisionNode Information about ray collision with a single 3D object.
Class TRayCollision Represents a ray collision with TCastleTransform (TCastleTransform that may have parents).
Record TCollisionDetailsItem Detailed information about collision with a single 3D object.
Class TCollisionDetails Represents a collision with a 3D objects tree.
Record TRenderStatistics Statistics about what was rendered during last frame.
Record TRenderOnePassParams How to render a single pass, when the shapes are already collected.
Class TRenderParams Information that a TCastleTransform.LocalRender needs to render.
Class TPrepareParams Information that a TCastleTransform object needs to prepare rendering.
Class TCastleBehavior Behaviors can be attached to TCastleTransform to perform specific logic, for example implement creature movement.
Class TCastleTransformList List of TCastleTransform instances.
Class TCastleTransform Group and transform (move, rotate, scale) children objects.
Record TRayCastResult Result of "ray cast" and "sphere cast", that describes what is hit by a ray (or sphere moving along a ray) in a viewport.
Record TPhysicsCollisionDetails Information send along with TCollisionEvent event, like TCastleRigidBody.OnCollisionEnter, TCastleRigidBody.OnCollisionExit.
Class TCastleLayerCollisions  
Class TCastleLayerNames  
Class TPhysicsProperties Configure physics simulation calculation.
Class TCastleCollider Abstract collider that determines the shape used to determine collisions with physics bodies.
Class TCastlePlaneCollider Push everything to be above the given static plane, like a floor.
Class TCastleBoxCollider Collide as a box.
Class TCastleSphereCollider Collide as a sphere.
Class TCastleCapsuleCollider Collide as a capsule.
Class TCastleMeshCollider Collide as a set of triangles determined by Mesh.
Class TCastleRigidBody Use this behavior to be affected by physics collisions and forces.
Class TCastleAbstractRootTransform Root of transformations and scenes (tree of TCastleTransform and TCastleScene).
Class EMaximumTransformDesignDepth type section started in CastleTransform.pas
Class TCastleTransformDesign Contents are loaded from an indicated castle-transform file (by the Url property).
Class TCastleTransformReference Reference another TCastleTransform instance, to render one TCastleTransform multiple times within the same viewport.
Class TCastlePerspective Subcomponent used in TCastleCamera.Perspective to set perspective projection parameters.
Class TCastleOrthographic Subcomponent used in TCastleCamera.Orthographic to set orthographic projection parameters.
Class TCastleCamera Camera determines viewer position and orientation in the viewport.
Class TCastleAbstractJoint Base class for physics joints, that connects two physics bodies and constraints their relative movement.
Class TCastleAbstractOneBodyJoint Abstract class for joints that use only one TCastleTransform.
Class TCastleAbstractTwoBodiesJoint Abstract class for joints that connect two TCastleTransform instances.
Class EConnectedSameAsParent  
Class TCastleHingeJoint Hinge joint allows to rotate the transformation around a given axis, like a door attached using hinges to the frame.
Class TCastleRopeJoint Rope joint connects two bodies by an invisible rope that prevents the distance between them to grow beyond specfied Distance.
Class TCastleBallJoint Ball joint allows to freely rotate the transformation of one object relative to another (rotate in any axis) but does not allow any movement.
Class TCastleDistanceJoint Distance joint tries to maintain a certain distance between two rigid bodies, with certain flexibility (like a spring).
Class TCastleGrabJoint Grab joint pulls the rigid body Anchor towards a TargetWorld defined in the world coordinates.

Functions and Procedures

procedure TransformSave(const T: TCastleTransform; const Url: String);
function TransformLoad(const Url: String; const Owner: TComponent): TCastleTransform;
procedure TransformMatricesMult(var Transform, InverseTransform: TMatrix4; const Center: TVector3; const Rotation: TVector4; const Scale: TVector3; const ScaleOrientation: TVector4; const Translation: TVector3); deprecated 'use TTransformation.Multiply';
function StrToOrientationType(const S: String): TOrientationType;
function OrientationFromDirectionUp(const Direction, Up: TVector3): TVector4; overload;
procedure OrientationFromDirectionUp(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); overload;
function OrientationFromDirectionUp(const Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TVector4; overload;
function OrientationToDirection(const OrientationRotation: TVector4): TVector3;
function OrientationToUp(const OrientationRotation: TVector4): TVector3;
function CamDirUp2Orient(const Direction, Up: TVector3): TVector4; overload; deprecated 'use OrientationFromDirectionUp';
procedure CamDirUp2Orient(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); overload; deprecated 'use OrientationFromDirectionUp';
function OrientationQuaternionFromDirectionUp(Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TQuaternion; overload;
function OrientationQuaternionFromDirectionUp(const Direction, Up: TVector3): TQuaternion; overload;
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);

Types

TPhysicsLayer = 0..19;
TPhysicsLayers = set of TPhysicsLayer;
TCastleTransformClass = class of TCastleTransform;
TRenderFromViewFunction = procedure (const RenderingCamera: TRenderingCamera) of object;
TVisibleChange = (...);
TVisibleChanges = set of TVisibleChange;
TVisibleChangeEvent = procedure (const Sender: TCastleTransform; const Changes: TVisibleChanges) of object;
TPrepareResourcesOption = (...);
TPrepareResourcesOptions = set of TPrepareResourcesOption;
PRayCollisionNode = ˆTRayCollisionNode;
PCollisionDetailsItem = ˆTCollisionDetailsItem;
TRemoveType = (...);
TOrientationType = (...);
PRenderStatistics = ˆTRenderStatistics;
TUserRenderingPass = 0..2;
TRenderEvent = procedure (const Transformation: TTransformation; const PassParams: TRenderOnePassParams) of object;
TCastleBehaviorClass = class of TCastleBehavior;
TCastleBehaviorList = specialize TObjectList<TCastleBehavior>;
TPhysicsRayCastResult = TRayCastResult deprecated 'use TRayCastResult';
TCollisionEvent = procedure (const CollisionDetails: TPhysicsCollisionDetails) of object;
TCastleRigidBodyList = specialize TList<TCastleRigidBody>;
TCollisionDetection = (...);
TReferenceTransformation = (...);
TFieldOfViewAxis = (...);
TSceneManagerWorld = TCastleAbstractRootTransform deprecated 'use TCastleRootTransform';

Constants

AllLayers = [Low(TPhysicsLayer)..High(TPhysicsLayer)];
rfOffScreen = rfRenderedTexture deprecated 'use rfRenderedTexture';
DefaultCameraDirection: TVector3 = (X: 0; Y: 0; Z: -1);
DefaultCameraUp : TVector3 = (X: 0; Y: 1; Z: 0);
Default2DProjectionFar = 1000.0 deprecated 'this default is not used; ProjectionFar in orthographic projection is now automatically adjusted to what you display';
Default2DProjectionNear = - 1000.0 deprecated 'this default is not used; ProjectionNear in orthographic projection is now automatically adjusted to what you display';
Default2DCameraZ = 1000.0 / 2;
RadiusToProjectionNear = 0.6;
DefaultCameraRadius = 0.1;
RadiusToPreferredHeightMin = 4.0;

Variables

InternalGizmoBoundingBox: Cardinal;

Description

Functions and Procedures

procedure TransformSave(const T: TCastleTransform; const Url: String);

Save / load TCastleTransform (or descendant) to a .castle-transform file.

An example:

{ TransformSave and TransformLoad example. }

{$apptype CONSOLE}

uses SysUtils, Classes,
  CastleLog, CastleVectors, CastleTransform, CastleScene, CastleComponentSerialize;
var
  Scene: TCastleScene;
  Transform: TCastleTransform;
  TransformOwner: TComponent;
begin
  InitializeLog;

  { Create TCastleTransform instance, with a TCastleScene child. }
  Scene := TCastleScene.Create(nil);
  Scene.Name := 'MyScene'; // will enable to find it later with FindRequiredComponent
  Scene.Load('castle-data:/teapot.x3dv');
  Transform := TCastleTransform.Create(nil);
  Transform.Translation := Vector3(1, 2, 3);
  Transform.Add(Scene);

  { Save it to file. }
  TransformSave(Transform, 'aaa.castle-transform');

  { You can destroy the instances now. }
  FreeAndNil(Scene);
  FreeAndNil(Transform);

  { Create a component that will own all loaded instances,
    allowing to easily free them,
    and to use FindRequiredComponent. }
  TransformOwner := TComponent.Create(nil);

  { Now you can load them from file, and check that they are equal. }
  Transform := TransformLoad('aaa.castle-transform', TransformOwner);
  WritelnLog('Loaded transform, with translation %s, with %d children', [
    Transform.Translation.ToString,
    Transform.Count
  ]);
  Scene := TransformOwner.FindRequiredComponent('MyScene') as TCastleScene;
  WritelnLog('Found scene in loaded transform, with url %s', [
    Scene.Url
  ]);

  { Free loaded stuff. }
  FreeAndNil(TransformOwner);
end.

Source: transform/castletransform_serialize.inc (line 25).

function TransformLoad(const Url: String; const Owner: TComponent): TCastleTransform;

This item has no description.

Source: transform/castletransform_serialize.inc (line 26).

procedure TransformMatricesMult(var Transform, InverseTransform: TMatrix4; const Center: TVector3; const Rotation: TVector4; const Scale: TVector3; const ScaleOrientation: TVector4; const Translation: TVector3); deprecated 'use TTransformation.Multiply';

Warning: this symbol is deprecated: use TTransformation.Multiply

This item has no description.

Source: transform/castletransform_miscellaneous_globals.inc (line 22).

function StrToOrientationType(const S: String): TOrientationType;

This item has no description.

Source: transform/castletransform_miscellaneous_globals.inc (line 33).

function OrientationFromDirectionUp(const Direction, Up: TVector3): TVector4; overload;

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).

Source: transform/castletransform_camera_utils.inc (line 50).

procedure OrientationFromDirectionUp(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); overload;

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 51).

function OrientationFromDirectionUp(const Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TVector4; overload;

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 53).

function OrientationToDirection(const OrientationRotation: TVector4): TVector3;

Convert rotation (X3D orientation) to a direction vector, reversing the OrientationFromDirectionUp.

Source: transform/castletransform_camera_utils.inc (line 59).

function OrientationToUp(const OrientationRotation: TVector4): TVector3;

Convert rotation (X3D orientation) to an up vector, reversing the OrientationFromDirectionUp.

Source: transform/castletransform_camera_utils.inc (line 63).

function CamDirUp2Orient(const Direction, Up: TVector3): TVector4; overload; deprecated 'use OrientationFromDirectionUp';

Warning: this symbol is deprecated: use OrientationFromDirectionUp

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 65).

procedure CamDirUp2Orient(const Direction, Up: TVector3; out Axis: TVector3; out Angle: Single); overload; deprecated 'use OrientationFromDirectionUp';

Warning: this symbol is deprecated: use OrientationFromDirectionUp

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 67).

function OrientationQuaternionFromDirectionUp(Direction, Up: TVector3; const DefaultDirection, DefaultUp: TVector3): TQuaternion; overload;

Convert camera direction and up vectors into a "rotation quaternion". Just like OrientationFromDirectionUp, but the result is a quaternion, not an axis-angle vector.

Source: transform/castletransform_camera_utils.inc (line 75).

function OrientationQuaternionFromDirectionUp(const Direction, Up: TVector3): TQuaternion; overload;

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 77).

function CamDirUp2OrientQuat(const Direction, Up: TVector3): TQuaternion; deprecated 'OrientationQuaternionFromDirectionUp';

Warning: this symbol is deprecated: OrientationQuaternionFromDirectionUp

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 81).

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.

Source: transform/castletransform_camera_utils.inc (line 92).

procedure CameraOrthoViewpointForWholeScene(const Box: TBox3D; const ViewportWidth, ViewportHeight: Single; const Origin: TVector2; out Position: TVector3; out AProjectionWidth, AProjectionHeight, AProjectionFar: Single);

Calculate suitable camera to see everything using an orthographic projection.

Assumes that the camera direction is -Z, and camera up is +Y. So the horizontal axis of the world is X, vertical axis is Y. These are default values of camera set by TCastleViewport.Setup2D.

The meaning of Origin is the same as TCastleOrthographic.Origin.

Returns new correct values of TCastleOrthographic.Width, TCastleOrthographic.Height, TCastleCamera.ProjectionFar and camera position (set it like Viewport.Camera.Translation := NewPosition;).

Source: transform/castletransform_camera_utils.inc (line 112).

Types

TPhysicsLayer = 0..19;

Each physics rigid body is part of a specific layer, TCastleRigidBody.Layer. It is configurable which layers can collide with each other (see https://castle-engine.io/physics#_layers ). Moreover routines like TCastleRigidBody.PhysicsRayCast allow to specify which layers are checked.

Source: transform/castletransform_physics_layers.inc (line 30).

TPhysicsLayers = set of TPhysicsLayer;

This item has no description.

Source: transform/castletransform_physics_layers.inc (line 32).

TCastleTransformClass = class of TCastleTransform;

This item has no description.

Source: transform/castletransform_initial_types.inc (line 28).

TRenderFromViewFunction = procedure (const RenderingCamera: TRenderingCamera) of object;

This item has no description.

TVisibleChange = (...);

Describe what visible thing changed for TCastleTransform.VisibleChangeHere.

Values
  • vcVisibleGeometry: Visible geometry (actual 3D shape) changed. It's not used when only light conditions, materials, textures and such changed.

    In practice, this means that the depth buffer from some point in space changed. Which means that shadow maps should be regenerated.

  • vcVisibleNonGeometry: Something visible, but not the geometry shape, changes. For example, material or texture on a visible surface changed.

Source: transform/castletransform_initial_types.inc (line 39).

TVisibleChanges = set of TVisibleChange;

This item has no description.

Source: transform/castletransform_initial_types.inc (line 52).

TVisibleChangeEvent = procedure (const Sender: TCastleTransform; const Changes: TVisibleChanges) of object;

This item has no description.

TPrepareResourcesOption = (...);

Various things that TCastleTransform.PrepareResources may prepare.

Values
  • prRenderSelf: Prepare resources for rendering *this* scene (on which TCastleTransform.PrepareResources is called).
  • prRenderClones: Prepare resources for rendering clones of the scene. E.g. textures, which are shared by clones using the cache.
  • prBackground
  • prBoundingBox
  • prShadowVolume
  • prSpatial: Prepare octrees (determined by things like TCastleSceneCore.Spatial).
  • prScreenEffects

Source: transform/castletransform_initial_types.inc (line 57).

TPrepareResourcesOptions = set of TPrepareResourcesOption;

This item has no description.

Source: transform/castletransform_initial_types.inc (line 70).

PRayCollisionNode = ˆTRayCollisionNode;

This item has no description.

Source: transform/castletransform_initial_types.inc (line 124).

PCollisionDetailsItem = ˆTCollisionDetailsItem;

This item has no description.

Source: transform/castletransform_initial_types.inc (line 210).

TRemoveType = (...);

This item has no description.

Values
  • rtNone
  • rtRemove
  • rtRemoveAndFree

Source: transform/castletransform_initial_types.inc (line 231).

TOrientationType = (...);

Orientation of the model is 3D world, determining where is the conceptual "up" direction of the model, and where is it facing.

This type is used by the TCastleTransform.Orientation and TCastleTransform.DefaultOrientation.

Orientation determines how TCastleTransform.Direction, TCastleTransform.Up work, i.e. what is TCastleTransform.Direction and TCastleTransform.Up relation to TCastleTransform.Rotation. The names of the enum values describe what is the direction/up when rotation is zero.

Values
  • otUpYDirectionMinusZ: Model up is +Y axis, direction is -Z which matches cameras of glTF, OpenGL, X3D.

    This also matches default export from Blender to X3D, with Blender "front" pointing toward -Z in the exported model. (But it mismatches default export from Blender to glTF in this regard.)

    Gravity pulls in -Y and GravityUp vector is +Y. Transformation makes -Z and +Y match (respectively) Direction and Up.

    For example, using this value for TCastleTransform.Orientation (or even TCastleTransform.DefaultOrientation) is sensible if you use default Blender X3D exporter, and you let the exporter to make a default transformation (to make +Z up into +Y up). Then you can follow the standard Blender view names ("front", "top" and such) when modelling, and Blender tools like "X-axis mirror" will work best.

  • otUpYDirectionZ: Model up is +Y axis, direction is +Z which matches export from Blender to glTF or Wavefront OBJ. This matches glTF specification that explicitly says "The front of a glTF asset faces +Z".

    Gravity pulls in -Y and GravityUp vector is +Y. Transformation makes +Z and +Y match (respectively) Direction and Up.

    This does not match default direction of OpenGL, X3D and glTF cameras. When viewed from the default direction of OpenGL, X3D and glTF cameras, you will see the front of the model, which means that the model's direction is the opposite of the camera direction.

    For example, using this value for TCastleTransform.Orientation (or even TCastleTransform.DefaultOrientation) is sensible if you use default Blender glTF or OBJ exporter, and you let the exporter to make a default transformation (to make +Z up into +Y up). This is the default setting. Then you can follow the standard Blender view names ("front", "top" and such) when modelling, and Blender tools like "X-axis mirror" will work best.

  • otUpZDirectionMinusY: Orientation sensible for models oriented around Z axis. Transformation makes -Y and +Z match (respectively) Direction and Up.

    Using this value for TCastleTransform.Orientation (or even TCastleTransform.DefaultOrientation) is sensible if you export your models from Blender to X3D without transforming them during export. Note that this is not the default Blender X3D exporter behavior. But you can configure the exporter to work like this (not transform), and then you can follow the standard Blender view names ("front", "top" and such) when modelling.

  • otUpZDirectionX:

    Warning: this symbol is deprecated.

    Up in +Z (like otUpZDirectionMinusY) and direction in +X. Should not be used in new models.

Source: transform/castletransform_initial_types.inc (line 246).

PRenderStatistics = ˆTRenderStatistics;

This item has no description.

Source: transform/castletransform_renderparams.inc (line 60).

TUserRenderingPass = 0..2;

Rendering pass, for user purposes. Useful to keep shaders cached when you render the same scene multiple times in the same frame (under different lighting conditions or other things that change shaders).

Source: transform/castletransform_renderparams.inc (line 98).

TRenderEvent = procedure (const Transformation: TTransformation; const PassParams: TRenderOnePassParams) of object;

Callback used by TRenderParams.AddRenderEvent.

See also
TRenderParams.AddRenderEvent
Add a custom rendering event.
TCastleBehaviorClass = class of TCastleBehavior;

TCastleBehavior.

Source: transform/castletransform_behavior.inc (line 19).

TCastleBehaviorList = specialize TObjectList<TCastleBehavior>;

This item has no description.

Source: transform/castletransform_behavior.inc (line 198).

TPhysicsRayCastResult = TRayCastResult deprecated 'use TRayCastResult';

Warning: this symbol is deprecated: use TRayCastResult

This item has no description.

Source: transform/castletransform_physics.inc (line 59).

TCollisionEvent = procedure (const CollisionDetails: TPhysicsCollisionDetails) of object;

This item has no description.

TCastleRigidBodyList = specialize TList<TCastleRigidBody>;

This item has no description.

Source: transform/castletransform_physics.inc (line 680).

TCollisionDetection = (...);

This item has no description.

Values
  • cdDiscrete
  • cdContinuous

Source: transform/castletransform_physics.inc (line 682).

TReferenceTransformation = (...);

How do we treat the transformation of TCastleTransformReference.Reference when rendering TCastleTransformReference.

Values
  • rtIgnoreTransform: Transformation of the referenced object (TCastleTransformReference.Reference) is completely ignored when it is rendered inside TCastleTransformReference.

    This means you can translate, rotate, scale the referenced object without it having any effect on how it is displayed inside TCastleTransformReference.

    Note that we ignore only the direct transformation of the referenced object. We never ignore transformations inside its children.

  • rtIgnoreTranslation: Translation (movement) of the referenced object (TCastleTransformReference.Reference) is ignored when it is rendered inside TCastleTransformReference.

    The rest (rotation, scaling) of the transformation is applied.

    This means you can translate the referenced object without it having any effect on how it is displayed inside TCastleTransformReference. However, rotating or scaling it will rotate/scale all the instances.

  • rtDoNotIgnore: Transformation of the referenced object (TCastleTransformReference.Reference) is completely applied when it is rendered inside TCastleTransformReference.

    This means that moving, rotating, scaling the referenced object will also move every instance of it inside TCastleTransformReference.

    This was the default engine behavior in Castle Game Engine version 7.0-alpha.3 before 2025-03-06.

Source: transform/castletransform_reference.inc (line 23).

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.

Source: transform/castletransform_camera.inc (line 23).

TSceneManagerWorld = TCastleAbstractRootTransform deprecated 'use TCastleRootTransform';

Warning: this symbol is deprecated: use TCastleRootTransform

Copyright 2017-2022 Michalis Kamburelis.

This file is part of "Castle Game Engine".

"Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright.

"Castle Game Engine" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

—————————————————————————-

Source: transform/castletransform_miscellaneous_globals.inc (line 20).

Constants

AllLayers = [Low(TPhysicsLayer)..High(TPhysicsLayer)];

This item has no description.

Source: transform/castletransform_physics_layers.inc (line 35).

rfOffScreen = rfRenderedTexture deprecated 'use rfRenderedTexture';

Warning: this symbol is deprecated: use rfRenderedTexture

This item has no description.

Source: transform/castletransform_miscellaneous_globals.inc (line 31).

DefaultCameraDirection: TVector3 = (X: 0; Y: 0; Z: -1);

Default camera direction and up vectors, used to define the meaning of "camera orientation" for OrientationFromDirectionUp, OrientationToDirection, OrientationToUp. These match X3D default camera values.

Source: transform/castletransform_camera_utils.inc (line 25).

DefaultCameraUp : TVector3 = (X: 0; Y: 1; Z: 0);

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 26).

Default2DProjectionFar = 1000.0 deprecated 'this default is not used; ProjectionFar in orthographic projection is now automatically adjusted to what you display';

Warning: this symbol is deprecated: this default is not used; ProjectionFar in orthographic projection is now automatically adjusted to what you display

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 29).

Default2DProjectionNear = - 1000.0 deprecated 'this default is not used; ProjectionNear in orthographic projection is now automatically adjusted to what you display';

Warning: this symbol is deprecated: this default is not used; ProjectionNear in orthographic projection is now automatically adjusted to what you display

This item has no description.

Source: transform/castletransform_camera_utils.inc (line 30).

Default2DCameraZ = 1000.0 / 2;

Default2DProjectionFar

Source: transform/castletransform_camera_utils.inc (line 31).

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."

Source: transform/castletransform_camera_utils.inc (line 124).

DefaultCameraRadius = 0.1;

Default Radius, determining also (with RadiusToProjectionNear) default TCastleCamera.EffectiveProjectionNear.

Note: *Do not* base automatic Radius (and, consistently, automatic ProjectionNear) on Box size.

- Major reason: It makes things go bad, as automatic ProjectionNear increases and clipping at near plane becomes visible, when you have some TCastleTransform in your world that travels forever (and thus increases the Viewport.ItemsBoundingBox into infinity).

E.g. a missile that flies into infinity. Or a box that falls down due to gravity into infinity. While such things in general should not happen (you should prevent things from traveling to infinity), but they may happen esp. in development, and it's bad when one problem (flying to infinity) causes another (sudden clipping at near plane).

- Minor reason: It avoids the need to calculate Viewport.ItemsBoundingBox at each frame, at least for the purpose of automatic projection for ProjectionNear. It was never observed in profiler, but in theory Viewport.ItemsBoundingBox may be costly when you have a lot of scenes.

Note: This is smaller, so even safer, than X3D default Navigation.avatarSize[0] (0.25).

Source: transform/castletransform_camera_utils.inc (line 152).

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_navigation/data/level/level-dungeon.gltf open with castle-model-viewer.

Source: transform/castletransform_camera_utils.inc (line 167).

Variables

InternalGizmoBoundingBox: Cardinal;

This item has no description.

Source: transform/castletransform_miscellaneous_globals.inc (line 36).


Generated by PasDoc 0.17.0.snapshot.