Merge branch 'master' into vulkan

This commit is contained in:
Jérôme Leclercq 2018-02-13 13:06:01 +01:00
commit 7d54ac4c10
425 changed files with 1939 additions and 619 deletions

3
.gitignore vendored
View File

@ -4,6 +4,9 @@ build/config.lua
# Nazara libraries # Nazara libraries
lib/* lib/*
# Self-hosted thirdparty libraries binaries
thirdparty/genlib/*
# Nazara plugin libraries # Nazara plugin libraries
plugins/lib/* plugins/lib/*

View File

@ -9,6 +9,12 @@ Miscellaneous:
- Updated stb_image to version 2.16 and stb_image_write to version 1.07 (allowing support for JPEG writing) - Updated stb_image to version 2.16 and stb_image_write to version 1.07 (allowing support for JPEG writing)
- ⚠️ Renamed extlibs folder to thirdparty - ⚠️ Renamed extlibs folder to thirdparty
- Partial fix for Premake regenerating projects for no reason - Partial fix for Premake regenerating projects for no reason
- FirstScene now uses the EventHandler (#151)
- ⚠️ Rename Prerequesites.hpp to Prerequisites.hpp (#153)
- Updated premake5-linux64 with a nightly to fix a build error when a previous version of Nazara was installed on the system.
- Fix compilation with some MinGW distributions
- Add Lua unit tests
- NDEBUG is now defined in Release
Nazara Engine: Nazara Engine:
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.
@ -53,6 +59,13 @@ Nazara Engine:
- Fix OBJParser relative offsets handling - Fix OBJParser relative offsets handling
- Add JPEG image saver - Add JPEG image saver
- Update Constraint2Ds classes (Add : Ref, Library, ConstRef, New function and Update : ctors) - Update Constraint2Ds classes (Add : Ref, Library, ConstRef, New function and Update : ctors)
- Fix LuaClass not working correctly when Lua stack wasn't empty
- Add RigidBody2D simulation control (via EnableSimulation and IsSimulationEnabled), which allows to disable physics and collisions at will.
- ⚠️ LuaInstance no longer load all lua libraries on construction, this is done in the new LoadLibraries method which allows you to excludes some libraries
- Clock::Restart now returns the elapsed microseconds since construction or last Restart call
- Add PhysWorld2D::[Get|Set]IterationCount to control how many iterations chipmunk will perform per step.
- Add PhysWorld2D::UseSpatialHash to use spatial hashing instead of bounding box trees, which may speedup simulation in some cases.
- Add PhysWorld[2D|3D] max step count per Step call (default: 50), to avoid spirals of death when the physics engine simulation time is over step size.
Nazara Development Kit: Nazara Development Kit:
- Added ImageWidget (#139) - Added ImageWidget (#139)
@ -84,6 +97,10 @@ Nazara Development Kit:
- Fix PhysicsComponent3D copy which was not copying physics state (such as mass, mass center, damping values, gravity factor and auto-sleep mode) - Fix PhysicsComponent3D copy which was not copying physics state (such as mass, mass center, damping values, gravity factor and auto-sleep mode)
- Fix TextAreaWidget::Clear crash - Fix TextAreaWidget::Clear crash
- Add ConstraintComponent2D class - Add ConstraintComponent2D class
- Fix CollisionComponent3D initialization (teleportation to their real coordinates) which could sometimes mess up the physics scene.
- ⚠️ Renamed World::Update() to World::Refresh() for more clarity and to differentiate it from World::Update(elapsedTime)
- World entity ids are now reused from lowest to highest (they were previously reused in reverse order of death)
- World now has an internal profiler, allowing to measure the refresh and system update time
# 0.4: # 0.4:

View File

@ -7,7 +7,7 @@
#ifndef NAZARA_MODULENAME_HPP #ifndef NAZARA_MODULENAME_HPP
#define NAZARA_MODULENAME_HPP #define NAZARA_MODULENAME_HPP
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Initializer.hpp> #include <Nazara/Core/Initializer.hpp>
#include <Nazara/ModuleName/Config.hpp> #include <Nazara/ModuleName/Config.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_ALGORITHM_HPP #ifndef NDK_ALGORITHM_HPP
#define NDK_ALGORITHM_HPP #define NDK_ALGORITHM_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Endianness.hpp> #include <Nazara/Core/Endianness.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_APPLICATION_HPP #ifndef NDK_APPLICATION_HPP
#define NDK_APPLICATION_HPP #define NDK_APPLICATION_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/World.hpp> #include <NDK/World.hpp>
#include <Nazara/Core/Clock.hpp> #include <Nazara/Core/Clock.hpp>
#include <map> #include <map>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <NDK/Sdk.hpp> #include <NDK/Sdk.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <type_traits> #include <type_traits>
@ -164,8 +164,10 @@ namespace Ndk
} }
else else
{ {
OnUpdate(m_maxUpdateRate); float updateRate = std::max(elapsedTime, m_maxUpdateRate);
m_updateCounter -= m_maxUpdateRate;
OnUpdate(updateRate);
m_updateCounter -= updateRate;
} }
} }
} }

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_BASEWIDGET_HPP #ifndef NDK_BASEWIDGET_HPP
#define NDK_BASEWIDGET_HPP #define NDK_BASEWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>
#include <NDK/EntityOwner.hpp> #include <NDK/EntityOwner.hpp>
#include <NDK/World.hpp> #include <NDK/World.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_CANVAS_HPP #ifndef NDK_CANVAS_HPP
#define NDK_CANVAS_HPP #define NDK_CANVAS_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Platform/CursorController.hpp> #include <Nazara/Platform/CursorController.hpp>
#include <Nazara/Platform/EventHandler.hpp> #include <Nazara/Platform/EventHandler.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Canvas.hpp> #include <NDK/Canvas.hpp>
#include <Nazara/Platform/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Algorithm.hpp> #include <NDK/Algorithm.hpp>
#include <type_traits> #include <type_traits>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Math/Algorithm.hpp> #include <Nazara/Math/Algorithm.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Components/GraphicsComponent.hpp> #include <NDK/Components/GraphicsComponent.hpp>
#include <NDK/World.hpp> #include <NDK/World.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Components/ParticleEmitterComponent.hpp> #include <NDK/Components/ParticleEmitterComponent.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
@ -49,7 +49,7 @@ namespace Ndk
inline void ParticleGroupComponent::AddEmitter(Entity* emitter) inline void ParticleGroupComponent::AddEmitter(Entity* emitter)
{ {
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a NodeComponent"); NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a ParticleEmitterComponent");
auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>(); auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>();
ParticleGroup::AddEmitter(&emitterComponent); ParticleGroup::AddEmitter(&emitterComponent);
@ -68,7 +68,7 @@ namespace Ndk
inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter)
{ {
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a NodeComponent"); NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a ParticleEmitterComponent");
auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>(); auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>();
ParticleGroup::RemoveEmitter(&emitterComponent); ParticleGroup::RemoveEmitter(&emitterComponent);

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -54,6 +54,8 @@ namespace Ndk
void SetLinearVelocity(const Nz::Vector3f& velocity); void SetLinearVelocity(const Nz::Vector3f& velocity);
void SetMass(float mass); void SetMass(float mass);
void SetMassCenter(const Nz::Vector3f& center); void SetMassCenter(const Nz::Vector3f& center);
void SetMaterial(const Nz::String& materialName);
void SetMaterial(int materialIndex);
void SetPosition(const Nz::Vector3f& position); void SetPosition(const Nz::Vector3f& position);
void SetRotation(const Nz::Quaternionf& rotation); void SetRotation(const Nz::Quaternionf& rotation);

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include "PhysicsComponent3D.hpp" #include "PhysicsComponent3D.hpp"
@ -396,7 +396,6 @@ namespace Ndk
* *
* \remark Produces a NazaraAssert if the physics object is invalid * \remark Produces a NazaraAssert if the physics object is invalid
*/ */
inline void PhysicsComponent3D::SetMassCenter(const Nz::Vector3f& center) inline void PhysicsComponent3D::SetMassCenter(const Nz::Vector3f& center)
{ {
NazaraAssert(m_object, "Invalid physics object"); NazaraAssert(m_object, "Invalid physics object");
@ -404,6 +403,34 @@ namespace Ndk
m_object->SetMassCenter(center); m_object->SetMassCenter(center);
} }
/*!
* \brief Sets the material of the object, affecting how object does respond to collisions
*
* \param materialName Name of the material, previously registered to physics world
*
* \remark materialName must exists in PhysWorld before this call
*/
inline void PhysicsComponent3D::SetMaterial(const Nz::String& materialName)
{
NazaraAssert(m_object, "Invalid physics object");
m_object->SetMaterial(materialName);
}
/*!
* \brief Sets the material of the object, affecting how object does respond to collisions
*
* \param materialIndex Id of the material, previously retrieved from a physics world
*
* \remark materialIndex must come from a call to in PhysWorld::CreateMaterial
*/
inline void PhysicsComponent3D::SetMaterial(int materialIndex)
{
NazaraAssert(m_object, "Invalid physics object");
m_object->SetMaterial(materialIndex);
}
/*! /*!
* \brief Sets the position of the physics object * \brief Sets the position of the physics object
* *

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -11,7 +11,7 @@
#include <Nazara/Core/HandledObject.hpp> #include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Core/Signal.hpp> #include <Nazara/Core/Signal.hpp>
#include <NDK/Algorithm.hpp> #include <NDK/Algorithm.hpp>
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -8,7 +8,7 @@
#define NDK_ENTITYLIST_HPP #define NDK_ENTITYLIST_HPP
#include <Nazara/Core/Bitset.hpp> #include <Nazara/Core/Bitset.hpp>
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>
namespace Ndk namespace Ndk

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <algorithm> #include <algorithm>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/StringStream.hpp> #include <Nazara/Core/StringStream.hpp>
#include <functional> #include <functional>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -9,7 +9,7 @@
#include <Nazara/Lua/LuaClass.hpp> #include <Nazara/Lua/LuaClass.hpp>
#include <Nazara/Lua/LuaInstance.hpp> #include <Nazara/Lua/LuaInstance.hpp>
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_LUAINTERFACE_HPP #ifndef NDK_LUAINTERFACE_HPP
#define NDK_LUAINTERFACE_HPP #define NDK_LUAINTERFACE_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Core/Color.hpp> #include <Nazara/Core/Color.hpp>
#include <Nazara/Lua/LuaState.hpp> #include <Nazara/Lua/LuaState.hpp>

View File

@ -22,15 +22,15 @@
SOFTWARE. SOFTWARE.
*/ */
#ifndef NDK_PREREQUESITES_HPP #ifndef NDK_PREREQUISITES_HPP
#define NDK_PREREQUESITES_HPP #define NDK_PREREQUISITES_HPP
/*! /*!
* \defgroup NDK (NazaraSDK) Nazara Development Kit * \defgroup NDK (NazaraSDK) Nazara Development Kit
* A library grouping every modules of Nazara into multiple higher-level features suchs as scene management (handled by an ECS), application, lua binding, etc. * A library grouping every modules of Nazara into multiple higher-level features suchs as scene management (handled by an ECS), application, lua binding, etc.
*/ */
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequisites.hpp>
// Importation/Exportation of the API // Importation/Exportation of the API
#if defined(NAZARA_STATIC) #if defined(NAZARA_STATIC)
@ -51,4 +51,4 @@ namespace Ndk
using SystemIndex = Nz::UInt32; using SystemIndex = Nz::UInt32;
} }
#endif // NDK_PREREQUESITES_HPP #endif // NDK_PREREQUISITES_HPP

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_SDK_HPP #ifndef NDK_SDK_HPP
#define NDK_SDK_HPP #define NDK_SDK_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_STATE_HPP #ifndef NDK_STATE_HPP
#define NDK_STATE_HPP #define NDK_STATE_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_STATEMACHINE_HPP #ifndef NDK_STATEMACHINE_HPP
#define NDK_STATEMACHINE_HPP #define NDK_STATEMACHINE_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/State.hpp> #include <NDK/State.hpp>
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/StateMachine.hpp> #include <NDK/StateMachine.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Algorithm.hpp> #include <NDK/Algorithm.hpp>
#include <type_traits> #include <type_traits>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,3 +1,3 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,3 +1,3 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -18,7 +18,6 @@ namespace Ndk
{ {
public: public:
PhysicsSystem3D(); PhysicsSystem3D();
PhysicsSystem3D(const PhysicsSystem3D& system);
~PhysicsSystem3D() = default; ~PhysicsSystem3D() = default;
Nz::PhysWorld3D& GetWorld(); Nz::PhysWorld3D& GetWorld();

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,3 +1,3 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_WIDGETS_BUTTONWIDGET_HPP #ifndef NDK_WIDGETS_BUTTONWIDGET_HPP
#define NDK_WIDGETS_BUTTONWIDGET_HPP #define NDK_WIDGETS_BUTTONWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Core/Color.hpp> #include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Widgets/ButtonWidget.hpp> #include <NDK/Widgets/ButtonWidget.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_WIDGETS_CHECKBOXWIDGET_HPP #ifndef NDK_WIDGETS_CHECKBOXWIDGET_HPP
#define NDK_WIDGETS_CHECKBOXWIDGET_HPP #define NDK_WIDGETS_CHECKBOXWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <NDK/Components/NodeComponent.hpp> #include <NDK/Components/NodeComponent.hpp>
#include <NDK/Widgets/Enums.hpp> #include <NDK/Widgets/Enums.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_WIDGETS_IMAGEWIDGET_HPP #ifndef NDK_WIDGETS_IMAGEWIDGET_HPP
#define NDK_WIDGETS_IMAGEWIDGET_HPP #define NDK_WIDGETS_IMAGEWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Widgets/ImageWidget.hpp> #include <NDK/Widgets/ImageWidget.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_WIDGETS_LABELWIDGET_HPP #ifndef NDK_WIDGETS_LABELWIDGET_HPP
#define NDK_WIDGETS_LABELWIDGET_HPP #define NDK_WIDGETS_LABELWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Graphics/TextSprite.hpp> #include <Nazara/Graphics/TextSprite.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Widgets/LabelWidget.hpp> #include <NDK/Widgets/LabelWidget.hpp>

View File

@ -1,13 +1,13 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
#ifndef NDK_WIDGETS_PROGRESSBARWIDGET_HPP #ifndef NDK_WIDGETS_PROGRESSBARWIDGET_HPP
#define NDK_WIDGETS_PROGRESSBARWIDGET_HPP #define NDK_WIDGETS_PROGRESSBARWIDGET_HPP
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequisites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Core/Color.hpp> #include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Samy Bensaid // Copyright (C) 2017 Samy Bensaid
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
namespace Ndk namespace Ndk
{ {

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Widgets/TextAreaWidget.hpp> #include <NDK/Widgets/TextAreaWidget.hpp>

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#pragma once #pragma once
@ -29,6 +29,7 @@ namespace Ndk
public: public:
using EntityVector = std::vector<EntityHandle>; using EntityVector = std::vector<EntityHandle>;
struct ProfilerData;
inline World(bool addDefaultSystems = true); inline World(bool addDefaultSystems = true);
World(const World&) = delete; World(const World&) = delete;
@ -46,8 +47,12 @@ namespace Ndk
void Clear() noexcept; void Clear() noexcept;
const EntityHandle& CloneEntity(EntityId id); const EntityHandle& CloneEntity(EntityId id);
inline void DisableProfiler();
inline void EnableProfiler(bool enable = true);
inline const EntityHandle& GetEntity(EntityId id); inline const EntityHandle& GetEntity(EntityId id);
inline const EntityList& GetEntities() const; inline const EntityList& GetEntities() const;
inline const ProfilerData& GetProfilerData() const;
inline BaseSystem& GetSystem(SystemIndex index); inline BaseSystem& GetSystem(SystemIndex index);
template<typename SystemType> SystemType& GetSystem(); template<typename SystemType> SystemType& GetSystem();
@ -59,17 +64,27 @@ namespace Ndk
inline bool IsEntityValid(const Entity* entity) const; inline bool IsEntityValid(const Entity* entity) const;
inline bool IsEntityIdValid(EntityId id) const; inline bool IsEntityIdValid(EntityId id) const;
inline bool IsProfilerEnabled() const;
void Refresh();
inline void RemoveAllSystems(); inline void RemoveAllSystems();
inline void RemoveSystem(SystemIndex index); inline void RemoveSystem(SystemIndex index);
template<typename SystemType> void RemoveSystem(); template<typename SystemType> void RemoveSystem();
inline void ResetProfiler();
void Update(); void Update(float elapsedTime);
inline void Update(float elapsedTime);
World& operator=(const World&) = delete; World& operator=(const World&) = delete;
inline World& operator=(World&& world) noexcept; inline World& operator=(World&& world) noexcept;
struct ProfilerData
{
Nz::UInt64 refreshTime = 0;
std::vector<Nz::UInt64> updateTime;
std::size_t updateCount = 0;
};
private: private:
inline void Invalidate(); inline void Invalidate();
inline void Invalidate(EntityId id); inline void Invalidate(EntityId id);
@ -95,11 +110,13 @@ namespace Ndk
std::vector<EntityBlock> m_entities; std::vector<EntityBlock> m_entities;
std::vector<EntityBlock*> m_entityBlocks; std::vector<EntityBlock*> m_entityBlocks;
std::vector<std::unique_ptr<EntityBlock>> m_waitingEntities; std::vector<std::unique_ptr<EntityBlock>> m_waitingEntities;
std::vector<EntityId> m_freeIdList;
EntityList m_aliveEntities; EntityList m_aliveEntities;
ProfilerData m_profilerData;
Nz::Bitset<Nz::UInt64> m_dirtyEntities; Nz::Bitset<Nz::UInt64> m_dirtyEntities;
Nz::Bitset<Nz::UInt64> m_freeEntityIds;
Nz::Bitset<Nz::UInt64> m_killedEntities; Nz::Bitset<Nz::UInt64> m_killedEntities;
bool m_orderedSystemsUpdated; bool m_orderedSystemsUpdated;
bool m_isProfilerEnabled;
}; };
} }

View File

@ -1,7 +1,8 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/World.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <type_traits> #include <type_traits>
@ -13,7 +14,9 @@ namespace Ndk
* \param addDefaultSystems Should default provided systems be used * \param addDefaultSystems Should default provided systems be used
*/ */
inline World::World(bool addDefaultSystems) inline World::World(bool addDefaultSystems) :
m_orderedSystemsUpdated(false),
m_isProfilerEnabled(false)
{ {
if (addDefaultSystems) if (addDefaultSystems)
AddDefaultSystems(); AddDefaultSystems();
@ -46,7 +49,10 @@ namespace Ndk
// We must ensure that the vector is big enough to hold the new system // We must ensure that the vector is big enough to hold the new system
if (index >= m_systems.size()) if (index >= m_systems.size())
{
m_systems.resize(index + 1); m_systems.resize(index + 1);
m_profilerData.updateTime.resize(index + 1, 0);
}
// Affectation and return of system // Affectation and return of system
m_systems[index] = std::move(system); m_systems[index] = std::move(system);
@ -81,7 +87,6 @@ namespace Ndk
* *
* \param count Number of entities to create * \param count Number of entities to create
*/ */
inline World::EntityVector World::CreateEntities(unsigned int count) inline World::EntityVector World::CreateEntities(unsigned int count)
{ {
EntityVector list; EntityVector list;
@ -93,16 +98,79 @@ namespace Ndk
return list; return list;
} }
/*!
* \brief Disables the profiler, clearing up results
*
* This is just a shortcut to EnableProfiler(false)
*
* \param enable Should the entity be enabled
*
* \see EnableProfiler
*/
inline void World::DisableProfiler()
{
EnableProfiler(false);
}
/*!
* \brief Enables/Disables the internal profiler
*
* Worlds come with a built-in profiler, allowing to measure update count along with time passed in refresh and system updates.
* This is disabled by default as it adds an small overhead to the update process.
*
* \param enable Should the profiler be enabled
*
* \remark Disabling the profiler clears up results, as if ResetProfiler has been called
*/
inline void World::EnableProfiler(bool enable)
{
if (m_isProfilerEnabled != enable)
{
m_isProfilerEnabled = enable;
if (enable)
ResetProfiler();
}
}
/*!
* \brief Gets an entity
* \return A constant reference to a handle of the entity
*
* \param id Identifier of the entity
*
* \remark Handle referenced by this function can move in memory when updating the world, do not keep a handle reference from a world update to another
* \remark If an invalid identifier is provided, an error got triggered and an invalid handle is returned
*/
inline const EntityHandle& World::GetEntity(EntityId id)
{
if (IsEntityIdValid(id))
return m_entityBlocks[id]->handle;
else
{
NazaraError("Invalid ID");
return EntityHandle::InvalidHandle;
}
}
/*! /*!
* \brief Gets every entities in the world * \brief Gets every entities in the world
* \return A constant reference to the entities * \return A constant reference to the entities
*/ */
inline const EntityList& World::GetEntities() const inline const EntityList& World::GetEntities() const
{ {
return m_aliveEntities; return m_aliveEntities;
} }
/*!
* \brief Gets the latest profiler data
* \return A constant reference to the profiler data
*/
inline const World::ProfilerData& World::GetProfilerData() const
{
return m_profilerData;
}
/*! /*!
* \brief Gets a system in the world by index * \brief Gets a system in the world by index
* \return A reference to the system * \return A reference to the system
@ -191,26 +259,6 @@ namespace Ndk
KillEntity(entity); KillEntity(entity);
} }
/*!
* \brief Gets an entity
* \return A constant reference to a handle of the entity
*
* \param id Identifier of the entity
*
* \remark Handle referenced by this function can move in memory when updating the world, do not keep a handle reference from a world update to another
* \remark If an invalid identifier is provided, an error got triggered and an invalid handle is returned
*/
inline const EntityHandle& World::GetEntity(EntityId id)
{
if (IsEntityIdValid(id))
return m_entityBlocks[id]->handle;
else
{
NazaraError("Invalid ID");
return EntityHandle::InvalidHandle;
}
}
/*! /*!
* \brief Checks whether or not an entity is valid * \brief Checks whether or not an entity is valid
* \return true If it is the case * \return true If it is the case
@ -229,12 +277,22 @@ namespace Ndk
* *
* \param id Identifier of the entity * \param id Identifier of the entity
*/ */
inline bool World::IsEntityIdValid(EntityId id) const inline bool World::IsEntityIdValid(EntityId id) const
{ {
return id < m_entityBlocks.size() && m_entityBlocks[id]->entity.IsValid(); return id < m_entityBlocks.size() && m_entityBlocks[id]->entity.IsValid();
} }
/*!
* \brief Checks whether or not the profiler is enabled
* \return true If it is the case
*
* \see EnableProfiler
*/
inline bool World::IsProfilerEnabled() const
{
return m_isProfilerEnabled;
}
/*! /*!
* \brief Removes each system from the world * \brief Removes each system from the world
*/ */
@ -264,10 +322,21 @@ namespace Ndk
} }
} }
/*!
* \brief Clear profiler results
*
* This reset the profiler results, filling all counters with zero
*/
inline void World::ResetProfiler()
{
m_profilerData.refreshTime = 0;
m_profilerData.updateCount = 0;
std::fill(m_profilerData.updateTime.begin(), m_profilerData.updateTime.end(), 0);
}
/*! /*!
* \brief Removes a system from the world by type * \brief Removes a system from the world by type
*/ */
template<typename SystemType> template<typename SystemType>
void World::RemoveSystem() void World::RemoveSystem()
{ {
@ -277,21 +346,6 @@ namespace Ndk
RemoveSystem(index); RemoveSystem(index);
} }
/*!
* \brief Updates the world
*
* \param elapsedTime Delta time used for the update
*/
inline void World::Update(float elapsedTime)
{
Update(); //< Update entities
// And then update systems
for (auto& systemPtr : m_orderedSystems)
systemPtr->Update(elapsedTime);
}
/*! /*!
* \brief Moves a world into another world object * \brief Moves a world into another world object
* \return A reference to the object * \return A reference to the object
@ -302,10 +356,12 @@ namespace Ndk
m_aliveEntities = std::move(world.m_aliveEntities); m_aliveEntities = std::move(world.m_aliveEntities);
m_dirtyEntities = std::move(world.m_dirtyEntities); m_dirtyEntities = std::move(world.m_dirtyEntities);
m_entityBlocks = std::move(world.m_entityBlocks); m_entityBlocks = std::move(world.m_entityBlocks);
m_freeIdList = std::move(world.m_freeIdList); m_freeEntityIds = std::move(world.m_freeEntityIds);
m_killedEntities = std::move(world.m_killedEntities); m_killedEntities = std::move(world.m_killedEntities);
m_orderedSystems = std::move(world.m_orderedSystems); m_orderedSystems = std::move(world.m_orderedSystems);
m_orderedSystemsUpdated = world.m_orderedSystemsUpdated; m_orderedSystemsUpdated = world.m_orderedSystemsUpdated;
m_profilerData = std::move(world.m_profilerData);
m_isProfilerEnabled = m_isProfilerEnabled;
m_entities = std::move(world.m_entities); m_entities = std::move(world.m_entities);
for (EntityBlock& block : m_entities) for (EntityBlock& block : m_entities)

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/Application.hpp> #include <NDK/Application.hpp>
#include <Nazara/Core/Log.hpp> #include <Nazara/Core/Log.hpp>
@ -107,8 +107,7 @@ namespace Ndk
if (m_shouldQuit) if (m_shouldQuit)
return false; return false;
m_updateTime = m_updateClock.GetSeconds(); m_updateTime = m_updateClock.Restart() / 1'000'000.f;
m_updateClock.Restart();
for (World& world : m_worlds) for (World& world : m_worlds)
world.Update(m_updateTime); world.Update(m_updateTime);
@ -165,6 +164,7 @@ namespace Ndk
consoleRef.AddLine(str); consoleRef.AddLine(str);
}); });
overlay->lua.LoadLibraries();
LuaAPI::RegisterClasses(overlay->lua); LuaAPI::RegisterClasses(overlay->lua);
// Override "print" function to add a line in the console // Override "print" function to add a line in the console

View File

@ -1,6 +1,6 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit" // This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <NDK/BaseComponent.hpp> #include <NDK/BaseComponent.hpp>

Some files were not shown because too many files have changed in this diff Show More