JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
JPL::SpecularRayTracing Class Reference

#include <JPLSpatial/PathTracing/SpecularRayTracing.h>

Static Public Member Functions

template<class SceneType , bool bPathHashCombine = true>
static void Trace (const SceneType &sceneInterface, const typename SceneType::Vec3 &origin, const TraceParameters &parameters, TraceResults< typename SceneType::Intersection > &outTraceResults)
 
template<class SceneType , class SpecularPathCacheContainer >
static void ProcessTraces (SceneType &sceneInterface, const typename SceneType::SourceData &sourceData, TraceResults< typename SceneType::Intersection > &traces, std::span< const typename SceneType::ReceiverData > receiverData, SpecularPathCacheContainer &caches)
 
template<class SceneType , class SpecularPathCacheContainer >
static void ProcessTraces (SceneType &sceneInterface, const typename SceneType::SourceData &sourceData, TraceResults< typename SceneType::Intersection > &sourceTraces, std::span< const typename SceneType::ReceiverData > receiverData, std::span< TraceResults< typename SceneType::Intersection > > receiverTraces, SpecularPathCacheContainer &caches)
 

Static Public Attributes

static constexpr std::size_t cMaxOrder = 16
 

Detailed Description

Specular Ray Tracing algorithm. Supporting backtracing - tracing from the listener. And bidirectional tracing - from the listener and sources.

Example backtracing from the listener:

// Step 1. Trace paths from the listener's postiion

MySceneType scenInterface;
Vec3 listenerPosition = ...;
TraceParameters parameters = ...;
TraceResults outTraceResults;

SpecularRayTracing::Trace(scenInterface, listenerPosition, parameters, outTraceResults)

// Step 2. Process traces

SourceData sourceData{ listenerPosition, listenerId };
std::span<ReceiverData> receiverData = ... // per sound source { position, Id }
std::span<SpecularPathCache*> specularPathCache = ... // per sound source SPC

SpecularRayTracing::ProcessTraces(scenInterface, sourceData, outTraceResults, receiversData, specularPathCache);

// Step 3. Make early reflection taps from SpecularPathCache

...

For bidirectional traces: 1) Do Step 1 from above for listener and for each source.

Member Function Documentation

◆ ProcessTraces() [1/2]

void JPL::SpecularRayTracing::ProcessTraces ( SceneType sceneInterface,
const typename SceneType::SourceData &  sourceData,
TraceResults< typename SceneType::Intersection > &  sourceTraces,
std::span< const typename SceneType::ReceiverData >  receiverData,
std::span< TraceResults< typename SceneType::Intersection > >  receiverTraces,
SpecularPathCacheContainer caches 
)
inlinestatic

Process bidirectional traces, connect source paths with receivers and receiver paths with the source.

Note: here source is assumed to be listener and thus the Image Sources are constructed from the receivers.

Parameters
sourceDatadata for the source of the traces
receiverDatadata for the receivers of the traces
sourceTracestraces done from the source position
receiverTracestraces done from the positions of receivers
Template Parameters
SpecularPathCacheContainermust have operator[] overloaded to access cache for a receiver index

◆ ProcessTraces() [2/2]

void JPL::SpecularRayTracing::ProcessTraces ( SceneType sceneInterface,
const typename SceneType::SourceData &  sourceData,
TraceResults< typename SceneType::Intersection > &  traces,
std::span< const typename SceneType::ReceiverData >  receiverData,
SpecularPathCacheContainer caches 
)
inlinestatic

Process traces from source direction, connect paths to receivers.

Note: here source is assumed to be listener and thus the Image Sources are constructed from the receivers.

Parameters
sourceDatadata for the source of the traces
receiverDatadata for the receiver of the traces
tracestraces done from the source position
Template Parameters
SpecularPathCacheContainermust have operator[] overloaded to access cache for a receiver index

◆ Trace()

template<class SceneType , bool bPathHashCombine>
void JPL::SpecularRayTracing::Trace ( const SceneType sceneInterface,
const typename SceneType::Vec3 &  origin,
const TraceParameters parameters,
TraceResults< typename SceneType::Intersection > &  outTraceResults 
)
inlinestatic

Trace paths from origin based on TraceParameters. This can be used to trace from the listener and sources.

Template Parameters
bPathHashCombineif set to true, hash of each node is a combination "up to" this node, otherwise it's a hash of this particular intersection.

Member Data Documentation

◆ cMaxOrder

constexpr std::size_t JPL::SpecularRayTracing::cMaxOrder = 16
staticconstexpr

The documentation for this class was generated from the following file: