-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscene.cpp
More file actions
71 lines (57 loc) · 2.3 KB
/
Copy pathscene.cpp
File metadata and controls
71 lines (57 loc) · 2.3 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
69
70
71
#include "scene.h"
void setup_scene(Scene_t& rendererScene) {//ran once to mesh meshes and instance instances
std::vector<Tri4d_t> mesh1 = {
// mesh origin (center at 0,0,0)
{{0,0,0,1}, {0,0,0,1}, {0,0,0,1}},
// bound centre (also at origin now)
{{0,0,0,1}, {0,0,0,1}, {0,0,0,1}},
// Front face (z = +50)
{{-50,-50, 50,1}, { 50,-50, 50,1}, { 50, 50, 50,1}},
{{-50,-50, 50,1}, { 50, 50, 50,1}, {-50, 50, 50,1}},
// Back face (z = -50)
{{-50,-50,-50,1}, { 50, 50,-50,1}, { 50,-50,-50,1}},
{{-50,-50,-50,1}, {-50, 50,-50,1}, { 50, 50,-50,1}},
// Left face (x = -50)
{{-50,-50,-50,1}, {-50,-50, 50,1}, {-50, 50, 50,1}},
{{-50,-50,-50,1}, {-50, 50, 50,1}, {-50, 50,-50,1}},
// Right face (x = +50)
{{ 50,-50,-50,1}, { 50, 50, 50,1}, { 50,-50, 50,1}},
{{ 50,-50,-50,1}, { 50, 50,-50,1}, { 50, 50, 50,1}},
// Top face (y = +50)
{{-50, 50,-50,1}, {-50, 50, 50,1}, { 50, 50, 50,1}},
{{-50, 50,-50,1}, { 50, 50, 50,1}, { 50, 50,-50,1}},
// Bottom face (y = -50)
{{-50,-50,-50,1}, { 50,-50, 50,1}, {-50,-50, 50,1}},
{{-50,-50,-50,1}, { 50,-50,-50,1}, { 50,-50, 50,1}},
};
struct Mesh_t cubeCube;
cubeCube.Triangles = mesh1;
cubeCube.triCount = mesh1.size();
cubeCube.boundBox = {
{{-50,-50,-50}},
{{-50,-50,50}},
{{-50,50,-50}},
{{-50,50,50}},
{{50,-50,-50}},
{{50,-50,50}},
{{50,50,-50}},
{{50,50,50}}
};
struct MeshInstance_t mesh1Instance1;
mesh1Instance1.parentMesh = cubeCube;
mesh1Instance1.pos = { 0,0,0 };
struct MeshInstance_t mesh1Instance2;
mesh1Instance2.parentMesh = cubeCube;
mesh1Instance2.pos = { 0,50,-150 };
struct MeshInstance_t mesh1Instance3;
mesh1Instance3.parentMesh = cubeCube;
mesh1Instance3.pos = { 100,0,-300 };
struct Camera_t camera;
camera.position = { 0,0,300 };//by default facing down -Z
camera.rotation = { 0,0,0 };
rendererScene.meshInstances.push_back(mesh1Instance1);
rendererScene.meshInstances.push_back(mesh1Instance2);
//rendererScene.meshInstances.push_back(mesh1Instance3);
rendererScene.meshInstanceCount = rendererScene.meshInstances.size();
rendererScene.camera = camera;
}