-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScene.h
63 lines (50 loc) · 1.5 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
55
56
57
58
59
60
61
62
63
/*
Scene.h
Reads a scene file, creates primitives, sets up the camera and screen, and
renders the scene.
*/
#ifndef I_SCENE
#define I_SCENE
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <glm/glm.hpp>
#include "Camera.h"
#include "Screen.h"
#include "Sampler.h"
#include "Raytracer.h"
#include "Primitive.h"
#include "Light.h"
enum TraceType { RAY, PATH };
enum SamplingType { UNIFORM, IMPORTANCE };
class Scene {
public:
friend class Raytracer;
Scene(const char* filename);
~Scene();
int renderImage();
private:
void raytrace();
bool readvals(std::stringstream &s, const int numvals, double* values);
void parseFile(const char* filename);
void rightMultiply(const glm::dmat4& M, std::stack<glm::dmat4>& transfstack);
Camera camera;
Screen screen;
std::vector<Primitive> primitiveList;
std::vector<Light> lightList;
std::vector<AreaLight*> areaLightList;
glm::dvec3 attenuation;
glm::dvec3 ambient;
std::string outputFilename;
std::stack<glm::dmat4> transfstack;
// Rendering settings
int maxDepth;
int samplesPerPixel;
bool directLighting;
bool indirectLighting;
SamplerType samplerType; // How we shoot rays through pixels
TraceType traceType; // Raytracing or Pathtracing
SamplingType samplingType; // How we weight indirect lighting rays
};
#endif