diff options
| author | petrie911 <69443847+petrie911@users.noreply.github.com> | 2024-03-13 15:56:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 14:56:30 -0600 |
| commit | 92e7076647d2da64e8f90aa66974c4a3dba03a06 (patch) | |
| tree | 968573727b890d6b0cf74a6ae354fffd98999af0 /src/types/Vec3D.cpp | |
| parent | 2338cab8df24d483a4a1eaf8bd23a997a4beffb8 (diff) | |
Add vector classes and SF64 colpoly factory. Also fix enum parsing (#39)
* 3D
* and env
* so much to fix
Diffstat (limited to 'src/types/Vec3D.cpp')
| -rw-r--r-- | src/types/Vec3D.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/types/Vec3D.cpp b/src/types/Vec3D.cpp new file mode 100644 index 0000000..0d75e88 --- /dev/null +++ b/src/types/Vec3D.cpp @@ -0,0 +1,57 @@ +#include "Vec3D.h" +#include <iomanip> + +Vec3f::Vec3f(float xv, float yv, float zv) : x(xv), y(yv), z(zv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec3f& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}"; + + return stream; +} + +Vec3s::Vec3s(int16_t xv, int16_t yv, int16_t zv) : x(xv), y(yv), z(zv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec3s& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}"; + return stream; +} + +Vec3i::Vec3i(int32_t xv, int32_t yv, int32_t zv) : x(xv), y(yv), z(zv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec3i& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}"; + return stream; +} + +Vec2f::Vec2f(float xv, float zv) : x(xv), z(zv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec2f& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.z << "}"; + return stream; +} + +Vec4f::Vec4f(float xv, float yv, float zv, float wv) : x(xv), y(yv), z(zv), w(wv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec4f& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}"; + return stream; +} + +Vec4s::Vec4s(int16_t xv, int16_t yv, int16_t zv, int16_t wv) : x(xv), y(yv), z(zv), w(wv) {} + +std::ostream& operator<< (std::ostream& stream, const Vec4s& vec) { + int width = stream.width(); + + stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}"; + return stream; +} |
