KarmaEngine
Game Engine for practical learning and research purposes
|
#include <Transform.h>
Public Member Functions | |
FTransform (glm::vec3 rotation, glm::vec3 translation, glm::vec3 scale3D) | |
const glm::vec3 & | GetLocation () |
const TRotator & | GetRotation () const |
const glm::vec3 & | GetTranslation () const |
const glm::vec3 & | GetScale3D () const |
void | SetScale3D (const glm::vec3 &newScale) |
void | SetRotation (const TRotator &newRotation) |
void | SetTranslation (const glm::vec3 &newTranslation) |
FTransform | GetRelativeTransform (const FTransform &RelativeToWhat) const |
FTransform | operator* (const FTransform &Other) const |
bool | AnyHasNegativeScale (const glm::vec3 &InScale3D, const glm::vec3 &InOtherScale3D) const |
glm::vec3 | GetSafeScaleReciprocal (const glm::vec3 &InScale, float Tolerance) const |
FORCEINLINE void | CopyTranslation (const FTransform &Other) |
FORCEINLINE void | CopyRotation (const FTransform &Other) |
FORCEINLINE void | CopyScale3D (const FTransform Other) |
Static Public Member Functions | |
static FTransform | Identity () |
static void | Multiply (FTransform *OutTransform, const FTransform *A, const FTransform *B) |
Static Public Attributes | |
static FTransform | m_Identity = FTransform() |
Transform composed of Scale, Rotation (as a quaternion), and Translation.
Transforms can be used to convert from one space to another, for example by transforming positions and directions from local space to world space.
Transformation of position vectors is applied in the order: Scale -> Rotate -> Translate. Transformation of direction vectors is applied in the order: Scale -> Rotate.
Order matters when composing transforms: C = A * B will yield a transform C that logically first applies A then B to any subsequent transformation. Note that this is the opposite order of quaternion (TQuat<T>) multiplication.
Example: LocalToWorld = (DeltaRotation * LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = (LocalToWorld * DeltaRotation) will change rotation in world space by DeltaRotation.
|
inline |
Copy rotation from another FTransform.
|
inline |
Copy scale from another FTransform.
|
inline |
Copy translation from another FTransform.
|
inline |
Mathematically if you have 0 scale, it should be infinite, however, in practice if you have 0 scale, and relative transform doesn't make much sense anymore because you should be instead of showing gigantic infinite mesh also returning BIG_NUMBER causes sequential NaN issues by multiplying so we hardcode as 0
|
inlinestatic |
Create a new transform: OutTransform = A * B.
Order matters when composing transforms : A * B will yield a transform that logically first applies A then B to any subsequent transformation.
OutTransform | pointer to transform that will store the result of A * B. |
A | Transform A. |
B | Transform B. |
Returns Multiplied Transform of 2 FTransforms
FTransform Karma::FTransform::operator* | ( | const FTransform & | Other | ) | const |
Return a transform that is the result of this multiplied by another transform. Order matters when composing transforms : C = A * B will yield a transform C that logically first applies A then B to any subsequent transformation.
Other | other transform by which to multiply. |