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. |
Class TRenderParams |
Information that a TCastleTransform object 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 TPhysicsRayCastResult |
Result of TCastleAbstractRootTransform.PhysicsRayCast and TCastleRigidBody.PhysicsRayCast. |
Class TCastleAbstractRootTransform |
Root of transformations and scenes (tree of TCastleTransform and TCastleScene). |
Class EMaximumTransformDesignDepth |
type |
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. |
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 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. |
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); |
procedure TransformSave(const T: TCastleTransform; const Url: String); |
Save / load TCastleTransform (or descendant) to a .castle-transform file.
An example:
uses SysUtils, Classes,
CastleLog, CastleVectors, CastleTransform, CastleScene, CastleComponentSerialize;
var
Scene: TCastleScene;
Transform: TCastleTransform;
TransformOwner: TComponent;
begin
InitializeLog;
Scene := TCastleScene.Create(nil);
Scene.Name := 'MyScene';
Scene.Load('castle-data:/teapot.x3dv');
Transform := TCastleTransform.Create(nil);
Transform.Translation := Vector3(1, 2, 3);
Transform.Add(Scene);
TransformSave(Transform, 'aaa.castle-transform');
FreeAndNil(Scene);
FreeAndNil(Transform);
TransformOwner := TComponent.Create(nil);
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
]);
FreeAndNil(TransformOwner);
end.
|
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.
|