Skip to content

Saumya #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Graphics/Saumya_Talera/Chapter1.ppm
Binary file not shown.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter2.ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter3.ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter4.ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter5(complete).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter5(complete).ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter5(one sphere).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter5(one sphere).ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter6.ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter7 HD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Graphics/Saumya_Talera/Chapter7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter7.ppm

Large diffs are not rendered by default.

Binary file added Graphics/Saumya_Talera/Chapter8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20,003 changes: 20,003 additions & 0 deletions Graphics/Saumya_Talera/Chapter8.ppm

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions Graphics/Saumya_Talera/camera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef CAMERAH
#define CAMERAH

#include "ray.h"

class camera {
public:
camera() {
lower_left_corner = vec3(-2.0, -1.0, -1.0);
horizontal = vec3(4.0, 0.0 ,0.0);
vertical = vec3(0.0, 2.0, 0.0);
origin = vec3(0.0, 0.0, 0.0);
}
ray get_ray(float u, float v) {return ray(origin, lower_left_corner + u*horizontal + v*vertical - origin);}

vec3 lower_left_corner;
vec3 horizontal;
vec3 vertical;
vec3 origin;
};

#endif
20 changes: 20 additions & 0 deletions Graphics/Saumya_Talera/hitable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef HITABLEH
#define HITABLEH

#include "ray.h"

class material;

struct hit_record {
float t;
vec3 p;
vec3 normal;
material *mat_ptr;
};

class hitable {
public:
virtual bool hit(const ray& r, float t_min, float t_max, hit_record& rec) const = 0;
};

#endif
29 changes: 29 additions & 0 deletions Graphics/Saumya_Talera/hitable_list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef HITABLELISTH
#define HITABLELISTH

#include "hitable.h"

class hitable_list: public hitable {
public:
hitable_list(){}
hitable_list(hitable **l, int n) {list=l;list_size=n;}
virtual bool hit(const ray& r, float t_min, float t_max, hit_record& rec) const;
hitable **list;
int list_size;
};

bool hitable_list::hit(const ray& r, float t_min, float t_max, hit_record& rec) const {
hit_record temp_rec;
bool hit_anything = false;
double closest_so_far = t_max;
for(int i=0;i<list_size;i++) {
if(list[i]->hit(r, t_min, closest_so_far, temp_rec)) {
hit_anything = true;
closest_so_far = temp_rec.t;
rec = temp_rec;
}
}
return hit_anything;
}

#endif
Loading