Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::Intersector Class Referenceabstract

#include <Intersector.h>

Inheritance diagram for ph::Intersector:
ph::Intersectable ph::BruteForceIntersector ph::KdtreeIntersector ph::TBinaryBvhIntersector< Index > ph::TIndexedKdtreeIntersector< Index > ph::TWideBvhIntersector< N, Index >

Public Member Functions

virtual void update (TSpanView< const Intersectable * > intersectables)=0
 
bool isIntersecting (const Ray &ray, HitProbe &probe) const override=0
 Determine whether a given ray hits the object.
 
math::AABB3D calcAABB () const override=0
 Calculates Axis-Aligned Bounding Box (AABB) of itself.
 
bool reintersect (const Ray &ray, HitProbe &probe, const Ray &srcRay, HitProbe &srcProbe) const override
 Intersect the intersected object again with a different ray.
 
void calcHitDetail (const Ray &ray, HitProbe &probe, HitDetail *out_detail) const override
 Calculates properties of a hit, such as coordinates and normal.
 
- Public Member Functions inherited from ph::Intersectable
virtual ~Intersectable ()=default
 
virtual bool isOccluding (const Ray &ray) const
 Determines whether this object blocks the ray.
 
virtual bool mayOverlapVolume (const math::AABB3D &volume) const
 Conservatively checks whether this object overlaps a volume.
 

Member Function Documentation

◆ calcAABB()

math::AABB3D ph::Intersector::calcAABB ( ) const
overridepure virtual

◆ calcHitDetail()

void ph::Intersector::calcHitDetail ( const Ray & ray,
HitProbe & probe,
HitDetail * out_detail ) const
overridevirtual

Calculates properties of a hit, such as coordinates and normal.

This method calculates a detailed description of a hit from the ray and probe involved in a hit event. For example, the ray and probe used for calling isIntersecting() can be the inputs of this method (if an intersection is found). The process of calculating intersection detail will destroy the input probe.

Parameters
rayThe ray from a hit event.
probeThe probe from a hit event. The process of detail calculation will destroy the probe.
out_detailStores the calculated details. This method calculates the essential details only. Some information such as coordinate bases will only be available if specifically requested afterwards (for an example, see HitDetail::computeBases()).
Note
See Primitive for more methods that can generate a hit event.
Warning
This method will destroy the probe.

Implements ph::Intersectable.

◆ isIntersecting()

bool ph::Intersector::isIntersecting ( const Ray & ray,
HitProbe & probe ) const
overridepure virtual

Determine whether a given ray hits the object.

Checks whether the specified ray intersects this intersectable. If there is an intersection, true is returned and a brief hit report is stored inside the probe. If there is no intersection, false is returned and the state of the probe is undefined. ray and probe can be used for obtaining hit detail if an intersection is found.

Note
Generates hit event (with ray and probe).

Implements ph::Intersectable.

Implemented in ph::BruteForceIntersector, ph::KdtreeIntersector, ph::TBinaryBvhIntersector< Index >, ph::TIndexedKdtreeIntersector< Index >, and ph::TWideBvhIntersector< N, Index >.

◆ reintersect()

bool ph::Intersector::reintersect ( const Ray & ray,
HitProbe & probe,
const Ray & srcRay,
HitProbe & srcProbe ) const
overridevirtual

Intersect the intersected object again with a different ray.

This method is different to isIntersecting(const Ray, HitProbe&) const. Given srcRay and srcProbe, this method performs an intersection test against the chain of intersectables recorded in srcProbe (so it is impossible to "discover" new intersectables with this method). Taking BVH as an example, the implementation may only record the intersected object in the probe so this method can bypass the entire BVH traversal.

Parameters
rayThe ray to test for intersection.
probeThe probe to record the intersection.
srcRayThe ray from a previous hit event.
srcProbeThe probe from a hit event. The process of re-intersect will destroy the probe.
Returns
Whether ray intersects the object.
Note
Generates hit event (with ray and probe).
Warning
This method will destroy srcProbe.

Implements ph::Intersectable.

◆ update()


The documentation for this class was generated from the following files: