Skip to content

Commit f9f19ad

Browse files
author
ThomasGeorge
committed
moss
1 parent 8628a44 commit f9f19ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+171
-167
lines changed

include/Hittables/Objects/AARect.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class AARect : public Shape
1414
const double j1, const double k) const;
1515

1616
public:
17-
HOST AARect(const double i0, const double i1, const double j0,
17+
DEV HOST AARect(const double i0, const double i1, const double j0,
1818
const double j1, const double k,
1919
const SharedPointer<Material> material);
20-
HOST ~AARect() noexcept = default;
20+
DEV HOST ~AARect() noexcept = default;
2121

2222
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
2323
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Objects/Box.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class Box : public Shape
88
HittableList sides;
99

1010
public:
11-
HOST Box(const Vec3 &p0, const Vec3 &p1,
11+
DEV HOST Box(const Vec3 &p0, const Vec3 &p1,
1212
const SharedPointer<Material> material);
1313

14-
HOST ~Box() noexcept = default;
14+
DEV HOST ~Box() noexcept = default;
1515

1616
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
1717
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Objects/Hittable.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class WeightedPdf;
1515
class Hittable
1616
{
1717
protected:
18-
HOST Hittable() = default;
18+
DEV HOST Hittable() = default;
1919

2020
public:
2121

22-
HOST virtual ~Hittable() noexcept = default;
22+
DEV HOST virtual ~Hittable() noexcept = default;
2323

2424
struct HitRecord
2525
{

include/Hittables/Objects/Shape.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ protected:
99
const SharedPointer<Material> material;
1010
AABB boundingBox;
1111

12-
HOST Shape(const SharedPointer<Material> material, const AABB &boundingBox);
13-
HOST virtual ~Shape() noexcept = default;
12+
DEV HOST Shape(const SharedPointer<Material> material, const AABB &boundingBox);
13+
DEV HOST virtual ~Shape() noexcept = default;
1414

1515
public:
1616
DEV virtual bool getBoundingBox(double time0, double time1, AABB &box) const override;

include/Hittables/Objects/Sphere.cuh

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ class Sphere : public Shape
1111
public:
1212
static DEV void getSphereUV(const Vec3 &p, double &u, double &v);
1313

14-
HOST Sphere(const Vec3 &center0, const double R,
14+
DEV HOST Sphere(const Vec3 &center0, const double R,
1515
const SharedPointer<Material> material,
1616
const double t0 = 0., const double t1 = 1.);
1717

18-
HOST Sphere(const Vec3 &center0, const Vec3 &center1, const double R,
18+
DEV HOST Sphere(const Vec3 &center0, const Vec3 &center1, const double R,
1919
const SharedPointer<Material> material,
2020
const double t0 = 0., const double t1 = 1.);
2121

22-
HOST ~Sphere() noexcept = default;
22+
DEV HOST ~Sphere() noexcept = default;
2323

2424
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
2525
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Transformations/AARotate.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class AARotate : public Hittable
1414
DEV void inverseRotateCoords(Vec3 &v, const double sin) const;
1515

1616
public:
17-
HOST AARotate(const SharedPointer<Hittable> shape, double angle);
18-
HOST ~AARotate() noexcept = default;
17+
DEV HOST AARotate(const SharedPointer<Hittable> shape, double angle);
18+
DEV HOST ~AARotate() noexcept = default;
1919

2020
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
2121
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Transformations/ConstantVolume.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class ConstantVolume : public Hittable
1010
const double densityReciprocal;
1111

1212
public:
13-
HOST ConstantVolume(const SharedPointer<Hittable> boundary,
13+
DEV HOST ConstantVolume(const SharedPointer<Hittable> boundary,
1414
const SharedPointer<Texture> phaseFunction,
1515
const double density);
16-
HOST ~ConstantVolume() noexcept = default;
16+
DEV HOST ~ConstantVolume() noexcept = default;
1717

1818
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
1919
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Transformations/FlipFace.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class FlipFace : public Hittable
88
const SharedPointer<Hittable> hittable;
99

1010
public:
11-
HOST FlipFace(const SharedPointer<Hittable> hittable);
12-
HOST ~FlipFace() noexcept = default;
11+
DEV HOST FlipFace(const SharedPointer<Hittable> hittable);
12+
DEV HOST ~FlipFace() noexcept = default;
1313

1414
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
1515
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Hittables/Transformations/Translate.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class Translate : public Hittable
77
Vec3 displacement;
88

99
public:
10-
HOST Translate(const SharedPointer<Hittable> shape, const Vec3 &displacement);
11-
HOST ~Translate() noexcept = default;
10+
DEV HOST Translate(const SharedPointer<Hittable> shape, const Vec3 &displacement);
11+
DEV HOST ~Translate() noexcept = default;
1212

1313
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
1414
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Light/OrthonormalBasis.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class OrthonormalBasis
77
{
88
Vec3 axes[3];
99
public:
10-
HOST OrthonormalBasis(const Vec3& sample);
11-
HOST ~OrthonormalBasis() noexcept = default;
10+
DEV HOST OrthonormalBasis(const Vec3& sample);
11+
DEV HOST ~OrthonormalBasis() noexcept = default;
1212

1313
DEV Vec3 operator[](int i) const;
1414

include/Materials/Dielectric.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class Dielectric : public Material
66
const double reflectiveIndex;
77

88
public:
9-
HOST Dielectric(const double reflectiveIndex);
10-
HOST ~Dielectric() noexcept = default;
9+
DEV HOST Dielectric(const double reflectiveIndex);
10+
DEV HOST ~Dielectric() noexcept = default;
1111

1212
DEV bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const override;
1313
};

include/Materials/DiffuseLight.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class DiffuseLight : public Material
77
const Vec3 &point) const override;
88

99
public:
10-
HOST DiffuseLight(const SharedPointer<Texture> emitter);
11-
HOST ~DiffuseLight() noexcept = default;
10+
DEV HOST DiffuseLight(const SharedPointer<Texture> emitter);
11+
DEV HOST ~DiffuseLight() noexcept = default;
1212

1313
DEV bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const override;
1414
};

include/Materials/IsotropicMaterial.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class IsotropicMaterial : public Material
55
{
66
public:
7-
HOST IsotropicMaterial(const SharedPointer<Texture> albedo);
8-
HOST virtual ~IsotropicMaterial() noexcept = default;
7+
DEV HOST IsotropicMaterial(const SharedPointer<Texture> albedo);
8+
DEV HOST virtual ~IsotropicMaterial() noexcept = default;
99

1010
DEV bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const override;};

include/Materials/LambertianDiffuse.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
class LambertianDiffuse : public Material
66
{
77
public:
8-
HOST LambertianDiffuse(const SharedPointer<Texture> albedo);
9-
HOST ~LambertianDiffuse() noexcept = default;
8+
DEV HOST LambertianDiffuse(const SharedPointer<Texture> albedo);
9+
DEV HOST ~LambertianDiffuse() noexcept = default;
1010

1111
DEV bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const override;
1212
};

include/Materials/Material.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ protected:
1313
const SharedPointer<Texture> albedo;
1414

1515
public:
16-
HOST Material(const SharedPointer<Texture> albedo);
17-
HOST virtual ~Material() noexcept = default;
16+
DEV HOST Material(const SharedPointer<Texture> albedo);
17+
DEV HOST virtual ~Material() noexcept = default;
1818

1919
DEV virtual bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const;
2020
DEV virtual Vec3 emitCol(const Ray &ray, Hittable::HitRecord &record, const Vec3 &point) const;

include/Materials/Metal.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class Metal : public Material
66
double fuzz;
77

88
public:
9-
HOST Metal(const SharedPointer<Texture> albedo, const double fuzz = 0.);
10-
HOST virtual ~Metal() noexcept = default;
9+
DEV HOST Metal(const SharedPointer<Texture> albedo, const double fuzz = 0.);
10+
DEV HOST virtual ~Metal() noexcept = default;
1111

1212
DEV bool scatterRay(const Ray &ray, Hittable::HitRecord &record) const override;
1313
};

include/Pdfs/CosinePdf.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class CosinePdf : public Pdf
66
{
77
OrthonormalBasis basis;
88
public:
9-
HOST CosinePdf();
10-
HOST ~CosinePdf() noexcept = default;
9+
DEV HOST CosinePdf();
10+
DEV HOST ~CosinePdf() noexcept = default;
1111

1212
DEV void construct(const Vec3& v) override;
1313
DEV double eval(const Vec3& v) const override;

include/Pdfs/HittablePdf.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class HittablePdf : public Pdf
99
Vec3 origin;
1010

1111
public:
12-
HOST HittablePdf(SharedPointer<Hittable> object);
13-
HOST ~HittablePdf() noexcept = default;
12+
DEV HOST HittablePdf(SharedPointer<Hittable> object);
13+
DEV HOST ~HittablePdf() noexcept = default;
1414

1515
DEV virtual void construct(const Vec3& v) override;
1616
DEV double eval(const Vec3& v) const override;

include/Pdfs/Pdf.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class Pdf
77
{
88
public:
9-
HOST Pdf() = default;
10-
HOST virtual ~Pdf() noexcept = default;
9+
DEV HOST Pdf() = default;
10+
DEV HOST virtual ~Pdf() noexcept = default;
1111

1212
DEV virtual void construct(const Vec3& v) {}
1313
DEV virtual double eval(const Vec3& v) const = 0;

include/Pdfs/WeightedPdf.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class WeightedPdf : public Pdf
99
const double pdf1Weight;
1010

1111
public:
12-
HOST WeightedPdf(SharedPointer<Pdf> pdf1, SharedPointer<Pdf> pdf2, double pdf1Weight);
13-
HOST ~WeightedPdf() noexcept = default;
12+
DEV HOST WeightedPdf(SharedPointer<Pdf> pdf1, SharedPointer<Pdf> pdf2, double pdf1Weight);
13+
DEV HOST ~WeightedPdf() noexcept = default;
1414

1515
DEV SharedPointer<Pdf> getPdf1() const;
1616
DEV SharedPointer<Pdf> getPdf2() const;

include/Scene/AABB.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class AABB
1111

1212
public:
1313
DEV HOST static AABB combineAABBs(const AABB &b1, const AABB &b2);
14-
HOST AABB(const Vec3 &minPoint = Vec3{}, const Vec3 &maxPoint = Vec3{});
15-
HOST ~AABB() noexcept = default;
14+
DEV HOST AABB(const Vec3 &minPoint = Vec3{}, const Vec3 &maxPoint = Vec3{});
15+
DEV HOST ~AABB() noexcept = default;
1616

1717
DEV const Vec3 &getMinPoint() const;
1818
DEV const Vec3 &getMaxPoint() const;

include/Scene/BVHNode.cuh

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class BVHNode : public Hittable
1212
AABB boundingBox;
1313

1414
public:
15-
HOST BVHNode() = default;
16-
HOST BVHNode(HittableList &world, const double time0, const double time1);
17-
HOST BVHNode(HittableList &world, const double time0, const double time1, const size_t start, const size_t end);
15+
DEV HOST BVHNode() = default;
16+
DEV HOST BVHNode(HittableList &world, const double time0, const double time1);
17+
DEV HOST BVHNode(HittableList &world, const double time0, const double time1, const size_t start, const size_t end);
1818

19-
HOST ~BVHNode() noexcept = default;
19+
DEV HOST ~BVHNode() noexcept = default;
2020

2121
DEV HitType getCollisionData(const Ray &ray, HitRecord &record,
2222
double tMin = -utils::infinity,

include/Scene/Camera.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class Camera
3232
double time1, time2;
3333

3434
public:
35-
HOST Camera(const double aspR, double fov, const double aperture, const double focusD,
35+
DEV HOST Camera(const double aspR, double fov, const double aperture, const double focusD,
3636
const Vec3 &lookfrom = Vec3{}, const Vec3 &lookat = Vec3{0., 0., -1.},
3737
double t0 = 0., double t1 = 0.);
3838

39-
HOST ~Camera() noexcept = default;
39+
DEV HOST ~Camera() noexcept = default;
4040

4141
DEV Ray &updateLineOfSight(double u, double v);
4242
DEV const Ray &getLineOfSight() const;

include/Scene/HittableList.cuh

+32-32
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,54 @@ class HittableList : public Hittable
1818
struct HittableNode;
1919
struct HittableNode
2020
{
21-
HittableNode* next;
21+
HittableNode* next;
2222
SharedPointer<Hittable> data;
2323

24-
HOST HittableNode(const SharedPointer<Hittable>& data = SharedPointer<Hittable>());
25-
HOST ~HittableNode() noexcept;
24+
DEV HOST HittableNode(const SharedPointer<Hittable>& data = SharedPointer<Hittable>());
25+
DEV HOST ~HittableNode() noexcept;
2626
};
2727

2828
class HittableLinkedList
2929
{
3030
HittableNode* head;
3131
HittableNode* tail;
32-
unsigned len;
32+
unsigned len;
3333

34+
public:
35+
DEV HOST HittableLinkedList();
36+
DEV HOST ~HittableLinkedList() noexcept;
37+
38+
HOST void emplace_back(const SharedPointer<Hittable>& data);
39+
HOST void clear();
40+
DEV HOST bool empty() const;
41+
DEV HOST SharedPointer<Hittable> at(unsigned i) const;
42+
DEV HOST unsigned size() const;
43+
44+
class Iterator;
45+
46+
DEV HOST Iterator begin() const;
47+
DEV HOST Iterator end() const;
48+
49+
class Iterator
50+
{
51+
HittableNode* curr;
3452
public:
35-
HOST HittableLinkedList();
36-
HOST ~HittableLinkedList() noexcept;
37-
38-
HOST void emplace_back(const SharedPointer<Hittable>& data);
39-
HOST void clear();
40-
DEV HOST bool empty() const;
41-
DEV HOST SharedPointer<Hittable> at(unsigned i) const;
42-
DEV HOST unsigned size() const;
43-
44-
class Iterator;
45-
46-
DEV HOST Iterator begin() const;
47-
DEV HOST Iterator end() const;
48-
49-
class Iterator
50-
{
51-
HittableNode* curr;
52-
public:
53-
DEV HOST Iterator(HittableNode* n = nullptr);
54-
DEV HOST ~Iterator() = default;
55-
56-
DEV HOST Iterator& operator++();
57-
DEV HOST Iterator& operator=(HittableNode* n);
58-
DEV HOST bool operator!=(const Iterator& it);
59-
DEV HOST SharedPointer<Hittable> operator*();
60-
};
53+
DEV HOST Iterator(HittableNode* n = nullptr);
54+
DEV HOST ~Iterator() = default;
55+
56+
DEV HOST Iterator& operator++();
57+
DEV HOST Iterator& operator=(HittableNode* n);
58+
DEV HOST bool operator!=(const Iterator& it);
59+
DEV HOST SharedPointer<Hittable> operator*();
60+
};
6161
};
6262

6363
HittableLinkedList hittables;
6464
#endif
6565

6666
public:
67-
HOST HittableList() = default;
68-
HOST ~HittableList() noexcept = default;
67+
DEV HOST HittableList() = default;
68+
DEV HOST ~HittableList() noexcept = default;
6969

7070
DEV Hittable::HitType getCollisionData(const Ray &ray, HitRecord &record,
7171
double tMin = -utils::infinity, double tMax = utils::infinity,

include/Textures/CheckerTexture.cuh

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class CheckerTexture : public Texture
1010
const Vec3 scale;
1111

1212
public:
13-
HOST CheckerTexture(const SharedPointer<Texture> tex1,
13+
DEV HOST CheckerTexture(const SharedPointer<Texture> tex1,
1414
const SharedPointer<Texture> tex2,
1515
const double x, const double y, const double z);
1616

17-
HOST CheckerTexture(const SharedPointer<Texture> tex1,
17+
DEV HOST CheckerTexture(const SharedPointer<Texture> tex1,
1818
const SharedPointer<Texture> tex2, const Vec3 &scale);
1919

20-
HOST ~CheckerTexture() noexcept = default;
20+
DEV HOST ~CheckerTexture() noexcept = default;
2121

2222
DEV Vec3 getValue(const double u, const double v, const Vec3 &point) const override;
2323
};

include/Textures/ImageTexture.cuh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class ImageTexture : public Texture
1212
int bytesPerScanline;
1313

1414
public:
15-
HOST ImageTexture(const std::string &filename);
16-
HOST ~ImageTexture() noexcept = default;
15+
DEV HOST ImageTexture(const std::string &filename);
16+
DEV HOST ~ImageTexture() noexcept = default;
1717

1818
DEV Vec3 getValue(double u, double v, const Vec3 &point) const override;
1919
};

0 commit comments

Comments
 (0)