Physics3D/Collider3D: Update ForEachPolygon signature
This commit is contained in:
parent
ffc58e9806
commit
ce43b633b9
|
|
@ -174,6 +174,7 @@ Nazara Engine:
|
||||||
- Signal now implement a copy constructor and copy assignation operator for convenience
|
- Signal now implement a copy constructor and copy assignation operator for convenience
|
||||||
- Fixed ENet UnreliableFragment packets sent as Unreliable (and such being incomplete upon reception)
|
- Fixed ENet UnreliableFragment packets sent as Unreliable (and such being incomplete upon reception)
|
||||||
- ENet DisconnectLater now reflects libenet behavior (and is waiting for unreliable commands to be sent before disconnecting for good)
|
- ENet DisconnectLater now reflects libenet behavior (and is waiting for unreliable commands to be sent before disconnecting for good)
|
||||||
|
- ⚠ Collider3D::ForEachPolygon now takes a void(Vector3f\*, std::size_t) callback (instead of void(float\*, std::size_t))
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace Nz
|
||||||
virtual void ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const;
|
virtual void ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const;
|
||||||
virtual float ComputeVolume() const;
|
virtual float ComputeVolume() const;
|
||||||
|
|
||||||
virtual void ForEachPolygon(const std::function<void(const float* vertices, std::size_t vertexCount)>& callback) const;
|
virtual void ForEachPolygon(const std::function<void(const Vector3f* vertices, std::size_t vertexCount)>& callback) const;
|
||||||
|
|
||||||
NewtonCollision* GetHandle(PhysWorld3D* world) const;
|
NewtonCollision* GetHandle(PhysWorld3D* world) const;
|
||||||
virtual ColliderType3D GetType() const = 0;
|
virtual ColliderType3D GetType() const = 0;
|
||||||
|
|
|
||||||
|
|
@ -114,12 +114,14 @@ namespace Nz
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Collider3D::ForEachPolygon(const std::function<void(const float* vertices, std::size_t vertexCount)>& callback) const
|
void Collider3D::ForEachPolygon(const std::function<void(const Vector3f* vertices, std::size_t vertexCount)>& callback) const
|
||||||
{
|
{
|
||||||
auto newtCallback = [](void* const userData, int vertexCount, const dFloat* const faceArray, int /*faceId*/)
|
auto newtCallback = [](void* const userData, int vertexCount, const dFloat* const faceArray, int /*faceId*/)
|
||||||
{
|
{
|
||||||
|
static_assert(sizeof(Vector3f) == 3 * sizeof(float), "Vector3 is expected to contain 3 floats without padding");
|
||||||
|
|
||||||
const auto& cb = *static_cast<std::add_pointer_t<decltype(callback)>>(userData);
|
const auto& cb = *static_cast<std::add_pointer_t<decltype(callback)>>(userData);
|
||||||
cb(faceArray, vertexCount);
|
cb(reinterpret_cast<const Vector3f*>(faceArray), vertexCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check for existing collision handles, and create a temporary one if none is available
|
// Check for existing collision handles, and create a temporary one if none is available
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue