summaryrefslogtreecommitdiff
path: root/wave-sim/src/simulation.h
blob: 68f2178bde9cf4d263435aac2e3184c883524372 (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
#pragma once

#include "graphics/shape.h"
#include "system.h"

class Shader;

class Simulation
{
public:
    Simulation();

    void init();

    void update(double seconds);

    void draw(Shader *shader);

    void toggleWire();

    void toggleForceRender();

    Eigen::Vector3d calculateFaceNormal(Eigen::Vector3d a, Eigen::Vector3d b, Eigen::Vector3d c);

    bool calculatePointBehindNormal(Eigen::Vector3d a, Eigen::Vector3d b, Eigen::Vector3d c, Eigen::Vector3d p);

    System mainSystem;

    enum EstimationMode { EULER, MIDPOINT, ADAPTIVE };

private:
    Shape m_shape;

    Shape m_ground;

    Shape m_extra;

    EstimationMode estimationMode = MIDPOINT;

    void initGround();
    void initExtra();
};