Merge branch 'master' of https://github.com/DigitalPulseSoftware/NazaraEngine
This commit is contained in:
commit
ae29fe12cb
|
|
@ -24,7 +24,7 @@ Nazara Engine:
|
|||
- Fix String movement constructor, which was leaving a null shared string (which was not reusable)
|
||||
- Add Flags<E>::Test method, in order to test one or multiple flags at once.
|
||||
- ⚠️ Vector2, Vector3 and Vector4 array/pointer constructor is now explicit to prevent some mistakes as `Vector2 vec2; vec2 = 0;`
|
||||
|
||||
- Fix RigidBody2D::SetGeom attribute copy and possible crash with static objects
|
||||
|
||||
Nazara Development Kit:
|
||||
- Added ImageWidget (#139)
|
||||
|
|
@ -46,6 +46,7 @@ Nazara Development Kit:
|
|||
- Fix TextAreaWidget cursor sometimes showing up in readonly mode
|
||||
- ⚠️ BaseWidget::OnKeyPressed now returns a boolean to indicate if it should block default action (such as tab to switch to the previous/next widget)
|
||||
- Pressing tab/shift-tab will now move to the next/previous widget able to be focused on
|
||||
- Fix GraphicsComponent::Clear method now clearing reflective states
|
||||
|
||||
# 0.4:
|
||||
|
||||
|
|
|
|||
|
|
@ -55,8 +55,15 @@ namespace Ndk
|
|||
|
||||
inline void GraphicsComponent::Clear()
|
||||
{
|
||||
m_materialEntries.clear();
|
||||
m_renderables.clear();
|
||||
|
||||
if (m_reflectiveMaterialCount > 0)
|
||||
{
|
||||
m_reflectiveMaterialCount = 0;
|
||||
InvalidateReflectionMap();
|
||||
}
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Ndk
|
|||
NazaraAssert(entityWorld->HasSystem<PhysicsSystem2D>(), "World must have a physics system");
|
||||
Nz::PhysWorld2D& physWorld = entityWorld->GetSystem<PhysicsSystem2D>().GetWorld();
|
||||
|
||||
m_staticBody.reset(new Nz::RigidBody2D(&physWorld, 0.f, m_geom));
|
||||
m_staticBody = std::make_unique<Nz::RigidBody2D>(&physWorld, 0.f, m_geom);
|
||||
|
||||
Nz::Matrix4f matrix;
|
||||
if (m_entity->HasComponent<NodeComponent>())
|
||||
|
|
|
|||
|
|
@ -74,10 +74,11 @@ namespace Nz
|
|||
static constexpr std::size_t InvalidShapeIndex = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
private:
|
||||
void CopyBodyData(cpBody* body);
|
||||
cpBody* Create(float mass = 1.f, float moment = 1.f);
|
||||
void Destroy();
|
||||
|
||||
static void CopyBodyData(cpBody* from, cpBody* to);
|
||||
|
||||
std::vector<cpShape*> m_shapes;
|
||||
Collider2DRef m_geom;
|
||||
cpBody* m_handle;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Platform | Build Status | Nightlies
|
||||
------------ | ------------- | -------------
|
||||
Windows | [](https://ci.appveyor.com/project/DPSLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DPSLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DPSLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64)
|
||||
Windows | [](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64)
|
||||
Linux | [](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine) | No
|
||||
|
||||
# Nazara Engine
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Platforme | Build Status | Nightlies
|
||||
------------ | ------------- | -------------
|
||||
Windows | [](https://ci.appveyor.com/project/DPSLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DPSLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DPSLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64)
|
||||
Windows | [](https://ci.appveyor.com/project/DrLynix/nazaraengine/branch/master) | MSVC14: [x86](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20Win32) [x86_64](https://ci.appveyor.com/api/projects/DrLynix/NazaraEngine/artifacts/package%2FNazaraEngine.7z?branch=master&job=Environment%3A%20TOOLSET%3Dvs2015%3B%20Configuration%3A%20ReleaseDynamic%3B%20Platform%3A%20x64)
|
||||
Linux | [](https://travis-ci.org/DigitalPulseSoftware/NazaraEngine) | Non
|
||||
|
||||
# Nazara Engine
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Nz
|
|||
m_handle = Create(m_mass, object.GetMomentOfInertia());
|
||||
SetGeom(object.GetGeom(), false);
|
||||
|
||||
CopyBodyData(object.GetHandle());
|
||||
CopyBodyData(object.GetHandle(), m_handle);
|
||||
|
||||
for (std::size_t i = 0; i < m_shapes.size(); ++i)
|
||||
m_shapes[i]->bb = cpShapeCacheBB(object.m_shapes[i]);
|
||||
|
|
@ -243,7 +243,7 @@ namespace Nz
|
|||
|
||||
cpBody* newHandle = Create(static_cast<float>(mass), static_cast<float>(moment));
|
||||
|
||||
CopyBodyData(m_handle);
|
||||
CopyBodyData(m_handle, newHandle);
|
||||
Destroy();
|
||||
|
||||
m_handle = newHandle;
|
||||
|
|
@ -403,25 +403,20 @@ namespace Nz
|
|||
return *this;
|
||||
}
|
||||
|
||||
void RigidBody2D::CopyBodyData(cpBody* body)
|
||||
{
|
||||
cpBodySetAngle(m_handle, cpBodyGetAngle(body));
|
||||
cpBodySetAngularVelocity(m_handle, cpBodyGetAngularVelocity(body));
|
||||
cpBodySetCenterOfGravity(m_handle, cpBodyGetCenterOfGravity(body));
|
||||
cpBodySetForce(m_handle, cpBodyGetForce(body));
|
||||
cpBodySetPosition(m_handle, cpBodyGetPosition(body));
|
||||
cpBodySetTorque(m_handle, cpBodyGetTorque(body));
|
||||
cpBodySetVelocity(m_handle, cpBodyGetVelocity(body));
|
||||
}
|
||||
|
||||
cpBody* RigidBody2D::Create(float mass, float moment)
|
||||
{
|
||||
cpBody* handle = cpBodyNew(mass, moment);
|
||||
cpBody* handle;
|
||||
if (IsKinematic())
|
||||
{
|
||||
if (IsStatic())
|
||||
handle = cpBodyNewStatic();
|
||||
else
|
||||
handle = cpBodyNewKinematic();
|
||||
}
|
||||
else
|
||||
handle = cpBodyNew(mass, moment);
|
||||
|
||||
cpBodySetUserData(handle, this);
|
||||
|
||||
if (mass <= 0.f)
|
||||
cpBodySetType(handle, CP_BODY_TYPE_KINEMATIC);
|
||||
|
||||
cpSpaceAddBody(m_world->GetHandle(), handle);
|
||||
|
||||
return handle;
|
||||
|
|
@ -443,4 +438,16 @@ namespace Nz
|
|||
}
|
||||
m_shapes.clear();
|
||||
}
|
||||
|
||||
void RigidBody2D::CopyBodyData(cpBody* from, cpBody* to)
|
||||
{
|
||||
cpBodySetAngle(to, cpBodyGetAngle(from));
|
||||
cpBodySetAngularVelocity(to, cpBodyGetAngularVelocity(from));
|
||||
cpBodySetCenterOfGravity(to, cpBodyGetCenterOfGravity(from));
|
||||
cpBodySetForce(to, cpBodyGetForce(from));
|
||||
cpBodySetPosition(to, cpBodyGetPosition(from));
|
||||
cpBodySetTorque(to, cpBodyGetTorque(from));
|
||||
cpBodySetVelocity(to, cpBodyGetVelocity(from));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue