Fix Audio & Physics compilation

This commit is contained in:
Jérôme Leclercq 2020-08-27 19:26:04 +02:00
parent 9d16559f55
commit 94523980fa
5 changed files with 26 additions and 24 deletions

View File

@ -97,7 +97,7 @@ namespace Nz
Vector3f Audio::GetListenerPosition()
{
Vector3f position;
alGetListenerfv(AL_POSITION, position);
alGetListenerfv(AL_POSITION, &position.x);
return position;
}
@ -127,7 +127,7 @@ namespace Nz
Vector3f Audio::GetListenerVelocity()
{
Vector3f velocity;
alGetListenerfv(AL_VELOCITY, velocity);
alGetListenerfv(AL_VELOCITY, &velocity.x);
return velocity;
}
@ -294,7 +294,7 @@ namespace Nz
void Audio::SetListenerPosition(const Vector3f& position)
{
alListenerfv(AL_POSITION, position);
alListenerfv(AL_POSITION, &position.x);
}
/*!
@ -340,7 +340,7 @@ namespace Nz
void Audio::SetListenerVelocity(const Vector3f& velocity)
{
alListenerfv(AL_VELOCITY, velocity);
alListenerfv(AL_VELOCITY, &velocity.x);
}
/*!

View File

@ -142,7 +142,7 @@ namespace Nz
NazaraAssert(m_source != InvalidSource, "Invalid sound emitter");
Vector3f position;
alGetSourcefv(m_source, AL_POSITION, position);
alGetSourcefv(m_source, AL_POSITION, &position.x);
return position;
}
@ -157,7 +157,7 @@ namespace Nz
NazaraAssert(m_source != InvalidSource, "Invalid sound emitter");
Vector3f velocity;
alGetSourcefv(m_source, AL_VELOCITY, velocity);
alGetSourcefv(m_source, AL_VELOCITY, &velocity.x);
return velocity;
}
@ -241,7 +241,7 @@ namespace Nz
{
NazaraAssert(m_source != InvalidSource, "Invalid sound emitter");
alSourcefv(m_source, AL_POSITION, position);
alSourcefv(m_source, AL_POSITION, &position.x);
}
/*!
@ -267,7 +267,7 @@ namespace Nz
{
NazaraAssert(m_source != InvalidSource, "Invalid sound emitter");
alSourcefv(m_source, AL_VELOCITY, velocity);
alSourcefv(m_source, AL_VELOCITY, &velocity.x);
}
/*!

View File

@ -57,12 +57,12 @@ namespace Nz
NewtonCollision* collision = CreateHandle(&world);
{
NewtonCollisionCalculateAABB(collision, offsetMatrix, min, max);
NewtonCollisionCalculateAABB(collision, offsetMatrix, &min.x, &max.x);
}
NewtonDestroyCollision(collision);
}
else
NewtonCollisionCalculateAABB(m_handles.begin()->second, offsetMatrix, min, max);
NewtonCollisionCalculateAABB(m_handles.begin()->second, offsetMatrix, &min.x, &max.x);
return Boxf(scale * min, scale * max);
}

View File

@ -45,7 +45,9 @@ namespace Nz
return bodyIterator(*static_cast<RigidBody3D*>(NewtonBodyGetUserData(body)));
};
NewtonWorldForEachBodyInAABBDo(m_world, box.GetMinimum(), box.GetMaximum(), NewtonCallback, const_cast<void*>(static_cast<const void*>(&iterator)));
Vector3f min = box.GetMinimum();
Vector3f max = box.GetMaximum();
NewtonWorldForEachBodyInAABBDo(m_world, &min.x, &max.x, NewtonCallback, const_cast<void*>(static_cast<const void*>(&iterator)));
}
Vector3f PhysWorld3D::GetGravity() const

View File

@ -144,7 +144,7 @@ namespace Nz
Boxf RigidBody3D::GetAABB() const
{
Vector3f min, max;
NewtonBodyGetAABB(m_body, min, max);
NewtonBodyGetAABB(m_body, &min.x, &max.x);
return Boxf(min, max);
}
@ -152,7 +152,7 @@ namespace Nz
Vector3f RigidBody3D::GetAngularDamping() const
{
Vector3f angularDamping;
NewtonBodyGetAngularDamping(m_body, angularDamping);
NewtonBodyGetAngularDamping(m_body, &angularDamping.x);
return angularDamping;
}
@ -160,7 +160,7 @@ namespace Nz
Vector3f RigidBody3D::GetAngularVelocity() const
{
Vector3f angularVelocity;
NewtonBodyGetOmega(m_body, angularVelocity);
NewtonBodyGetOmega(m_body, &angularVelocity.x);
return angularVelocity;
}
@ -188,7 +188,7 @@ namespace Nz
Vector3f RigidBody3D::GetLinearVelocity() const
{
Vector3f velocity;
NewtonBodyGetVelocity(m_body, velocity);
NewtonBodyGetVelocity(m_body, &velocity.x);
return velocity;
}
@ -201,7 +201,7 @@ namespace Nz
Vector3f RigidBody3D::GetMassCenter(CoordSys coordSys) const
{
Vector3f center;
NewtonBodyGetCentreOfMass(m_body, center);
NewtonBodyGetCentreOfMass(m_body, &center.x);
switch (coordSys)
{
@ -268,12 +268,12 @@ namespace Nz
void RigidBody3D::SetAngularDamping(const Vector3f& angularDamping)
{
NewtonBodySetAngularDamping(m_body, angularDamping);
NewtonBodySetAngularDamping(m_body, &angularDamping.x);
}
void RigidBody3D::SetAngularVelocity(const Vector3f& angularVelocity)
{
NewtonBodySetOmega(m_body, angularVelocity);
NewtonBodySetOmega(m_body, &angularVelocity.x);
}
void RigidBody3D::SetGeom(Collider3DRef geom)
@ -301,7 +301,7 @@ namespace Nz
void RigidBody3D::SetLinearVelocity(const Vector3f& velocity)
{
NewtonBodySetVelocity(m_body, velocity);
NewtonBodySetVelocity(m_body, &velocity.x);
}
void RigidBody3D::SetMass(float mass)
@ -342,7 +342,7 @@ namespace Nz
void RigidBody3D::SetMassCenter(const Vector3f& center)
{
if (m_mass > 0.f)
NewtonBodySetCentreOfMass(m_body, center);
NewtonBodySetCentreOfMass(m_body, &center.x);
}
void RigidBody3D::SetMaterial(const String& materialName)
@ -389,9 +389,9 @@ namespace Nz
// Moving a static body in Newton does not update bodies at the target location
// http://newtondynamics.com/wiki/index.php5?title=Can_i_dynamicly_move_a_TriMesh%3F
Vector3f min, max;
NewtonBodyGetAABB(m_body, min, max);
NewtonBodyGetAABB(m_body, &min.x, &max.x);
NewtonWorldForEachBodyInAABBDo(m_world->GetHandle(), min, max, [](const NewtonBody* const body, void* const userData) -> int
NewtonWorldForEachBodyInAABBDo(m_world->GetHandle(), &min.x, &max.x, [](const NewtonBody* const body, void* const userData) -> int
{
NazaraUnused(userData);
NewtonBodySetSleepState(body, 0);
@ -430,8 +430,8 @@ namespace Nz
if (!NumberEquals(me->m_gravityFactor, 0.f))
me->m_forceAccumulator += me->m_world->GetGravity() * me->m_gravityFactor * me->m_mass;
NewtonBodySetForce(body, me->m_forceAccumulator);
NewtonBodySetTorque(body, me->m_torqueAccumulator);
NewtonBodySetForce(body, &me->m_forceAccumulator.x);
NewtonBodySetTorque(body, &me->m_torqueAccumulator.x);
me->m_torqueAccumulator.Set(0.f);
me->m_forceAccumulator.Set(0.f);