Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Photon.Deterministic.FPMatrix4x4 Struct Reference

Represents 4x4 column major matrix. Each cell can be individually accessed as a field (M<row><column>), with indexing indexxing property[row, column] or with indexing property[index]. More...

Public Member Functions

override Int32 GetHashCode ()
 Computes the hash code for the current instance. More...
 
FPVector3 MultiplyPoint (FPVector3 point)
 Transforms a position by this matrix. Works with regulard 3D transformations and with projective transformations. More...
 
FPVector3 MultiplyPoint3x4 (FPVector3 point)
 Transforms a position by this matrix. Faster than MultiplyPoint(FPVector3), but works only with regulard 3D transformations. More...
 
FPVector3 MultiplyVector (FPVector3 vector)
 Transforms a direction by this matrix. Only rotation and scale part of the matrix is taken into account. More...
 
override String ToString ()
 Returns a string representation of the FPMatrix4x4 object. The string representation consists of the values of the matrix elements formatted as a 4x4 matrix. More...
 

Static Public Member Functions

static FPMatrix4x4 FromColumns (FP m00, FP m10, FP m20, FP m30, FP m01, FP m11, FP m21, FP m31, FP m02, FP m12, FP m22, FP m32, FP m03, FP m13, FP m23, FP m33)
 Create from columns - first four values set the first colunn, second four values - second column etc. More...
 
static FPMatrix4x4 FromRows (FP m00, FP m01, FP m02, FP m03, FP m10, FP m11, FP m12, FP m13, FP m20, FP m21, FP m22, FP m23, FP m30, FP m31, FP m32, FP m33)
 Create from rows - first four values set the first row, second four values - second row etc. More...
 
static FPMatrix4x4 InverseLookAt (FPVector3 from, FPVector3 to, FPVector3 up)
 Creates inverse of look-at matrix, i.e. observer to world transformation. Equivalent to Unity's Matrix4x4.LookAt. More...
 
static FPMatrix4x4 InverseTRS (FPVector3 pos, FPQuaternion q, FPVector3 s)
 Creates an inversion translation, rotation and scaling matrix. This is significantly faster than inverting TRS matrix. Can be used to create world-to-local transformations. Rotation is expected to be normalized. More...
 
static FPMatrix4x4 LookAt (FPVector3 from, FPVector3 to, FPVector3 up)
 Creates look-at matrix, i.e. world to observer transformation. Unity's Matrix4x4.LookAt does the opposite - creates observer to world transformation. To get same behaviour use InverseLookAt(FPVector3, FPVector3, FPVector3) More...
 
static FPMatrix4x4 operator* (FPMatrix4x4 a, FPMatrix4x4 b)
 Multiplies two matrices. More...
 
static FPMatrix4x4 Rotate (FPQuaternion q)
 Creates a rotation matrix. Rotation is expected to be normalized. More...
 
static FPMatrix4x4 Scale (FPVector3 scale)
 Creates a scaling matrix. More...
 
static void Serialize (void *ptr, IDeterministicFrameSerializer serializer)
 Serializes a FPMatrix4x4 object using a given IDeterministicFrameSerializer. More...
 
static FPMatrix4x4 Translate (FPVector3 translation)
 Creates a translation matrix. More...
 
static FPMatrix4x4 TRS (FPVector3 pos, FPQuaternion q, FPVector3 s)
 Creates a translation, rotation and scaling matrix. Can be used to create local-to-world transformations. Rotation is expected to be normalized. More...
 

Public Attributes

FP Determinant3x3
 Calculates determinant, taking only rotation and scale parts of this matrix into account. More...
 
bool IsIdentity
 Returns true if this matrix is equal to the Identity matrix More...
 
FP M00
 First row, first column More...
 
FP M01
 First row, second column More...
 
FP M02
 First row, third column More...
 
FP M03
 First row, fourth column More...
 
FP M10
 Second row, first column More...
 
FP M11
 Second row, second column More...
 
FP M12
 Second row, third column More...
 
FP M13
 Second row, fourth column More...
 
FP M20
 Third row, first column More...
 
FP M21
 Third row, second column More...
 
FP M22
 Third row, third column More...
 
FP M23
 Third row, fourth column More...
 
FP M30
 Fourth row, first column More...
 
FP M31
 Fourth row, second column More...
 
FP M32
 Fourth row, third column More...
 
FP M33
 Fourth row, fourth column More...
 
FPMatrix4x4 Transposed => FromColumns(M00, M01, M02, M03, M10, M11, M12, M13, M20, M21, M22, M23, M30, M31, M32, M33)
 Creates transposed matrix. More...
 

Static Public Attributes

const int SIZE = FP.SIZE * 16
 The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
 
static FPMatrix4x4 Zero => new FPMatrix4x4()
 Matrix with 0s in every cell. More...
 

Properties

FP Determinant [get]
 Calculates determinant of this matrix. More...
 
static FPMatrix4x4 Identity [get]
 Matrix with 1s in the main diagonal and 0s in all other cells. More...
 
FPMatrix4x4 Inverted [get]
 Creates inverted matrix. Matrix with determinant 0 can not be inverted and result with Zero. More...
 
FPVector3 LossyScale [get]
 Attempts to get a scale value from the matrix. More...
 
FPQuaternion Rotation [get]
 Attempts to get a rotation quaternion from this matrix. More...
 
FP this[int index] [get, set]
 Gets or sets cell M<index%4><index/4> More...
 
FP this[int row, int column] [get, set]
 Gets or sets cell M<row><column>. More...
 

Detailed Description

Represents 4x4 column major matrix. Each cell can be individually accessed as a field (M<row><column>), with indexing indexxing property[row, column] or with indexing property[index].

Member Function Documentation

◆ FromRows()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.FromRows ( FP  m00,
FP  m01,
FP  m02,
FP  m03,
FP  m10,
FP  m11,
FP  m12,
FP  m13,
FP  m20,
FP  m21,
FP  m22,
FP  m23,
FP  m30,
FP  m31,
FP  m32,
FP  m33 
)
inlinestatic

Create from rows - first four values set the first row, second four values - second row etc.

◆ FromColumns()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.FromColumns ( FP  m00,
FP  m10,
FP  m20,
FP  m30,
FP  m01,
FP  m11,
FP  m21,
FP  m31,
FP  m02,
FP  m12,
FP  m22,
FP  m32,
FP  m03,
FP  m13,
FP  m23,
FP  m33 
)
inlinestatic

Create from columns - first four values set the first colunn, second four values - second column etc.

◆ InverseLookAt()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.InverseLookAt ( FPVector3  from,
FPVector3  to,
FPVector3  up 
)
inlinestatic

Creates inverse of look-at matrix, i.e. observer to world transformation. Equivalent to Unity's Matrix4x4.LookAt.

Parameters
from
to
up
Returns

◆ LookAt()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.LookAt ( FPVector3  from,
FPVector3  to,
FPVector3  up 
)
inlinestatic

Creates look-at matrix, i.e. world to observer transformation. Unity's Matrix4x4.LookAt does the opposite - creates observer to world transformation. To get same behaviour use InverseLookAt(FPVector3, FPVector3, FPVector3)

Parameters
from
to
up
Returns

◆ Scale()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Scale ( FPVector3  scale)
static

Creates a scaling matrix.

Parameters
scale
Returns

◆ Translate()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Translate ( FPVector3  translation)
static

Creates a translation matrix.

Parameters
translation
Returns

◆ Serialize()

static void Photon.Deterministic.FPMatrix4x4.Serialize ( void *  ptr,
IDeterministicFrameSerializer  serializer 
)
inlinestatic

Serializes a FPMatrix4x4 object using a given IDeterministicFrameSerializer.

Parameters
ptrA pointer to the FPMatrix4x4 object to be serialized.
serializerThe IDeterministicFrameSerializer used for serialization.

◆ ToString()

override String Photon.Deterministic.FPMatrix4x4.ToString ( )
inline

Returns a string representation of the FPMatrix4x4 object. The string representation consists of the values of the matrix elements formatted as a 4x4 matrix.

Returns
A string representation of the FPMatrix4x4 object.

◆ GetHashCode()

override Int32 Photon.Deterministic.FPMatrix4x4.GetHashCode ( )
inline

Computes the hash code for the current instance.

Returns
The hash code for the current instance.

◆ operator*()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.operator* ( FPMatrix4x4  a,
FPMatrix4x4  b 
)
inlinestatic

Multiplies two matrices.

◆ MultiplyPoint()

FPVector3 Photon.Deterministic.FPMatrix4x4.MultiplyPoint ( FPVector3  point)
inline

Transforms a position by this matrix. Works with regulard 3D transformations and with projective transformations.

◆ MultiplyPoint3x4()

FPVector3 Photon.Deterministic.FPMatrix4x4.MultiplyPoint3x4 ( FPVector3  point)
inline

Transforms a position by this matrix. Faster than MultiplyPoint(FPVector3), but works only with regulard 3D transformations.

◆ MultiplyVector()

FPVector3 Photon.Deterministic.FPMatrix4x4.MultiplyVector ( FPVector3  vector)
inline

Transforms a direction by this matrix. Only rotation and scale part of the matrix is taken into account.

◆ TRS()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.TRS ( FPVector3  pos,
FPQuaternion  q,
FPVector3  s 
)
inlinestatic

Creates a translation, rotation and scaling matrix. Can be used to create local-to-world transformations. Rotation is expected to be normalized.

◆ InverseTRS()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.InverseTRS ( FPVector3  pos,
FPQuaternion  q,
FPVector3  s 
)
inlinestatic

Creates an inversion translation, rotation and scaling matrix. This is significantly faster than inverting TRS matrix. Can be used to create world-to-local transformations. Rotation is expected to be normalized.

◆ Rotate()

static FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Rotate ( FPQuaternion  q)
inlinestatic

Creates a rotation matrix. Rotation is expected to be normalized.

Member Data Documentation

◆ SIZE

const int Photon.Deterministic.FPMatrix4x4.SIZE = FP.SIZE * 16
static

The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.

◆ Zero

FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Zero => new FPMatrix4x4()
static

Matrix with 0s in every cell.

◆ M00

FP Photon.Deterministic.FPMatrix4x4.M00

First row, first column

◆ M10

FP Photon.Deterministic.FPMatrix4x4.M10

Second row, first column

◆ M20

FP Photon.Deterministic.FPMatrix4x4.M20

Third row, first column

◆ M30

FP Photon.Deterministic.FPMatrix4x4.M30

Fourth row, first column

◆ M01

FP Photon.Deterministic.FPMatrix4x4.M01

First row, second column

◆ M11

FP Photon.Deterministic.FPMatrix4x4.M11

Second row, second column

◆ M21

FP Photon.Deterministic.FPMatrix4x4.M21

Third row, second column

◆ M31

FP Photon.Deterministic.FPMatrix4x4.M31

Fourth row, second column

◆ M02

FP Photon.Deterministic.FPMatrix4x4.M02

First row, third column

◆ M12

FP Photon.Deterministic.FPMatrix4x4.M12

Second row, third column

◆ M22

FP Photon.Deterministic.FPMatrix4x4.M22

Third row, third column

◆ M32

FP Photon.Deterministic.FPMatrix4x4.M32

Fourth row, third column

◆ M03

FP Photon.Deterministic.FPMatrix4x4.M03

First row, fourth column

◆ M13

FP Photon.Deterministic.FPMatrix4x4.M13

Second row, fourth column

◆ M23

FP Photon.Deterministic.FPMatrix4x4.M23

Third row, fourth column

◆ M33

FP Photon.Deterministic.FPMatrix4x4.M33

Fourth row, fourth column

◆ Transposed

FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Transposed => FromColumns(M00, M01, M02, M03, M10, M11, M12, M13, M20, M21, M22, M23, M30, M31, M32, M33)

Creates transposed matrix.

◆ IsIdentity

bool Photon.Deterministic.FPMatrix4x4.IsIdentity
Initial value:

Returns true if this matrix is equal to the Identity matrix

◆ Determinant3x3

FP Photon.Deterministic.FPMatrix4x4.Determinant3x3
Initial value:
=> FP.FromRaw(
(((((M00.RawValue * M11.RawValue + FP.MulRound) >> FP.MulShift) * M22.RawValue + FP.MulRound) >> FP.MulShift) + ((((M10.RawValue * M21.RawValue + FP.MulRound) >> FP.MulShift) * M02.RawValue + FP.MulRound) >> FP.MulShift) + ((((M20.RawValue * M01.RawValue + FP.MulRound) >> FP.MulShift) * M12.RawValue + FP.MulRound) >> FP.MulShift))
- (((((M02.RawValue * M11.RawValue + FP.MulRound) >> FP.MulShift) * M20.RawValue + FP.MulRound) >> FP.MulShift) + ((((M12.RawValue * M21.RawValue + FP.MulRound) >> FP.MulShift) * M00.RawValue + FP.MulRound) >> FP.MulShift) + ((((M22.RawValue * M01.RawValue + FP.MulRound) >> FP.MulShift) * M10.RawValue + FP.MulRound) >> FP.MulShift))
)

Calculates determinant, taking only rotation and scale parts of this matrix into account.

Property Documentation

◆ Identity

FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Identity
staticget

Matrix with 1s in the main diagonal and 0s in all other cells.

◆ this[int row, int column]

FP Photon.Deterministic.FPMatrix4x4.this[int row, int column]
getset

Gets or sets cell M<row><column>.

Parameters
row
column
Returns

◆ this[int index]

FP Photon.Deterministic.FPMatrix4x4.this[int index]
getset

Gets or sets cell M<index%4><index/4>

Parameters
index
Returns

◆ LossyScale

FPVector3 Photon.Deterministic.FPMatrix4x4.LossyScale
get

Attempts to get a scale value from the matrix.

◆ Inverted

FPMatrix4x4 Photon.Deterministic.FPMatrix4x4.Inverted
get

Creates inverted matrix. Matrix with determinant 0 can not be inverted and result with Zero.

◆ Determinant

FP Photon.Deterministic.FPMatrix4x4.Determinant
get

Calculates determinant of this matrix.

◆ Rotation

FPQuaternion Photon.Deterministic.FPMatrix4x4.Rotation
get

Attempts to get a rotation quaternion from this matrix.

Photon.Deterministic.FPMatrix4x4.M20
FP M20
Third row, first column
Definition: FPMatrix4x4.cs:46
Photon.Deterministic.FPMatrix4x4.M33
FP M33
Fourth row, fourth column
Definition: FPMatrix4x4.cs:72
Photon.Deterministic.FPMatrix4x4.M01
FP M01
First row, second column
Definition: FPMatrix4x4.cs:50
Photon.Deterministic.FPMatrix4x4.M00
FP M00
First row, first column
Definition: FPMatrix4x4.cs:42
Photon.Deterministic.FPMatrix4x4.M32
FP M32
Fourth row, third column
Definition: FPMatrix4x4.cs:64
Photon.Deterministic.FPMatrix4x4.M11
FP M11
Second row, second column
Definition: FPMatrix4x4.cs:52
Photon.Deterministic.FPMatrix4x4.M10
FP M10
Second row, first column
Definition: FPMatrix4x4.cs:44
Photon.Deterministic.FPMatrix4x4.M31
FP M31
Fourth row, second column
Definition: FPMatrix4x4.cs:56
Photon.Deterministic.FPMatrix4x4.M30
FP M30
Fourth row, first column
Definition: FPMatrix4x4.cs:48
Photon.Deterministic.FPMatrix4x4.M21
FP M21
Third row, second column
Definition: FPMatrix4x4.cs:54
Photon.Deterministic.FP.RawValue
Int64 RawValue
The raw integer value of the fixed-point number.
Definition: FP.cs:156
Photon.Deterministic.FPMatrix4x4.M13
FP M13
Second row, fourth column
Definition: FPMatrix4x4.cs:68
Photon.Deterministic.FPMatrix4x4.M12
FP M12
Second row, third column
Definition: FPMatrix4x4.cs:60
Photon.Deterministic.FPMatrix4x4.M02
FP M02
First row, third column
Definition: FPMatrix4x4.cs:58
Photon.Deterministic.FPMatrix4x4.M22
FP M22
Third row, third column
Definition: FPMatrix4x4.cs:62
Photon.Deterministic.FPMatrix4x4.M03
FP M03
First row, fourth column
Definition: FPMatrix4x4.cs:66
Photon.Deterministic.FPMatrix4x4.M23
FP M23
Third row, fourth column
Definition: FPMatrix4x4.cs:70