Repository navigation
Expand file tree
/
Copy pathscene.h
More file actions
70 lines (50 loc) · 1.64 KB
/
Copy pathscene.h
File metadata and controls
70 lines (50 loc) · 1.64 KB
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
//header file for camera
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include "geometry.h"
using namespace std;
const float epsilon = 1e-4;
class Camera {
public:
glm::vec3 eye, center, up;
float fovy;
Camera(glm::vec3 lookfrom, glm::vec3 lookat, glm::vec3 up_dir, float fov_y);
Camera();
};
// To be used when camera configuration is passed
class Scene {
public:
Camera cam;
std::vector<Light> lights;
std::vector<glm::vec3> vertices;
std::vector<Object*> objects; //holds pointers to all objects
//for vertices with norms. one-to-one correspondence between indices.
std::vector<glm::vec3> vertnorms;
std::vector<glm::vec3> norms;
glm::vec3 attenuation = glm::vec3(1.0f, 0.0f, 0.0f);
void rightmultiply(const glm::mat4 & M, stack<glm::mat4> &transfstack);
bool readvals(stringstream &s, const int numvals, float* values);
void readfile(const char* filename);
// The following are temporary storage variables for parsing
int width = 256;
int height = 256;
int depth = 5;
std::string outfilename = "raytrace.png";
float sx, sy ; // the scale in x and y
float tx, ty ; // the translation in x and y
// Materials (read from file)
// With multiple objects, these are colors for each.
float ambient[3] ;
float diffuse[3] ;
float specular[3] ;
float emission[3] ;
float shininess = 0;
int maxverts; //max number of vertices for a triangle
int maxvertnorms; //max number of vertices with normals
float vertex[3]; //vertex with coords x,y,z
float vertexnorm[6]; //vertex with coords x,y,z and its surface normals nx,ny,nz
};