-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
341 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
- Section 11 | ||
- improve compilation time | ||
- move as much code as possible in .cpp files | ||
- create blobs | ||
- accelerate with GPU compute shaders | ||
- use raytracing extensions if possible | ||
- make buildchain crossplatform with CMake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
#include "geometry/IHittable.hpp" | ||
|
||
#include "ray.hpp" | ||
|
||
|
||
void HitRecord::SetFaceNormal(const Ray& ray, const Vec3& outwardNormal) | ||
{ | ||
front_face = ray.Direction().Dot(outwardNormal) < 0.0; | ||
normal = front_face ? outwardNormal : -outwardNormal; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
#include "geometry/scene.hpp" | ||
|
||
#include "interval.hpp" | ||
|
||
|
||
using namespace std; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
#include <memory> | ||
#include <vector> | ||
|
||
|
||
class Scene : public IHittable { | ||
|
||
private: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
|
||
#include "interval.hpp" | ||
|
||
#include <cmath> | ||
|
||
|
||
const Interval Interval::Empty = Interval(INFINITY, -INFINITY); | ||
const Interval Interval::Universe = Interval(-INFINITY, INFINITY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
|
||
#pragma once | ||
|
||
#include <cmath> | ||
|
||
|
||
class Interval { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
#include "lambertian.hpp" | ||
|
||
#include "vec.hpp" | ||
#include "ray.hpp" | ||
#include "geometry/IHittable.hpp" | ||
|
||
|
||
using namespace std; | ||
|
||
|
||
bool Lambertian::Scatter( | ||
const Ray& incoming_ray, | ||
const HitRecord& rec, | ||
RGBColor& attenuation, | ||
Ray& scattered_ray | ||
) const | ||
{ | ||
Vec3 scatter_direction = rec.normal + Vec3::RandomUnitVector(); | ||
|
||
if (scatter_direction.IsNearZero()){ | ||
scatter_direction = rec.normal; | ||
} | ||
|
||
scattered_ray = Ray(rec.hitPoint, scatter_direction); | ||
attenuation = m_albedo; | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
#pragma once | ||
|
||
#include "material/material.hpp" | ||
|
||
|
||
class Lambertian : public Material { | ||
|
||
private: | ||
|
||
RGBColor m_albedo; | ||
|
||
|
||
public: | ||
|
||
Lambertian(const RGBColor& albedo): m_albedo{albedo} {}; | ||
|
||
virtual bool Scatter( | ||
const Ray& incoming_ray, | ||
const HitRecord& rec, | ||
RGBColor& attenuation, | ||
Ray& scattered_ray | ||
) const override; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
#pragma once | ||
|
||
#include "vec.hpp" | ||
|
||
|
||
class Ray; | ||
class HitRecord; | ||
|
||
|
||
class Material { | ||
|
||
public: | ||
|
||
virtual ~Material() {} | ||
virtual bool Scatter( | ||
const Ray& incoming_ray, | ||
const HitRecord& rec, | ||
RGBColor& attenuation, | ||
Ray& scattered_ray | ||
) const | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
}; |
Oops, something went wrong.