-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
55 lines (42 loc) · 1.64 KB
/
main.cpp
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
#include "GeometryStage.h"
#include "Rasterisation.h"
#include "TextureLoader/Texture.h"
#include "TextureLoader/TextureLoader.h"
using namespace VkRenderer;
using namespace std;
int main() {
VirtualDevice device("test", 600, 600);
Color colors[6] = {
Color(1.0f, 0.0f, 0.2f, 1.0f),
Color(1.0f, 0.0f, 0.2f, 1.0f),
Color(0.2f, 1.0f, 0.0f, 1.0f),
Color(0.2f, 1.0f, 0.0f, 1.0f),
Color(0.0f, 0.2f, 1.0f, 1.0f),
Color(0.0f, 0.2f, 1.0f, 1.0f)
};
Mesh cube = createCube(1.0f, colors);
Mesh sphere = createSphere(0.5f, 15.0f);
device.setBackgroundColor(0.3f, 0.58f, 0.80f);
Transform::currentTransform.setView(
getView(Vector(0.0f, 0.0f, 1.5f), Vector(0.0f, 0.0f, -1.0f), Vector(0.0f, 1.0f, 0.0f)));
Transform::currentTransform.setProjection(getPerspective(45.0f, 1.0f, 0.1f, 100.0f));
device.setDrawMode(DRAW_BORDERS, false);
device.setDrawMode(DRAW_FACES, true);
device.setOptimization(FACE_CULLING, true);
Image::Texture test(SPHERE_TEXTURE, SAMPLE_FILTER_LINEAR);
Image::TextureLoader loader;
loader.loadTextureChar(&test, "../earth_texture.png", PNG, RGBA);
device.bindTexture(&test);
while (!device.shouldShutdown()) {
device.refreshBuffer();
device.mainLoop();
// Transform::currentTransform.setModel(translate(normalPhongConstants.lightPos) * scale(0.2f, 0.2f, 0.2f));
// cube.render(device);
//
// Transform::currentTransform.setModel(translate(0.0f, 0.0f, 0.0f));
// cube.render(device);
sphere.render(device);
}
device.refreshBuffer();
return 0;
}