-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scene.h
54 lines (43 loc) · 1.1 KB
/
Scene.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 SCENE__H_
#define SCENE__H_
#include <string>
#include <memory>
#include <vector>
#include "Primitive.h"
#include "Light.h"
#include "Camera.h"
#include "Window.h"
// class Scene
// stores all objects and lights in the scene, as well as the camera
// and renders them from the camera's pov when asked
// can be built from Parser::buildSceneFromFile - thus Parser is a friend
class Scene
{
public:
Scene();
Scene(const Camera &cam, const int width, const int height);
void addSphere(Sphere sphere);
void addTriangle(Triangle triangle);
void addPlane(Plane plane);
void addLight(Light light);
void update(float dt);
void render();
void save();
int width() {return m_width;}
int height() {return m_height;}
Camera &camera() {return m_camera;}
friend class Parser;
private:
void createGeometry();
std::vector<Light> m_lights;
std::vector<Sphere> m_spheres;
std::vector<Plane> m_planes;
std::vector<Triangle> m_triangles;
Window m_window;
Camera m_camera;
int m_width, m_height;
Shader m_shader;
GLuint m_vertexArray;
bool m_dirty;
};
#endif