Plasma Engine  2.0
Loading...
Searching...
No Matches
Declarations.h
1#pragma once
2
4
5#include <Foundation/Basics.h>
6
7#if PL_ENABLED(PL_MATH_CHECK_FOR_NAN)
8# define PL_NAN_ASSERT(obj) (obj)->AssertNotNaN();
9#else
10# define PL_NAN_ASSERT(obj)
11#endif
12
13#define PL_DECLARE_IF_FLOAT_TYPE template <typename = typename std::enable_if<std::is_floating_point_v<Type> == true>>
14#define PL_IMPLEMENT_IF_FLOAT_TYPE template <typename ENABLE_IF_FLOAT>
15
18{
19 constexpr plIntFloatUnion(float fInit)
20 : f(fInit)
21 {
22 }
23
24 constexpr plIntFloatUnion(plUInt32 uiInit)
25 : i(uiInit)
26 {
27 }
28
29 plUInt32 i;
30 float f;
31};
32
35{
36
37 constexpr plInt64DoubleUnion(double fInit)
38 : f(fInit)
39 {
40 }
41 constexpr plInt64DoubleUnion(plUInt64 uiInit)
42 : i(uiInit)
43 {
44 }
45
46 plUInt64 i;
47 double f;
48};
49
63{
69};
70
77{
83
87 PL_FOUNDATION_DLL static Enum Default;
88};
89
100{
101 enum Enum
102 {
104 Flipped,
106 };
107
111 PL_FOUNDATION_DLL static Enum RenderToTextureDefault;
112};
113
116{
117 enum Enum
118 {
119 LeftHanded,
120 RightHanded,
121 };
122
124 PL_FOUNDATION_DLL static Enum Default /*= plHandedness::LeftHanded*/;
125};
126
127// forward declarations
128template <typename Type>
129class plVec2Template;
130
137
138template <typename Type>
139class plVec3Template;
140
147
148template <typename Type>
149class plVec4Template;
150
161
162template <typename Type>
163class plMat3Template;
164
167
168template <typename Type>
169class plMat4Template;
170
173
174template <typename Type>
175struct plPlaneTemplate;
176
179
180template <typename Type>
181class plQuatTemplate;
182
185
186template <typename Type>
188
192
193template <typename Type>
195
198
199template <typename Type>
201
204
205template <plUInt8 DecimalBits>
206class plFixedPoint;
207
208class plAngle;
209
210template <typename Type>
212
215
216class plColor;
217class plColorLinearUB;
218class plColorGammaUB;
219
220class plRandom;
221
222template <typename Type>
223class plRectTemplate;
224
231
232class plFrustum;
233
234
236struct PL_FOUNDATION_DLL plBasisAxis
237{
238 using StorageType = plInt8;
239
241 enum Enum : plInt8
242 {
243 PositiveX,
244 PositiveY,
245 PositiveZ,
246 NegativeX,
247 NegativeY,
248 NegativeZ,
249
250 Default = PositiveX
251 };
252
254 static plVec3 GetBasisVector(plBasisAxis::Enum basisAxis);
255
257 static plMat3 CalculateTransformationMatrix(plBasisAxis::Enum forwardDir, plBasisAxis::Enum rightDir, plBasisAxis::Enum dir, float fUniformScale = 1.0f, float fScaleX = 1.0f, float fScaleY = 1.0f, float fScaleZ = 1.0f);
258
260 static plQuat GetBasisRotation(plBasisAxis::Enum identity, plBasisAxis::Enum axis);
261
263 static plQuat GetBasisRotation_PosX(plBasisAxis::Enum axis);
264
268 static plBasisAxis::Enum GetOrthogonalAxis(plBasisAxis::Enum axis1, plBasisAxis::Enum axis2, bool bFlip);
269};
270
272struct PL_FOUNDATION_DLL plComparisonOperator
273{
274 using StorageType = plUInt8;
275
276 enum Enum
277 {
278 Equal,
279 NotEqual,
280 Less,
281 LessEqual,
282 Greater,
283 GreaterEqual,
284
285 Default = Equal
286 };
287
289 template <typename T>
290 static bool Compare(plComparisonOperator::Enum cmp, const T& a, const T& b); // [tested]
291};
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
A combination of a bounding box and a bounding sphere with the same center.
Definition BoundingBoxSphere.h:12
An axis-aligned bounding box implementation.
Definition BoundingBox.h:12
An implementation of a bounding sphere.
Definition BoundingSphere.h:11
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:99
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:61
Implements fixed point arithmetic for fractional values.
Definition FixedPoint.h:23
Represents the frustum of some camera and can be used for culling objects.
Definition Frustum.h:32
A 3x3 component matrix class.
Definition Mat3.h:9
A 4x4 component matrix class.
Definition Mat4.h:11
Quaternions can be used to represent rotations in 3D space.
Definition Quat.h:19
A random number generator. Currently uses the WELL512 algorithm.
Definition Random.h:9
A simple rectangle class templated on the type for x, y and width, height.
Definition Rect.h:10
A class that represents position, rotation and scaling via a position vector, a quaternion and a scal...
Definition Transform.h:31
A 2-component vector class.
Definition Vec2.h:14
A 3-component vector class.
Definition Vec3.h:9
A 4-component vector class.
Definition Vec4.h:9
An enum that allows to select on of the six main axis (positive / negative)
Definition Declarations.h:237
Enum
An enum that allows to select on of the six main axis (positive / negative)
Definition Declarations.h:242
Describes for which depth range a projection matrix is constructed.
Definition Declarations.h:77
Enum
Definition Declarations.h:79
@ ZeroToOne
Near plane at 0, far plane at 1.
Definition Declarations.h:81
@ MinusOneToOne
Near plane at -1, far plane at +1.
Definition Declarations.h:80
static PL_FOUNDATION_DLL Enum Default
Holds the default value for the projection depth range on each platform. This can be overridden by re...
Definition Declarations.h:87
Specifies whether a projection matrix should flip the result along the Y axis or not.
Definition Declarations.h:100
static PL_FOUNDATION_DLL Enum RenderToTextureDefault
Holds the platform default value for the clip space Y mode when rendering to a texture....
Definition Declarations.h:111
Enum
Definition Declarations.h:102
@ Flipped
Definition Declarations.h:104
@ Regular
Creates a regular projection matrix.
Definition Declarations.h:103
An enum that represents the operator of a comparison.
Definition Declarations.h:273
For selecting a left-handed or right-handed convention.
Definition Declarations.h:116
static PL_FOUNDATION_DLL Enum Default
Holds the default handedness value to use. pl uses 'LeftHanded' by default.
Definition Declarations.h:124
Enum to describe which memory layout is used to store a matrix in a float array.
Definition Declarations.h:63
Enum
Definition Declarations.h:65
@ RowMajor
The matrix is stored in row-major format.
Definition Declarations.h:66
@ ColumnMajor
The matrix is stored in column-major format.
Definition Declarations.h:67
A class that represents a mathematical plane.
Definition Plane.h:21
Simple helper union to store ints and doubles to modify their bit patterns.
Definition Declarations.h:35
Simple helper union to store ints and floats to modify their bit patterns.
Definition Declarations.h:18