aboutsummaryrefslogtreecommitdiff
path: root/cWiremesh.h
diff options
context:
space:
mode:
authorGravatar jonas <himself@jonasgunz.de> 2019-01-12 21:36:30 +0100
committerGravatar jonas <himself@jonasgunz.de> 2019-01-12 21:36:30 +0100
commit5d0b6dd79722707afb15642cc8523b36a6391e0d (patch)
treee7045bb0d5c2b25bbb4a2903ebb044c30b1b55d7 /cWiremesh.h
parent91e4ffec239c198c9c4652dc50812165813fe79f (diff)
downloadtermgl-5d0b6dd79722707afb15642cc8523b36a6391e0d.tar.gz
changed to cWiremesh, removed inherit, cWiremesh now directly writes to renderer
Things get funky when x > origin.x ?!?
Diffstat (limited to 'cWiremesh.h')
-rw-r--r--cWiremesh.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/cWiremesh.h b/cWiremesh.h
new file mode 100644
index 0000000..49bf4b9
--- /dev/null
+++ b/cWiremesh.h
@@ -0,0 +1,66 @@
+#pragma once
+
+#include <vector>
+#include <cmath>
+
+#include "cRender.h"
+
+#define _DEPTH 100
+
+struct sCoord3d
+{
+ int x;
+ int y;
+ int z;
+
+ sCoord3d operator+(sCoord3d p)
+ {
+ sCoord3d ret;
+ ret.x = x + p.x;
+ ret.y = y + p.y;
+ ret.z = z + p.z;
+ return ret;
+ }
+};
+
+struct sVector
+{
+ sCoord3d origin;
+ sCoord3d direction;
+
+ char c;
+ WORD color;
+};
+
+class cWiremesh
+{
+public:
+
+ cWiremesh();
+
+ virtual ~cWiremesh();
+
+ void addVector(sCoord3d _origin, sCoord3d _vector, char _char, WORD _color);
+
+ void rotate(sCoord3d _val);
+
+ sCoord3d getPosition();
+
+ void setPosition(int _x, int _y, int _z);
+
+ void setPosition(sCoord3d _pos);
+
+ void reset();
+
+ void write(cRender *_render);
+
+protected:
+
+private:
+
+ sPos translate(sCoord3d _coord, sCoord3d _origin);
+
+ sCoord3d position;
+
+ std::vector<sVector> vectors;
+};