-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworld.h
More file actions
64 lines (44 loc) · 1.6 KB
/
world.h
File metadata and controls
64 lines (44 loc) · 1.6 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
#ifndef WORLD_H
#define WORLD_H
#include <stdlib.h>
#include <vector>
//loacl include
#include "pixel.h"
#include "camera.h"
#include "object.h"
#include "tracer.h"
#include "scene_info.h"
#include "viewplane.h"
#include "mesh3d.h"
class World
{
public:
World();
~World();
World(unsigned int w, unsigned int h);
void build();//make a brand new world!
void set_background(Pixel& bg);
void set_pixel_size(float s);
void resize(int w, int h);
void render_world();
void add_object(Object * obj);
unsigned char* _pixels;
unsigned char* pixels();
private:
//view plane info
Viewplane vp;
std::vector<Object*>_objects;
Camera * _camera;
Tracer * _tracer;
//helpers
void update_color(Scene_info &info, int row, int col, Vector3d &normal_hit, Vector3d &amb_dir, float factor);
void update_spec(Scene_info &info, int row, int col, Vector3d &spec_hit, Vector3d &view_vec,
Directional_ray &environment_light);
void update_dir_and_org(Scene_info &info, Directional_ray &ray, Vector3d &normal_hit);
void copy_info_color(Scene_info &info, int row, int col);
void trace_scene(Scene_info &info, Directional_ray &ray, Directional_ray &environment_light, int rec_ctr,
int cur_obj_idx, float min_distance,
int i, int j,
Vector3d &amb_dir, float factor, Point3d &cur_orig);
};
#endif // WORLD_H