Ocean
TracingGroup.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_GI_TRACING_GROUP_H
9 #define META_OCEAN_RENDERING_GI_TRACING_GROUP_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 namespace GlobalIllumination
21 {
22 
23 /**
24  * This class implements a group of tracing objects.
25  * @ingroup renderinggi
26  */
27 class OCEAN_RENDERING_GI_EXPORT TracingGroup : public TracingObject
28 {
29  private:
30 
31  /**
32  * Definition of a vector holding tracing objects.
33  */
34  typedef std::vector<const TracingObject*> TracingObjects;
35 
36  public:
37 
38  /**
39  * Destructs this tracking object.
40  */
41  ~TracingGroup() override;
42 
43  /**
44  * Adds a new tracing object to this group object.
45  * @param object The new object to be added, must be valid
46  */
47  inline void addObject(const TracingObject* object);
48 
49  /**
50  * Determines the nearest intersection with between this tracing object and a given 3D ray.
51  * @see TracingObject::findNearestIntersection().
52  */
53  void findNearestIntersection(const Line3& ray, RayIntersection& intersection, const bool frontFace, const Scalar eps, const TracingObject* excludedObject = nullptr) const override;
54 
55  /**
56  * Determines whether this tracing object has an intersection with a provided 3D ray.
57  * @see TracingObject::hasIntersection().
58  */
59  bool hasIntersection(const Line3& ray, const Scalar maximalDistance = Numeric::maxValue(), const TracingObject* excludedObject = nullptr) const override;
60 
61  /**
62  * Determines the amount of light that transmits trough this object in the case e.g., this object is transparent.
63  * @see TracingObject::determineDampingColor().
64  */
65  bool determineDampingColor(const Line3& ray, RGBAColor& color, const Scalar maximalDistance = Numeric::maxValue()) const override;
66 
67  /**
68  * Determines the light (the color) for a specified viewing ray this object does reflect.
69  * @see TracingObject::determineColor().
70  */
71  bool determineColor(const Vector3& viewPosition, const Vector3& viewObjectDirection, const RayIntersection& intersection, const TracingGroup& group, const unsigned int bounces, const TracingObject* excludedObject, const Lighting::LightingModes lightingModes, RGBAColor& color) const override;
72 
73  private:
74 
75  /// The group of tracing objects.
77 };
78 
79 inline void TracingGroup::addObject(const TracingObject* object)
80 {
81  ocean_assert(object);
82  tracingObjects.push_back(object);
83 }
84 
85 }
86 
87 }
88 
89 }
90 
91 #endif // META_OCEAN_RENDERING_GI_TRACING_GROUP_H
This class implements an infinite line in 3D space.
Definition: Line3.h:70
static constexpr T maxValue()
Returns the max scalar value.
Definition: Numeric.h:3244
This class implements a color defined by red, green, blue and alpha parameters.
Definition: RGBAColor.h:41
LightingModes
Definition of individual lighting modes.
Definition: Lighting.h:47
This class implements a ray intersection object.
Definition: RayIntersection.h:44
This class implements a group of tracing objects.
Definition: TracingGroup.h:28
void findNearestIntersection(const Line3 &ray, RayIntersection &intersection, const bool frontFace, const Scalar eps, const TracingObject *excludedObject=nullptr) const override
Determines the nearest intersection with between this tracing object and a given 3D ray.
TracingObjects tracingObjects
The group of tracing objects.
Definition: TracingGroup.h:76
bool hasIntersection(const Line3 &ray, const Scalar maximalDistance=Numeric::maxValue(), const TracingObject *excludedObject=nullptr) const override
Determines whether this tracing object has an intersection with a provided 3D ray.
bool determineDampingColor(const Line3 &ray, RGBAColor &color, const Scalar maximalDistance=Numeric::maxValue()) const override
Determines the amount of light that transmits trough this object in the case e.g.,...
std::vector< const TracingObject * > TracingObjects
Definition of a vector holding tracing objects.
Definition: TracingGroup.h:34
void addObject(const TracingObject *object)
Adds a new tracing object to this group object.
Definition: TracingGroup.h:79
~TracingGroup() override
Destructs this tracking object.
bool determineColor(const Vector3 &viewPosition, const Vector3 &viewObjectDirection, const RayIntersection &intersection, const TracingGroup &group, const unsigned int bounces, const TracingObject *excludedObject, const Lighting::LightingModes lightingModes, RGBAColor &color) const override
Determines the light (the color) for a specified viewing ray this object does reflect.
This class is the abstract base class for all tracing objects.
Definition: TracingObject.h:39
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15