Switch from Nz prefix to namespace Nz

What a huge commit


Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
Lynix
2015-09-25 19:20:05 +02:00
parent c214251ecf
commit df8da275c4
609 changed files with 68265 additions and 66534 deletions

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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());
}
}

View File

@@ -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");
}

View File

@@ -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;

View File

@@ -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());
}
}

View File

@@ -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;