-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWorld.h
80 lines (53 loc) · 1.6 KB
/
World.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef WORLD_H
#define WORLD_H
#include "common.h"
#include "RGBColor.h"
#include "Sphere.h"
#include "ViewPlane.h"
#include "Tracer.h"
#include "Drawing.h"
#include "Light.h"
#include "Camera.h"
class AmbientOccluder;
class World {
public:
ViewPlane vp; // the plane to show rendered results
Camera * camera_ptr; // camera used to do projection
RGBColor bg_color; // background color
Sphere sphere; // no use here, but for Single Sphere Tracer
Tracer * tracer_ptr; // tracer pointer to point to different tracers
Drawing draw; // the part used to interact with GUI
vector <GeometryObject *> objects; // object storage
Light * ambient; //
vector<Light *> lights; // light storage
// base functions
World();
//
void build();
// init screen
void openWindow();
// work procedure
void work();
// finish the work
void finish();
// when without cameras
void simpleRenderScene();
// update the screen
void displayPixel(const int &, const int &, const RGBColor &);
// for multiple objects
void addObject(GeometryObject *);
// simple hit system
ShadeRec hitBareBonesOjbects(const Ray &);
// for adding lights
void addLight(Light *);
// fake, generate VPLs
void generateVPLs(PointLight *, const Normal &);
void setAmbientLight(Ambient *);
void setAmbientOccluder(AmbientOccluder *);
void setCamera(Camera *);
// for general use
ShadeRec hitOjbects(const Ray &); // wtf, different from here to there in the context book
// for overflow colors
RGBColor maxToOne(const RGBColor &) const;
};
#endif