Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
MaskedIntersectable.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <Common/primitive_type.h>
7
8#include <memory>
9
10namespace ph
11{
12
13class SurfaceHit;
14
24{
25public:
34 const Intersectable* intersectable,
35 const std::shared_ptr<TTexture<real>>& mask,
36 uint8 maxIterations = 4);
37
38 bool isIntersecting(const Ray& ray, HitProbe& probe) const override;
39
40 bool reintersect(
41 const Ray& ray,
42 HitProbe& probe,
43 const Ray& srcRay,
44 HitProbe& srcProbe) const override;
45
46 void calcHitDetail(
47 const Ray& ray,
48 HitProbe& probe,
49 HitDetail* out_detail) const override;
50
51 math::AABB3D calcAABB() const override;
52
53private:
54 bool isOnMask(const SurfaceHit& X) const;
55
56 const Intersectable* m_intersectable;
57 std::shared_ptr<TTexture<real>> m_mask;
58 uint8 m_maxIterations;
59};
60
61}// end namespace ph
Detailed information regarding a ray-primitive intersection.
Definition HitDetail.h:26
Lightweight ray intersection testing and reporting object. If an intersection is found,...
Definition HitProbe.h:27
An object in the scene that a ray can intersect with.
Definition Intersectable.h:31
Carve out some part of an intersectable. This is a masking approach based on intersection routine....
Definition MaskedIntersectable.h:24
void calcHitDetail(const Ray &ray, HitProbe &probe, HitDetail *out_detail) const override
Calculates properties of a hit, such as coordinates and normal.
Definition MaskedIntersectable.cpp:166
math::AABB3D calcAABB() const override
Calculates Axis-Aligned Bounding Box (AABB) of itself.
Definition MaskedIntersectable.cpp:178
MaskedIntersectable(const Intersectable *intersectable, const std::shared_ptr< TTexture< real > > &mask, uint8 maxIterations=4)
Definition MaskedIntersectable.cpp:64
bool isIntersecting(const Ray &ray, HitProbe &probe) const override
Determine whether a given ray hits the object.
Definition MaskedIntersectable.cpp:79
bool reintersect(const Ray &ray, HitProbe &probe, const Ray &srcRay, HitProbe &srcProbe) const override
Intersect the intersected object again with a different ray.
Definition MaskedIntersectable.cpp:117
Represents a ray in space.
Definition Ray.h:21
General information about a ray-surface intersection event.
Definition SurfaceHit.h:59
Definition TTexture.h:12
The root for all renderer implementations.
Definition EEngineProject.h:6