summaryrefslogtreecommitdiff
path: root/engine-ocean/Graphics/shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ocean/Graphics/shape.cpp')
-rw-r--r--engine-ocean/Graphics/shape.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/engine-ocean/Graphics/shape.cpp b/engine-ocean/Graphics/shape.cpp
new file mode 100644
index 0000000..cd0b9b4
--- /dev/null
+++ b/engine-ocean/Graphics/shape.cpp
@@ -0,0 +1,46 @@
+#include "shape.h"
+#include <Eigen/Dense>
+#include "Graphics/global.h"
+#include "Graphics/material.h"
+#include <iostream>
+
+Shape::Shape(std::shared_ptr<VAO> vao):
+ m_vao(vao)
+{
+
+}
+
+Shape::Shape(std::shared_ptr<VAO> vao, std::shared_ptr<Material> shape_material):
+ m_vao(vao),
+ m_shape_material(shape_material)
+{
+ hasShapeSpecificMaterial = true;
+
+}
+
+Shape::~Shape(){
+
+}
+
+std::shared_ptr<Material> Shape::getShapeMaterial(){
+ if (hasShapeSpecificMaterial){
+ return m_shape_material;
+ }
+ std::cout << "this shape does not have material." << std::endl;
+}
+
+bool Shape::hasMaterial(){
+ return hasShapeSpecificMaterial;
+}
+
+void Shape::draw(){
+ m_vao->draw();
+}
+
+void Shape::updateVAO(const std::vector<Eigen::Vector3f> &vertices, const std::vector<Eigen::Vector3i> &faces){
+
+
+ m_vao = Global::graphics.makeVAOFromData(vertices, faces, true, false).second;
+
+
+}