medfall

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

commit dc7d356b347dbf6a69d70247297bb3ca49b6d662
parent 29bd02410470bac8c4244d5ac2486bd9e7ba439e
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Mar 25 02:04:44 +0200

Add ggformat overloads for v2/v3/v4

Diffstat:
linear_algebra.h | 40++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)
diff --git a/linear_algebra.h b/linear_algebra.h @@ -762,4 +762,44 @@ forceinline v3u32 mean( v3u32 mins, v3u32 maxs ) { return mins + ( maxs - mins ) / 2; } +/* + * ggformat support + */ + +#include "ggformat.h" + +inline void format( FormatBuffer * fb, const v2 & v, const FormatOpts & opts ) { + format( fb, "v2(" ); + format( fb, v.x, opts ); + format( fb, ", " ); + format( fb, v.y, opts ); + format( fb, ")" ); +} + +inline void format( FormatBuffer * fb, const v3 & v, const FormatOpts & opts ) { + format( fb, "v3(" ); + format( fb, v.x, opts ); + format( fb, ", " ); + format( fb, v.y, opts ); + format( fb, ", " ); + format( fb, v.z, opts ); + format( fb, ")" ); +} + +inline void format( FormatBuffer * fb, const v4 & v, const FormatOpts & opts ) { + format( fb, "v4(" ); + format( fb, v.x, opts ); + format( fb, ", " ); + format( fb, v.y, opts ); + format( fb, ", " ); + format( fb, v.z, opts ); + format( fb, ", w = " ); + format( fb, v.w, opts ); + format( fb, ")" ); +} + +/* + * autogenerated visitor header + */ + #include "visitors/linear_algebra.h"