diff options
| author | day <day@national.shitposting.agency> | 2026-03-16 16:25:49 +0100 |
|---|---|---|
| committer | day <day@national.shitposting.agency> | 2026-03-16 16:25:49 +0100 |
| commit | 7f85c9fc75bd62ac09ea4457d3b17f85988fca66 (patch) | |
| tree | 15248e42bfafc6bd19e50c9010b701057958ff3a /src/util/vector.h | |
| parent | 872c39b24ecf4063f785ff3e8b2f940acd8c2d59 (diff) | |
| parent | 991352b0d2767e6bd1a46f554db4ac9d208c13ad (diff) | |
Merge remote-tracking branch 'origin/master' into obj
Diffstat (limited to 'src/util/vector.h')
| -rw-r--r-- | src/util/vector.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/vector.h b/src/util/vector.h index 854b454..eb386ab 100644 --- a/src/util/vector.h +++ b/src/util/vector.h @@ -1,7 +1,7 @@ #pragma once #include <math.h> -#include "typedef.h" +#include "string.h" static const F32 PI = 3.14159265359f; static const F32 PIRAD = 0.01745329251f; @@ -13,7 +13,6 @@ struct VEC2 { VEC2() { x = y = 0.0f; } VEC2( F32 X, F32 Y ) { x = X; y = Y; } - VEC2( const F32* v ) { x = v[0]; y = v[1]; } VEC2( const VEC2& v ) { x = v.x; y = v.y; } bool operator==( const VEC2& v ) const { return ( x == v.x && y == v.y ); } @@ -49,7 +48,6 @@ struct VEC3 { VEC3() { x = y = z = 0.0f; } VEC3( F32 X, F32 Y, F32 Z ) { x = X; y = Y; z = Z; } - VEC3( const F32* v ) { x = v[0]; y = v[1]; z = v[2]; } VEC3( const VEC3& v ) { x = v.x; y = v.y; z = v.z; } VEC3( const VEC2& v ) { x = v.x; y = v.y; z = 0.f; } @@ -250,3 +248,7 @@ inline void angle_vectors( const VEC3& angles, VEC3* forward, VEC3* right, VEC3* up->z = cr * cp; } } + +inline STR to_str( VEC2 v ) { return STR( "%.02f, %.02f", v.x, v.y ); } +inline STR to_str( VEC3 v ) { return STR( "%.02f, %.02f, %.02f", v.x, v.y, v.z ); } +inline STR to_str( VEC4 v ) { return STR( "%.02f, %.02f, %.02f, %.02f", v.x, v.y, v.z, v.w ); } |
