summaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2024-04-06 15:36:03 -0600
committerGitHub <noreply@github.com>2024-04-06 15:36:03 -0600
commit24633ebd7cc6866da3e3d06fddc6f0f49a741f1d (patch)
tree357a563fae006b04ded941ee534b1d6522f3fc32 /src/types
parentad667b705dad3476a1ae803f23588c55baab2ee4 (diff)
Introduce Metadata and ItemCurve Factories (#27)
* Introduce metadata * Metadata works now * Cleanup * Fixes * Cleanup 2 * yaml improvement * Comment update * Rename tables to metadata * Update * Fix warnings * Implement ItemCurve * Remove unused enum * Replace static with const * Fix bug * Add const * More fixes * Fix quote bug in IncludeFactory * Fix header in ItemCurve * Fixes * Fix texture factory * updates * Clearer debug info * Fixes * Working ci8 png * Fix size output * Fix * Add gitignore for modding * Fix precision for mtx * Remove header exporter from metadata * Remove hardcoded enum * Remove tabs * Remove tabs * tlut temp fix --------- Co-authored-by: = <=>
Diffstat (limited to 'src/types')
-rw-r--r--src/types/Vec3D.cpp17
-rw-r--r--src/types/Vec3D.h11
2 files changed, 28 insertions, 0 deletions
diff --git a/src/types/Vec3D.cpp b/src/types/Vec3D.cpp
index c70e540..ab263f8 100644
--- a/src/types/Vec3D.cpp
+++ b/src/types/Vec3D.cpp
@@ -86,6 +86,23 @@ std::ostream& operator<< (std::ostream& stream, const Vec3i& vec) {
return stream;
}
+Vec3iu::Vec3iu(uint32_t xv, uint32_t yv, uint32_t zv) : x(xv), y(yv), z(zv) {}
+
+int Vec3iu::width() {
+ auto wx = GetMagnitude(this->x);
+ auto wy = GetMagnitude(this->y);
+ auto wz = GetMagnitude(this->z);
+
+ return std::max(wx, std::max(wy, wz));
+}
+
+std::ostream& operator<< (std::ostream& stream, const Vec3iu& 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) {}
int Vec2f::precision() {
diff --git a/src/types/Vec3D.h b/src/types/Vec3D.h
index acb6eea..76a8d5d 100644
--- a/src/types/Vec3D.h
+++ b/src/types/Vec3D.h
@@ -36,6 +36,17 @@ public:
friend std::ostream& operator<< (std::ostream& stream, const Vec3i& vec);
};
+class Vec3iu {
+public:
+ uint32_t x;
+ uint32_t y;
+ uint32_t z;
+
+ Vec3iu(uint32_t xv = 0, uint32_t yv = 0, uint32_t zv = 0);
+ int width();
+ friend std::ostream& operator<< (std::ostream& stream, const Vec3iu& vec);
+};
+
class Vec2f {
public:
float x;