diff options
| author | Sebastian Park <SebPark03@gmail.com> | 2024-04-10 02:45:04 -0400 |
|---|---|---|
| committer | Sebastian Park <SebPark03@gmail.com> | 2024-04-10 02:45:04 -0400 |
| commit | 47cd8a592ecad52c1b01f27d23476c0a5afeb7f1 (patch) | |
| tree | 36b9abaff4e92a4a6df0d5ecb0e43e05c3aefd48 /wave-sim/src/graphics/shape.h | |
| parent | fd19124693bb32835ad97802ba1950cd5202dbd2 (diff) | |
initial
Diffstat (limited to 'wave-sim/src/graphics/shape.h')
| -rw-r--r-- | wave-sim/src/graphics/shape.h | 59 |
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 |
