-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtil.h
54 lines (42 loc) · 1.57 KB
/
Util.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 UTIL_H
#define UTIL_H
#include <vector>
#include <fstream>
#include <iostream>
#include <QVector3D>
#include <QVector4D>
#include <QMatrix4x4>
namespace util {
inline
std::vector<QVector3D> genTriangle() {
std::vector<QVector3D> data;
data.reserve(12);
/*data.emplace_back(QVector3D(-1.0, -2.0/3.0, 0.0));
data.emplace_back(QVector3D(-2.0, -1.0, 0.0));
data.emplace_back(QVector3D(-1.0, 2.0/3.0, 0.0));
data.emplace_back(QVector3D(-2.0, 1.0, 0.0));
data.emplace_back(QVector3D(1, -2.0/3.0, 0.0));
data.emplace_back(QVector3D(+1.0, -1.0, 1.0));
data.emplace_back(QVector3D(1.0, 2.0/3.0, 0.0));
data.emplace_back(QVector3D(1.0, 1.0, 0.0));
data.emplace_back(QVector3D(1.0, -2.0/3.0, 0.0));
data.emplace_back(QVector3D(+1.0, -1.0, 1.0));
data.emplace_back(QVector3D(-1, 2.0/3.0, 0.0));
data.emplace_back(QVector3D(-2.0, +1.0, 0.0));*/
data.emplace_back(QVector3D(-1.0, -1.0, 0.0));
data.emplace_back(QVector3D(-2.0, -1.0, 0.0));
data.emplace_back(QVector3D(-1.0, 1.0, 0.0));
data.emplace_back(QVector3D(-2.0, 1.0, 0.0));
data.emplace_back(QVector3D(1, -1.0, 0.0));
data.emplace_back(QVector3D(+1.0, -1.0, 1.0));
data.emplace_back(QVector3D(1.0, 1.0, 0.0));
data.emplace_back(QVector3D(1.0, 1.0, 0.0));
data.emplace_back(QVector3D(1.0, -1.0, 0.0));
data.emplace_back(QVector3D(+1.0, -1.0, 1.0));
data.emplace_back(QVector3D(-1, 1.0, 0.0));
data.emplace_back(QVector3D(-2.0, +1.0, 0.0));
std::cout << "num vertices: " << data.size() << std::endl;
return data;
}
} // namespace util
#endif