| 37 | // -------------------------------------------------------------------------------------------------------------------- |
| 38 | |
| 39 | CSimulator::CSimulator(CContext* context, |
| 40 | IPLSimulationSettings* settings) |
| 41 | { |
| 42 | auto _context = context->mHandle.get(); |
| 43 | if (!_context) |
| 44 | throw Exception(Status::Failure); |
| 45 | |
| 46 | auto _enableDirect = (settings->flags & IPL_SIMULATIONFLAGS_DIRECT); |
| 47 | auto _enableIndirect = (settings->flags & IPL_SIMULATIONFLAGS_REFLECTIONS); |
| 48 | auto _enablePathing = (settings->flags & IPL_SIMULATIONFLAGS_PATHING); |
| 49 | auto _sceneType = static_cast<SceneType>(settings->sceneType); |
| 50 | auto _indirectType = static_cast<IndirectEffectType>(settings->reflectionType); |
| 51 | auto _maxNumListeners = 1; |
| 52 | auto _asymmetricVisRange = true; |
| 53 | auto _down = Vector3f(0.0f, -1.0f, 0.0f); |
| 54 | auto _openCL = (settings->openCLDevice) ? reinterpret_cast<COpenCLDevice*>(settings->openCLDevice)->mHandle.get() : nullptr; |
| 55 | auto _radeonRays = (settings->radeonRaysDevice) ? reinterpret_cast<CRadeonRaysDevice*>(settings->radeonRaysDevice)->mHandle.get() : nullptr; |
| 56 | auto _tan = (settings->tanDevice) ? reinterpret_cast<CTrueAudioNextDevice*>(settings->tanDevice)->mHandle.get() : nullptr; |
| 57 | |
| 58 | new (&mHandle) Handle<SimulationManager>(ipl::make_shared<SimulationManager>(_enableDirect, _enableIndirect, _enablePathing, |
| 59 | _sceneType, _indirectType, settings->maxNumOcclusionSamples, settings->maxNumRays, |
| 60 | settings->numDiffuseSamples, settings->maxDuration, settings->maxOrder, |
| 61 | settings->maxNumSources, _maxNumListeners, settings->numThreads, |
| 62 | settings->rayBatchSize, settings->numVisSamples, _asymmetricVisRange, _down, |
| 63 | settings->samplingRate, settings->frameSize, _openCL, _radeonRays, _tan), _context); |
| 64 | } |
| 65 | |
| 66 | ISimulator* CSimulator::retain() |
| 67 | { |