aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-27 21:52:21 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-18 15:21:48 +0100
commit2d8b61bf9fc36e933a0091e1098e62faf143412c (patch)
tree6b82990f2f61e0c55085ef65ebaa21e41e55dd43 /include
parentce271c4c6d0f9c440d90397c07eaa96b0443ff47 (diff)
Add triangle type
Diffstat (limited to 'include')
-rw-r--r--include/RenderBackend/OpenGL/DeviceMemory.hpp4
-rw-r--r--include/Triangle2D.hpp16
-rw-r--r--include/Vertex2D.hpp18
3 files changed, 37 insertions, 1 deletions
diff --git a/include/RenderBackend/OpenGL/DeviceMemory.hpp b/include/RenderBackend/OpenGL/DeviceMemory.hpp
index 10ed040..c37acfb 100644
--- a/include/RenderBackend/OpenGL/DeviceMemory.hpp
+++ b/include/RenderBackend/OpenGL/DeviceMemory.hpp
@@ -2,6 +2,7 @@
#include "../../DataView.hpp"
#include "../../utils.hpp"
+#include "../../Triangle2D.hpp"
#include <stdexcept>
namespace amalgine
@@ -36,7 +37,8 @@ namespace amalgine
};
~DeviceMemory();
- void copy(const DataView<f32> &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE);
+ //void copy(const DataView<f32> &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE);
+ void copy(const DataView<Triangle2D> &triangles, StorageType storageType);
void draw();
private:
DeviceMemory();
diff --git a/include/Triangle2D.hpp b/include/Triangle2D.hpp
new file mode 100644
index 0000000..d5d76bd
--- /dev/null
+++ b/include/Triangle2D.hpp
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Vertex2D.hpp"
+
+namespace amalgine
+{
+ class Triangle2D
+ {
+ public:
+ Triangle2D(const Vertex2D &_p1, const Vertex2D &_p2, const Vertex2D &_p3) : p1(_p1), p2(_p2), p3(_p3) {}
+
+ Vertex2D p1;
+ Vertex2D p2;
+ Vertex2D p3;
+ };
+}
diff --git a/include/Vertex2D.hpp b/include/Vertex2D.hpp
new file mode 100644
index 0000000..de22cd9
--- /dev/null
+++ b/include/Vertex2D.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "types.hpp"
+
+namespace amalgine
+{
+ class Vertex2D
+ {
+ public:
+ Vertex2D(f32 _x = 0.0f, f32 _y = 0.0f) : x(_x), y(_y)
+ {
+
+ }
+
+ f32 x;
+ f32 y;
+ };
+}