RayTracer class

Performs multi-bounce ray tracing against RaycastColliderComponent entities that have RaycastColliderComponent.isReflective set to true.

Each bounce reflects the ray's direction around the surface normal and multiplies the remaining distance budget by RaycastColliderComponent.reflectivity.

Example:

final tracer = RayTracer(raycastSystem: raycastSys, maxBounces: 3);
final trace = tracer.trace(Ray(origin: origin, direction: dir));
for (final seg in trace.segments) {
  drawBeam(seg.from, seg.to, hitPoint: seg.hit?.point);
}

Constructors

RayTracer({required RaycastSystem raycastSystem, int maxBounces = 3, double minReflectivity = 0.1})

Properties

hashCode int
The hash code for this object.
no setterinherited
maxBounces int
Maximum number of reflection bounces (0 = no bounces).
final
minReflectivity double
Minimum surface reflectivity required to produce a bounce (0–1).
final
raycastSystem RaycastSystem
The RaycastSystem used to query each ray segment.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
trace(Ray ray, {String? filterTag}) RayTrace
Trace ray through the world, bouncing off reflective surfaces.

Operators

operator ==(Object other) bool
The equality operator.
inherited