-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (32 loc) · 1.05 KB
/
main.cpp
File metadata and controls
33 lines (32 loc) · 1.05 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
#include "camera.h"
#include "render.h"
#include "shape.h"
#include <vector>
// Example with SBS-3d render
int main(){
Rectangle* testShape = new Rectangle{std::vector<double>{10,5,0}, 5, 5, 5};
Sphere* testSphere = new Sphere{std::vector<double>{10, 2, 0}, 2};
Camera testCamera{std::vector<double>{0,2,-0.5}};
Camera testCamera2{std::vector<double>{0,2,0.5}};
testCamera.world.push_back(testShape);
testCamera.world.push_back(testSphere);
testCamera2.world = testCamera.world;
double speedLeft = 0.05;
int i = 0;
double angleLeft = 0;
while(true){
angleLeft += 3;
testCamera.lookAt(std::vector<double>{10, 5, 0});
testCamera2.lookAt(std::vector<double>{10, 5, 0});
testSphere->center[0] -= 0.01;
i++;
testSphere->center[2] += speedLeft;
testSphere->center[1] += speedLeft * 0.1;
if(i==100){
i=0;
speedLeft *= -1;
}
renderFrame3D(testCamera.getRender(), testCamera2.getRender());
//renderFrame(testCamera.getRender());
}
}