Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Primitive.h
Go to the documentation of this file.
1#pragma once
2
4#include "Math/TVector3.h"
6
7#include <Common/primitive_type.h>
8
9namespace ph
10{
11
12class Ray;
13class HitProbe;
14class HitDetail;
15class PrimitiveMetadata;
16class PrimitivePosSampleQuery;
17class PrimitivePosPdfQuery;
18class SampleFlow;
19
23{
24public:
25 bool isIntersecting(const Ray& ray, HitProbe& probe) const override = 0;
26
28 const Ray& ray,
29 HitProbe& probe,
30 HitDetail* out_detail) const override = 0;
31
33 const Ray& ray,
34 HitProbe& probe,
35 const Ray& srcRay,
36 HitProbe& srcProbe) const override = 0;
37
38 math::AABB3D calcAABB() const override = 0;
39
43 virtual void genPosSample(
45 SampleFlow& sampleFlow,
46 HitProbe& probe) const;
47
50 virtual void calcPosPdf(PrimitivePosPdfQuery& query) const;
51
59 virtual real calcExtendedArea() const;
60
64 virtual const PrimitiveMetadata* getMetadata() const;
65};
66
67// In-header Implementation:
68
69inline real Primitive::calcExtendedArea() const
70{
71 return 0.0_r;
72}
73
75{
76 return nullptr;
77}
78
79}// 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
A physical shape in the scene.
Definition Primitive.h:23
virtual real calcExtendedArea() const
Calculates the area extended by this primitive. The term "extended" implies single-sided,...
Definition Primitive.h:69
void calcHitDetail(const Ray &ray, HitProbe &probe, HitDetail *out_detail) const override=0
Calculates properties of a hit, such as coordinates and normal.
virtual const PrimitiveMetadata * getMetadata() const
Definition Primitive.h:74
bool reintersect(const Ray &ray, HitProbe &probe, const Ray &srcRay, HitProbe &srcProbe) const override=0
Intersect the intersected object again with a different ray.
virtual void calcPosPdf(PrimitivePosPdfQuery &query) const
Given a point on the surface of this primitive, calculates the PDF of sampling this point.
Definition Primitive.cpp:19
virtual void genPosSample(PrimitivePosSampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const
Generates a sample point on the surface of this primitive.
Definition Primitive.cpp:10
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.
Collection of attached components to a primitive. This type effectively "glues" various components th...
Definition PrimitiveMetadata.h:22
Information for the probability of generating a specific sample point on a primitive.
Definition PrimitivePosPdfQuery.h:91
Information for generating a sample point on a primitive.
Definition PrimitivePosSampleQuery.h:132
Represents a ray in space.
Definition Ray.h:21
A sample with arbitrary dimensions with fine-grained sampling control.
Definition SampleFlow.h:19
The root for all renderer implementations.
Definition EEngineProject.h:6