From 47cd8a592ecad52c1b01f27d23476c0a5afeb7f1 Mon Sep 17 00:00:00 2001 From: Sebastian Park Date: Wed, 10 Apr 2024 02:45:04 -0400 Subject: initial --- wave-sim/src/graphics/shape.h | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 wave-sim/src/graphics/shape.h (limited to 'wave-sim/src/graphics/shape.h') 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 +#include + +#include + +class Shader; + +class Shape +{ +public: + Shape(); + +// void init(const std::vector &vertices, const std::vector &normals, const std::vector &triangles); + void init(const std::vector &vertices, const std::vector &triangles); + void init(const std::vector &vertices, const std::vector &triangles, const std::vector &tetIndices); + + void setVertices(const std::vector &vertices, const std::vector &normals); + void setVertices(const std::vector &vertices); + void setVerticesF(const std::vector &vertices, const std::vector &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 m_faces; + + Eigen::Matrix4f m_modelMatrix; + + bool m_wireframe; + + int m_force; +}; + +#endif // SHAPE_H -- cgit v1.2.3-70-g09d2