| 82 | } |
| 83 | |
| 84 | float SpatializationNode::distanceConeGain(ContextRenderLock & r) |
| 85 | { |
| 86 | if (!r.context()) |
| 87 | return 1.f; |
| 88 | |
| 89 | auto listener = r.context()->listener(); |
| 90 | |
| 91 | /// @fixme these values should be per sample, not per quantum |
| 92 | FloatPoint3D fwd = { |
| 93 | listener->forwardX()->value(), |
| 94 | listener->forwardY()->value(), |
| 95 | listener->forwardZ()->value()}; |
| 96 | |
| 97 | /// @fixme these values should be per sample, not per quantum |
| 98 | FloatPoint3D pos = { |
| 99 | positionX()->value(), |
| 100 | positionY()->value(), |
| 101 | positionZ()->value()}; |
| 102 | |
| 103 | float occlusionAttenuation = occluders ? occluders->occlusion(pos, fwd) : 1.0f; |
| 104 | return occlusionAttenuation * PannerNode::distanceConeGain(r); |
| 105 | } |
| 106 | } |