-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
93 lines (68 loc) · 1.74 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef _SCENE_H_
#define _SCENE_H_
#include <limits>
#include <cstdlib>
#include <vector>
#include "object.h"
#include "vector.h"
#include "fimage.h"
#include <time.h>
#include <thread>
#include <mutex>
#include "defines.h"
extern unsigned int *state;
#define INF std::numeric_limits<double>::infinity()
#define PI 3.14159265359;
using namespace std;
class Object;
class Light;
class hit;
class Scene {
public:
vector<Object*> Objects;
vector<Light*> Lights;
vector<fimage*> Textures;
fimage image;
char output[64];
double windowScale;
double scale;
double superSample;
double shadowSample;
int recursion;
int sampleMethod;
int occlusionMethod;
int softShadows;
int occlusion;
int occlusionSamples = 25;
int pass;
double occlusionRadius = 1.0;
Vec win; // window reletive to pov
Vec pov; // pov
Vec p; // aboslute center point of window
Vec u, v;
Vec ambient;
Scene();
fimage *AddTexture(const char *c);
void setRes(int w, int h, int d, int div);
void setCamera(Vec origin, Vec focus, double s);
Scene(int w, int h, int d);
void windowVect();
Vec getPixelCoordinate(double x, double y);
void getPixelVector(double x, double y, Vec *Rp, Vec *RA);
Light* newLight();
template<typename T>
T *newObject() {
T *p = new T;
Objects.push_back(p);
return p;
}
void drawPixel(double, double);
void drawRange(int, int);
void drawScene();
double SampleLight(hit*, Vec*, Light*, int);
double Occlusion(hit h, Vec d);
Vec TraceLight(hit, Vec);
hit Closest(Vec, Vec);
Vec Cast(Vec o, Vec d, int depth);
};
#endif