| 27 | // -------------------------------------------------------------------------------------------------------------------- |
| 28 | |
| 29 | SimulationData::SimulationData(bool enableIndirect, |
| 30 | bool enablePathing, |
| 31 | SceneType sceneType, |
| 32 | IndirectEffectType indirectType, |
| 33 | int maxNumOcclusionSamples, |
| 34 | float maxDuration, |
| 35 | int maxOrder, |
| 36 | int samplingRate, |
| 37 | int frameSize, |
| 38 | shared_ptr<OpenCLDevice> openCL, |
| 39 | shared_ptr<TANDevice> tan) |
| 40 | { |
| 41 | directInputs.flags = static_cast<DirectSimulationFlags>(0); |
| 42 | directInputs.occlusionType = OcclusionType::Raycast; |
| 43 | directInputs.occlusionRadius = 0.0f; |
| 44 | directInputs.numOcclusionSamples = maxNumOcclusionSamples; |
| 45 | directInputs.numTransmissionRays = 1; |
| 46 | |
| 47 | reflectionInputs.enabled = false; |
| 48 | pathingInputs.enabled = false; |
| 49 | |
| 50 | directOutputs.directPath.distanceAttenuation = 1.0f; |
| 51 | directOutputs.directPath.directivity = 1.0f; |
| 52 | directOutputs.directPath.occlusion = 1.0f; |
| 53 | for (auto i = 0; i < Bands::kNumBands; ++i) |
| 54 | { |
| 55 | directOutputs.directPath.airAbsorption[i] = 1.0f; |
| 56 | directOutputs.directPath.transmission[i] = 1.0f; |
| 57 | } |
| 58 | |
| 59 | if (enableIndirect) |
| 60 | { |
| 61 | reflectionInputs.transitionTime = 1.0f; |
| 62 | reflectionInputs.overlapFraction = 0.25f; |
| 63 | reflectionInputs.baked = false; |
| 64 | for (auto i = 0; i < Bands::kNumBands; ++i) |
| 65 | { |
| 66 | reflectionInputs.reverbScale[i] = 1.0f; |
| 67 | } |
| 68 | |
| 69 | reflectionState.energyField = EnergyFieldFactory::create(sceneType, maxDuration, maxOrder, openCL); |
| 70 | reflectionState.accumEnergyField = EnergyFieldFactory::create(sceneType, maxDuration, maxOrder, openCL); |
| 71 | reflectionState.energyField->reset(); |
| 72 | reflectionState.accumEnergyField->reset(); |
| 73 | reflectionState.numFramesAccumulated = 0; |
| 74 | |
| 75 | if (indirectType != IndirectEffectType::Parametric) |
| 76 | { |
| 77 | reflectionState.impulseResponse = ImpulseResponseFactory::create(indirectType, maxDuration, maxOrder, samplingRate, openCL); |
| 78 | reflectionState.impulseResponse->reset(); |
| 79 | |
| 80 | reflectionState.impulseResponseCopy = ImpulseResponseFactory::create(indirectType, maxDuration, maxOrder, samplingRate, openCL); |
| 81 | reflectionState.impulseResponseCopy->reset(); |
| 82 | |
| 83 | auto numChannels = SphericalHarmonics::numCoeffsForOrder(maxOrder); |
| 84 | auto irSize = static_cast<int>(ceilf(maxDuration * samplingRate)); |
| 85 | |
| 86 | reflectionState.distanceAttenuationCorrectionCurve.resize(irSize); |
nothing calls this directly
no test coverage detected