-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (54 loc) · 1.98 KB
/
main.cpp
File metadata and controls
68 lines (54 loc) · 1.98 KB
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
60
61
62
63
64
65
66
67
68
#include"Scene.h"
#include"glRenderSystem.h"
#include "Controller.h"
using namespace violet;
int main() {
Scene scene(new glRenderSystem(WindowInfo("soft body", 1280, 1080, false)));
CamPtr cam = make_shared<Camera>(vec3(5,5,5),"walker");
CamPtr cam1 = make_shared<Camera>(vec3(5, 5, 5), "test");
ComPtr control = make_unique<RambleController>();
cam->addComponent(control);
scene.insert(cam, scene.getRoot());
//scene.insert(cam1, dynamic_pointer_cast<Object,Camera>(cam));
scene.setCurCam("walker");
LightPtr light = make_shared<Light>(vec3(-80,80,80),vec3(0.7f,0.7f,0.7f));
scene.insert(light, scene.getRoot());
LightPtr light1 = make_shared<Light>(vec3(80, -80, -80), vec3(0.f, 0.3f, 0.f));
//scene.insert(light1, scene.getRoot());
/*
MeshPtr houseMesh(new Mesh{ "G:\\model\\house\\house\\house.obj" });
MeshPtr floorMesh(new Mesh{ "G:\\model\\floor.obj" });
MeshPtr grassMesh(new Mesh{ "G:\\model\\tree\\tree.obj" });*/
//MeshPtr carMesh(new Mesh{ "tree.obj" });
MeshPtr houseMesh(new Mesh{ "./resource/house/house_01.obj" });
MeshPtr floorMesh(new Mesh{ "./resource/floor/untitled.obj" });
MeshPtr grassMesh(new Mesh{ "./resource/tree/Tree.obj" });
MeshPtr palmMesh(new Mesh{ "./resource/palm/palm.obj" });
ObjPtr house(new Object());
scene.insert(house, scene.getRoot());
house->setMesh(houseMesh);
house->rotate({ 0,0,0 });
ObjPtr floor(new Object());
scene.insert(floor, house);
floor->setMesh(floorMesh);
//monkey1->move({ 0,5,-20 });
//monkey1->rotate({ 0,0,50 });
ObjPtr grass(new Object());
scene.insert(grass, house);
grass->setMesh(grassMesh);
grass->move(vec3{ 5.0f,0.f,0.f });
ObjPtr palm(new Object());
scene.insert(palm, house);
palm->setMesh(palmMesh);
palm->move(vec3{ 5.0f,0.f,5.f });
//ObjPtr car(new Object());
//scene.insert(car, house);
//car->setMesh(carMesh);
//car->move(vec3{ 5.0f,0.f,0.f });
scene.setUpdate([&grass,&house]() {
grass->rotate(vec3{ 0.f, 0.5f, 0.f });
//house->rotate(vec3{ 0.f, 0.1f, 0.f });
});
scene.draw();
return 0;
}