blob: 6540ef62b4ca87611e5994dd33b3b8e7e3b19ba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
|