A composed object compiled into a pool: a trivially copyable handle that evaluates the object's signed distance (or implicit function value) on the host or on a device.
More...
|
|
| Tape ()=delete |
| | No empty tape.
|
| |
| | Tape (Pool &a_pool, const Expr< T > &a_expr, const TapeOptions &a_options=TapeOptions()) |
| | Compile an expression into a pool.
|
| |
| | Tape (const Layout &a_layout, const PoolLocation &a_location) noexcept |
| | Rebuild a handle from a stored layout and the location of the pool that holds it.
|
| |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| | The object's value at a point: negative inside, positive outside, zero on the surface.
|
| |
| PrimitiveRef< T > | closestPrimitive (const Vec3T< T > &a_point) const noexcept |
| | The deciding leaf at a point: the primitive whose surface the value comes from there (see PrimitiveRef), with the point in its own frame.
|
| |
| HitT< T > | firstHit (const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options=RayOptions< T >()) const noexcept |
| | The first crossing of the object's surface along a ray, entering or leaving.
|
| |
| HitT< T > | firstHit (const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) const noexcept |
| | The first crossing of the object's surface on the segment from a_from to a_to.
|
| |
| HitStatus | intersects (const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options=RayOptions< T >()) const noexcept |
| | Whether a ray crosses the object's surface in [a_tMin, a_tMax].
|
| |
| HitStatus | intersects (const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) const noexcept |
| | Whether the segment from a_from to a_to crosses the object's surface.
|
| |
| template<class P > |
| bool | isPrimitive (const PrimitiveRef< T > &a_ref) const noexcept |
| | Whether a reference's leaf is a primitive of type P.
|
| |
| template<class P > |
| P | primitive (const PrimitiveRef< T > &a_ref) const noexcept |
| | The primitive a reference names, by value: the shape itself, or for a pool-resident type (a mesh SDF, a BVH union, a tape) its handle, rebuilt with the tape's location, so that it resolves against the same pool (or mirror) the tape does.
|
| |
| template<class F > |
| void | visitPrimitive (const PrimitiveRef< T > &a_ref, F &&a_f) const noexcept |
| | Call a function with the primitive a reference names, as primitive.
|
| |
| BV | computeBoundingVolume () const noexcept |
| | A box enclosing the object.
|
| |
| DistanceQuality | getDistanceQuality () const noexcept |
| | How far signedDistance() can be trusted as a distance.
|
| |
| uint32_t | getNumPrograms () const noexcept |
| | Number of sub-programs (1 plus one per Blur, Mollify, FiniteRepetition and BVH union operand).
|
| |
| uint32_t | getNumClauses () const noexcept |
| | Number of clauses over all sub-programs (the ray programs' not counted).
|
| |
| uint32_t | getNumBVHUnions () const noexcept |
| | Number of unions evaluated with a BVH.
|
| |
| uint32_t | getCallDepth () const noexcept |
| | How deep sub-program calls nest (0 if the tape has no Blur, Mollify, FiniteRepetition or BVH union).
|
| |
| const Layout & | layout () const noexcept |
| | The tape's arrays, with no location: what an outer pool-resident object stores.
|
| |
| Tape | rebasedView (const Pool &a_pool) const noexcept |
| | A view of this tape resolving against another pool of its mirror chain.
|
| |
| Tape | deepCopy (Pool &a_dstPool) const |
| | Copy the tape, and every pool-resident primitive and BVH it holds, into another pool.
|
| |
Public Member Functions inherited from EBGeometry::PoolHandle |
| PoolLocation | location () const noexcept |
| | Where this handle's arrays live.
|
| |
| bool | isAttachedTo (const Pool &a_pool) const noexcept |
| | Check whether this handle's arrays were reserved from a_pool.
|
| |
|
| template<class F > |
| static constexpr bool | hasFeature = TapeDetail::IndexOf<F, Features>::value < Features::size |
| | Whether the tape compiles feature F (see TapeFeature).
|
| |
|
static constexpr size_t | BranchingRatio = 4 |
| | Branching factor of the BVHs over union operands.
|
| |
|
static constexpr unsigned | MaxCallDepth = 4 |
| | How deep Blur, Mollify, FiniteRepetition and BVH unions may nest.
|
| |
|
static constexpr uint32_t | ValueStackSize = 16 |
| | Values a sub-program may hold at once.
|
| |
|
static constexpr uint32_t | PointStackSize = 8 |
| | Points a sub-program may hold at once (its input point included).
|
| |
|
static constexpr uint32_t | RayStackSize = 4 |
| | Span lists a ray program may hold at once; a subtree that would need more is marched.
|
| |
|
Protected Member Functions inherited from EBGeometry::PoolHandle |
|
| PoolHandle () noexcept=default |
| | An unset location; the first reservation attaches it.
|
| |
| | PoolHandle (const PoolLocation &a_location) noexcept |
| | Adopt a location, as a handle rebuilt from a stored layout does.
|
| |
| | PoolHandle (const PoolHandle &) noexcept=default |
| | Copy a handle, as a derived handle's copy does.
|
| |
|
| PoolHandle (PoolHandle &&) noexcept=default |
| | Move a handle; the same as a copy.
|
| |
| PoolHandle & | operator= (const PoolHandle &) noexcept=default |
| | Copy-assign a handle, as a derived handle's assignment does.
|
| |
| PoolHandle & | operator= (PoolHandle &&) noexcept=default |
| | Move-assign a handle; the same as a copy.
|
| |
|
| ~PoolHandle () noexcept=default |
| | Destructor; protected, since a PoolHandle exists only as the base of a handle.
|
| |
| void * | base () noexcept |
| | The base address this handle's offsets resolve against; see PoolLocation::base().
|
| |
| const void * | base () const noexcept |
| | The base address this handle's offsets resolve against, for read-only access.
|
| |
| void | attach (const Pool &a_pool, const char *a_who) noexcept |
| | Follow a_pool, as the first reservation does; see PoolLocation::attach().
|
| |
| PoolLocation | rebasedLocation (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept |
| | The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOnto().
|
| |
| void | setLocation (const PoolLocation &a_location) noexcept |
| | Replace the location, for a view or a copy made by a derived handle.
|
| |
template<class T, class... UserPrimitives>
class EBGeometry::Tape< T, UserPrimitives >
A composed object compiled into a pool: a trivially copyable handle that evaluates the object's signed distance (or implicit function value) on the host or on a device.
Build one from an Expr:
const T d = tape.signedDistance(p);
Signed distance field for an axis-aligned box (AABB).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:351
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:183
Signed distance field for a sphere.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:199
A composed object compiled into a pool: a trivially copyable handle that evaluates the object's signe...
Definition EBGeometry_Tape.hpp:683
Expr< ExprPrecision< A > > Union(const A &a_first, const B &a_second)
Union of two objects: the minimum of their values.
Expr< ExprPrecision< A > > Difference(const A &a_first, const B &a_second)
Difference A \ B: max(A, -B), inside A and outside B.
HostMemoryResource & hostMemoryResource() noexcept
Process-wide default host memory resource.
Expr< ExprPrecision< A > > Translate(const A &a_operand, const Vec3T< ExprPrecision< A > > &a_shift)
Translate an object by a shift.
The analytic shapes and the mesh SDFs (FlatMeshSDF, and MeshSDF and TriMeshSDF with the default branching factor and width) are built-in primitive types; any other shape type, such as a BVHUnion, a MeshSDF with another branching factor, another Tape or a type of your own, is listed in UserPrimitives. A pool-resident primitive must live in the tape's pool. The pool must outlive the tape and every copy and view of it (see PoolHandle).
The compiler works out each sub-expression's bounding box and distance quality (see Expr). A union or smooth union of many objects is evaluated with a BVH over their boxes, pruned as BVHUnion is, unless an object is not a distance. With exact distances the value is the plain minimum; with operands that are only bounds (DistanceQuality::Bound) pruning can skip an operand whose value is below its box's distance, so the value can be larger than the plain minimum, but it keeps the sign and is still a bound. Blur, Mollify, FiniteRepetition and BVH unions evaluate a sub-program several times; they nest at most MaxCallDepth deep, and a sub-program needs at most ValueStackSize values and PointStackSize points at once; the constructor rejects an expression that needs more.
Optional features (see TapeFeature) are listed among the template arguments, before the user primitive types by convention: Tape<T, TapeFeature::ExactOffsets, MyUnion>. A tape compiles only the features it lists, and without one computes the same object by the general path.
- Template Parameters
-
| T | Floating-point precision. |
| UserPrimitives | Additional primitive types (each a shape of precision T), and features (see TapeFeature). |
template<class T , class... UserPrimitives>
The deciding leaf at a point: the primitive whose surface the value comes from there (see PrimitiveRef), with the point in its own frame.
Evaluates the tape as signedDistance() does, carrying with each value the leaf it comes from. The leaves are numbered in expression order, depth first, each occurrence counted. A primitive that is itself a composition (a fused one, a tape, a BVH union) is one leaf: the tape is the scene, its leaves the parts. Callable on a device, like signedDistance().
- Parameters
-
- Returns
- The leaf, its type and index in the tape, and the point in its frame.