medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 067b69953ec3a1a8056ee1602893b498313a46a3
parent c3bf18ee8fd6cff3215c42c94725916cc855ca42
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Nov 14 23:34:39 +0200

Move v3u32 into linear_algebra.h

Diffstat:
heightmap.h | 24------------------------
linear_algebra.h | 30+++++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/heightmap.h b/heightmap.h @@ -67,18 +67,6 @@ enum Quadrant { QUADRANT_NE, }; -struct v3u32 { - u32 x, y, z; - - v3u32() { } - - explicit v3u32( u32 a, u32 b, u32 c ) { - x = a; - y = b; - z = c; - } -}; - struct AABBu32 { v3u32 mins, maxs; @@ -97,18 +85,6 @@ struct AABBu32 { AABBu32 clamp_z( u32 lo, u32 hi ); }; -inline v3u32 operator+( v3u32 u, v3u32 v ) { - return v3u32( u.x + v.x, u.y + v.y, u.z + v.z ); -} - -inline v3u32 operator-( v3u32 u, v3u32 v ) { - return v3u32( u.x - v.x, u.y - v.y, u.z - v.z ); -} - -inline v3u32 operator/( v3u32 v, u32 d ) { - return v3u32( v.x / d, v.y / d, v.z / d ); -} - struct AABB { v3 mins, maxs; diff --git a/linear_algebra.h b/linear_algebra.h @@ -78,6 +78,18 @@ struct v3 { } }; +struct v3u32 { + u32 x, y, z; + + v3u32() { } + + explicit v3u32( u32 a, u32 b, u32 c ) { + x = a; + y = b; + z = c; + } +}; + #define GLMV3( v ) v3( ( v ).x, ( v ).y, ( v ).z ) struct m3 { @@ -202,7 +214,7 @@ struct quat { float x, y, z, w; }; -// TODO: v3x4, v4x4, simd matrices, v3u32? +// TODO: v3x4, v4x4, simd matrices? /* * v2 @@ -335,6 +347,22 @@ forceinline v3 normalize( v3 v ) { } /* + * v3u32 + */ + +forceinline v3u32 operator+( v3u32 u, v3u32 v ) { + return v3u32( u.x + v.x, u.y + v.y, u.z + v.z ); +} + +forceinline v3u32 operator-( v3u32 u, v3u32 v ) { + return v3u32( u.x - v.x, u.y - v.y, u.z - v.z ); +} + +forceinline v3u32 operator/( v3u32 v, u32 d ) { + return v3u32( v.x / d, v.y / d, v.z / d ); +} + +/* * m3 */