Photon Engine 2.0.0-beta
A physically based renderer.
|
A sphere specifically built for environment lighting. This primitive is for environment map with latitude-longitude format. Unlike regular primitives, transformations are done locally rather than wrapping the primitive by another to allow a wider set of custom operations. Note that the UV for the environment sphere is based on the direction of incident ray. More...
#include <PLatLongEnvSphere.h>
Public Member Functions | |
PLatLongEnvSphere (real radius) | |
PLatLongEnvSphere (real radius, const math::StaticRigidTransform *localToWorld, const math::StaticRigidTransform *worldToLocal) | |
bool | isIntersecting (const Ray &ray, HitProbe &probe) const override |
Determine whether a given ray hits the object. | |
bool | isOccluding (const Ray &ray) const override |
Determines whether this object blocks the ray. | |
void | calcHitDetail (const Ray &ray, HitProbe &probe, HitDetail *out_detail) const override |
Calculates properties of a hit, such as coordinates and normal. | |
void | calcPosPdf (PrimitivePosPdfQuery &query) const override |
Given a point on the surface of this primitive, calculates the PDF of sampling this point. | |
void | genPosSample (PrimitivePosSampleQuery &query, SampleFlow &sampleFlow, HitProbe &probe) const override |
Generates a sample point on the surface of this primitive. | |
bool | mayOverlapVolume (const math::AABB3D &volume) const override |
Conservatively checks whether this object overlaps a volume. | |
math::AABB3D | calcAABB () const override |
Calculates Axis-Aligned Bounding Box (AABB) of itself. | |
real | calcExtendedArea () const override |
Calculates the area extended by this primitive. The term "extended" implies single-sided, e.g., a triangle's extended area is half the absolute value of the cross product of its two edge vectors. To treat it as double-sided, you need to multiply the result by 2 manually. | |
Public Member Functions inherited from ph::PBasicSphere | |
PBasicSphere (real radius) | |
bool | reintersect (const Ray &ray, HitProbe &probe, const Ray &srcRay, HitProbe &srcProbe) const override |
Intersect the intersected object again with a different ray. | |
real | getRadius () const |
real | getRcpRadius () const |
Public Member Functions inherited from ph::Primitive | |
virtual const PrimitiveMetadata * | getMetadata () const |
Public Member Functions inherited from ph::Intersectable | |
virtual | ~Intersectable ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from ph::PBasicSphere | |
auto | getRefinedSurfaceAndNormal (const math::Vector3R &srcSurface) const -> std::pair< math::Vector3R, math::Vector3R > |
A sphere specifically built for environment lighting. This primitive is for environment map with latitude-longitude format. Unlike regular primitives, transformations are done locally rather than wrapping the primitive by another to allow a wider set of custom operations. Note that the UV for the environment sphere is based on the direction of incident ray.
|
explicit |
ph::PLatLongEnvSphere::PLatLongEnvSphere | ( | real | radius, |
const math::StaticRigidTransform * | localToWorld, | ||
const math::StaticRigidTransform * | worldToLocal ) |
|
inlineoverridevirtual |
Calculates Axis-Aligned Bounding Box (AABB) of itself.
Reimplemented from ph::PBasicSphere.
|
inlineoverridevirtual |
Calculates the area extended by this primitive. The term "extended" implies single-sided, e.g., a triangle's extended area is half the absolute value of the cross product of its two edge vectors. To treat it as double-sided, you need to multiply the result by 2 manually.
Reimplemented from ph::PBasicSphere.
|
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.
ray | The ray from a hit event. |
probe | The probe from a hit event. The process of detail calculation will destroy the probe. |
out_detail | Stores 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() ). |
Primitive
for more methods that can generate a hit event. Implements ph::PBasicSphere.
|
overridevirtual |
Given a point on the surface of this primitive, calculates the PDF of sampling this point.
Reimplemented from ph::Primitive.
|
overridevirtual |
Generates a sample point on the surface of this primitive.
PrimitivePosSampleOutput::getObservationRay()
and probe
). Reimplemented from ph::Primitive.
|
overridevirtual |
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.
ray
and probe
). Reimplemented from ph::PBasicSphere.
|
overridevirtual |
Determines whether this object blocks the ray.
If greater performance is desired, you can override the default implementation which simply calls isIntersecting(const Ray&, HitProbe&) const to do the job. The test generally considers the underlying shape as hollow (for closed shape), e.g., a sphere is not occluding a line segment inside the sphere.
This method does not provide any means to retrieve HitDetail
. Focusing on testing occlusion can improve performance for some cases.
Reimplemented from ph::Intersectable.
|
inlineoverridevirtual |
Conservatively checks whether this object overlaps a volume.
By conservative, it means true can be returned even though the object does not overlap the volume; but if it actually does, true must be returned. The default implementation performs conservative intersecting test using the AABB calculated by calcAABB(). Although false-positives are allowed for this method, providing an implementation with higher accuracy is benefitial for many algorithms used by the renderer. The test generally considers the underlying shape as hollow (for closed shape), while the volume is solid.
Reimplemented from ph::PBasicSphere.