-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesh.hh
41 lines (34 loc) · 1.24 KB
/
mesh.hh
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
#pragma once
#include <cmath>
#include <vector>
#include "../material/material.hh"
#include "../math/vec.hh"
#include "hitable.hh"
#include "triangle.hh"
//
#include "../io/obj.hh"
namespace partou::shape
{
class Mesh : public Hitable
{
public:
explicit Mesh() = default;
explicit Mesh(const std::vector<Triangle>& tris, std::shared_ptr<Material> matp = nullptr);
explicit Mesh(const io::loader::OBJ& objLoader, std::shared_ptr<Material> matp = nullptr);
// explicit Mesh(Mesh& m, std::shared_ptr<Material> matp = nullptr);
// explicit Mesh(Mesh&& m) = default;
// explicit Mesh(const Mesh& m) = default;
// explicit Mesh(Mesh& m);
auto apply(const math::spatial::Transform& tModel) -> Mesh&;
auto computeBoundingBox() -> void;
auto hit(const Ray& r, const math::Float t_min, const math::Float t_max, hit_info& info) const
-> bool final override;
auto transformModel(const math::spatial::Transform& tModel) -> void final override;
auto pdf_value(const math::Point3f& origin, const math::Vec3f& dir) const
-> math::Float final override;
auto random(const math::Point3f& origin) const -> math::Vec3f final override;
std::shared_ptr<Material> m_matptr;
std::vector<Triangle> m_tris;
protected:
};
} // namespace partou::shape