Switch from Nz prefix to namespace Nz
What a huge commit Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Ndk
|
||||
{
|
||||
inline Application::Application()
|
||||
{
|
||||
NzErrorFlags errFlags(nzErrorFlag_ThrowException, true);
|
||||
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
|
||||
|
||||
// Initialisation du SDK
|
||||
Sdk::Initialize();
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Ndk
|
||||
|
||||
BaseComponent(ComponentIndex componentIndex);
|
||||
BaseComponent(const BaseComponent&) = default;
|
||||
BaseComponent(BaseComponent&&) noexcept = default;
|
||||
BaseComponent(BaseComponent&&) = default;
|
||||
virtual ~BaseComponent();
|
||||
|
||||
virtual BaseComponent* Clone() const = 0;
|
||||
@@ -32,7 +32,7 @@ namespace Ndk
|
||||
ComponentIndex GetIndex() const;
|
||||
|
||||
BaseComponent& operator=(const BaseComponent&) = default;
|
||||
BaseComponent& operator=(BaseComponent&&) noexcept = default;
|
||||
BaseComponent& operator=(BaseComponent&&) = default;
|
||||
|
||||
protected:
|
||||
ComponentIndex m_componentIndex;
|
||||
|
||||
@@ -79,11 +79,11 @@ namespace Ndk
|
||||
static inline void Uninitialize();
|
||||
|
||||
std::vector<EntityHandle> m_entities;
|
||||
NzBitset<nzUInt64> m_entityBits;
|
||||
NzBitset<> m_excludedComponents;
|
||||
mutable NzBitset<> m_filterResult;
|
||||
NzBitset<> m_requiredAnyComponents;
|
||||
NzBitset<> m_requiredComponents;
|
||||
Nz::Bitset<Nz::UInt64> m_entityBits;
|
||||
Nz::Bitset<> m_excludedComponents;
|
||||
mutable Nz::Bitset<> m_filterResult;
|
||||
Nz::Bitset<> m_requiredAnyComponents;
|
||||
Nz::Bitset<> m_requiredComponents;
|
||||
SystemIndex m_systemIndex;
|
||||
World* m_world;
|
||||
float m_updateCounter;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ndk
|
||||
{
|
||||
class Entity;
|
||||
|
||||
class NDK_API CameraComponent : public Component<CameraComponent>, public NzAbstractViewer
|
||||
class NDK_API CameraComponent : public Component<CameraComponent>, public Nz::AbstractViewer
|
||||
{
|
||||
public:
|
||||
inline CameraComponent();
|
||||
@@ -34,26 +34,26 @@ namespace Ndk
|
||||
inline void EnsureViewportUpdate() const;
|
||||
|
||||
inline float GetAspectRatio() const;
|
||||
inline NzVector3f GetEyePosition() const;
|
||||
inline NzVector3f GetForward() const;
|
||||
inline Nz::Vector3f GetEyePosition() const;
|
||||
inline Nz::Vector3f GetForward() const;
|
||||
inline float GetFOV() const;
|
||||
inline const NzFrustumf& GetFrustum() const;
|
||||
inline const Nz::Frustumf& GetFrustum() const;
|
||||
inline unsigned int GetLayer() const;
|
||||
inline const NzMatrix4f& GetProjectionMatrix() const;
|
||||
inline nzProjectionType GetProjectionType() const;
|
||||
inline const NzRenderTarget* GetTarget() const;
|
||||
inline const NzRectf& GetTargetRegion() const;
|
||||
inline const NzMatrix4f& GetViewMatrix() const;
|
||||
inline const NzRecti& GetViewport() const;
|
||||
inline const Nz::Matrix4f& GetProjectionMatrix() const;
|
||||
inline Nz::ProjectionType GetProjectionType() const;
|
||||
inline const Nz::RenderTarget* GetTarget() const;
|
||||
inline const Nz::Rectf& GetTargetRegion() const;
|
||||
inline const Nz::Matrix4f& GetViewMatrix() const;
|
||||
inline const Nz::Recti& GetViewport() const;
|
||||
inline float GetZFar() const;
|
||||
inline float GetZNear() const;
|
||||
|
||||
inline void SetFOV(float fov);
|
||||
inline void SetLayer(unsigned int layer);
|
||||
inline void SetProjectionType(nzProjectionType projection);
|
||||
inline void SetTarget(const NzRenderTarget* renderTarget);
|
||||
inline void SetTargetRegion(const NzRectf& region);
|
||||
inline void SetViewport(const NzRecti& viewport);
|
||||
inline void SetProjectionType(Nz::ProjectionType projection);
|
||||
inline void SetTarget(const Nz::RenderTarget* renderTarget);
|
||||
inline void SetTargetRegion(const Nz::Rectf& region);
|
||||
inline void SetViewport(const Nz::Recti& viewport);
|
||||
inline void SetZFar(float zFar);
|
||||
inline void SetZNear(float zNear);
|
||||
|
||||
@@ -69,26 +69,26 @@ namespace Ndk
|
||||
void OnComponentAttached(BaseComponent& component) override;
|
||||
void OnComponentDetached(BaseComponent& component) override;
|
||||
void OnDetached() override;
|
||||
void OnNodeInvalidated(const NzNode* node);
|
||||
void OnRenderTargetRelease(const NzRenderTarget* renderTarget);
|
||||
void OnRenderTargetSizeChange(const NzRenderTarget* renderTarget);
|
||||
void OnNodeInvalidated(const Nz::Node* node);
|
||||
void OnRenderTargetRelease(const Nz::RenderTarget* renderTarget);
|
||||
void OnRenderTargetSizeChange(const Nz::RenderTarget* renderTarget);
|
||||
|
||||
void UpdateFrustum() const;
|
||||
void UpdateProjectionMatrix() const;
|
||||
void UpdateViewMatrix() const;
|
||||
void UpdateViewport() const;
|
||||
|
||||
NazaraSlot(NzNode, OnNodeInvalidation, m_nodeInvalidationSlot);
|
||||
NazaraSlot(NzRenderTarget, OnRenderTargetRelease, m_targetReleaseSlot);
|
||||
NazaraSlot(NzRenderTarget, OnRenderTargetSizeChange, m_targetResizeSlot);
|
||||
NazaraSlot(Nz::Node, OnNodeInvalidation, m_nodeInvalidationSlot);
|
||||
NazaraSlot(Nz::RenderTarget, OnRenderTargetRelease, m_targetReleaseSlot);
|
||||
NazaraSlot(Nz::RenderTarget, OnRenderTargetSizeChange, m_targetResizeSlot);
|
||||
|
||||
nzProjectionType m_projectionType;
|
||||
mutable NzFrustumf m_frustum;
|
||||
mutable NzMatrix4f m_projectionMatrix;
|
||||
mutable NzMatrix4f m_viewMatrix;
|
||||
NzRectf m_targetRegion;
|
||||
mutable NzRecti m_viewport;
|
||||
const NzRenderTarget* m_target;
|
||||
Nz::ProjectionType m_projectionType;
|
||||
mutable Nz::Frustumf m_frustum;
|
||||
mutable Nz::Matrix4f m_projectionMatrix;
|
||||
mutable Nz::Matrix4f m_viewMatrix;
|
||||
Nz::Rectf m_targetRegion;
|
||||
mutable Nz::Recti m_viewport;
|
||||
const Nz::RenderTarget* m_target;
|
||||
mutable bool m_frustumUpdated;
|
||||
mutable bool m_projectionMatrixUpdated;
|
||||
mutable bool m_viewMatrixUpdated;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace Ndk
|
||||
{
|
||||
inline CameraComponent::CameraComponent() :
|
||||
m_projectionType(nzProjectionType_Perspective),
|
||||
m_projectionType(Nz::ProjectionType_Perspective),
|
||||
m_targetRegion(0.f, 0.f, 1.f, 1.f),
|
||||
m_target(nullptr),
|
||||
m_frustumUpdated(false),
|
||||
@@ -25,7 +25,7 @@ namespace Ndk
|
||||
|
||||
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
|
||||
Component(camera),
|
||||
NzAbstractViewer(camera),
|
||||
AbstractViewer(camera),
|
||||
m_projectionType(camera.m_projectionType),
|
||||
m_targetRegion(camera.m_targetRegion),
|
||||
m_target(nullptr),
|
||||
@@ -78,7 +78,7 @@ namespace Ndk
|
||||
return m_fov;
|
||||
}
|
||||
|
||||
inline const NzFrustumf& CameraComponent::GetFrustum() const
|
||||
inline const Nz::Frustumf& CameraComponent::GetFrustum() const
|
||||
{
|
||||
EnsureFrustumUpdate();
|
||||
|
||||
@@ -90,36 +90,36 @@ namespace Ndk
|
||||
return m_layer;
|
||||
}
|
||||
|
||||
inline const NzMatrix4f& CameraComponent::GetProjectionMatrix() const
|
||||
inline const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const
|
||||
{
|
||||
EnsureProjectionMatrixUpdate();
|
||||
|
||||
return m_projectionMatrix;
|
||||
}
|
||||
|
||||
inline nzProjectionType CameraComponent::GetProjectionType() const
|
||||
inline Nz::ProjectionType CameraComponent::GetProjectionType() const
|
||||
{
|
||||
return m_projectionType;
|
||||
}
|
||||
|
||||
inline const NzRenderTarget* CameraComponent::GetTarget() const
|
||||
inline const Nz::RenderTarget* CameraComponent::GetTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
inline const NzRectf& CameraComponent::GetTargetRegion() const
|
||||
inline const Nz::Rectf& CameraComponent::GetTargetRegion() const
|
||||
{
|
||||
return m_targetRegion;
|
||||
}
|
||||
|
||||
inline const NzMatrix4f& CameraComponent::GetViewMatrix() const
|
||||
inline const Nz::Matrix4f& CameraComponent::GetViewMatrix() const
|
||||
{
|
||||
EnsureViewMatrixUpdate();
|
||||
|
||||
return m_viewMatrix;
|
||||
}
|
||||
|
||||
inline const NzRecti& CameraComponent::GetViewport() const
|
||||
inline const Nz::Recti& CameraComponent::GetViewport() const
|
||||
{
|
||||
EnsureViewportUpdate();
|
||||
|
||||
@@ -138,20 +138,20 @@ namespace Ndk
|
||||
|
||||
inline void CameraComponent::SetFOV(float fov)
|
||||
{
|
||||
NazaraAssert(!NzNumberEquals(fov, 0.f), "FOV must be different from zero");
|
||||
NazaraAssert(!Nz::NumberEquals(fov, 0.f), "FOV must be different from zero");
|
||||
m_fov = fov;
|
||||
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
inline void CameraComponent::SetProjectionType(nzProjectionType projectionType)
|
||||
inline void CameraComponent::SetProjectionType(Nz::ProjectionType projectionType)
|
||||
{
|
||||
m_projectionType = projectionType;
|
||||
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
inline void CameraComponent::SetTarget(const NzRenderTarget* renderTarget)
|
||||
inline void CameraComponent::SetTarget(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
m_target = renderTarget;
|
||||
if (m_target)
|
||||
@@ -160,14 +160,14 @@ namespace Ndk
|
||||
m_targetReleaseSlot.Disconnect();
|
||||
}
|
||||
|
||||
inline void CameraComponent::SetTargetRegion(const NzRectf& region)
|
||||
inline void CameraComponent::SetTargetRegion(const Nz::Rectf& region)
|
||||
{
|
||||
m_targetRegion = region;
|
||||
|
||||
InvalidateViewport();
|
||||
}
|
||||
|
||||
inline void CameraComponent::SetViewport(const NzRecti& viewport)
|
||||
inline void CameraComponent::SetViewport(const Nz::Recti& viewport)
|
||||
{
|
||||
NazaraAssert(m_target, "Component has no render target");
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Ndk
|
||||
float invWidth = 1.f/m_target->GetWidth();
|
||||
float invHeight = 1.f/m_target->GetHeight();
|
||||
|
||||
SetTargetRegion(NzRectf(invWidth * viewport.x, invHeight * viewport.y, invWidth * viewport.width, invHeight * viewport.height));
|
||||
SetTargetRegion(Nz::Rectf(invWidth * viewport.x, invHeight * viewport.y, invWidth * viewport.width, invHeight * viewport.height));
|
||||
}
|
||||
|
||||
inline void CameraComponent::SetZFar(float zFar)
|
||||
@@ -187,7 +187,7 @@ namespace Ndk
|
||||
|
||||
inline void CameraComponent::SetZNear(float zNear)
|
||||
{
|
||||
NazaraAssert(!NzNumberEquals(zNear, 0.f), "zNear cannot be zero");
|
||||
NazaraAssert(!Nz::NumberEquals(zNear, 0.f), "zNear cannot be zero");
|
||||
m_zNear = zNear;
|
||||
|
||||
InvalidateProjectionMatrix();
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
#include <NDK/Component.hpp>
|
||||
#include <memory>
|
||||
|
||||
class NzPhysObject;
|
||||
namespace Nz
|
||||
{
|
||||
class PhysObject;
|
||||
}
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
@@ -23,30 +26,30 @@ namespace Ndk
|
||||
friend class StaticCollisionSystem;
|
||||
|
||||
public:
|
||||
CollisionComponent(NzPhysGeomRef geom = NzPhysGeomRef());
|
||||
CollisionComponent(Nz::PhysGeomRef geom = Nz::PhysGeomRef());
|
||||
CollisionComponent(const CollisionComponent& collision);
|
||||
~CollisionComponent() = default;
|
||||
|
||||
const NzPhysGeomRef& GetGeom() const;
|
||||
const Nz::PhysGeomRef& GetGeom() const;
|
||||
|
||||
void SetGeom(NzPhysGeomRef geom);
|
||||
void SetGeom(Nz::PhysGeomRef geom);
|
||||
|
||||
CollisionComponent& operator=(NzPhysGeomRef geom);
|
||||
CollisionComponent& operator=(Nz::PhysGeomRef geom);
|
||||
CollisionComponent& operator=(CollisionComponent&& collision) = default;
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
private:
|
||||
void InitializeStaticBody();
|
||||
NzPhysObject* GetStaticBody();
|
||||
Nz::PhysObject* GetStaticBody();
|
||||
|
||||
void OnAttached() override;
|
||||
void OnComponentAttached(BaseComponent& component) override;
|
||||
void OnComponentDetached(BaseComponent& component) override;
|
||||
void OnDetached() override;
|
||||
|
||||
std::unique_ptr<NzPhysObject> m_staticBody;
|
||||
NzPhysGeomRef m_geom;
|
||||
std::unique_ptr<Nz::PhysObject> m_staticBody;
|
||||
Nz::PhysGeomRef m_geom;
|
||||
bool m_bodyUpdated;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline CollisionComponent::CollisionComponent(NzPhysGeomRef geom) :
|
||||
inline CollisionComponent::CollisionComponent(Nz::PhysGeomRef geom) :
|
||||
m_geom(std::move(geom)),
|
||||
m_bodyUpdated(false)
|
||||
{
|
||||
@@ -21,19 +21,19 @@ namespace Ndk
|
||||
{
|
||||
}
|
||||
|
||||
inline const NzPhysGeomRef& CollisionComponent::GetGeom() const
|
||||
inline const Nz::PhysGeomRef& CollisionComponent::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
inline CollisionComponent& CollisionComponent::operator=(NzPhysGeomRef geom)
|
||||
inline CollisionComponent& CollisionComponent::operator=(Nz::PhysGeomRef geom)
|
||||
{
|
||||
SetGeom(geom);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline NzPhysObject* CollisionComponent::GetStaticBody()
|
||||
inline Nz::PhysObject* CollisionComponent::GetStaticBody()
|
||||
{
|
||||
return m_staticBody.get();
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ namespace Ndk
|
||||
inline GraphicsComponent(const GraphicsComponent& graphicsComponent);
|
||||
~GraphicsComponent() = default;
|
||||
|
||||
inline void AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const;
|
||||
inline void AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const;
|
||||
|
||||
inline void Attach(NzInstancedRenderableRef renderable);
|
||||
inline void Attach(Nz::InstancedRenderableRef renderable);
|
||||
|
||||
inline void EnsureTransformMatrixUpdate() const;
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
private:
|
||||
void InvalidateRenderableData(const NzInstancedRenderable* renderable, nzUInt32 flags, unsigned int index);
|
||||
void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, unsigned int index);
|
||||
inline void InvalidateRenderables();
|
||||
inline void InvalidateTransformMatrix();
|
||||
|
||||
@@ -39,29 +39,29 @@ namespace Ndk
|
||||
void OnComponentAttached(BaseComponent& component) override;
|
||||
void OnComponentDetached(BaseComponent& component) override;
|
||||
void OnDetached() override;
|
||||
void OnNodeInvalidated(const NzNode* node);
|
||||
void OnNodeInvalidated(const Nz::Node* node);
|
||||
|
||||
void UpdateTransformMatrix() const;
|
||||
|
||||
NazaraSlot(NzNode, OnNodeInvalidation, m_nodeInvalidationSlot);
|
||||
NazaraSlot(Nz::Node, OnNodeInvalidation, m_nodeInvalidationSlot);
|
||||
|
||||
struct Renderable
|
||||
{
|
||||
Renderable(NzMatrix4f& transformMatrix) :
|
||||
Renderable(Nz::Matrix4f& transformMatrix) :
|
||||
data(transformMatrix),
|
||||
dataUpdated(false)
|
||||
{
|
||||
}
|
||||
|
||||
NazaraSlot(NzInstancedRenderable, OnInstancedRenderableInvalidateData, renderableInvalidationSlot);
|
||||
NazaraSlot(Nz::InstancedRenderable, OnInstancedRenderableInvalidateData, renderableInvalidationSlot);
|
||||
|
||||
mutable NzInstancedRenderable::InstanceData data;
|
||||
NzInstancedRenderableRef renderable;
|
||||
mutable Nz::InstancedRenderable::InstanceData data;
|
||||
Nz::InstancedRenderableRef renderable;
|
||||
mutable bool dataUpdated;
|
||||
};
|
||||
|
||||
std::vector<Renderable> m_renderables;
|
||||
mutable NzMatrix4f m_transformMatrix;
|
||||
mutable Nz::Matrix4f m_transformMatrix;
|
||||
mutable bool m_transformMatrixUpdated;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Ndk
|
||||
Attach(r.renderable);
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const
|
||||
inline void GraphicsComponent::AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const
|
||||
{
|
||||
EnsureTransformMatrixUpdate();
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::Attach(NzInstancedRenderableRef renderable)
|
||||
inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable)
|
||||
{
|
||||
m_renderables.emplace_back(m_transformMatrix);
|
||||
Renderable& r = m_renderables.back();
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API LightComponent : public Component<LightComponent>, public NzLight
|
||||
class NDK_API LightComponent : public Component<LightComponent>, public Nz::Light
|
||||
{
|
||||
public:
|
||||
inline LightComponent(nzLightType lightType = nzLightType_Point);
|
||||
inline LightComponent(Nz::LightType lightType = Nz::LightType_Point);
|
||||
LightComponent(const LightComponent& light) = default;
|
||||
~LightComponent() = default;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline LightComponent::LightComponent(nzLightType lightType) :
|
||||
NzLight(lightType)
|
||||
inline LightComponent::LightComponent(Nz::LightType lightType) :
|
||||
Nz::Light(lightType)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace Ndk
|
||||
{
|
||||
class Entity;
|
||||
|
||||
class NDK_API NodeComponent : public Component<NodeComponent>, public NzNode
|
||||
class NDK_API NodeComponent : public Component<NodeComponent>, public Nz::Node
|
||||
{
|
||||
public:
|
||||
NodeComponent() = default;
|
||||
~NodeComponent() = default;
|
||||
|
||||
void SetParent(Entity* entity, bool keepDerived = false);
|
||||
using NzNode::SetParent;
|
||||
using Nz::Node::SetParent;
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
};
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Ndk
|
||||
{
|
||||
NazaraAssert(entity->HasComponent<NodeComponent>(), "Entity must have a NodeComponent");
|
||||
|
||||
NzNode::SetParent(entity->GetComponent<NodeComponent>(), keepDerived);
|
||||
Nz::Node::SetParent(entity->GetComponent<NodeComponent>(), keepDerived);
|
||||
}
|
||||
else
|
||||
NzNode::SetParent(nullptr, keepDerived);
|
||||
Nz::Node::SetParent(nullptr, keepDerived);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,45 +25,45 @@ namespace Ndk
|
||||
PhysicsComponent(const PhysicsComponent& physics);
|
||||
~PhysicsComponent() = default;
|
||||
|
||||
void AddForce(const NzVector3f& force, nzCoordSys coordSys = nzCoordSys_Global);
|
||||
void AddForce(const NzVector3f& force, const NzVector3f& point, nzCoordSys coordSys = nzCoordSys_Global);
|
||||
void AddTorque(const NzVector3f& torque, nzCoordSys coordSys = nzCoordSys_Global);
|
||||
void AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
void AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
void AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys = Nz::CoordSys_Global);
|
||||
|
||||
void EnableAutoSleep(bool autoSleep);
|
||||
|
||||
NzBoxf GetAABB() const;
|
||||
NzVector3f GetAngularVelocity() const;
|
||||
Nz::Boxf GetAABB() const;
|
||||
Nz::Vector3f GetAngularVelocity() const;
|
||||
float GetGravityFactor() const;
|
||||
float GetMass() const;
|
||||
NzVector3f GetMassCenter(nzCoordSys coordSys = nzCoordSys_Local) const;
|
||||
const NzMatrix4f& GetMatrix() const;
|
||||
NzVector3f GetPosition() const;
|
||||
NzQuaternionf GetRotation() const;
|
||||
NzVector3f GetVelocity() const;
|
||||
Nz::Vector3f GetMassCenter(Nz::CoordSys coordSys = Nz::CoordSys_Local) const;
|
||||
const Nz::Matrix4f& GetMatrix() const;
|
||||
Nz::Vector3f GetPosition() const;
|
||||
Nz::Quaternionf GetRotation() const;
|
||||
Nz::Vector3f GetVelocity() const;
|
||||
|
||||
bool IsAutoSleepEnabled() const;
|
||||
bool IsMoveable() const;
|
||||
bool IsSleeping() const;
|
||||
|
||||
void SetAngularVelocity(const NzVector3f& angularVelocity);
|
||||
void SetAngularVelocity(const Nz::Vector3f& angularVelocity);
|
||||
void SetGravityFactor(float gravityFactor);
|
||||
void SetMass(float mass);
|
||||
void SetMassCenter(const NzVector3f& center);
|
||||
void SetPosition(const NzVector3f& position);
|
||||
void SetRotation(const NzQuaternionf& rotation);
|
||||
void SetVelocity(const NzVector3f& velocity);
|
||||
void SetMassCenter(const Nz::Vector3f& center);
|
||||
void SetPosition(const Nz::Vector3f& position);
|
||||
void SetRotation(const Nz::Quaternionf& rotation);
|
||||
void SetVelocity(const Nz::Vector3f& velocity);
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
private:
|
||||
NzPhysObject& GetPhysObject();
|
||||
Nz::PhysObject& GetPhysObject();
|
||||
|
||||
void OnAttached() override;
|
||||
void OnComponentAttached(BaseComponent& component) override;
|
||||
void OnComponentDetached(BaseComponent& component) override;
|
||||
void OnDetached() override;
|
||||
|
||||
std::unique_ptr<NzPhysObject> m_object;
|
||||
std::unique_ptr<Nz::PhysObject> m_object;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,21 +12,21 @@ namespace Ndk
|
||||
NazaraUnused(physics);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::AddForce(const NzVector3f& force, nzCoordSys coordSys)
|
||||
inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->AddForce(force, coordSys);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::AddForce(const NzVector3f& force, const NzVector3f& point, nzCoordSys coordSys)
|
||||
inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->AddForce(force, point, coordSys);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::AddTorque(const NzVector3f& torque, nzCoordSys coordSys)
|
||||
inline void PhysicsComponent::AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
@@ -40,14 +40,14 @@ namespace Ndk
|
||||
m_object->EnableAutoSleep(autoSleep);
|
||||
}
|
||||
|
||||
inline NzBoxf PhysicsComponent::GetAABB() const
|
||||
inline Nz::Boxf PhysicsComponent::GetAABB() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
return m_object->GetAABB();
|
||||
}
|
||||
|
||||
inline NzVector3f PhysicsComponent::GetAngularVelocity() const
|
||||
inline Nz::Vector3f PhysicsComponent::GetAngularVelocity() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
@@ -68,35 +68,35 @@ namespace Ndk
|
||||
return m_object->GetMass();
|
||||
}
|
||||
|
||||
inline NzVector3f PhysicsComponent::GetMassCenter(nzCoordSys coordSys) const
|
||||
inline Nz::Vector3f PhysicsComponent::GetMassCenter(Nz::CoordSys coordSys) const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
return m_object->GetMassCenter(coordSys);
|
||||
}
|
||||
|
||||
inline const NzMatrix4f& PhysicsComponent::GetMatrix() const
|
||||
inline const Nz::Matrix4f& PhysicsComponent::GetMatrix() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
return m_object->GetMatrix();
|
||||
}
|
||||
|
||||
inline NzVector3f PhysicsComponent::GetPosition() const
|
||||
inline Nz::Vector3f PhysicsComponent::GetPosition() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
return m_object->GetPosition();
|
||||
}
|
||||
|
||||
inline NzQuaternionf PhysicsComponent::GetRotation() const
|
||||
inline Nz::Quaternionf PhysicsComponent::GetRotation() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
return m_object->GetRotation();
|
||||
}
|
||||
|
||||
inline NzVector3f PhysicsComponent::GetVelocity() const
|
||||
inline Nz::Vector3f PhysicsComponent::GetVelocity() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Ndk
|
||||
return m_object->IsSleeping();
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::SetAngularVelocity(const NzVector3f& angularVelocity)
|
||||
inline void PhysicsComponent::SetAngularVelocity(const Nz::Vector3f& angularVelocity)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
@@ -139,35 +139,35 @@ namespace Ndk
|
||||
m_object->SetMass(mass);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::SetMassCenter(const NzVector3f& center)
|
||||
inline void PhysicsComponent::SetMassCenter(const Nz::Vector3f& center)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->SetMassCenter(center);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::SetPosition(const NzVector3f& position)
|
||||
inline void PhysicsComponent::SetPosition(const Nz::Vector3f& position)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->SetPosition(position);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::SetRotation(const NzQuaternionf& rotation)
|
||||
inline void PhysicsComponent::SetRotation(const Nz::Quaternionf& rotation)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->SetRotation(rotation);
|
||||
}
|
||||
|
||||
inline void PhysicsComponent::SetVelocity(const NzVector3f& velocity)
|
||||
inline void PhysicsComponent::SetVelocity(const Nz::Vector3f& velocity)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->SetVelocity(velocity);
|
||||
}
|
||||
|
||||
inline NzPhysObject& PhysicsComponent::GetPhysObject()
|
||||
inline Nz::PhysObject& PhysicsComponent::GetPhysObject()
|
||||
{
|
||||
return *m_object.get();
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Ndk
|
||||
class NDK_API VelocityComponent : public Component<VelocityComponent>
|
||||
{
|
||||
public:
|
||||
VelocityComponent(const NzVector3f& velocity = NzVector3f::Zero());
|
||||
VelocityComponent(const Nz::Vector3f& velocity = Nz::Vector3f::Zero());
|
||||
~VelocityComponent() = default;
|
||||
|
||||
NzVector3f linearVelocity;
|
||||
Nz::Vector3f linearVelocity;
|
||||
|
||||
VelocityComponent& operator=(const NzVector3f& vel);
|
||||
VelocityComponent& operator=(const Nz::Vector3f& vel);
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
};
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline VelocityComponent::VelocityComponent(const NzVector3f& velocity) :
|
||||
inline VelocityComponent::VelocityComponent(const Nz::Vector3f& velocity) :
|
||||
linearVelocity(velocity)
|
||||
{
|
||||
}
|
||||
|
||||
inline VelocityComponent& VelocityComponent::operator=(const NzVector3f& vel)
|
||||
inline VelocityComponent& VelocityComponent::operator=(const Nz::Vector3f& vel)
|
||||
{
|
||||
linearVelocity = vel;
|
||||
return *this;
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace Ndk
|
||||
|
||||
inline BaseComponent& GetComponent(ComponentIndex index);
|
||||
template<typename ComponentType> ComponentType& GetComponent();
|
||||
inline const NzBitset<>& GetComponentBits() const;
|
||||
inline const Nz::Bitset<>& GetComponentBits() const;
|
||||
inline EntityId GetId() const;
|
||||
inline const NzBitset<>& GetSystemBits() const;
|
||||
inline const Nz::Bitset<>& GetSystemBits() const;
|
||||
inline World* GetWorld() const;
|
||||
|
||||
inline bool HasComponent(ComponentIndex index) const;
|
||||
@@ -69,9 +69,9 @@ namespace Ndk
|
||||
|
||||
std::vector<std::unique_ptr<BaseComponent>> m_components;
|
||||
std::vector<EntityHandle*> m_handles;
|
||||
Nz::Bitset<> m_componentBits;
|
||||
Nz::Bitset<> m_systemBits;
|
||||
EntityId m_id;
|
||||
NzBitset<> m_componentBits;
|
||||
NzBitset<> m_systemBits;
|
||||
World* m_world;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Ndk
|
||||
return static_cast<ComponentType&>(GetComponent(index));
|
||||
}
|
||||
|
||||
inline const NzBitset<>& Entity::GetComponentBits() const
|
||||
inline const Nz::Bitset<>& Entity::GetComponentBits() const
|
||||
{
|
||||
return m_componentBits;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace Ndk
|
||||
return m_id;
|
||||
}
|
||||
|
||||
inline const NzBitset<>& Entity::GetSystemBits() const
|
||||
inline const Nz::Bitset<>& Entity::GetSystemBits() const
|
||||
{
|
||||
return m_systemBits;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Ndk
|
||||
|
||||
EntityHandle& Swap(EntityHandle& handle);
|
||||
|
||||
NzString ToString() const;
|
||||
Nz::String ToString() const;
|
||||
|
||||
operator bool() const;
|
||||
operator Entity*() const;
|
||||
|
||||
@@ -90,9 +90,9 @@ namespace Ndk
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline NzString EntityHandle::ToString() const
|
||||
inline Nz::String EntityHandle::ToString() const
|
||||
{
|
||||
NzStringStream ss;
|
||||
Nz::StringStream ss;
|
||||
ss << "EntityHandle(";
|
||||
if (IsValid())
|
||||
ss << "Entity(" << m_entity->GetId() << ')';
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Ndk
|
||||
|
||||
private:
|
||||
std::vector<EntityHandle> m_entities;
|
||||
NzBitset<nzUInt64> m_entityBits;
|
||||
Nz::Bitset<Nz::UInt64> m_entityBits;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
// Interface STD
|
||||
// Nz::Interface STD
|
||||
inline EntityList::Container::iterator EntityList::begin()
|
||||
{
|
||||
return m_entities.begin();
|
||||
|
||||
@@ -57,10 +57,10 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
using ComponentId = nzUInt64;
|
||||
using ComponentIndex = nzUInt32;
|
||||
using EntityId = nzUInt32;
|
||||
using SystemIndex = nzUInt32;
|
||||
using ComponentId = Nz::UInt64;
|
||||
using ComponentIndex = Nz::UInt32;
|
||||
using EntityId = Nz::UInt32;
|
||||
using SystemIndex = Nz::UInt32;
|
||||
}
|
||||
|
||||
#endif // NDK_PREREQUESITES_HPP
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace Ndk
|
||||
PhysicsSystem(const PhysicsSystem& system);
|
||||
~PhysicsSystem() = default;
|
||||
|
||||
NzPhysWorld& GetWorld();
|
||||
const NzPhysWorld& GetWorld() const;
|
||||
Nz::PhysWorld& GetWorld();
|
||||
const Nz::PhysWorld& GetWorld() const;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Ndk
|
||||
|
||||
EntityList m_dynamicObjects;
|
||||
EntityList m_staticObjects;
|
||||
NzPhysWorld m_world;
|
||||
Nz::PhysWorld m_world;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline NzPhysWorld& PhysicsSystem::GetWorld()
|
||||
inline Nz::PhysWorld& PhysicsSystem::GetWorld()
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
|
||||
inline const NzPhysWorld& PhysicsSystem::GetWorld() const
|
||||
inline const Nz::PhysWorld& PhysicsSystem::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
|
||||
@@ -25,16 +25,16 @@ namespace Ndk
|
||||
inline RenderSystem(const RenderSystem& renderSystem);
|
||||
~RenderSystem() = default;
|
||||
|
||||
inline const NzBackgroundRef& GetDefaultBackground() const;
|
||||
inline const NzMatrix4f& GetCoordinateSystemMatrix() const;
|
||||
inline NzVector3f GetGlobalForward() const;
|
||||
inline NzVector3f GetGlobalRight() const;
|
||||
inline NzVector3f GetGlobalUp() const;
|
||||
inline const Nz::BackgroundRef& GetDefaultBackground() const;
|
||||
inline const Nz::Matrix4f& GetCoordinateSystemMatrix() const;
|
||||
inline Nz::Vector3f GetGlobalForward() const;
|
||||
inline Nz::Vector3f GetGlobalRight() const;
|
||||
inline Nz::Vector3f GetGlobalUp() const;
|
||||
|
||||
inline void SetDefaultBackground(NzBackgroundRef background);
|
||||
inline void SetGlobalForward(const NzVector3f& direction);
|
||||
inline void SetGlobalRight(const NzVector3f& direction);
|
||||
inline void SetGlobalUp(const NzVector3f& direction);
|
||||
inline void SetDefaultBackground(Nz::BackgroundRef background);
|
||||
inline void SetGlobalForward(const Nz::Vector3f& direction);
|
||||
inline void SetGlobalRight(const Nz::Vector3f& direction);
|
||||
inline void SetGlobalUp(const Nz::Vector3f& direction);
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace Ndk
|
||||
EntityList m_cameras;
|
||||
EntityList m_drawables;
|
||||
EntityList m_lights;
|
||||
NzBackgroundRef m_background;
|
||||
NzForwardRenderTechnique m_renderTechnique;
|
||||
NzMatrix4f m_coordinateSystemMatrix;
|
||||
Nz::BackgroundRef m_background;
|
||||
Nz::ForwardRenderTechnique m_renderTechnique;
|
||||
Nz::Matrix4f m_coordinateSystemMatrix;
|
||||
bool m_coordinateSystemInvalidated;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,37 +9,37 @@ namespace Ndk
|
||||
{
|
||||
}
|
||||
|
||||
inline const NzBackgroundRef& RenderSystem::GetDefaultBackground() const
|
||||
inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const
|
||||
{
|
||||
return m_background;
|
||||
}
|
||||
|
||||
inline const NzMatrix4f& RenderSystem::GetCoordinateSystemMatrix() const
|
||||
inline const Nz::Matrix4f& RenderSystem::GetCoordinateSystemMatrix() const
|
||||
{
|
||||
return m_coordinateSystemMatrix;
|
||||
}
|
||||
|
||||
inline NzVector3f RenderSystem::GetGlobalForward() const
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalForward() const
|
||||
{
|
||||
return NzVector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
|
||||
return Nz::Vector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
|
||||
}
|
||||
|
||||
inline NzVector3f RenderSystem::GetGlobalRight() const
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalRight() const
|
||||
{
|
||||
return NzVector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
|
||||
return Nz::Vector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
|
||||
}
|
||||
|
||||
inline NzVector3f RenderSystem::GetGlobalUp() const
|
||||
inline Nz::Vector3f RenderSystem::GetGlobalUp() const
|
||||
{
|
||||
return NzVector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
|
||||
return Nz::Vector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
|
||||
}
|
||||
|
||||
inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
|
||||
inline void RenderSystem::SetDefaultBackground(Nz::BackgroundRef background)
|
||||
{
|
||||
m_background = std::move(background);
|
||||
}
|
||||
|
||||
inline void RenderSystem::SetGlobalForward(const NzVector3f& direction)
|
||||
inline void RenderSystem::SetGlobalForward(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m13 = -direction.x;
|
||||
m_coordinateSystemMatrix.m23 = -direction.y;
|
||||
@@ -48,7 +48,7 @@ namespace Ndk
|
||||
InvalidateCoordinateSystem();
|
||||
}
|
||||
|
||||
inline void RenderSystem::SetGlobalRight(const NzVector3f& direction)
|
||||
inline void RenderSystem::SetGlobalRight(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m11 = direction.x;
|
||||
m_coordinateSystemMatrix.m21 = direction.y;
|
||||
@@ -57,7 +57,7 @@ namespace Ndk
|
||||
InvalidateCoordinateSystem();
|
||||
}
|
||||
|
||||
inline void RenderSystem::SetGlobalUp(const NzVector3f& direction)
|
||||
inline void RenderSystem::SetGlobalUp(const Nz::Vector3f& direction)
|
||||
{
|
||||
m_coordinateSystemMatrix.m12 = direction.x;
|
||||
m_coordinateSystemMatrix.m22 = direction.y;
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace Ndk
|
||||
std::vector<EntityBlock> m_entities;
|
||||
std::vector<EntityId> m_freeIdList;
|
||||
EntityList m_aliveEntities;
|
||||
NzBitset<nzUInt64> m_dirtyEntities;
|
||||
NzBitset<nzUInt64> m_killedEntities;
|
||||
Nz::Bitset<Nz::UInt64> m_dirtyEntities;
|
||||
Nz::Bitset<Nz::UInt64> m_killedEntities;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace Ndk
|
||||
if (!entity)
|
||||
return false;
|
||||
|
||||
const NzBitset<>& components = entity->GetComponentBits();
|
||||
const Nz::Bitset<>& components = entity->GetComponentBits();
|
||||
|
||||
m_filterResult.PerformsAND(m_requiredComponents, components);
|
||||
if (m_filterResult != m_requiredComponents)
|
||||
if (m_filterResult != m_requiredComponents)
|
||||
return false; // Au moins un component requis n'est pas présent
|
||||
|
||||
m_filterResult.PerformsAND(m_excludedComponents, components);
|
||||
|
||||
@@ -17,20 +17,20 @@ namespace Ndk
|
||||
EnsureViewMatrixUpdate();
|
||||
EnsureViewportUpdate();
|
||||
|
||||
NzRenderer::SetMatrix(nzMatrixType_Projection, m_projectionMatrix);
|
||||
NzRenderer::SetMatrix(nzMatrixType_View, m_viewMatrix);
|
||||
NzRenderer::SetTarget(m_target);
|
||||
NzRenderer::SetViewport(m_viewport);
|
||||
Nz::Renderer::SetMatrix(Nz::MatrixType_Projection, m_projectionMatrix);
|
||||
Nz::Renderer::SetMatrix(Nz::MatrixType_View, m_viewMatrix);
|
||||
Nz::Renderer::SetTarget(m_target);
|
||||
Nz::Renderer::SetViewport(m_viewport);
|
||||
}
|
||||
|
||||
NzVector3f CameraComponent::GetEyePosition() const
|
||||
Nz::Vector3f CameraComponent::GetEyePosition() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
|
||||
return m_entity->GetComponent<NodeComponent>().GetPosition();
|
||||
}
|
||||
|
||||
NzVector3f CameraComponent::GetForward() const
|
||||
Nz::Vector3f CameraComponent::GetForward() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Ndk
|
||||
InvalidateViewMatrix();
|
||||
}
|
||||
|
||||
void CameraComponent::OnNodeInvalidated(const NzNode* node)
|
||||
void CameraComponent::OnNodeInvalidated(const Nz::Node* node)
|
||||
{
|
||||
NazaraUnused(node);
|
||||
|
||||
@@ -88,20 +88,20 @@ namespace Ndk
|
||||
InvalidateViewMatrix();
|
||||
}
|
||||
|
||||
void CameraComponent::OnRenderTargetRelease(const NzRenderTarget* renderTarget)
|
||||
void CameraComponent::OnRenderTargetRelease(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
if (renderTarget == m_target)
|
||||
m_target = nullptr;
|
||||
else
|
||||
NazaraInternalError("Not listening to " + NzString::Pointer(renderTarget));
|
||||
NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget));
|
||||
}
|
||||
|
||||
void CameraComponent::OnRenderTargetSizeChange(const NzRenderTarget* renderTarget)
|
||||
void CameraComponent::OnRenderTargetSizeChange(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
if (renderTarget == m_target)
|
||||
InvalidateViewport();
|
||||
else
|
||||
NazaraInternalError("Not listening to " + NzString::Pointer(renderTarget));
|
||||
NazaraInternalError("Not listening to " + Nz::String::Pointer(renderTarget));
|
||||
}
|
||||
|
||||
void CameraComponent::UpdateFrustum() const
|
||||
@@ -118,13 +118,13 @@ namespace Ndk
|
||||
{
|
||||
switch (m_projectionType)
|
||||
{
|
||||
case nzProjectionType_Orthogonal:
|
||||
case Nz::ProjectionType_Orthogonal:
|
||||
EnsureViewportUpdate();
|
||||
|
||||
m_projectionMatrix.MakeOrtho(0.f, static_cast<float>(m_viewport.width), 0.f, static_cast<float>(m_viewport.height), m_zNear, m_zFar);
|
||||
break;
|
||||
|
||||
case nzProjectionType_Perspective:
|
||||
case Nz::ProjectionType_Perspective:
|
||||
EnsureViewportUpdate(); // Can affect aspect ratio
|
||||
|
||||
m_projectionMatrix.MakePerspective(m_fov, m_aspectRatio, m_zNear, m_zFar);
|
||||
@@ -141,7 +141,7 @@ namespace Ndk
|
||||
NodeComponent& nodeComponent = m_entity->GetComponent<NodeComponent>();
|
||||
|
||||
// Build the view matrix using the NodeComponent position/rotation
|
||||
m_viewMatrix.MakeViewMatrix(nodeComponent.GetPosition(nzCoordSys_Global), nodeComponent.GetRotation(nzCoordSys_Global));
|
||||
m_viewMatrix.MakeViewMatrix(nodeComponent.GetPosition(Nz::CoordSys_Global), nodeComponent.GetRotation(Nz::CoordSys_Global));
|
||||
m_viewMatrixUpdated = true;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Ndk
|
||||
unsigned int targetHeight = std::max(m_target->GetHeight(), 1U); // Let's make sure we won't divide by zero
|
||||
|
||||
// Our target region is expressed as % of the viewport dimensions, let's compute it in pixels
|
||||
NzRectf fViewport(m_targetRegion);
|
||||
Nz::Rectf fViewport(m_targetRegion);
|
||||
fViewport.x *= targetWidth;
|
||||
fViewport.y *= targetHeight;
|
||||
fViewport.width *= targetWidth;
|
||||
@@ -161,11 +161,11 @@ namespace Ndk
|
||||
|
||||
// Compute the new aspect ratio, if it's different we need to invalidate the projection matrix
|
||||
float aspectRatio = fViewport.width/fViewport.height;
|
||||
if (!NzNumberEquals(m_aspectRatio, aspectRatio, 0.001f))
|
||||
if (!Nz::NumberEquals(m_aspectRatio, aspectRatio, 0.001f))
|
||||
{
|
||||
m_aspectRatio = aspectRatio;
|
||||
|
||||
if (m_projectionType == nzProjectionType_Perspective)
|
||||
if (m_projectionType == Nz::ProjectionType_Perspective)
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
void CollisionComponent::SetGeom(NzPhysGeomRef geom)
|
||||
void CollisionComponent::SetGeom(Nz::PhysGeomRef geom)
|
||||
{
|
||||
m_geom = std::move(geom);
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace Ndk
|
||||
|
||||
NazaraAssert(entityWorld, "Entity must have world");
|
||||
NazaraAssert(entityWorld->HasSystem<PhysicsSystem>(), "World must have a physics system");
|
||||
NzPhysWorld& physWorld = entityWorld->GetSystem<PhysicsSystem>().GetWorld();
|
||||
Nz::PhysWorld& physWorld = entityWorld->GetSystem<PhysicsSystem>().GetWorld();
|
||||
|
||||
m_staticBody.reset(new NzPhysObject(&physWorld, m_geom));
|
||||
m_staticBody.reset(new Nz::PhysObject(&physWorld, m_geom));
|
||||
m_staticBody->EnableAutoSleep(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
void GraphicsComponent::InvalidateRenderableData(const NzInstancedRenderable* renderable, nzUInt32 flags, unsigned int index)
|
||||
void GraphicsComponent::InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, unsigned int index)
|
||||
{
|
||||
NazaraAssert(index < m_renderables.size(), "Invalid renderable index");
|
||||
NazaraUnused(renderable);
|
||||
@@ -55,7 +55,7 @@ namespace Ndk
|
||||
InvalidateTransformMatrix();
|
||||
}
|
||||
|
||||
void GraphicsComponent::OnNodeInvalidated(const NzNode* node)
|
||||
void GraphicsComponent::OnNodeInvalidated(const Nz::Node* node)
|
||||
{
|
||||
NazaraUnused(node);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Ndk
|
||||
|
||||
Ndk::RenderSystem& renderSystem = m_entity->GetWorld()->GetSystem<Ndk::RenderSystem>();
|
||||
|
||||
m_transformMatrix = NzMatrix4f::ConcatenateAffine(renderSystem.GetCoordinateSystemMatrix(), m_entity->GetComponent<NodeComponent>().GetTransformMatrix());
|
||||
m_transformMatrix = Nz::Matrix4f::ConcatenateAffine(renderSystem.GetCoordinateSystemMatrix(), m_entity->GetComponent<NodeComponent>().GetTransformMatrix());
|
||||
m_transformMatrixUpdated = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,19 +17,19 @@ namespace Ndk
|
||||
World* entityWorld = m_entity->GetWorld();
|
||||
NazaraAssert(entityWorld->HasSystem<PhysicsSystem>(), "World must have a physics system");
|
||||
|
||||
NzPhysWorld& world = entityWorld->GetSystem<PhysicsSystem>().GetWorld();
|
||||
Nz::PhysWorld& world = entityWorld->GetSystem<PhysicsSystem>().GetWorld();
|
||||
|
||||
NzPhysGeomRef geom;
|
||||
Nz::PhysGeomRef geom;
|
||||
if (m_entity->HasComponent<CollisionComponent>())
|
||||
geom = m_entity->GetComponent<CollisionComponent>().GetGeom();
|
||||
|
||||
NzMatrix4f matrix;
|
||||
Nz::Matrix4f matrix;
|
||||
if (m_entity->HasComponent<NodeComponent>())
|
||||
matrix = m_entity->GetComponent<NodeComponent>().GetTransformMatrix();
|
||||
else
|
||||
matrix.MakeIdentity();
|
||||
|
||||
m_object.reset(new NzPhysObject(&world, geom, matrix));
|
||||
m_object.reset(new Nz::PhysObject(&world, geom, matrix));
|
||||
m_object->SetMass(1.f);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Ndk
|
||||
if (IsComponent<CollisionComponent>(component))
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid object");
|
||||
m_object->SetGeom(NzNullGeom::New());
|
||||
m_object->SetGeom(Nz::NullGeom::New());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,19 +35,19 @@ namespace Ndk
|
||||
|
||||
try
|
||||
{
|
||||
NzErrorFlags errFlags(nzErrorFlag_ThrowException, true);
|
||||
Nz::ErrorFlags errFlags(Nz::ErrorFlag_ThrowException, true);
|
||||
|
||||
// Initialisation du moteur
|
||||
|
||||
// Modules clients
|
||||
NzAudio::Initialize();
|
||||
NzGraphics::Initialize();
|
||||
Nz::Audio::Initialize();
|
||||
Nz::Graphics::Initialize();
|
||||
|
||||
// Modules serveurs
|
||||
NzLua::Initialize();
|
||||
NzNoise::Initialize();
|
||||
NzPhysics::Initialize();
|
||||
NzUtility::Initialize();
|
||||
Nz::Lua::Initialize();
|
||||
Nz::Noise::Initialize();
|
||||
Nz::Physics::Initialize();
|
||||
Nz::Utility::Initialize();
|
||||
|
||||
// Initialisation du SDK
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Ndk
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to initialize NDK: " + NzString(e.what()));
|
||||
NazaraError("Failed to initialize NDK: " + Nz::String(e.what()));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -99,14 +99,14 @@ namespace Ndk
|
||||
// Libération du moteur
|
||||
|
||||
// Modules clients
|
||||
NzAudio::Uninitialize();
|
||||
NzGraphics::Uninitialize();
|
||||
Nz::Audio::Uninitialize();
|
||||
Nz::Graphics::Uninitialize();
|
||||
|
||||
// Modules serveurs
|
||||
NzLua::Uninitialize();
|
||||
NzNoise::Uninitialize();
|
||||
NzPhysics::Uninitialize();
|
||||
NzUtility::Uninitialize();
|
||||
Nz::Lua::Uninitialize();
|
||||
Nz::Noise::Uninitialize();
|
||||
Nz::Physics::Uninitialize();
|
||||
Nz::Utility::Uninitialize();
|
||||
|
||||
NazaraNotice("Uninitialized: SDK");
|
||||
}
|
||||
|
||||
@@ -30,22 +30,22 @@ namespace Ndk
|
||||
|
||||
// On récupère la position et la rotation pour les affecter au listener
|
||||
const NodeComponent& node = entity->GetComponent<NodeComponent>();
|
||||
NzAudio::SetListenerPosition(node.GetPosition(nzCoordSys_Global));
|
||||
NzAudio::SetListenerRotation(node.GetRotation(nzCoordSys_Global));
|
||||
Nz::Audio::SetListenerPosition(node.GetPosition(Nz::CoordSys_Global));
|
||||
Nz::Audio::SetListenerRotation(node.GetRotation(Nz::CoordSys_Global));
|
||||
|
||||
// On vérifie la présence d'une donnée de vitesse, et on l'affecte
|
||||
// (La vitesse du listener Audio ne le fait pas se déplacer, mais affecte par exemple l'effet Doppler)
|
||||
if (entity->HasComponent<VelocityComponent>())
|
||||
{
|
||||
const VelocityComponent& velocity = entity->GetComponent<VelocityComponent>();
|
||||
NzAudio::SetListenerVelocity(velocity.linearVelocity);
|
||||
Nz::Audio::SetListenerVelocity(velocity.linearVelocity);
|
||||
}
|
||||
|
||||
activeListenerCount++;
|
||||
}
|
||||
|
||||
if (activeListenerCount > 1)
|
||||
NazaraWarning(NzString::Number(activeListenerCount) + " listeners were active in the same update loop");
|
||||
NazaraWarning(Nz::String::Number(activeListenerCount) + " listeners were active in the same update loop");
|
||||
}
|
||||
|
||||
SystemIndex ListenerSystem::systemIndex;
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace Ndk
|
||||
NodeComponent& node = entity->GetComponent<NodeComponent>();
|
||||
PhysicsComponent& phys = entity->GetComponent<PhysicsComponent>();
|
||||
|
||||
NzPhysObject& physObj = phys.GetPhysObject();
|
||||
node.SetRotation(physObj.GetRotation(), nzCoordSys_Global);
|
||||
node.SetPosition(physObj.GetPosition(), nzCoordSys_Global);
|
||||
Nz::PhysObject& physObj = phys.GetPhysObject();
|
||||
node.SetRotation(physObj.GetRotation(), Nz::CoordSys_Global);
|
||||
node.SetPosition(physObj.GetPosition(), Nz::CoordSys_Global);
|
||||
}
|
||||
|
||||
float invElapsedTime = 1.f / elapsedTime;
|
||||
@@ -56,12 +56,12 @@ namespace Ndk
|
||||
CollisionComponent& collision = entity->GetComponent<CollisionComponent>();
|
||||
NodeComponent& node = entity->GetComponent<NodeComponent>();
|
||||
|
||||
NzPhysObject* physObj = collision.GetStaticBody();
|
||||
Nz::PhysObject* physObj = collision.GetStaticBody();
|
||||
|
||||
NzQuaternionf oldRotation = physObj->GetRotation();
|
||||
NzVector3f oldPosition = physObj->GetPosition();
|
||||
NzQuaternionf newRotation = node.GetRotation(nzCoordSys_Global);
|
||||
NzVector3f newPosition = node.GetPosition(nzCoordSys_Global);
|
||||
Nz::Quaternionf oldRotation = physObj->GetRotation();
|
||||
Nz::Vector3f oldPosition = physObj->GetPosition();
|
||||
Nz::Quaternionf newRotation = node.GetRotation(Nz::CoordSys_Global);
|
||||
Nz::Vector3f newPosition = node.GetPosition(Nz::CoordSys_Global);
|
||||
|
||||
// Pour déplacer des objets statiques et assurer les collisions, il faut leur définir une vitesse
|
||||
// (note importante: le moteur physique n'applique pas la vitesse sur les objets statiques)
|
||||
@@ -71,21 +71,21 @@ namespace Ndk
|
||||
physObj->SetVelocity((newPosition - oldPosition) * invElapsedTime);
|
||||
}
|
||||
else
|
||||
physObj->SetVelocity(NzVector3f::Zero());
|
||||
physObj->SetVelocity(Nz::Vector3f::Zero());
|
||||
|
||||
if (newRotation != oldRotation)
|
||||
{
|
||||
NzQuaternionf transition = newRotation * oldRotation.GetConjugate();
|
||||
NzEulerAnglesf angles = transition.ToEulerAngles();
|
||||
NzVector3f angularVelocity(NzToRadians(angles.pitch * invElapsedTime),
|
||||
NzToRadians(angles.yaw * invElapsedTime),
|
||||
NzToRadians(angles.roll * invElapsedTime));
|
||||
Nz::Quaternionf transition = newRotation * oldRotation.GetConjugate();
|
||||
Nz::EulerAnglesf angles = transition.ToEulerAngles();
|
||||
Nz::Vector3f angularVelocity(Nz::ToRadians(angles.pitch * invElapsedTime),
|
||||
Nz::ToRadians(angles.yaw * invElapsedTime),
|
||||
Nz::ToRadians(angles.roll * invElapsedTime));
|
||||
|
||||
physObj->SetRotation(oldRotation);
|
||||
physObj->SetAngularVelocity(angularVelocity);
|
||||
}
|
||||
else
|
||||
physObj->SetAngularVelocity(NzVector3f::Zero());
|
||||
physObj->SetAngularVelocity(Nz::Vector3f::Zero());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace Ndk
|
||||
{
|
||||
RenderSystem::RenderSystem() :
|
||||
m_coordinateSystemMatrix(NzMatrix4f::Identity()),
|
||||
m_coordinateSystemMatrix(Nz::Matrix4f::Identity()),
|
||||
m_coordinateSystemInvalidated(true)
|
||||
{
|
||||
SetDefaultBackground(NzColorBackground::New());
|
||||
SetDefaultBackground(Nz::ColorBackground::New());
|
||||
SetUpdateRate(0.f);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Ndk
|
||||
CameraComponent& camComponent = camera->GetComponent<CameraComponent>();
|
||||
camComponent.ApplyView();
|
||||
|
||||
NzAbstractRenderQueue* renderQueue = m_renderTechnique.GetRenderQueue();
|
||||
Nz::AbstractRenderQueue* renderQueue = m_renderTechnique.GetRenderQueue();
|
||||
renderQueue->Clear();
|
||||
|
||||
//TODO: Culling
|
||||
@@ -91,11 +91,11 @@ namespace Ndk
|
||||
NodeComponent& drawableNode = light->GetComponent<NodeComponent>();
|
||||
|
||||
///TODO: Cache somehow?
|
||||
lightComponent.AddToRenderQueue(renderQueue, NzMatrix4f::ConcatenateAffine(m_coordinateSystemMatrix, drawableNode.GetTransformMatrix()));
|
||||
lightComponent.AddToRenderQueue(renderQueue, Nz::Matrix4f::ConcatenateAffine(m_coordinateSystemMatrix, drawableNode.GetTransformMatrix()));
|
||||
}
|
||||
|
||||
NzSceneData sceneData;
|
||||
sceneData.ambientColor = NzColor(25, 25, 25);
|
||||
Nz::SceneData sceneData;
|
||||
sceneData.ambientColor = Nz::Color(25, 25, 25);
|
||||
sceneData.background = m_background;
|
||||
sceneData.viewer = &camComponent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user