-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorld.h
More file actions
43 lines (33 loc) · 968 Bytes
/
World.h
File metadata and controls
43 lines (33 loc) · 968 Bytes
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
//
// Created by Bray, Matthew D ERDC-RDE-GSL-MS CIV on 11/20/22.
//
#ifndef RAYCASTER_WORLD_H
#define RAYCASTER_WORLD_H
#include <memory>
#include <vector>
#include "Lights.h"
#include "Shape.h"
#include "Transform.h"
#include "Patterns.h"
#include "Sphere.h"
#include "Plane.h"
#include "Cube.h"
// For reference to understand push_back and emplace_back
// https://stackoverflow.com/questions/4303513/push-back-vs-emplace-back
class World {
public:
// std::vector<Shape> objects{};
std::vector<std::unique_ptr<Shape>> objects{};
std::vector<std::unique_ptr<Light>> lights{};
template<class ShapeType>
void add_object(const ShapeType& object) {
objects.emplace_back(std::make_unique<ShapeType>(object));
}
template<class LightType>
void add_light(const LightType& light) {
lights.emplace_back(std::make_unique<LightType>(light));
}
};
World default_world();
World cornell_box();
#endif //RAYCASTER_WORLD_H