| 285 | } |
| 286 | |
| 287 | void Xaudio2Effect3D::update(std::chrono::system_clock::time_point const & now, bool leftHanded) |
| 288 | { |
| 289 | using namespace std::chrono; |
| 290 | |
| 291 | float dt = (float)0.001f * duration_cast<milliseconds>(now - prevTime).count(); |
| 292 | |
| 293 | affine3 const & xform = transform.get(); |
| 294 | |
| 295 | float3 prevP = prevPosition, |
| 296 | curP = xform.m_translation, |
| 297 | V = dt * (curP - prevP); |
| 298 | |
| 299 | float3 front = xform.transformVector({ 0.f, 0.f, -1.f }), |
| 300 | up = xform.transformVector({ 0.f, 1.f, 0.f }); |
| 301 | |
| 302 | if (leftHanded) |
| 303 | { |
| 304 | emitter.Position = X3DAUDIO_VECTOR(curP.x, curP.y, curP.z); |
| 305 | emitter.Velocity = X3DAUDIO_VECTOR(V.x, V.y, V.z); |
| 306 | emitter.OrientFront = X3DAUDIO_VECTOR(front.x, front.y, front.z); |
| 307 | emitter.OrientTop = X3DAUDIO_VECTOR(up.x, up.y, up.z); |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | emitter.Position = X3DAUDIO_VECTOR(curP.x, curP.y, -curP.z); |
| 312 | emitter.Velocity = X3DAUDIO_VECTOR(V.x, V.y, -V.z); |
| 313 | emitter.OrientFront = X3DAUDIO_VECTOR(front.x, front.y, -front.z); |
| 314 | emitter.OrientTop = X3DAUDIO_VECTOR(up.x, up.y, -up.z); |
| 315 | } |
| 316 | |
| 317 | prevPosition = prevP; |
| 318 | prevTime = now; |
| 319 | } |
| 320 | |
| 321 | // |
| 322 | // Xaudio2 engine specialization |
nothing calls this directly
no test coverage detected