Class T3DTransform

Unit

Declaration

type T3DTransform = class(T3DCustomTransform)

Description

Transform (move, rotate, scale) children T3D objects. Transformation is a combined 1. Translation, 2. and Rotation around Center point, 3. and Scale around Center and with orientation given by ScaleOrientation.

For precise order of the translation/rotation/scale operations, see the X3D Transform node specification.

Default values of all fields indicate "no transformation". So everything is zero, except Scale is (1,1,1).

This descends from T3DList, and it transforms all it's children.

Hierarchy

Overview

Methods

Protected procedure SetCenter(const Value: TVector3Single);
Protected procedure SetRotation(const Value: TVector4Single);
Protected procedure SetScale(const Value: TVector3Single);
Protected procedure SetScaleOrientation(const Value: TVector4Single);
Protected procedure SetTranslation(const Value: TVector3Single);
Protected function OnlyTranslation: boolean; override;
Protected function GetCenter: TVector3Single; override;
Protected function GetRotation: TVector4Single; override;
Protected function GetScale: TVector3Single; override;
Protected function GetScaleOrientation: TVector4Single; override;
Protected function GetTranslation: TVector3Single; override;
Public constructor Create(AOwner: TComponent); override;
Public procedure Translate(const T: TVector3Single); override;
Public procedure Identity;

Properties

Public property Translation: TVector3Single read FTranslation write SetTranslation;
Public property Center: TVector3Single read FCenter write SetCenter;
Public property Rotation: TVector4Single read FRotation write SetRotation;
Public property Scale: TVector3Single read FScale write SetScale;
Public property ScaleOrientation: TVector4Single read FScaleOrientation write SetScaleOrientation;

Description

Methods

Protected procedure SetCenter(const Value: TVector3Single);
 
Protected procedure SetRotation(const Value: TVector4Single);
 
Protected procedure SetScale(const Value: TVector3Single);
 
Protected procedure SetScaleOrientation(const Value: TVector4Single);
 
Protected procedure SetTranslation(const Value: TVector3Single);
 
Protected function OnlyTranslation: boolean; override;
 
Protected function GetCenter: TVector3Single; override;
 
Protected function GetRotation: TVector4Single; override;
 
Protected function GetScale: TVector3Single; override;
 
Protected function GetScaleOrientation: TVector4Single; override;
 
Protected function GetTranslation: TVector3Single; override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public procedure Translate(const T: TVector3Single); override;
 
Public procedure Identity;

Make the transform do nothing — zero Translation, zero Rotation, Scale to one. Also resets ScaleOrientation.

Properties

Public property Translation: TVector3Single read FTranslation write SetTranslation;

Translation (move) the children. Zero by default.

Public property Center: TVector3Single read FCenter write SetCenter;

Center point around which the Rotation and Scale is performed.

Public property Rotation: TVector4Single read FRotation write SetRotation;

Rotation in 3D, around a specified axis. Rotation is expressed as a 4D vector, in which the first 3 components specify the rotation axis (does not need to be normalized, but must be non-zero), and the last component is the rotation angle in radians.

Rotation is done around Center.

Public property Scale: TVector3Single read FScale write SetScale;

Scale in 3D. Scaling is done around Center and with orientation given by ScaleOrientation.

We do the best we can to work with any scale value, even negative or zero. But usually, it's best to keep the scale positive. More information:

  1. If you can, keep the scale uniform, that is scale equal amount in X, Y and Z. For example set scale = (3.0, 3.0, 3.0) to scale 3x times, and avoid scale like (3.0, 1.0, 1.0) that scales more in one direction.

    Non-uniform scale works, but some collisions are not perfectly calculated then. (For example, an ideal sphere is no longer a sphere when scaled in non-uniform fashion, and not everywhere do we account for that.) Although it works Ok on meshes. ScaleOrientation matters in case of non-uniform scale.

  2. All scale components should > 0 if you want 3D lighting to work corrrectly. That is, avoid negative scale, that flips the orientation of faces (CCW becomes CW), or standard lighting may not work Ok.

    For unlit stuff, or custom lighting, negative scale may be Ok. For many 2D games that use no lighting/custom lighting, negative scale is Ok.

  3. At least, keep all scale components non-zero. Otherwise the scaling operation is not invertible, and generally collisions will not work correctly.

    If you really need to set zero scale, at least consider using Collides = False.

Public property ScaleOrientation: TVector4Single read FScaleOrientation write SetScaleOrientation;

Orientation in which 3D Scale is performed.


Generated by PasDoc 0.14.0.