SurfaceGroup class
#include <darts/surface_group.h>
A collection of Surfaces grouped together.
Provides an interface for treating a collection of Surfaces as a single Surface. This base class implements a naive linear-time intersection routine which simply intersects each ray with every child Surface.
This class also serves as the superclass for acceleration structures (such as BVHs, KD-Trees) which are responsible for performing ray-surface intersection tests against a collection of Surfaces.
We derive SurfaceGroup from XformedSurface so that nested SurfaceGroups can be individually positioned/oriented with respect to their parent.
Base classes
- class XformedSurface
- A convenience subclass of Surface for surfaces with a Transform.
Derived classes
- struct BBH
- An axis-aligned bounding box hierarchy acceleration structure.
Constructors, destructors, conversion operators
- SurfaceGroup(const json& j = json::object())
- Create a new naive accelerator, add children if they are specified in
j
.
Public functions
- void build(const Scene* scene) override
- Perform any necessary precomputation before ray tracing.
- void add_child(shared_ptr<Surface> surface) override
- Add a child surface.
- auto intersect(const Ray3f& ray, HitRecord& hit) const -> bool override
- Intersect a ray against all surfaces registered with the Accelerator.
- auto local_bounds() const -> Box3f override
- Return the surface's local-space AABB.
Protected variables
- vector<shared_ptr<Surface>> m_surfaces
- All children.
Function documentation
void SurfaceGroup:: build(const Scene* scene) override
Perform any necessary precomputation before ray tracing.
If a surface requires some precomputation (e.g. building an acceleration structure) overload this function. This will be called after the last child has been added and before any call to intersect().
The base class implementation just does nothing.
bool SurfaceGroup:: intersect(const Ray3f& ray,
HitRecord& hit) const override
Intersect a ray against all surfaces registered with the Accelerator.
Parameters | |
---|---|
ray in | A 3-dimensional ray data structure with minimum/maximum extent information |
hit out | A detailed intersection record, which will be filled by the intersection query |
Returns | True if an intersection was found |
Intersect a ray against this surface and return detailed intersection information.