Update vector and rect api to use constructors
This commit is contained in:
		
							parent
							
								
									2f6624fad7
								
							
						
					
					
						commit
						88bac561ec
					
				
							
								
								
									
										466
									
								
								dqn.h
									
									
									
									
									
								
							
							
						
						
									
										466
									
								
								dqn.h
									
									
									
									
									
								
							| @ -82,6 +82,7 @@ | |||||||
| //   - Get rid of reliance on MAX_PATH
 | //   - Get rid of reliance on MAX_PATH
 | ||||||
| //
 | //
 | ||||||
| // - Make lib compile and run on Linux with GCC using -03
 | // - Make lib compile and run on Linux with GCC using -03
 | ||||||
|  | // - Make DqnV* operations be static to class for consistency?
 | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // Preprocessor Checks
 | // Preprocessor Checks
 | ||||||
| @ -1164,25 +1165,42 @@ DQN_FILE_SCOPE f32 DqnMath_Clampf(f32 val, f32 min, f32 max); | |||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV2 Public API - 2D Math Vectors
 | // #DqnV2 Public API - 2D Math Vectors
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| typedef union DqnV2 { | class DqnV2i | ||||||
| 	struct { f32 x, y; }; | { | ||||||
| 	struct { f32 w, h; }; | public: | ||||||
| 	struct { f32 min, max; }; | 	union | ||||||
| 	f32 e[2]; | 	{ | ||||||
| } DqnV2; | 		struct { i32 x, y; }; | ||||||
|  | 		struct { i32 w, h; }; | ||||||
|  | 		struct { i32 min, max; }; | ||||||
|  | 		i32 e[2]; | ||||||
|  | 	}; | ||||||
| 
 | 
 | ||||||
| typedef union DqnV2i { | 	DqnV2i(); | ||||||
| 	struct { i32 x, y; }; | 	DqnV2i(i32 x_, i32 y_); | ||||||
| 	struct { i32 w, h; }; | 	DqnV2i(f32 x_, f32 y_); | ||||||
| 	struct { i32 min, max; }; | 	DqnV2i(class DqnV2 a); | ||||||
| 	i32 e[2]; |  | ||||||
| } DqnV2i; |  | ||||||
| 
 | 
 | ||||||
| // DqnV2
 | }; | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_1f (f32 xy); | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_2f (f32 x, f32 y); | class DqnV2 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_2i (i32 x, i32 y); // Typecasts 2 integers to 2 floats
 | { | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_V2i(DqnV2i a); | public: | ||||||
|  | 	union | ||||||
|  | 	{ | ||||||
|  | 		struct { f32 x, y; }; | ||||||
|  | 		struct { f32 w, h; }; | ||||||
|  | 		struct { f32 min, max; }; | ||||||
|  | 		f32 e[2]; | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	DqnV2(); | ||||||
|  | 	DqnV2(f32 xy); | ||||||
|  | 	DqnV2(f32 x_, f32 y_); | ||||||
|  | 	DqnV2(i32 x_, i32 y_); | ||||||
|  | 	DqnV2(DqnV2i a); | ||||||
|  | 
 | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Add     (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE DqnV2 DqnV2_Add     (DqnV2 a, DqnV2 b); | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Sub     (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE DqnV2 DqnV2_Sub     (DqnV2 a, DqnV2 b); | ||||||
| @ -1192,11 +1210,11 @@ DQN_FILE_SCOPE DqnV2 DqnV2_Hadamard(DqnV2 a, DqnV2 b); | |||||||
| DQN_FILE_SCOPE f32   DqnV2_Dot     (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE f32   DqnV2_Dot     (DqnV2 a, DqnV2 b); | ||||||
| DQN_FILE_SCOPE bool  DqnV2_Equals  (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE bool  DqnV2_Equals  (DqnV2 a, DqnV2 b); | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE f32   DqnV2_LengthSquared(DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE f32   DqnV2_LengthSquared(const DqnV2 a, const DqnV2 b); | ||||||
| DQN_FILE_SCOPE f32   DqnV2_Length       (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE f32   DqnV2_Length       (const DqnV2 a, const DqnV2 b); | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Normalise    (DqnV2 a); | DQN_FILE_SCOPE DqnV2 DqnV2_Normalise    (const DqnV2 a); | ||||||
| DQN_FILE_SCOPE bool  DqnV2_Overlaps     (DqnV2 a, DqnV2 b); | DQN_FILE_SCOPE bool  DqnV2_Overlaps     (      DqnV2 a,       DqnV2 b); | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Perpendicular(DqnV2 a); | DQN_FILE_SCOPE DqnV2 DqnV2_Perpendicular(const DqnV2 a); | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_ResizeKeepAspectRatio(DqnV2 srcSize, DqnV2 targetSize); | DQN_FILE_SCOPE DqnV2 DqnV2_ResizeKeepAspectRatio(DqnV2 srcSize, DqnV2 targetSize); | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_ConstrainToRatio     (DqnV2 dim, DqnV2 ratio); // Resize the dimension to fit the aspect ratio provided. Downscale only.
 | DQN_FILE_SCOPE DqnV2 DqnV2_ConstrainToRatio     (DqnV2 dim, DqnV2 ratio); // Resize the dimension to fit the aspect ratio provided. Downscale only.
 | ||||||
| @ -1214,10 +1232,6 @@ DQN_FILE_SCOPE inline DqnV2 &operator+=(DqnV2 &a, DqnV2 b) { return (a = DqnV2_A | |||||||
| DQN_FILE_SCOPE inline bool   operator==(DqnV2  a, DqnV2 b) { return      DqnV2_Equals  (a, b);  } | DQN_FILE_SCOPE inline bool   operator==(DqnV2  a, DqnV2 b) { return      DqnV2_Equals  (a, b);  } | ||||||
| 
 | 
 | ||||||
| // DqnV2i
 | // DqnV2i
 | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_2i(i32 x, i32 y); |  | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_2f(f32 x, f32 y); // Typecasts 2 floats to 2 integers
 |  | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_V2(DqnV2 a); |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_Add     (DqnV2i a, DqnV2i b); | DQN_FILE_SCOPE DqnV2i DqnV2i_Add     (DqnV2i a, DqnV2i b); | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_Sub     (DqnV2i a, DqnV2i b); | DQN_FILE_SCOPE DqnV2i DqnV2i_Sub     (DqnV2i a, DqnV2i b); | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_Scalei  (DqnV2i a, i32 b); | DQN_FILE_SCOPE DqnV2i DqnV2i_Scalei  (DqnV2i a, i32 b); | ||||||
| @ -1239,27 +1253,38 @@ DQN_FILE_SCOPE inline bool    operator==(DqnV2i  a, DqnV2i b) { return      DqnV | |||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV3 Public API - 3D Math Vectors
 | // #DqnV3 Public API - 3D Math Vectors
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| typedef union DqnV3 | class DqnV3 | ||||||
| { | { | ||||||
| 	struct { f32 x, y, z; }; | public: | ||||||
|     DqnV2 xy; | 	union | ||||||
|  | 	{ | ||||||
|  | 		struct { f32 x, y, z; }; | ||||||
|  | 		DqnV2 xy; | ||||||
|  | 		struct { f32 r, g, b; }; | ||||||
|  | 		f32 e[3]; | ||||||
|  | 	}; | ||||||
| 
 | 
 | ||||||
|     struct { f32 r, g, b; }; | 	DqnV3(); | ||||||
| 	f32 e[3]; | 	DqnV3(f32 xyz); | ||||||
| } DqnV3; | 	DqnV3(f32 x_, f32 y_, f32 z_); | ||||||
|  | 	DqnV3(i32 x_, i32 y_, i32 z_); | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| typedef union DqnV3i | class DqnV3i | ||||||
| { | { | ||||||
| 	struct { i32 x, y, z; }; | public: | ||||||
|     struct { i32 r, g, b; }; | 	union | ||||||
| 	i32 e[3]; | 	{ | ||||||
| } DqnV3i; | 		struct { i32 x, y, z; }; | ||||||
|  | 		struct { i32 r, g, b; }; | ||||||
|  | 		i32 e[3]; | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	DqnV3i(i32 x_, i32 y_, i32 z_); | ||||||
|  | 	DqnV3i(f32 x_, f32 y_, f32 z_); | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| // DqnV3
 | // DqnV3
 | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_1f(f32 xyz); |  | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_3f(f32 x, f32 y, f32 z); |  | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_3i(i32 x, i32 y, i32 z); // Create a vector using ints and typecast to floats
 |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_Add     (DqnV3 a, DqnV3 b); | DQN_FILE_SCOPE DqnV3 DqnV3_Add     (DqnV3 a, DqnV3 b); | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_Sub     (DqnV3 a, DqnV3 b); | DQN_FILE_SCOPE DqnV3 DqnV3_Sub     (DqnV3 a, DqnV3 b); | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_Scalei  (DqnV3 a, i32 b); | DQN_FILE_SCOPE DqnV3 DqnV3_Scalei  (DqnV3 a, i32 b); | ||||||
| @ -1275,7 +1300,7 @@ DQN_FILE_SCOPE f32   DqnV3_LengthSquared(DqnV3 a, DqnV3 b); | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator- (DqnV3  a, DqnV3 b) { return      DqnV3_Sub     (a, b);           } | DQN_FILE_SCOPE inline DqnV3  operator- (DqnV3  a, DqnV3 b) { return      DqnV3_Sub     (a, b);           } | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator+ (DqnV3  a, DqnV3 b) { return      DqnV3_Add     (a, b);           } | DQN_FILE_SCOPE inline DqnV3  operator+ (DqnV3  a, DqnV3 b) { return      DqnV3_Add     (a, b);           } | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator+ (DqnV3  a, f32   b) { return      DqnV3_Add     (a, DqnV3_1f(b)); } | DQN_FILE_SCOPE inline DqnV3  operator+ (DqnV3  a, f32   b) { return      DqnV3_Add     (a, DqnV3(b)); } | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, DqnV3 b) { return      DqnV3_Hadamard(a, b);           } | DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, DqnV3 b) { return      DqnV3_Hadamard(a, b);           } | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, f32   b) { return      DqnV3_Scalef  (a, b);           } | DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, f32   b) { return      DqnV3_Scalef  (a, b);           } | ||||||
| DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, i32   b) { return      DqnV3_Scalei  (a, b);           } | DQN_FILE_SCOPE inline DqnV3  operator* (DqnV3  a, i32   b) { return      DqnV3_Scalei  (a, b);           } | ||||||
| @ -1287,32 +1312,32 @@ DQN_FILE_SCOPE inline DqnV3 &operator-=(DqnV3 &a, DqnV3 b) { return (a = DqnV3_S | |||||||
| DQN_FILE_SCOPE inline DqnV3 &operator+=(DqnV3 &a, DqnV3 b) { return (a = DqnV3_Add     (a, b));          } | DQN_FILE_SCOPE inline DqnV3 &operator+=(DqnV3 &a, DqnV3 b) { return (a = DqnV3_Add     (a, b));          } | ||||||
| DQN_FILE_SCOPE inline bool   operator==(DqnV3  a, DqnV3 b) { return      DqnV3_Equals  (a, b);           } | DQN_FILE_SCOPE inline bool   operator==(DqnV3  a, DqnV3 b) { return      DqnV3_Equals  (a, b);           } | ||||||
| 
 | 
 | ||||||
| // DqnV3i
 |  | ||||||
| DQN_FILE_SCOPE DqnV3i DqnV3i_3i(i32 x, i32 y, i32 z); |  | ||||||
| DQN_FILE_SCOPE DqnV3i DqnV3i_3f(f32 x, f32 y, f32 z); |  | ||||||
| 
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV4 Public API - 4D Math Vectors
 | // #DqnV4 Public API - 4D Math Vectors
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| typedef union DqnV4 { | class DqnV4 | ||||||
| 	struct | { | ||||||
|  | public: | ||||||
|  | 	union | ||||||
| 	{ | 	{ | ||||||
| 		f32 x, y, z, w; | 		struct { f32 x, y, z, w; }; | ||||||
|  | 		DqnV3 xyz; | ||||||
|  | 		DqnV2 xy; | ||||||
|  | 
 | ||||||
|  | 		struct { f32 r, g, b, a; }; | ||||||
|  | 		DqnV3 rgb; | ||||||
|  | 
 | ||||||
|  | 		f32    e[4]; | ||||||
|  | 		DqnV2 v2[2]; | ||||||
| 	}; | 	}; | ||||||
| 	DqnV3 xyz; |  | ||||||
| 	DqnV2 xy; |  | ||||||
| 
 | 
 | ||||||
| 	struct { f32 r, g, b, a; }; | 	DqnV4(); | ||||||
| 	DqnV3 rgb; | 	DqnV4(f32 xyzw); | ||||||
|  | 	DqnV4(f32 x_, f32 y_, f32 z_, f32 w_); | ||||||
|  | 	DqnV4(i32 x_, i32 y_, i32 z_, i32 w_); | ||||||
|  | 	DqnV4(DqnV3 a, f32 w); | ||||||
| 
 | 
 | ||||||
| 	f32    e[4]; | }; | ||||||
| 	DqnV2 v2[2]; |  | ||||||
| } DqnV4; |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_1f(f32 xyzw); |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_4f(f32 x, f32 y, f32 z, f32 w); |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_4i(i32 x, i32 y, i32 z, f32 w); // Create a vector using ints and typecast to floats
 |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_V3(DqnV3 a, f32 w); |  | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_Add     (DqnV4 a, DqnV4 b); | DQN_FILE_SCOPE DqnV4 DqnV4_Add     (DqnV4 a, DqnV4 b); | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_Sub     (DqnV4 a, DqnV4 b); | DQN_FILE_SCOPE DqnV4 DqnV4_Sub     (DqnV4 a, DqnV4 b); | ||||||
| @ -1324,7 +1349,7 @@ DQN_FILE_SCOPE bool  DqnV4_Equals  (DqnV4 a, DqnV4 b); | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator- (DqnV4  a, DqnV4 b) { return      DqnV4_Sub     (a, b);            } | DQN_FILE_SCOPE inline DqnV4  operator- (DqnV4  a, DqnV4 b) { return      DqnV4_Sub     (a, b);            } | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator+ (DqnV4  a, DqnV4 b) { return      DqnV4_Add     (a, b);            } | DQN_FILE_SCOPE inline DqnV4  operator+ (DqnV4  a, DqnV4 b) { return      DqnV4_Add     (a, b);            } | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator+ (DqnV4  a, f32   b) { return      DqnV4_Add     (a, DqnV4_1f(b));  } | DQN_FILE_SCOPE inline DqnV4  operator+ (DqnV4  a, f32   b) { return      DqnV4_Add     (a, DqnV4(b));     } | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, DqnV4 b) { return      DqnV4_Hadamard(a, b);            } | DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, DqnV4 b) { return      DqnV4_Hadamard(a, b);            } | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, f32   b) { return      DqnV4_Scalef  (a, b);            } | DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, f32   b) { return      DqnV4_Scalef  (a, b);            } | ||||||
| DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, i32   b) { return      DqnV4_Scalei  (a, b);            } | DQN_FILE_SCOPE inline DqnV4  operator* (DqnV4  a, i32   b) { return      DqnV4_Scalei  (a, b);            } | ||||||
| @ -1363,23 +1388,25 @@ DQN_FILE_SCOPE DqnV4   DqnMat4_MulV4       (DqnMat4 a, DqnV4 b); | |||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnRect Public API - Rectangles
 | // #DqnRect Public API - Rectangles
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| typedef struct DqnRect | class DqnRect | ||||||
| { | { | ||||||
|  | public: | ||||||
| 	DqnV2 min; | 	DqnV2 min; | ||||||
| 	DqnV2 max; | 	DqnV2 max; | ||||||
| } DqnRect; |  | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_4f       (f32 minX, f32 minY, f32 maxX, f32 maxY); | 	DqnRect(); | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_4i       (i32 minX, i32 minY, i32 maxX, i32 maxY); | 	DqnRect(DqnV2 origin, DqnV2 size); | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_Init     (DqnV2 origin, DqnV2 size); | 	DqnRect(f32 x, f32 y, f32 w, f32 h); | ||||||
|  | 	DqnRect(i32 x, i32 y, i32 w, i32 h); | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE void    DqnRect_GetSize2f(DqnRect rect, f32 *width, f32 *height); | 	void  GetSize  (f32 *const width, f32 *const height) const; | ||||||
| DQN_FILE_SCOPE void    DqnRect_GetSize2i(DqnRect rect, i32 *width, i32 *height); | 	DqnV2 GetSize  ()                                    const; | ||||||
| DQN_FILE_SCOPE DqnV2   DqnRect_GetSizeV2(DqnRect rect); | 	DqnV2 GetCenter()                                    const; | ||||||
| DQN_FILE_SCOPE DqnV2   DqnRect_GetCenter(DqnRect rect); | 
 | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_ClipRect (DqnRect rect, DqnRect clip); | 	DqnRect ClipRect (const DqnRect clip) const; | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_Move     (DqnRect rect, DqnV2 shift); | 	DqnRect Move     (const DqnV2 shift)  const; | ||||||
| DQN_FILE_SCOPE bool    DqnRect_ContainsP(DqnRect rect, DqnV2 p); | 	bool    ContainsP(const DqnV2 p)      const; | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnChar Public API - Char Operations
 | // #DqnChar Public API - Char Operations
 | ||||||
| @ -3227,46 +3254,20 @@ DQN_FILE_SCOPE f32 DqnMath_Clampf(f32 val, f32 min, f32 max) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV2 Init Implementation
 | // #DqnV2 Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_1f(f32 xy) | DqnV2::DqnV2()                                          { } | ||||||
| { | DqnV2::DqnV2(f32 xy)         : x(xy)      , y(xy)       { } | ||||||
| 	DqnV2 result = {0}; | DqnV2::DqnV2(f32 x_, f32 y_) : x(x_)      , y(y_)       { } | ||||||
| 	result.x  = xy; | DqnV2::DqnV2(i32 x_, i32 y_) : x((f32)x_) , y((f32)y_)  { } | ||||||
| 	result.y  = xy; | DqnV2::DqnV2(DqnV2i a)       : x((f32)a.x), y((f32)a.y) { } | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_2f(f32 x, f32 y) |  | ||||||
| { |  | ||||||
| 	DqnV2 result = {0}; |  | ||||||
| 	result.x  = x; |  | ||||||
| 	result.y  = y; |  | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_2i(i32 x, i32 y) |  | ||||||
| { |  | ||||||
| 	DqnV2 result = DqnV2_2f((f32)x, (f32)y); |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_V2i(DqnV2i a) |  | ||||||
| { |  | ||||||
| 	DqnV2 result = {0}; |  | ||||||
| 	result.x = (f32)a.x; |  | ||||||
| 	result.y = (f32)a.y; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV2 Arithmetic Implementation
 | // #DqnV2 Arithmetic Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Add(DqnV2 a, DqnV2 b) | DQN_FILE_SCOPE DqnV2 DqnV2_Add(DqnV2 a, DqnV2 b) | ||||||
| { | { | ||||||
| 	DqnV2 result = {0}; | 	DqnV2 result = {}; | ||||||
| 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | ||||||
| 		result.e[i] = a.e[i] + b.e[i]; | 		result.e[i] = a.e[i] + b.e[i]; | ||||||
| 
 | 
 | ||||||
| @ -3275,7 +3276,7 @@ DQN_FILE_SCOPE DqnV2 DqnV2_Add(DqnV2 a, DqnV2 b) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Sub(DqnV2 a, DqnV2 b) | DQN_FILE_SCOPE DqnV2 DqnV2_Sub(DqnV2 a, DqnV2 b) | ||||||
| { | { | ||||||
| 	DqnV2 result = {0}; | 	DqnV2 result = {}; | ||||||
| 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | ||||||
| 		result.e[i] = a.e[i] - b.e[i]; | 		result.e[i] = a.e[i] - b.e[i]; | ||||||
| 
 | 
 | ||||||
| @ -3284,7 +3285,7 @@ DQN_FILE_SCOPE DqnV2 DqnV2_Sub(DqnV2 a, DqnV2 b) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Scalei(DqnV2 a, i32 b) | DQN_FILE_SCOPE DqnV2 DqnV2_Scalei(DqnV2 a, i32 b) | ||||||
| { | { | ||||||
| 	DqnV2 result = {0}; | 	DqnV2 result = {}; | ||||||
| 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | ||||||
| 		result.e[i] = a.e[i] * b; | 		result.e[i] = a.e[i] * b; | ||||||
| 
 | 
 | ||||||
| @ -3293,7 +3294,7 @@ DQN_FILE_SCOPE DqnV2 DqnV2_Scalei(DqnV2 a, i32 b) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Scalef(DqnV2 a, f32 b) | DQN_FILE_SCOPE DqnV2 DqnV2_Scalef(DqnV2 a, f32 b) | ||||||
| { | { | ||||||
| 	DqnV2 result = {0}; | 	DqnV2 result = {}; | ||||||
| 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | ||||||
| 		result.e[i] = a.e[i] * b; | 		result.e[i] = a.e[i] * b; | ||||||
| 
 | 
 | ||||||
| @ -3302,7 +3303,7 @@ DQN_FILE_SCOPE DqnV2 DqnV2_Scalef(DqnV2 a, f32 b) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Hadamard(DqnV2 a, DqnV2 b) | DQN_FILE_SCOPE DqnV2 DqnV2_Hadamard(DqnV2 a, DqnV2 b) | ||||||
| { | { | ||||||
| 	DqnV2 result = {0}; | 	DqnV2 result = {}; | ||||||
| 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | 	for (u32 i = 0; i < DQN_ARRAY_COUNT(a.e); i++) | ||||||
| 		result.e[i] = a.e[i] * b.e[i]; | 		result.e[i] = a.e[i] * b.e[i]; | ||||||
| 
 | 
 | ||||||
| @ -3333,15 +3334,15 @@ DQN_FILE_SCOPE bool DqnV2_Equals(DqnV2 a, DqnV2 b) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE f32 DqnV2_LengthSquared(DqnV2 a, DqnV2 b) | DQN_FILE_SCOPE f32 DqnV2_LengthSquared(const DqnV2 a, const DqnV2 b) | ||||||
| { | { | ||||||
| 	f32 x      = b.x - a.x; | 	f32 x_     = b.x - a.x; | ||||||
| 	f32 y      = b.y - a.y; | 	f32 y_     = b.y - a.y; | ||||||
| 	f32 result = (DQN_SQUARED(x) + DQN_SQUARED(y)); | 	f32 result = (DQN_SQUARED(x_) + DQN_SQUARED(y_)); | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE f32 DqnV2_Length(DqnV2 a, DqnV2 b) | DQN_FILE_SCOPE f32 DqnV2_Length(const DqnV2 a, const DqnV2 b) | ||||||
| { | { | ||||||
| 	f32 lengthSq = DqnV2_LengthSquared(a, b); | 	f32 lengthSq = DqnV2_LengthSquared(a, b); | ||||||
| 	if (lengthSq == 0) return 0; | 	if (lengthSq == 0) return 0; | ||||||
| @ -3350,12 +3351,12 @@ DQN_FILE_SCOPE f32 DqnV2_Length(DqnV2 a, DqnV2 b) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Normalise(DqnV2 a) | DQN_FILE_SCOPE DqnV2 DqnV2_Normalise(const DqnV2 a) | ||||||
| { | { | ||||||
| 	f32 magnitude = DqnV2_Length(DqnV2_2f(0, 0), a); | 	f32 magnitude = DqnV2_Length(DqnV2(0, 0), a); | ||||||
| 	if (magnitude == 0) return DqnV2_1f(0.0f); | 	if (magnitude == 0) return DqnV2(0.0f); | ||||||
| 
 | 
 | ||||||
| 	DqnV2 result = DqnV2_Scalef(a, 1 / magnitude); | 	DqnV2 result = a * (1.0f / magnitude); | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -3369,12 +3370,11 @@ DQN_FILE_SCOPE bool DqnV2_Overlaps(DqnV2 a, DqnV2 b) | |||||||
| 	if (lenOfA > lenOfB) | 	if (lenOfA > lenOfB) | ||||||
| 	{ | 	{ | ||||||
| 		DqnV2 tmp = a; | 		DqnV2 tmp = a; | ||||||
| 		a          = b; | 		a         = b; | ||||||
| 		b          = tmp; | 		b         = tmp; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((a.min >= b.min && a.min <= b.max) || | 	if ((a.min >= b.min && a.min <= b.max) || (a.max >= b.min && a.max <= b.max)) | ||||||
| 	    (a.max >= b.min && a.max <= b.max)) |  | ||||||
| 	{ | 	{ | ||||||
| 		result = true; | 		result = true; | ||||||
| 	} | 	} | ||||||
| @ -3382,13 +3382,12 @@ DQN_FILE_SCOPE bool DqnV2_Overlaps(DqnV2 a, DqnV2 b) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_Perpendicular(DqnV2 a) | DQN_FILE_SCOPE DqnV2 DqnV2_Perpendicular(const DqnV2 a) | ||||||
| { | { | ||||||
| 	DqnV2 result = DqnV2_2f(a.y, -a.x); | 	DqnV2 result = DqnV2(a.y, -a.x); | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2 DqnV2_ResizeKeepAspectRatio(DqnV2 srcSize, DqnV2 targetSize) | DQN_FILE_SCOPE DqnV2 DqnV2_ResizeKeepAspectRatio(DqnV2 srcSize, DqnV2 targetSize) | ||||||
| { | { | ||||||
| 	f32 ratioA   = srcSize.w / targetSize.w; | 	f32 ratioA   = srcSize.w / targetSize.w; | ||||||
| @ -3413,33 +3412,12 @@ DQN_FILE_SCOPE DqnV2 DqnV2_ConstrainToRatio(DqnV2 dim, DqnV2 ratio) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV2i Init Implementation
 | // #DqnV2i Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_2i(i32 x, i32 y) | DqnV2i::DqnV2i(i32 x_, i32 y_) : x(x_)      , y(y_)       { } | ||||||
| { | DqnV2i::DqnV2i(f32 x_, f32 y_) : x((i32)x_) , y((i32)y_)  { } | ||||||
| 	DqnV2i result = {0}; | DqnV2i::DqnV2i(DqnV2 a)        : x((i32)a.x), y((i32)a.y) { } | ||||||
| 	result.x      = x; |  | ||||||
| 	result.y      = y; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_2f(f32 x, f32 y) |  | ||||||
| { |  | ||||||
| 	DqnV2i result = DqnV2i_2i((i32)x, (i32)y); |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_V2(DqnV2 a) |  | ||||||
| { |  | ||||||
| 	DqnV2i result = {0}; |  | ||||||
| 	result.x      = (i32)a.x; |  | ||||||
| 	result.y      = (i32)a.y; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| // #DqnV2i Arithmetic Implementation
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| DQN_FILE_SCOPE DqnV2i DqnV2i_Add(DqnV2i a, DqnV2i b) | DQN_FILE_SCOPE DqnV2i DqnV2i_Add(DqnV2i a, DqnV2i b) | ||||||
| { | { | ||||||
| 	DqnV2i result = {0}; | 	DqnV2i result = {0}; | ||||||
| @ -3510,29 +3488,13 @@ DQN_FILE_SCOPE bool DqnV2i_Equals(DqnV2i a, DqnV2i b) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV3 Init Implementation
 | // #DqnV3 Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_1f(f32 xyz) | DqnV3::DqnV3() { } | ||||||
| { | DqnV3::DqnV3(f32 xyz)                : x(xyz)    , y(xyz)    , z(xyz)     { } | ||||||
| 	DqnV3 result = {xyz, xyz, xyz}; | DqnV3::DqnV3(f32 x_, f32 y_, f32 z_) : x(x_)     , y(y_)     , z(z_)      { } | ||||||
| 	return result; | DqnV3::DqnV3(i32 x_, i32 y_, i32 z_) : x((f32)x_), y((f32)y_), z((f32)z_) { } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_3f(f32 x, f32 y, f32 z) |  | ||||||
| { |  | ||||||
| 	DqnV3 result = {x, y, z}; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_3i(i32 x, i32 y, i32 z) |  | ||||||
| { |  | ||||||
| 	DqnV3 result = {(f32)x, (f32)y, (f32)z}; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| // #DqnV3 Arithmetic Implementation
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| DQN_FILE_SCOPE DqnV3 DqnV3_Add(DqnV3 a, DqnV3 b) | DQN_FILE_SCOPE DqnV3 DqnV3_Add(DqnV3 a, DqnV3 b) | ||||||
| { | { | ||||||
| 	DqnV3 result = {0}; | 	DqnV3 result = {0}; | ||||||
| @ -3646,49 +3608,19 @@ DQN_FILE_SCOPE f32 DqnV3_Length(DqnV3 a, DqnV3 b) | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV3i Init Implementation
 | // #DqnV3i Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV3i DqnV3i_3i(i32 x, i32 y, i32 z) | DqnV3i::DqnV3i(i32 x_, i32 y_, i32 z_) : x(x_)     , y(y_)     , z(z_)      { } | ||||||
| { | DqnV3i::DqnV3i(f32 x_, f32 y_, f32 z_) : x((i32)x_), y((i32)y_), z((i32)z_) { } | ||||||
| 	DqnV3i result = {x, y, z}; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV3i DqnV3i_3f(f32 x, f32 y, f32 z) |  | ||||||
| { |  | ||||||
| 	DqnV3i result = {(i32)x, (i32)y, (i32)z}; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV4 Init Implementation
 | // #DqnV4 Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_1f(f32 xyzw) | DqnV4::DqnV4() {}; | ||||||
| { | DqnV4::DqnV4(f32 xyzw)                       : x(xyzw)   , y(xyzw)   , z(xyzw)   , w(xyzw)    { } | ||||||
| 	DqnV4 result = {xyzw, xyzw, xyzw, xyzw}; | DqnV4::DqnV4(f32 x_, f32 y_, f32 z_, f32 w_) : x(x_)     , y(y_)     , z(z_)     , w(w_)      { } | ||||||
| 	return result; | DqnV4::DqnV4(i32 x_, i32 y_, i32 z_, i32 w_) : x((f32)x_), y((f32)y_), z((f32)z_), w((f32)w_) { } | ||||||
| } | DqnV4::DqnV4(DqnV3 a, f32 w)                 :  x(a.x)   , y(a.y)    , z(a.z)    , w(w)       { } | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_4f(f32 x, f32 y, f32 z, f32 w) |  | ||||||
| { |  | ||||||
| 	DqnV4 result = {x, y, z, w}; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_4i(i32 x, i32 y, i32 z, i32 w) |  | ||||||
| { |  | ||||||
| 	DqnV4 result = DqnV4_4f((f32)x, (f32)y, (f32)z, (f32)w); |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnV4 DqnV4_V3(DqnV3 a, f32 w) |  | ||||||
| { |  | ||||||
| 	DqnV4 result; |  | ||||||
| 	result.xyz = a; |  | ||||||
| 	result.w   = w; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnV4 Arithmetic Implementation
 | // #DqnV4 Arithmetic Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| @ -3766,7 +3698,7 @@ DQN_FILE_SCOPE bool DqnV4_Equals(DqnV4 a, DqnV4 b) | |||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE DqnMat4 DqnMat4_Identity() | DQN_FILE_SCOPE DqnMat4 DqnMat4_Identity() | ||||||
| { | { | ||||||
| 	DqnMat4 result = {0}; | 	DqnMat4 result = {0, 0, 0, 0}; | ||||||
| 	result.e[0][0] = 1; | 	result.e[0][0] = 1; | ||||||
| 	result.e[1][1] = 1; | 	result.e[1][1] = 1; | ||||||
| 	result.e[2][2] = 1; | 	result.e[2][2] = 1; | ||||||
| @ -3809,7 +3741,7 @@ DQN_FILE_SCOPE DqnMat4 DqnMat4_Perspective(f32 fovYDegrees, f32 aspectRatio, f32 | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnMat4 DqnMat4_LookAt(DqnV3 eye, DqnV3 center, DqnV3 up) | DQN_FILE_SCOPE DqnMat4 DqnMat4_LookAt(DqnV3 eye, DqnV3 center, DqnV3 up) | ||||||
| { | { | ||||||
| 	DqnMat4 result = {0}; | 	DqnMat4 result = {0, 0, 0, 0}; | ||||||
| 
 | 
 | ||||||
| 	DqnV3 f = DqnV3_Normalise(DqnV3_Sub(eye, center)); | 	DqnV3 f = DqnV3_Normalise(DqnV3_Sub(eye, center)); | ||||||
| 	DqnV3 s = DqnV3_Normalise(DqnV3_Cross(up, f)); | 	DqnV3 s = DqnV3_Normalise(DqnV3_Cross(up, f)); | ||||||
| @ -3859,7 +3791,7 @@ DQN_FILE_SCOPE DqnMat4 DqnMat4_Rotate(f32 radians, f32 x, f32 y, f32 z) | |||||||
| 	f32 cosVal         = cosf(radians); | 	f32 cosVal         = cosf(radians); | ||||||
| 	f32 oneMinusCosVal = 1 - cosVal; | 	f32 oneMinusCosVal = 1 - cosVal; | ||||||
| 
 | 
 | ||||||
| 	DqnV3 axis = DqnV3_Normalise(DqnV3_3f(x, y, z)); | 	DqnV3 axis = DqnV3_Normalise(DqnV3(x, y, z)); | ||||||
| 
 | 
 | ||||||
| 	result.e[0][0] = (axis.x * axis.x * oneMinusCosVal) + cosVal; | 	result.e[0][0] = (axis.x * axis.x * oneMinusCosVal) + cosVal; | ||||||
| 	result.e[0][1] = (axis.x * axis.y * oneMinusCosVal) + (axis.z * sinVal); | 	result.e[0][1] = (axis.x * axis.y * oneMinusCosVal) + (axis.z * sinVal); | ||||||
| @ -3878,7 +3810,7 @@ DQN_FILE_SCOPE DqnMat4 DqnMat4_Rotate(f32 radians, f32 x, f32 y, f32 z) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnMat4 DqnMat4_Scale(f32 x, f32 y, f32 z) | DQN_FILE_SCOPE DqnMat4 DqnMat4_Scale(f32 x, f32 y, f32 z) | ||||||
| { | { | ||||||
| 	DqnMat4 result = {0}; | 	DqnMat4 result = {0, 0, 0, 0}; | ||||||
| 	result.e[0][0] = x; | 	result.e[0][0] = x; | ||||||
| 	result.e[1][1] = y; | 	result.e[1][1] = y; | ||||||
| 	result.e[2][2] = z; | 	result.e[2][2] = z; | ||||||
| @ -3888,7 +3820,7 @@ DQN_FILE_SCOPE DqnMat4 DqnMat4_Scale(f32 x, f32 y, f32 z) | |||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnMat4 DqnMat4_ScaleV3(DqnV3 scale) | DQN_FILE_SCOPE DqnMat4 DqnMat4_ScaleV3(DqnV3 scale) | ||||||
| { | { | ||||||
| 	DqnMat4 result = {0}; | 	DqnMat4 result = {0, 0, 0, 0}; | ||||||
| 	result.e[0][0] = scale.x; | 	result.e[0][0] = scale.x; | ||||||
| 	result.e[1][1] = scale.y; | 	result.e[1][1] = scale.y; | ||||||
| 	result.e[2][2] = scale.z; | 	result.e[2][2] = scale.z; | ||||||
| @ -3923,96 +3855,78 @@ DQN_FILE_SCOPE DqnV4 DqnMat4_MulV4(DqnMat4 a, DqnV4 b) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| // #DqnRect Init Implementation
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 |  | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_4f(f32 minX, f32 minY, f32 maxX, f32 maxY) |  | ||||||
| { |  | ||||||
| 	DqnRect result = {0}; |  | ||||||
| 	result.min     = DqnV2_2f(minX, minY); |  | ||||||
| 	result.max     = DqnV2_2f(maxX, maxY); |  | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_4i(i32 minX, i32 minY, i32 maxX, i32 maxY) |  | ||||||
| { |  | ||||||
| 	DqnRect result = {0}; |  | ||||||
| 	result.min     = DqnV2_2i(minX, minY); |  | ||||||
| 	result.max     = DqnV2_2i(maxX, maxY); |  | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_Init(DqnV2 origin, DqnV2 size) |  | ||||||
| { |  | ||||||
| 	DqnRect result = {0}; |  | ||||||
| 	result.min      = origin; |  | ||||||
| 	result.max      = DqnV2_Add(origin, size); |  | ||||||
| 
 |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // #DqnRect Implementation
 | // #DqnRect Implementation
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////
 | ||||||
| DQN_FILE_SCOPE void DqnRect_GetSize2f(DqnRect rect, f32 *width, f32 *height) | DqnRect::DqnRect() {} | ||||||
|  | DqnRect::DqnRect(DqnV2 origin, DqnV2 size) | ||||||
| { | { | ||||||
| 	*width  = rect.max.x - rect.min.x; | 	this->min = origin; | ||||||
| 	*height = rect.max.y - rect.min.y; | 	this->max = this->min + size; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE void DqnRect_GetSize2i(DqnRect rect, i32 *width, i32 *height) | DqnRect::DqnRect(f32 x, f32 y, f32 w, f32 h) | ||||||
| { | { | ||||||
| 	*width  = (i32)(rect.max.x - rect.min.x); | 	this->min = DqnV2(x, y); | ||||||
| 	*height = (i32)(rect.max.y - rect.min.y); | 	this->max = DqnV2(x + w, y + h); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnRect_GetSizeV2(DqnRect rect) | DqnRect::DqnRect(i32 x, i32 y, i32 w, i32 h) | ||||||
| { | { | ||||||
| 	f32 width     = rect.max.x - rect.min.x; | 	this->min = DqnV2(x, y); | ||||||
| 	f32 height    = rect.max.y - rect.min.y; | 	this->max = DqnV2(x + w, y + h); | ||||||
| 	DqnV2 result  = DqnV2_2f(width, height); | } | ||||||
|  | 
 | ||||||
|  | void DqnRect::GetSize(f32 *const width, f32 *const height) const | ||||||
|  | { | ||||||
|  | 	if (width)  *width  = this->max.x - this->min.x; | ||||||
|  | 	if (height) *height = this->max.y - this->min.y; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | DqnV2 DqnRect::GetSize() const | ||||||
|  | { | ||||||
|  | 	f32 width     = this->max.x - this->min.x; | ||||||
|  | 	f32 height    = this->max.y - this->min.y; | ||||||
|  | 	DqnV2 result  = DqnV2(width, height); | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnV2 DqnRect_GetCentre(DqnRect rect) | DqnV2 DqnRect::GetCenter() const | ||||||
| { | { | ||||||
| 	f32 sumX  = rect.min.x + rect.max.x; | 	f32 sumX     = this->min.x + this->max.x; | ||||||
| 	f32 sumY  = rect.min.y + rect.max.y; | 	f32 sumY     = this->min.y + this->max.y; | ||||||
| 	DqnV2 result = DqnV2_Scalef(DqnV2_2f(sumX, sumY), 0.5f); | 	DqnV2 result = DqnV2(sumX, sumY) * 0.5f; | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_ClipRect(DqnRect rect, DqnRect clip) | DqnRect DqnRect::ClipRect(const DqnRect clip) const | ||||||
| { | { | ||||||
| 	DqnRect result = {0}; | 	DqnV2 clipSize = clip.GetSize(); | ||||||
| 	DqnV2 clipSize = DqnRect_GetSizeV2(clip); |  | ||||||
| 
 | 
 | ||||||
| 	result.max.x = DQN_MIN(rect.max.x, clipSize.w); | 	DqnRect result; | ||||||
| 	result.max.y = DQN_MIN(rect.max.y, clipSize.h); | 	result.max.x = DQN_MIN(this->max.x, clipSize.w); | ||||||
| 	result.min.x = DQN_MAX(clip.min.x, rect.min.x); | 	result.max.y = DQN_MIN(this->max.y, clipSize.h); | ||||||
| 	result.min.y = DQN_MAX(clip.min.y, rect.min.y); | 	result.min.x = DQN_MAX(clip.min.x, this->min.x); | ||||||
|  | 	result.min.y = DQN_MAX(clip.min.y, this->min.y); | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE DqnRect DqnRect_Move(DqnRect rect, DqnV2 shift) | DqnRect DqnRect::Move(const DqnV2 shift) const | ||||||
| { | { | ||||||
| 	DqnRect result = {0}; | 	DqnRect result; | ||||||
| 	result.min       = DqnV2_Add(rect.min, shift); | 	result.min = this->min + shift; | ||||||
| 	result.max       = DqnV2_Add(rect.max, shift); | 	result.max = this->max + shift; | ||||||
| 
 |  | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DQN_FILE_SCOPE bool DqnRect_ContainsP(DqnRect rect, DqnV2 p) | bool DqnRect::ContainsP(const DqnV2 p) const | ||||||
| { | { | ||||||
| 	bool outsideOfRectX = false; | 	bool outsideOfRectX = false; | ||||||
| 	if (p.x < rect.min.x || p.x > rect.max.w) | 	if (p.x < this->min.x || p.x > this->max.w) | ||||||
| 		outsideOfRectX = true; | 		outsideOfRectX = true; | ||||||
| 
 | 
 | ||||||
| 	bool outsideOfRectY = false; | 	bool outsideOfRectY = false; | ||||||
| 	if (p.y < rect.min.y || p.y > rect.max.h) | 	if (p.y < this->min.y || p.y > this->max.h) | ||||||
| 		outsideOfRectY = true; | 		outsideOfRectY = true; | ||||||
| 
 | 
 | ||||||
| 	if (outsideOfRectX || outsideOfRectY) return false; | 	if (outsideOfRectX || outsideOfRectY) return false; | ||||||
|  | |||||||
| @ -83,13 +83,13 @@ void HandmadeMathTestInternal() | |||||||
| 	if (1) | 	if (1) | ||||||
| 	{ | 	{ | ||||||
| 		hmm_vec3 hmmVec       = HMM_Vec3i(1, 2, 3); | 		hmm_vec3 hmmVec       = HMM_Vec3i(1, 2, 3); | ||||||
| 		DqnV3 dqnVec          = DqnV3_3i(1, 2, 3); | 		DqnV3 dqnVec          = DqnV3(1, 2, 3); | ||||||
| 		DqnMat4 dqnTranslate  = DqnMat4_Translate3f(dqnVec.x, dqnVec.y, dqnVec.z); | 		DqnMat4 dqnTranslate  = DqnMat4_Translate3f(dqnVec.x, dqnVec.y, dqnVec.z); | ||||||
| 		hmm_mat4 hmmTranslate = HMM_Translate(hmmVec); | 		hmm_mat4 hmmTranslate = HMM_Translate(hmmVec); | ||||||
| 		HandmadeMathVerifyMat4(dqnTranslate, hmmTranslate); | 		HandmadeMathVerifyMat4(dqnTranslate, hmmTranslate); | ||||||
| 
 | 
 | ||||||
| 		hmm_vec3 hmmAxis      = HMM_Vec3(0.5f, 0.2f, 0.7f); | 		hmm_vec3 hmmAxis      = HMM_Vec3(0.5f, 0.2f, 0.7f); | ||||||
| 		DqnV3 dqnAxis         = DqnV3_3f(0.5f, 0.2f, 0.7f); | 		DqnV3 dqnAxis         = DqnV3(0.5f, 0.2f, 0.7f); | ||||||
| 		f32 rotationInDegrees = 80.0f; | 		f32 rotationInDegrees = 80.0f; | ||||||
| 
 | 
 | ||||||
| 		DqnMat4 dqnRotate = DqnMat4_Rotate(DQN_DEGREES_TO_RADIANS(rotationInDegrees), dqnAxis.x, | 		DqnMat4 dqnRotate = DqnMat4_Rotate(DQN_DEGREES_TO_RADIANS(rotationInDegrees), dqnAxis.x, | ||||||
| @ -110,7 +110,7 @@ void HandmadeMathTestInternal() | |||||||
| 		// Test Mat4 * MulV4
 | 		// Test Mat4 * MulV4
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV4 dqnV4    = DqnV4_4f(1, 2, 3, 4); | 			DqnV4 dqnV4    = DqnV4(1, 2, 3, 4); | ||||||
| 			hmm_vec4 hmmV4 = HMM_Vec4(1, 2, 3, 4); | 			hmm_vec4 hmmV4 = HMM_Vec4(1, 2, 3, 4); | ||||||
| 
 | 
 | ||||||
| 			DqnV4 dqnResult    = DqnMat4_MulV4(dqnTSMatrix, dqnV4); | 			DqnV4 dqnResult    = DqnMat4_MulV4(dqnTSMatrix, dqnV4); | ||||||
| @ -703,7 +703,7 @@ void DqnVX_Test() | |||||||
| 		// V2 Creating
 | 		// V2 Creating
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 vec = DqnV2_2f(5.5f, 5.0f); | 			DqnV2 vec = DqnV2(5.5f, 5.0f); | ||||||
| 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f); | 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f); | ||||||
| 			DQN_ASSERT(vec.w == 5.5f && vec.h == 5.0f); | 			DQN_ASSERT(vec.w == 5.5f && vec.h == 5.0f); | ||||||
| 			LogSuccess("DqnV2(): Creating"); | 			LogSuccess("DqnV2(): Creating"); | ||||||
| @ -712,7 +712,7 @@ void DqnVX_Test() | |||||||
| 		// V2 with 2 integers
 | 		// V2 with 2 integers
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 vec = DqnV2_2i(3, 5); | 			DqnV2 vec = DqnV2(3, 5); | ||||||
| 			DQN_ASSERT(vec.x == 3 && vec.y == 5.0f); | 			DQN_ASSERT(vec.x == 3 && vec.y == 5.0f); | ||||||
| 			DQN_ASSERT(vec.w == 3 && vec.h == 5.0f); | 			DQN_ASSERT(vec.w == 3 && vec.h == 5.0f); | ||||||
| 			LogSuccess("DqnV2(): with 2 integers"); | 			LogSuccess("DqnV2(): with 2 integers"); | ||||||
| @ -721,25 +721,25 @@ void DqnVX_Test() | |||||||
| 		// V2 Arithmetic
 | 		// V2 Arithmetic
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 vecA = DqnV2_2f(5, 10); | 			DqnV2 vecA = DqnV2(5, 10); | ||||||
| 			DqnV2 vecB = DqnV2_2i(2, 3); | 			DqnV2 vecB = DqnV2(2, 3); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(vecA, vecB) == false); | 			DQN_ASSERT(DqnV2_Equals(vecA, vecB) == false); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(vecA, DqnV2_2f(5, 10)) == true); | 			DQN_ASSERT(DqnV2_Equals(vecA, DqnV2(5, 10)) == true); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(vecB, DqnV2_2f(2, 3)) == true); | 			DQN_ASSERT(DqnV2_Equals(vecB, DqnV2(2, 3)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 result = DqnV2_Add(vecA, DqnV2_2f(5, 10)); | 			DqnV2 result = DqnV2_Add(vecA, DqnV2(5, 10)); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(result, DqnV2_2f(10, 20)) == true); | 			DQN_ASSERT(DqnV2_Equals(result, DqnV2(10, 20)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV2_Sub(result, DqnV2_2f(5, 10)); | 			result = DqnV2_Sub(result, DqnV2(5, 10)); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(result, DqnV2_2f(5, 10)) == true); | 			DQN_ASSERT(DqnV2_Equals(result, DqnV2(5, 10)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV2_Scalef(result, 5); | 			result = DqnV2_Scalef(result, 5); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(result, DqnV2_2f(25, 50)) == true); | 			DQN_ASSERT(DqnV2_Equals(result, DqnV2(25, 50)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV2_Hadamard(result, DqnV2_2f(10, 0.5f)); | 			result = DqnV2_Hadamard(result, DqnV2(10.0f, 0.5f)); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(result, DqnV2_2f(250, 25)) == true); | 			DQN_ASSERT(DqnV2_Equals(result, DqnV2(250, 25)) == true); | ||||||
| 
 | 
 | ||||||
| 			f32 dotResult = DqnV2_Dot(DqnV2_2f(5, 10), DqnV2_2f(3, 4)); | 			f32 dotResult = DqnV2_Dot(DqnV2(5, 10), DqnV2(3, 4)); | ||||||
| 			DQN_ASSERT(dotResult == 55); | 			DQN_ASSERT(dotResult == 55); | ||||||
| 			LogSuccess("DqnV2(): Arithmetic"); | 			LogSuccess("DqnV2(): Arithmetic"); | ||||||
| 		} | 		} | ||||||
| @ -747,29 +747,29 @@ void DqnVX_Test() | |||||||
| 		// Test operator overloading
 | 		// Test operator overloading
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 vecA = DqnV2_2f(5, 10); | 			DqnV2 vecA = DqnV2(5, 10); | ||||||
| 			DqnV2 vecB = DqnV2_2i(2, 3); | 			DqnV2 vecB = DqnV2(2, 3); | ||||||
| 			DQN_ASSERT((vecA == vecB) == false); | 			DQN_ASSERT((vecA == vecB) == false); | ||||||
| 			DQN_ASSERT((vecA == DqnV2_2f(5, 10)) == true); | 			DQN_ASSERT((vecA == DqnV2(5, 10)) == true); | ||||||
| 			DQN_ASSERT((vecB == DqnV2_2f(2, 3)) == true); | 			DQN_ASSERT((vecB == DqnV2(2, 3)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 result = vecA + DqnV2_2f(5, 10); | 			DqnV2 result = vecA + DqnV2(5, 10); | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(10, 20)) == true); | 			DQN_ASSERT((result == DqnV2(10, 20)) == true); | ||||||
| 
 | 
 | ||||||
| 			result -= DqnV2_2f(5, 10); | 			result -= DqnV2(5, 10); | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(5, 10)) == true); | 			DQN_ASSERT((result == DqnV2(5, 10)) == true); | ||||||
| 
 | 
 | ||||||
| 			result *= 5; | 			result *= 5; | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(25, 50)) == true); | 			DQN_ASSERT((result == DqnV2(25, 50)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result * DqnV2_2f(10, 0.5f); | 			result = result * DqnV2(10.0f, 0.5f); | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(250, 25)) == true); | 			DQN_ASSERT((result == DqnV2(250, 25)) == true); | ||||||
| 
 | 
 | ||||||
| 			result += DqnV2_2f(1, 1); | 			result += DqnV2(1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(251, 26)) == true); | 			DQN_ASSERT((result == DqnV2(251, 26)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result - DqnV2_2f(1, 1); | 			result = result - DqnV2(1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV2_2f(250, 25)) == true); | 			DQN_ASSERT((result == DqnV2(250, 25)) == true); | ||||||
| 			LogSuccess("DqnV2(): operator overloading"); | 			LogSuccess("DqnV2(): operator overloading"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| @ -777,8 +777,8 @@ void DqnVX_Test() | |||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			const f32 EPSILON = 0.001f; | 			const f32 EPSILON = 0.001f; | ||||||
| 			DqnV2 a           = DqnV2_2f(0, 0); | 			DqnV2 a           = DqnV2(0, 0); | ||||||
| 			DqnV2 b           = DqnV2_2f(3, 4); | 			DqnV2 b           = DqnV2(3, 4); | ||||||
| 
 | 
 | ||||||
| 			f32 lengthSq = DqnV2_LengthSquared(a, b); | 			f32 lengthSq = DqnV2_LengthSquared(a, b); | ||||||
| 			DQN_ASSERT(lengthSq == 25); | 			DQN_ASSERT(lengthSq == 25); | ||||||
| @ -796,7 +796,7 @@ void DqnVX_Test() | |||||||
| 			DQN_ASSERT_MSG(diffNormY < EPSILON, "normalised.y: %f, normY: %f\n", normalised.y, | 			DQN_ASSERT_MSG(diffNormY < EPSILON, "normalised.y: %f, normY: %f\n", normalised.y, | ||||||
| 			               normY); | 			               normY); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 c = DqnV2_2f(3.5f, 8.0f); | 			DqnV2 c = DqnV2(3.5f, 8.0f); | ||||||
| 			DQN_ASSERT(DqnV2_Overlaps(b, c) == true); | 			DQN_ASSERT(DqnV2_Overlaps(b, c) == true); | ||||||
| 			DQN_ASSERT(DqnV2_Overlaps(b, a) == false); | 			DQN_ASSERT(DqnV2_Overlaps(b, a) == false); | ||||||
| 
 | 
 | ||||||
| @ -809,8 +809,8 @@ void DqnVX_Test() | |||||||
| 		// V2 ConstrainToRatio
 | 		// V2 ConstrainToRatio
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 ratio  = DqnV2_2f(16, 9); | 			DqnV2 ratio  = DqnV2(16, 9); | ||||||
| 			DqnV2 dim    = DqnV2_2f(2000, 1080); | 			DqnV2 dim    = DqnV2(2000, 1080); | ||||||
| 			DqnV2 result = DqnV2_ConstrainToRatio(dim, ratio); | 			DqnV2 result = DqnV2_ConstrainToRatio(dim, ratio); | ||||||
| 			DQN_ASSERT(result.w == 1920 && result.h == 1080); | 			DQN_ASSERT(result.w == 1920 && result.h == 1080); | ||||||
| 			LogSuccess("DqnV2->ConstrainToRatio()"); | 			LogSuccess("DqnV2->ConstrainToRatio()"); | ||||||
| @ -823,7 +823,7 @@ void DqnVX_Test() | |||||||
| 		// V3i Creating
 | 		// V3i Creating
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV3 vec = DqnV3_3f(5.5f, 5.0f, 5.875f); | 			DqnV3 vec = DqnV3(5.5f, 5.0f, 5.875f); | ||||||
| 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f && vec.z == 5.875f); | 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f && vec.z == 5.875f); | ||||||
| 			DQN_ASSERT(vec.r == 5.5f && vec.g == 5.0f && vec.b == 5.875f); | 			DQN_ASSERT(vec.r == 5.5f && vec.g == 5.0f && vec.b == 5.875f); | ||||||
| 			LogSuccess("DqnV3(): Creating"); | 			LogSuccess("DqnV3(): Creating"); | ||||||
| @ -832,7 +832,7 @@ void DqnVX_Test() | |||||||
| 		// V3i Creating
 | 		// V3i Creating
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV3 vec = DqnV3_3i(3, 4, 5); | 			DqnV3 vec = DqnV3(3, 4, 5); | ||||||
| 			DQN_ASSERT(vec.x == 3 && vec.y == 4 && vec.z == 5); | 			DQN_ASSERT(vec.x == 3 && vec.y == 4 && vec.z == 5); | ||||||
| 			DQN_ASSERT(vec.r == 3 && vec.g == 4 && vec.b == 5); | 			DQN_ASSERT(vec.r == 3 && vec.g == 4 && vec.b == 5); | ||||||
| 			LogSuccess("DqnV3(): Creating"); | 			LogSuccess("DqnV3(): Creating"); | ||||||
| @ -841,58 +841,58 @@ void DqnVX_Test() | |||||||
| 		// V3 Arithmetic
 | 		// V3 Arithmetic
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV3 vecA = DqnV3_3f(5, 10, 15); | 			DqnV3 vecA = DqnV3(5, 10, 15); | ||||||
| 			DqnV3 vecB = DqnV3_3f(2, 3, 6); | 			DqnV3 vecB = DqnV3(2, 3, 6); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(vecA, vecB) == false); | 			DQN_ASSERT(DqnV3_Equals(vecA, vecB) == false); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(vecA, DqnV3_3f(5, 10, 15)) == true); | 			DQN_ASSERT(DqnV3_Equals(vecA, DqnV3(5, 10, 15)) == true); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(vecB, DqnV3_3f(2, 3, 6)) == true); | 			DQN_ASSERT(DqnV3_Equals(vecB, DqnV3(2, 3, 6)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV3 result = DqnV3_Add(vecA, DqnV3_3f(5, 10, 15)); | 			DqnV3 result = DqnV3_Add(vecA, DqnV3(5, 10, 15)); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(result, DqnV3_3f(10, 20, 30)) == true); | 			DQN_ASSERT(DqnV3_Equals(result, DqnV3(10, 20, 30)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV3_Sub(result, DqnV3_3f(5, 10, 15)); | 			result = DqnV3_Sub(result, DqnV3(5, 10, 15)); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(result, DqnV3_3f(5, 10, 15)) == true); | 			DQN_ASSERT(DqnV3_Equals(result, DqnV3(5, 10, 15)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV3_Scalef(result, 5); | 			result = DqnV3_Scalef(result, 5); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(result, DqnV3_3f(25, 50, 75)) == true); | 			DQN_ASSERT(DqnV3_Equals(result, DqnV3(25, 50, 75)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV3_Hadamard(result, DqnV3_3f(10.0f, 0.5f, 10.0f)); | 			result = DqnV3_Hadamard(result, DqnV3(10.0f, 0.5f, 10.0f)); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(result, DqnV3_3f(250, 25, 750)) == true); | 			DQN_ASSERT(DqnV3_Equals(result, DqnV3(250, 25, 750)) == true); | ||||||
| 
 | 
 | ||||||
| 			f32 dotResult = DqnV3_Dot(DqnV3_3f(5, 10, 2), DqnV3_3f(3, 4, 6)); | 			f32 dotResult = DqnV3_Dot(DqnV3(5, 10, 2), DqnV3(3, 4, 6)); | ||||||
| 			DQN_ASSERT(dotResult == 67); | 			DQN_ASSERT(dotResult == 67); | ||||||
| 
 | 
 | ||||||
| 			DqnV3 cross = DqnV3_Cross(vecA, vecB); | 			DqnV3 cross = DqnV3_Cross(vecA, vecB); | ||||||
| 			DQN_ASSERT(DqnV3_Equals(cross, DqnV3_3f(15, 0, -5)) == true); | 			DQN_ASSERT(DqnV3_Equals(cross, DqnV3(15, 0, -5)) == true); | ||||||
| 			LogSuccess("DqnV3(): Arithmetic"); | 			LogSuccess("DqnV3(): Arithmetic"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// V3 More Arithmetic
 | 		// V3 More Arithmetic
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV3 vecA = DqnV3_3f(5, 10, 15); | 			DqnV3 vecA = DqnV3(5, 10, 15); | ||||||
| 			DqnV3 vecB = DqnV3_3f(2, 3, 6); | 			DqnV3 vecB = DqnV3(2, 3, 6); | ||||||
| 			DQN_ASSERT((vecA == vecB) == false); | 			DQN_ASSERT((vecA == vecB) == false); | ||||||
| 			DQN_ASSERT((vecA == DqnV3_3f(5, 10, 15)) == true); | 			DQN_ASSERT((vecA == DqnV3(5, 10, 15)) == true); | ||||||
| 			DQN_ASSERT((vecB == DqnV3_3f(2, 3, 6)) == true); | 			DQN_ASSERT((vecB == DqnV3(2, 3, 6)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV3 result = vecA + DqnV3_3f(5, 10, 15); | 			DqnV3 result = vecA + DqnV3(5, 10, 15); | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(10, 20, 30)) == true); | 			DQN_ASSERT((result == DqnV3(10, 20, 30)) == true); | ||||||
| 
 | 
 | ||||||
| 			result -= DqnV3_3f(5, 10, 15); | 			result -= DqnV3(5, 10, 15); | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(5, 10, 15)) == true); | 			DQN_ASSERT((result == DqnV3(5, 10, 15)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result * 5; | 			result = result * 5; | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(25, 50, 75)) == true); | 			DQN_ASSERT((result == DqnV3(25, 50, 75)) == true); | ||||||
| 
 | 
 | ||||||
| 			result *= DqnV3_3f(10.0f, 0.5f, 10.0f); | 			result *= DqnV3(10.0f, 0.5f, 10.0f); | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(250, 25, 750)) == true); | 			DQN_ASSERT((result == DqnV3(250, 25, 750)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result - DqnV3_3f(1, 1, 1); | 			result = result - DqnV3(1, 1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(249, 24, 749)) == true); | 			DQN_ASSERT((result == DqnV3(249, 24, 749)) == true); | ||||||
| 
 | 
 | ||||||
| 			result += DqnV3_3f(1, 1, 1); | 			result += DqnV3(1, 1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV3_3f(250, 25, 750)) == true); | 			DQN_ASSERT((result == DqnV3(250, 25, 750)) == true); | ||||||
| 			LogSuccess("DqnV3(): More Arithmetic"); | 			LogSuccess("DqnV3(): More Arithmetic"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @ -904,7 +904,7 @@ void DqnVX_Test() | |||||||
| 		// V4 Creating
 | 		// V4 Creating
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV4 vec = DqnV4_4f(5.5f, 5.0f, 5.875f, 5.928f); | 			DqnV4 vec = DqnV4(5.5f, 5.0f, 5.875f, 5.928f); | ||||||
| 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f && vec.z == 5.875f && vec.w == 5.928f); | 			DQN_ASSERT(vec.x == 5.5f && vec.y == 5.0f && vec.z == 5.875f && vec.w == 5.928f); | ||||||
| 			DQN_ASSERT(vec.r == 5.5f && vec.g == 5.0f && vec.b == 5.875f && vec.a == 5.928f); | 			DQN_ASSERT(vec.r == 5.5f && vec.g == 5.0f && vec.b == 5.875f && vec.a == 5.928f); | ||||||
| 			LogSuccess("DqnV4(): Creating"); | 			LogSuccess("DqnV4(): Creating"); | ||||||
| @ -913,7 +913,7 @@ void DqnVX_Test() | |||||||
| 		// V4i Creating
 | 		// V4i Creating
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV4 vec = DqnV4_4i(3, 4, 5, 6); | 			DqnV4 vec = DqnV4(3, 4, 5, 6); | ||||||
| 			DQN_ASSERT(vec.x == 3 && vec.y == 4 && vec.z == 5 && vec.w == 6); | 			DQN_ASSERT(vec.x == 3 && vec.y == 4 && vec.z == 5 && vec.w == 6); | ||||||
| 			DQN_ASSERT(vec.r == 3 && vec.g == 4 && vec.b == 5 && vec.a == 6); | 			DQN_ASSERT(vec.r == 3 && vec.g == 4 && vec.b == 5 && vec.a == 6); | ||||||
| 			LogSuccess("DqnV4(): Integer ctor creating"); | 			LogSuccess("DqnV4(): Integer ctor creating"); | ||||||
| @ -922,25 +922,25 @@ void DqnVX_Test() | |||||||
| 		// V4 Arithmetic
 | 		// V4 Arithmetic
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV4 vecA = DqnV4_4f(5, 10, 15, 20); | 			DqnV4 vecA = DqnV4(5, 10, 15, 20); | ||||||
| 			DqnV4 vecB = DqnV4_4i(2, 3, 6, 8); | 			DqnV4 vecB = DqnV4(2, 3, 6, 8); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(vecA, vecB) == false); | 			DQN_ASSERT(DqnV4_Equals(vecA, vecB) == false); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(vecA, DqnV4_4f(5, 10, 15, 20)) == true); | 			DQN_ASSERT(DqnV4_Equals(vecA, DqnV4(5, 10, 15, 20)) == true); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(vecB, DqnV4_4f(2, 3, 6, 8)) == true); | 			DQN_ASSERT(DqnV4_Equals(vecB, DqnV4(2, 3, 6, 8)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV4 result = DqnV4_Add(vecA, DqnV4_4f(5, 10, 15, 20)); | 			DqnV4 result = DqnV4_Add(vecA, DqnV4(5, 10, 15, 20)); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(result, DqnV4_4f(10, 20, 30, 40)) == true); | 			DQN_ASSERT(DqnV4_Equals(result, DqnV4(10, 20, 30, 40)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV4_Sub(result, DqnV4_4f(5, 10, 15, 20)); | 			result = DqnV4_Sub(result, DqnV4(5, 10, 15, 20)); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(result, DqnV4_4f(5, 10, 15, 20)) == true); | 			DQN_ASSERT(DqnV4_Equals(result, DqnV4(5, 10, 15, 20)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV4_Scalef(result, 5); | 			result = DqnV4_Scalef(result, 5); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(result, DqnV4_4f(25, 50, 75, 100)) == true); | 			DQN_ASSERT(DqnV4_Equals(result, DqnV4(25, 50, 75, 100)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = DqnV4_Hadamard(result, DqnV4_4f(10, 0.5f, 10, 0.25f)); | 			result = DqnV4_Hadamard(result, DqnV4(10.0f, 0.5f, 10.0f, 0.25f)); | ||||||
| 			DQN_ASSERT(DqnV4_Equals(result, DqnV4_4f(250, 25, 750, 25)) == true); | 			DQN_ASSERT(DqnV4_Equals(result, DqnV4(250, 25, 750, 25)) == true); | ||||||
| 
 | 
 | ||||||
| 			f32 dotResult = DqnV4_Dot(DqnV4_4f(5, 10, 2, 8), DqnV4_4f(3, 4, 6, 5)); | 			f32 dotResult = DqnV4_Dot(DqnV4(5, 10, 2, 8), DqnV4(3, 4, 6, 5)); | ||||||
| 			DQN_ASSERT(dotResult == 107); | 			DQN_ASSERT(dotResult == 107); | ||||||
| 			LogSuccess("DqnV4(): Arithmetic"); | 			LogSuccess("DqnV4(): Arithmetic"); | ||||||
| 		} | 		} | ||||||
| @ -948,29 +948,29 @@ void DqnVX_Test() | |||||||
| 		// V4 More Arthmetic
 | 		// V4 More Arthmetic
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV4 vecA = DqnV4_4f(5, 10, 15, 20); | 			DqnV4 vecA = DqnV4(5, 10, 15, 20); | ||||||
| 			DqnV4 vecB = DqnV4_4i(2, 3, 6, 8); | 			DqnV4 vecB = DqnV4(2, 3, 6, 8); | ||||||
| 			DQN_ASSERT((vecA == vecB) == false); | 			DQN_ASSERT((vecA == vecB) == false); | ||||||
| 			DQN_ASSERT((vecA == DqnV4_4f(5, 10, 15, 20)) == true); | 			DQN_ASSERT((vecA == DqnV4(5, 10, 15, 20)) == true); | ||||||
| 			DQN_ASSERT((vecB == DqnV4_4f(2, 3, 6, 8)) == true); | 			DQN_ASSERT((vecB == DqnV4(2, 3, 6, 8)) == true); | ||||||
| 
 | 
 | ||||||
| 			DqnV4 result = vecA + DqnV4_4f(5, 10, 15, 20); | 			DqnV4 result = vecA + DqnV4(5, 10, 15, 20); | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(10, 20, 30, 40)) == true); | 			DQN_ASSERT((result == DqnV4(10, 20, 30, 40)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result - DqnV4_4f(5, 10, 15, 20); | 			result = result - DqnV4(5, 10, 15, 20); | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(5, 10, 15, 20)) == true); | 			DQN_ASSERT((result == DqnV4(5, 10, 15, 20)) == true); | ||||||
| 
 | 
 | ||||||
| 			result = result * 5; | 			result = result * 5; | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(25, 50, 75, 100)) == true); | 			DQN_ASSERT((result == DqnV4(25, 50, 75, 100)) == true); | ||||||
| 
 | 
 | ||||||
| 			result *= DqnV4_4f(10, 0.5f, 10, 0.25f); | 			result *= DqnV4(10.0f, 0.5f, 10.0f, 0.25f); | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(250, 25, 750, 25)) == true); | 			DQN_ASSERT((result == DqnV4(250, 25, 750, 25)) == true); | ||||||
| 
 | 
 | ||||||
| 			result += DqnV4_4f(1, 1, 1, 1); | 			result += DqnV4(1, 1, 1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(251, 26, 751, 26)) == true); | 			DQN_ASSERT((result == DqnV4(251, 26, 751, 26)) == true); | ||||||
| 
 | 
 | ||||||
| 			result -= DqnV4_4f(1, 1, 1, 1); | 			result -= DqnV4(1, 1, 1, 1); | ||||||
| 			DQN_ASSERT((result == DqnV4_4f(250, 25, 750, 25)) == true); | 			DQN_ASSERT((result == DqnV4(250, 25, 750, 25)) == true); | ||||||
| 			LogSuccess("DqnV4(): More Arthmetic"); | 			LogSuccess("DqnV4(): More Arthmetic"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @ -984,17 +984,21 @@ void DqnRect_Test() | |||||||
| 		// Test rect init functions
 | 		// Test rect init functions
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnRect rect4f = DqnRect_4f(1.1f, 2.2f, 3.3f, 4.4f); | 			DqnRect rect4f = DqnRect(1.1f, 2.2f, 3.3f, 4.4f); | ||||||
| 			DqnRect rect4i = DqnRect_4i(1, 2, 3, 4); | 			DqnRect rect4i = DqnRect(1, 2, 3, 4); | ||||||
| 
 | 
 | ||||||
| 			DQN_ASSERT(rect4i.min.x == 1 && rect4i.min.y == 2); | 			DQN_ASSERT(rect4i.min.x == 1 && rect4i.min.y == 2); | ||||||
| 			DQN_ASSERT(rect4i.max.x == 3 && rect4i.max.y == 4); | 			DQN_ASSERT(rect4i.max.x == 4 && rect4i.max.y == 6); | ||||||
| 			DQN_ASSERT(rect4f.min.x == 1.1f && rect4f.min.y == 2.2f); |  | ||||||
| 			DQN_ASSERT(rect4f.max.x == 3.3f && rect4f.max.y == 4.4f); |  | ||||||
| 
 | 
 | ||||||
| 			DqnRect rect = DqnRect_Init(DqnV2_2f(-10, -10), DqnV2_2f(20, 20)); | 			const f32 EPSILON = 0.001f; | ||||||
| 			DQN_ASSERT(DqnV2_Equals(rect.min, DqnV2_2f(-10, -10))); | 			f32 diffMaxX      = rect4f.max.x - 4.4f; | ||||||
| 			DQN_ASSERT(DqnV2_Equals(rect.max, DqnV2_2f(10, 10))); | 			f32 diffMaxY      = rect4f.max.y - 6.6f; | ||||||
|  | 			DQN_ASSERT(rect4f.min.x == 1.1f && rect4f.min.y == 2.2f); | ||||||
|  | 			DQN_ASSERT(DQN_ABS(diffMaxX) < EPSILON && DQN_ABS(diffMaxY) < EPSILON); | ||||||
|  | 
 | ||||||
|  | 			DqnRect rect = DqnRect(-10, -10, 20, 20); | ||||||
|  | 			DQN_ASSERT(DqnV2_Equals(rect.min, DqnV2(-10, -10))); | ||||||
|  | 			DQN_ASSERT(DqnV2_Equals(rect.max, DqnV2(10, 10))); | ||||||
| 			LogSuccess("DqnRect(): Test rect init functions"); | 			LogSuccess("DqnRect(): Test rect init functions"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| @ -1004,39 +1008,28 @@ void DqnRect_Test() | |||||||
| 			// Test float rect
 | 			// Test float rect
 | ||||||
| 			if (1) | 			if (1) | ||||||
| 			{ | 			{ | ||||||
| 				DqnRect rect = DqnRect_Init(DqnV2_2f(-10, -10), DqnV2_2f(20, 20)); | 				DqnRect rect = DqnRect(DqnV2(-10, -10), DqnV2(20, 20)); | ||||||
| 
 | 
 | ||||||
| 				f32 width, height; | 				f32 width, height; | ||||||
| 				DqnRect_GetSize2f(rect, &width, &height); | 				rect.GetSize(&width, &height); | ||||||
| 				DQN_ASSERT(width == 20); | 				DQN_ASSERT(width == 20); | ||||||
| 				DQN_ASSERT(height == 20); | 				DQN_ASSERT(height == 20); | ||||||
| 
 | 
 | ||||||
| 				DqnV2 dim = DqnRect_GetSizeV2(rect); | 				DqnV2 dim = rect.GetSize(); | ||||||
| 				DQN_ASSERT(DqnV2_Equals(dim, DqnV2_2f(20, 20))); | 				DQN_ASSERT(DqnV2_Equals(dim, DqnV2(20, 20))); | ||||||
| 				LogSuccess("DqnRect->GetSize(): Test float rect"); | 				LogSuccess("DqnRect->GetSize(): Test float rect"); | ||||||
| 			} | 			} | ||||||
| 
 |  | ||||||
| 			// Test rect with float values and GetSize as 2 integers
 |  | ||||||
| 			if (1) |  | ||||||
| 			{ |  | ||||||
| 				DqnRect rect = DqnRect_Init(DqnV2_2f(-10.5f, -10.5f), DqnV2_2f(20.5f, 20.5f)); |  | ||||||
| 				i32 width, height; |  | ||||||
| 				DqnRect_GetSize2i(rect, &width, &height); |  | ||||||
| 				DQN_ASSERT(width == 20); |  | ||||||
| 				DQN_ASSERT(height == 20); |  | ||||||
| 				LogSuccess("DqnRect->GetSize(): Test rect with float values and GetSize as 2 integers"); |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Test rect get centre
 | 		// Test rect get centre
 | ||||||
| 		DqnRect rect     = DqnRect_Init(DqnV2_2f(-10, -10), DqnV2_2f(20, 20)); | 		DqnRect rect     = DqnRect(DqnV2(-10, -10), DqnV2(20, 20)); | ||||||
| 		DqnV2 rectCenter = DqnRect_GetCentre(rect); | 		DqnV2 rectCenter = rect.GetCenter(); | ||||||
| 		DQN_ASSERT(DqnV2_Equals(rectCenter, DqnV2_2f(0, 0))); | 		DQN_ASSERT(DqnV2_Equals(rectCenter, DqnV2(0, 0))); | ||||||
| 		LogSuccess("DqnRect->GetCentre()"); | 		LogSuccess("DqnRect->GetCentre()"); | ||||||
| 
 | 
 | ||||||
| 		// Test clipping rect get centre
 | 		// Test clipping rect get centre
 | ||||||
| 		DqnRect clipRect   = DqnRect_4i(-15, -15, 10, 10); | 		DqnRect clipRect   = DqnRect(-15, -15, 10, 10); | ||||||
| 		DqnRect clipResult = DqnRect_ClipRect(rect, clipRect); | 		DqnRect clipResult = rect.ClipRect(clipRect); | ||||||
| 		DQN_ASSERT(clipResult.min.x == -10 && clipResult.min.y == -10); | 		DQN_ASSERT(clipResult.min.x == -10 && clipResult.min.y == -10); | ||||||
| 		DQN_ASSERT(clipResult.max.x == 10 && clipResult.max.y == 10); | 		DQN_ASSERT(clipResult.max.x == 10 && clipResult.max.y == 10); | ||||||
| 		LogSuccess("DqnRect->ClipRect()"); | 		LogSuccess("DqnRect->ClipRect()"); | ||||||
| @ -1044,29 +1037,29 @@ void DqnRect_Test() | |||||||
| 		// Test shifting rect
 | 		// Test shifting rect
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnRect shiftedRect = DqnRect_Move(rect, DqnV2_2f(10, 0)); | 			DqnRect shiftedRect = rect.Move(DqnV2(10, 0)); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(shiftedRect.min, DqnV2_2f(0, -10))); | 			DQN_ASSERT(DqnV2_Equals(shiftedRect.min, DqnV2(0, -10))); | ||||||
| 			DQN_ASSERT(DqnV2_Equals(shiftedRect.max, DqnV2_2f(20, 10))); | 			DQN_ASSERT(DqnV2_Equals(shiftedRect.max, DqnV2(20, 10))); | ||||||
| 
 | 
 | ||||||
| 			// Ensure dimensions have remained the same
 | 			// Ensure dimensions have remained the same
 | ||||||
| 			if (1) | 			if (1) | ||||||
| 			{ | 			{ | ||||||
| 				f32 width, height; | 				f32 width, height; | ||||||
| 				DqnRect_GetSize2f(shiftedRect, &width, &height); | 				shiftedRect.GetSize(&width, &height); | ||||||
| 				DQN_ASSERT(width == 20); | 				DQN_ASSERT(width == 20); | ||||||
| 				DQN_ASSERT(height == 20); | 				DQN_ASSERT(height == 20); | ||||||
| 
 | 
 | ||||||
| 				DqnV2 dim = DqnRect_GetSizeV2(shiftedRect); | 				DqnV2 dim = shiftedRect.GetSize(); | ||||||
| 				DQN_ASSERT(DqnV2_Equals(dim, DqnV2_2f(20, 20))); | 				DQN_ASSERT(DqnV2_Equals(dim, DqnV2(20, 20))); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			// Test rect contains p
 | 			// Test rect contains p
 | ||||||
| 			if (1) | 			if (1) | ||||||
| 			{ | 			{ | ||||||
| 				DqnV2 inP  = DqnV2_2f(5, 5); | 				DqnV2 inP  = DqnV2(5, 5); | ||||||
| 				DqnV2 outP = DqnV2_2f(100, 100); | 				DqnV2 outP = DqnV2(100, 100); | ||||||
| 				DQN_ASSERT(DqnRect_ContainsP(shiftedRect, inP)); | 				DQN_ASSERT(shiftedRect.ContainsP(inP)); | ||||||
| 				DQN_ASSERT(!DqnRect_ContainsP(shiftedRect, outP)); | 				DQN_ASSERT(!shiftedRect.ContainsP(outP)); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			LogSuccess("DqnRect->Move()"); | 			LogSuccess("DqnRect->Move()"); | ||||||
| @ -1086,7 +1079,7 @@ void DqnArray_TestInternal(const DqnMemAPI memAPI) | |||||||
| 		// Test basic insert
 | 		// Test basic insert
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 va = DqnV2_2f(5, 10); | 			DqnV2 va = DqnV2(5, 10); | ||||||
| 			DQN_ASSERT(array.Push(va)); | 			DQN_ASSERT(array.Push(va)); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 vb = array.data[0]; | 			DqnV2 vb = array.data[0]; | ||||||
| @ -1100,7 +1093,7 @@ void DqnArray_TestInternal(const DqnMemAPI memAPI) | |||||||
| 		// Test array resizing and freeing
 | 		// Test array resizing and freeing
 | ||||||
| 		if (1) | 		if (1) | ||||||
| 		{ | 		{ | ||||||
| 			DqnV2 va = DqnV2_2f(10, 15); | 			DqnV2 va = DqnV2(10, 15); | ||||||
| 			DQN_ASSERT(array.Push(va)); | 			DQN_ASSERT(array.Push(va)); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 vb = array.data[0]; | 			DqnV2 vb = array.data[0]; | ||||||
| @ -1148,7 +1141,7 @@ void DqnArray_TestInternal(const DqnMemAPI memAPI) | |||||||
| 			DQN_ASSERT(array.max >= 11); | 			DQN_ASSERT(array.max >= 11); | ||||||
| 			DQN_ASSERT(array.count == 11); | 			DQN_ASSERT(array.count == 11); | ||||||
| 
 | 
 | ||||||
| 			DqnV2 vc = DqnV2_2f(90, 100); | 			DqnV2 vc = DqnV2(90, 100); | ||||||
| 			DQN_ASSERT(array.Push(vc)); | 			DQN_ASSERT(array.Push(vc)); | ||||||
| 			DQN_ASSERT(array.max >= 12); | 			DQN_ASSERT(array.max >= 12); | ||||||
| 			DQN_ASSERT(array.count == 12); | 			DQN_ASSERT(array.count == 12); | ||||||
| @ -1170,10 +1163,10 @@ void DqnArray_TestInternal(const DqnMemAPI memAPI) | |||||||
| 
 | 
 | ||||||
| 	if (1) | 	if (1) | ||||||
| 	{ | 	{ | ||||||
| 		DqnV2 a = DqnV2_2f(1, 2); | 		DqnV2 a = DqnV2(1, 2); | ||||||
| 		DqnV2 b = DqnV2_2f(3, 4); | 		DqnV2 b = DqnV2(3, 4); | ||||||
| 		DqnV2 c = DqnV2_2f(5, 6); | 		DqnV2 c = DqnV2(5, 6); | ||||||
| 		DqnV2 d = DqnV2_2f(7, 8); | 		DqnV2 d = DqnV2(7, 8); | ||||||
| 
 | 
 | ||||||
| 		DQN_ASSERT(array.Init(16, memAPI)); | 		DQN_ASSERT(array.Init(16, memAPI)); | ||||||
| 		DQN_ASSERT(array.Remove(0) == false); | 		DQN_ASSERT(array.Remove(0) == false); | ||||||
| @ -1219,10 +1212,10 @@ void DqnArray_TestInternal(const DqnMemAPI memAPI) | |||||||
| 
 | 
 | ||||||
| 	if (1) | 	if (1) | ||||||
| 	{ | 	{ | ||||||
| 		DqnV2 a = DqnV2_2f(1, 2); | 		DqnV2 a = DqnV2(1, 2); | ||||||
| 		DqnV2 b = DqnV2_2f(3, 4); | 		DqnV2 b = DqnV2(3, 4); | ||||||
| 		DqnV2 c = DqnV2_2f(5, 6); | 		DqnV2 c = DqnV2(5, 6); | ||||||
| 		DqnV2 d = DqnV2_2f(7, 8); | 		DqnV2 d = DqnV2(7, 8); | ||||||
| 
 | 
 | ||||||
| 		DQN_ASSERT(array.Init(16, memAPI)); | 		DQN_ASSERT(array.Init(16, memAPI)); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user