-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubdivisionController.h
54 lines (39 loc) · 1.26 KB
/
SubdivisionController.h
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
#ifndef SUBDIVISIONCONTROLLER_H
#define SUBDIVISIONCONTROLLER_H
#include <iostream>
#include <map>
#include <vector>
#include "SubdivisionStrategy.h"
#include "LoopSubdivisionStrategy.h"
#include "ButterflySubdivisionStrategy.h"
#include "CatmullClarkSubdivisionStrategy.h"
#include "KobbeltSubdivisionStrategy.h"
#include "CustomSchemeSubdivisionStrategy.h"
#include "CustomSchemeHandler.h"
#include "mesh.h"
#include "DebugHelper.h"
enum SubdivisionScheme {Loop, Butterfly, CatmullClark, Kobbelt, Custom};
class SubdivisionController
{
public:
~SubdivisionController();
static SubdivisionController& getInstance() {
static SubdivisionController instance;
return instance;
}
SubdivisionController(SubdivisionController const&) = delete;
void operator=(SubdivisionController const&) = delete;
void switchTo(SubdivisionScheme scheme);
void doSubdivision();
void doBackwardStep();
Mesh getCurrentMesh();
void setBaseMesh(Mesh baseMesh);
bool canDoBackwardStep();
private:
SubdivisionController();
SubdivisionStrategy* currentStrategy = nullptr;
std::map<SubdivisionScheme, SubdivisionStrategy*> strategyMap;
int currentMeshIndex = 0;
std::vector<Mesh> meshHistory;
};
#endif // SUBDIVISIONCONTROLLER_H