summaryrefslogtreecommitdiff
path: root/wave-sim/src/graphics/shape.h
diff options
context:
space:
mode:
Diffstat (limited to 'wave-sim/src/graphics/shape.h')
-rw-r--r--wave-sim/src/graphics/shape.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/wave-sim/src/graphics/shape.h b/wave-sim/src/graphics/shape.h
new file mode 100644
index 0000000..6540ef6
--- /dev/null
+++ b/wave-sim/src/graphics/shape.h
@@ -0,0 +1,59 @@
+#ifndef SHAPE_H
+#define SHAPE_H
+
+#include <GL/glew.h>
+#include <vector>
+
+#include <Eigen/Dense>
+
+class Shader;
+
+class Shape
+{
+public:
+ Shape();
+
+// void init(const std::vector<Eigen::Vector3d> &vertices, const std::vector<Eigen::Vector3d> &normals, const std::vector<Eigen::Vector3i> &triangles);
+ void init(const std::vector<Eigen::Vector3d> &vertices, const std::vector<Eigen::Vector3i> &triangles);
+ void init(const std::vector<Eigen::Vector3d> &vertices, const std::vector<Eigen::Vector3i> &triangles, const std::vector<Eigen::Vector4i> &tetIndices);
+
+ void setVertices(const std::vector<Eigen::Vector3d> &vertices, const std::vector<Eigen::Vector3d> &normals);
+ void setVertices(const std::vector<Eigen::Vector3d> &vertices);
+ void setVerticesF(const std::vector<Eigen::Vector3d> &vertices, const std::vector<Eigen::Vector3d> &forces);
+
+ void setModelMatrix(const Eigen::Affine3f &model);
+
+ void toggleWireframe();
+
+ void draw(Shader *shader);
+
+ void setColor(float r, float g, float b);
+
+ void toggleForce();
+
+private:
+ GLuint m_surfaceVao;
+ GLuint m_tetVao;
+ GLuint m_surfaceVbo;
+ GLuint m_tetVbo;
+ GLuint m_surfaceIbo;
+ GLuint m_tetIbo;
+
+ unsigned int m_numSurfaceVertices;
+ unsigned int m_numTetVertices;
+ unsigned int m_verticesSize;
+ float m_red;
+ float m_blue;
+ float m_green;
+ float m_alpha;
+
+ std::vector<Eigen::Vector3i> m_faces;
+
+ Eigen::Matrix4f m_modelMatrix;
+
+ bool m_wireframe;
+
+ int m_force;
+};
+
+#endif // SHAPE_H