Big config/debug update
Added config checkers Macro no longer use suffixes Moved MemoryManager to upper directory Renamed *_MEMORYMANAGER to *_MANAGE_MEMORY Renamed AUDIO_STREAMEDBUFFERCOUNT to AUDIO_STREAMED_BUFFER_COUNT Renamed CORE_REAL_PRECISION to CORE_DECIMAL_DIGITS Renamed DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION to DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION Renamed GRAPHICS_MAX_LIGHTPERPASS to GRAPHICS_MAX_LIGHT_PER_PASS Renamed UTILITY_FORCE_DECLARATION_STRIDE_MULTIPLE_OF_32 to UTILITY_VERTEX_DECLARATION_FORCE_STRIDE_MULTIPLE_OF_32 Former-commit-id: 81ef836ac9f092ac471f60e544bb7c7c6370593c
This commit is contained in:
parent
f819beb747
commit
c4b10dddda
|
|
@ -17,7 +17,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/ModuleName/Debug/Leaks.cpp"
|
excludes "../src/Nazara/ModuleName/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,15 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_MODULENAME_MEMORYMANAGER 0
|
#define NAZARA_MODULENAME_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_MODULENAME_SAFE 1
|
#define NAZARA_MODULENAME_SAFE 1
|
||||||
|
|
||||||
|
/// Chaque modification d'un paramètre ci-dessous implique une modification (souvent mineure) du code
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/ModuleName/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright (C) 2014 AUTHORS
|
||||||
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckType(name, type, err) static_assert(std::is_ ##type <decltype(name)>::value, #type err)
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_MODULENAME_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_MODULENAME_MANAGE_MEMORY
|
||||||
|
#define NAZARA_MODULENAME_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_MODULENAME_HPP
|
||||||
|
|
@ -3,9 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/Config.hpp>
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
#if NAZARA_MODULENAME_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_MODULENAME_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
|
|
||||||
#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete
|
|
||||||
#define new new(__FILE__, __LINE__)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Module name"
|
// This file is part of the "Nazara Engine - Module name"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_MODULENAME_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_MODULENAME_HPP
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/ModuleName/Config.hpp>
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
#if NAZARA_MODULENAME_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_MODULENAME_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryLeakTracker.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -27,4 +27,5 @@ void operator delete[](void* pointer) noexcept
|
||||||
{
|
{
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // NAZARA_MODULENAME_MANAGE_MEMORY
|
||||||
|
|
@ -21,7 +21,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Audio/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Audio/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Graphics/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Graphics/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Lua/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Lua/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Noise/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Noise/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Physics/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Physics/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Renderer/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Renderer/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
excludes "../src/Nazara/Utility/Debug/Leaks.cpp"
|
excludes "../src/Nazara/Utility/Debug/NewOverload.cpp"
|
||||||
else
|
else
|
||||||
configuration "DebugStatic"
|
configuration "DebugStatic"
|
||||||
links "NazaraCore-s-d"
|
links "NazaraCore-s-d"
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,18 @@
|
||||||
#ifndef NAZARA_CONFIG_AUDIO_HPP
|
#ifndef NAZARA_CONFIG_AUDIO_HPP
|
||||||
#define NAZARA_CONFIG_AUDIO_HPP
|
#define NAZARA_CONFIG_AUDIO_HPP
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Modifier la configuration d'un module nécessite une recompilation quasi-intégrale de celui-ci et de ceux en héritant
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_AUDIO_MEMORYMANAGER 0
|
#define NAZARA_AUDIO_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité supplémentaires (Teste notamment les arguments des fonctions, conseillé pour le développement)
|
||||||
#define NAZARA_AUDIO_SAFE 1
|
#define NAZARA_AUDIO_SAFE 1
|
||||||
|
|
||||||
// Le nombre de buffers utilisés lors du streaming d'objets audio (Au moins deux)
|
// Le nombre de buffers utilisés lors du streaming d'objets audio (Au moins deux)
|
||||||
#define NAZARA_AUDIO_STREAMEDBUFFERCOUNT 2
|
#define NAZARA_AUDIO_STREAMED_BUFFER_COUNT 2
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Audio/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_AUDIO_HPP
|
#endif // NAZARA_CONFIG_AUDIO_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_AUDIO_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_AUDIO_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
|
#define NAZARA_AUDIO_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CheckTypeAndVal(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_AUDIO_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Audio/Config.hpp>
|
#include <Nazara/Audio/Config.hpp>
|
||||||
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Audio module"
|
// This file is part of the "Nazara Engine - Audio module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
|
// Précision des réels lors de la transformation en chaîne de caractère (Max. chiffres après la virgule)
|
||||||
|
#define NAZARA_CORE_DECIMAL_DIGITS 6
|
||||||
|
|
||||||
// Duplique la sortie du log sur le flux de sortie standard (cout)
|
// Duplique la sortie du log sur le flux de sortie standard (cout)
|
||||||
#define NAZARA_CORE_DUPLICATE_LOG_TO_COUT 0
|
#define NAZARA_CORE_DUPLICATE_LOG_TO_COUT 0
|
||||||
|
|
||||||
|
|
@ -44,11 +47,8 @@
|
||||||
// Incorpore la table Unicode Character Data (Nécessaires pour faire fonctionner le flag NzString::HandleUTF8)
|
// Incorpore la table Unicode Character Data (Nécessaires pour faire fonctionner le flag NzString::HandleUTF8)
|
||||||
#define NAZARA_CORE_INCLUDE_UNICODEDATA 0
|
#define NAZARA_CORE_INCLUDE_UNICODEDATA 0
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_CORE_MEMORYMANAGER 0
|
#define NAZARA_CORE_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Précision des réels lors de la transformation en texte (Max. chiffres après la virgule)
|
|
||||||
#define NAZARA_CORE_REAL_PRECISION 6
|
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_CORE_SAFE 1
|
#define NAZARA_CORE_SAFE 1
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
#define NAZARA_THREADSAFETY_LOG 1 // NzLog
|
#define NAZARA_THREADSAFETY_LOG 1 // NzLog
|
||||||
#define NAZARA_THREADSAFETY_RESOURCE 1 // NzResource
|
#define NAZARA_THREADSAFETY_RESOURCE 1 // NzResource
|
||||||
|
|
||||||
// Le nombre de spinlocks à utiliser avec les critical sections de Windows (0 pour désactiver)
|
// Le nombre de spinlocks à utiliser avec les sections critiques de Windows (0 pour désactiver)
|
||||||
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
||||||
|
|
||||||
// Optimise l'implémentation Windows avec certaines avancées de Windows vista (Casse la compatibilité XP)
|
// Optimise l'implémentation Windows avec certaines avancées de Windows vista (Casse la compatibilité XP)
|
||||||
|
|
@ -75,4 +75,7 @@
|
||||||
#define NAZARA_CORE_TIMER_WAKEUPTIME 10
|
#define NAZARA_CORE_TIMER_WAKEUPTIME 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Core/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_CORE_HPP
|
#endif // NAZARA_CONFIG_CORE_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_CORE_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_CORE_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
#define NAZARA_CORE_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CheckTypeAndVal(NAZARA_CORE_DECIMAL_DIGITS, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
CheckTypeAndVal(NAZARA_CORE_FILE_BUFFERSIZE, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
CheckTypeAndVal(NAZARA_CORE_WINDOWS_CS_SPINLOCKS, integral, >=, 0, " shall be a positive integer");
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_CORE_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Config.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_CORE_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
// Copyright (C) 2014 Jérôme Leclercq
|
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
|
||||||
|
|
||||||
#ifndef NAZARA_DEBUG_MEMORYMANAGER_HPP
|
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_HPP
|
|
||||||
|
|
||||||
#include <Nazara/Prerequesites.hpp>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
class NAZARA_API NzMemoryManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void* Allocate(std::size_t size, bool multi, const char* file = nullptr, unsigned int line = 0);
|
|
||||||
|
|
||||||
static void Free(void* pointer, bool multi);
|
|
||||||
|
|
||||||
static unsigned int GetAllocatedBlockCount();
|
|
||||||
static std::size_t GetAllocatedSize();
|
|
||||||
static unsigned int GetAllocationCount();
|
|
||||||
|
|
||||||
static void NextFree(const char* file, unsigned int line);
|
|
||||||
|
|
||||||
private:
|
|
||||||
NzMemoryManager();
|
|
||||||
~NzMemoryManager();
|
|
||||||
|
|
||||||
static void Initialize();
|
|
||||||
static void TimeInfo(char buffer[23]);
|
|
||||||
static void Uninitialize();
|
|
||||||
};
|
|
||||||
|
|
||||||
NAZARA_API void* operator new(std::size_t size, const char* file, unsigned int line);
|
|
||||||
NAZARA_API void* operator new[](std::size_t size, const char* file, unsigned int line);
|
|
||||||
NAZARA_API void operator delete(void* ptr, const char* file, unsigned int line) noexcept;
|
|
||||||
NAZARA_API void operator delete[](void* ptr, const char* file, unsigned int line) noexcept;
|
|
||||||
|
|
||||||
#endif // NAZARA_DEBUG_MEMORYMANAGER_HPP
|
|
||||||
|
|
||||||
#ifndef NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete
|
|
||||||
#define new new(__FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
// Pas de #pragma once car ce fichier est prévu pour être inclus plusieurs fois
|
||||||
|
|
||||||
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
#if NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
|
||||||
|
#ifndef NAZARA_DEBUG_NEWREDEFINITION_HPP
|
||||||
|
#define NAZARA_DEBUG_NEWREDEFINITION_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
|
|
||||||
|
NAZARA_API void* operator new(std::size_t size, const char* file, unsigned int line);
|
||||||
|
NAZARA_API void* operator new[](std::size_t size, const char* file, unsigned int line);
|
||||||
|
NAZARA_API void operator delete(void* ptr, const char* file, unsigned int line) noexcept;
|
||||||
|
NAZARA_API void operator delete[](void* ptr, const char* file, unsigned int line) noexcept;
|
||||||
|
|
||||||
|
#endif // NAZARA_DEBUG_NEWREDEFINITION_HPP
|
||||||
|
|
||||||
|
#ifndef NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||||
|
#define delete NzMemoryManager::NextFree(__FILE__, __LINE__), delete
|
||||||
|
#define new new(__FILE__, __LINE__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_CORE_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_MEMORYMANAGER_HPP
|
||||||
|
#define NAZARA_MEMORYMANAGER_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
class NAZARA_API NzMemoryManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void* Allocate(std::size_t size, bool multi = false, const char* file = nullptr, unsigned int line = 0);
|
||||||
|
|
||||||
|
static void Free(void* pointer, bool multi = false);
|
||||||
|
|
||||||
|
static unsigned int GetAllocatedBlockCount();
|
||||||
|
static std::size_t GetAllocatedSize();
|
||||||
|
static unsigned int GetAllocationCount();
|
||||||
|
|
||||||
|
static void NextFree(const char* file, unsigned int line);
|
||||||
|
|
||||||
|
private:
|
||||||
|
NzMemoryManager();
|
||||||
|
~NzMemoryManager();
|
||||||
|
|
||||||
|
static void Initialize();
|
||||||
|
static void TimeInfo(char buffer[23]);
|
||||||
|
static void Uninitialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_MEMORYMANAGER_HPP
|
||||||
|
|
@ -32,13 +32,18 @@
|
||||||
// À partir de combien d'instances d'un même mesh/matériau l'instancing doit-il être utilisé ?
|
// À partir de combien d'instances d'un même mesh/matériau l'instancing doit-il être utilisé ?
|
||||||
#define NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT 10
|
#define NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT 10
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_GRAPHICS_MEMORYMANAGER 0
|
#define NAZARA_GRAPHICS_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_GRAPHICS_SAFE 1
|
#define NAZARA_GRAPHICS_SAFE 1
|
||||||
|
|
||||||
|
/// Chaque modification d'un paramètre ci-dessous implique une modification (souvent mineure) du code
|
||||||
|
|
||||||
// Le nombre maximum de lumières qu'un shader standard supportera
|
// Le nombre maximum de lumières qu'un shader standard supportera
|
||||||
#define NAZARA_GRAPHICS_MAX_LIGHTPERPASS 3U // Unsigned
|
#define NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS 3
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Graphics/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_GRAPHICS_HPP
|
#endif // NAZARA_CONFIG_GRAPHICS_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Graphics module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_GRAPHICS_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_GRAPHICS_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||||
|
#define NAZARA_GRAPHICS_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CheckTypeAndVal(NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
CheckTypeAndVal(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_GRAPHICS_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/Config.hpp>
|
#include <Nazara/Graphics/Config.hpp>
|
||||||
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Graphics module"
|
// This file is part of the "Nazara Engine - Graphics module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_GRAPHICS_HPP
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,13 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_LUA_MEMORYMANAGER 0
|
#define NAZARA_LUA_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_LUA_SAFE 1
|
#define NAZARA_LUA_SAFE 1
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Lua/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_LUA_HPP
|
#endif // NAZARA_CONFIG_LUA_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Lua module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_LUA_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_LUA_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_LUA_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_LUA_MANAGE_MEMORY
|
||||||
|
#define NAZARA_LUA_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_LUA_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Lua/Config.hpp>
|
#include <Nazara/Lua/Config.hpp>
|
||||||
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_LUA_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Lua scripting module"
|
// This file is part of the "Nazara Engine - Lua scripting module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_LUA_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ unsigned int NzGetNumberLength(int number);
|
||||||
unsigned int NzGetNumberLength(unsigned int number);
|
unsigned int NzGetNumberLength(unsigned int number);
|
||||||
unsigned int NzGetNumberLength(long long number);
|
unsigned int NzGetNumberLength(long long number);
|
||||||
unsigned int NzGetNumberLength(unsigned long long number);
|
unsigned int NzGetNumberLength(unsigned long long number);
|
||||||
unsigned int NzGetNumberLength(float number, nzUInt8 precision = NAZARA_CORE_REAL_PRECISION);
|
unsigned int NzGetNumberLength(float number, nzUInt8 precision = NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
unsigned int NzGetNumberLength(double number, nzUInt8 precision = NAZARA_CORE_REAL_PRECISION);
|
unsigned int NzGetNumberLength(double number, nzUInt8 precision = NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
unsigned int NzGetNumberLength(long double number, nzUInt8 precision = NAZARA_CORE_REAL_PRECISION);
|
unsigned int NzGetNumberLength(long double number, nzUInt8 precision = NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
template<typename T, typename T2> T NzLerp(T from, T to, T2 interpolation);
|
template<typename T, typename T2> T NzLerp(T from, T to, T2 interpolation);
|
||||||
template<typename T> T NzNormalizeAngle(T angle);
|
template<typename T> T NzNormalizeAngle(T angle);
|
||||||
template<typename T> bool NzNumberEquals(T a, T b, T maxDifference = std::numeric_limits<T>::epsilon());
|
template<typename T> bool NzNumberEquals(T a, T b, T maxDifference = std::numeric_limits<T>::epsilon());
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,13 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_NOISE_MEMORYMANAGER 0
|
#define NAZARA_NOISE_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_NOISE_SAFE 1
|
#define NAZARA_NOISE_SAFE 1
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Noise/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Noise module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_NOISE_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_NOISE_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_NOISE_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_NOISE_MANAGE_MEMORY
|
||||||
|
#define NAZARA_NOISE_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_NOISE_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Noise/Config.hpp>
|
#include <Nazara/Noise/Config.hpp>
|
||||||
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_NOISE_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Noise module"
|
// This file is part of the "Nazara Engine - Noise module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_NOISE_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,13 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_PHYSICS_MEMORYMANAGER 0
|
#define NAZARA_PHYSICS_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_PHYSICS_SAFE 1
|
#define NAZARA_PHYSICS_SAFE 1
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Physics/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_PHYSICS_HPP
|
#endif // NAZARA_CONFIG_PHYSICS_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Physics module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_PHYSICS_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_PHYSICS_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
|
#define NAZARA_PHYSICS_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_PHYSICS_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Physics/Config.hpp>
|
#include <Nazara/Physics/Config.hpp>
|
||||||
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Physics module"
|
// This file is part of the "Nazara Engine - Physics module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// La taille du buffer d'Instancing (définit le nombre maximum d'instances en un rendu)
|
// La taille du buffer d'Instancing (définit le nombre maximum d'instances en un rendu)
|
||||||
#define NAZARA_RENDERER_INSTANCE_BUFFER_SIZE 8192*64 // 8192 matrices 4x4 flottantes
|
#define NAZARA_RENDERER_INSTANCE_BUFFER_SIZE 524288 // 8192 matrices 4x4 flottantes
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_RENDERER_MEMORYMANAGER 0
|
#define NAZARA_RENDERER_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Active le paramère debug des paramètres des contextes par défaut (Perte de performances mais capable de recevoir des messages d'OpenGL)
|
// Active le paramère debug des paramètres des contextes par défaut (Perte de performances mais capable de recevoir des messages d'OpenGL)
|
||||||
#define NAZARA_RENDERER_OPENGL_DEBUG 0
|
#define NAZARA_RENDERER_OPENGL_DEBUG 0
|
||||||
|
|
@ -41,4 +41,7 @@
|
||||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
#define NAZARA_RENDERER_SAFE 1
|
#define NAZARA_RENDERER_SAFE 1
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Renderer/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Graphics module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_RENDERER_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_RENDERER_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
|
#define NAZARA_RENDERER_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CheckTypeAndVal(NAZARA_RENDERER_INSTANCE_BUFFER_SIZE, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_RENDERER_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Renderer/Config.hpp>
|
#include <Nazara/Renderer/Config.hpp>
|
||||||
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Renderer module"
|
// This file is part of the "Nazara Engine - Renderer module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine - Window module
|
Nazara Engine - Utility module
|
||||||
|
|
||||||
Copyright (C) 2014 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
Copyright (C) 2014 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||||
|
|
||||||
|
|
@ -29,11 +29,8 @@
|
||||||
|
|
||||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||||
|
|
||||||
// Force les buffers à posséder un stride multiple de 32 bytes (Gain de performances sur certaines cartes/plus de consommation mémoire)
|
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes)
|
||||||
#define NAZARA_UTILITY_FORCE_DECLARATION_STRIDE_MULTIPLE_OF_32 0 ///FIXME: Ne peut pas être utilisé pour l'instant
|
#define NAZARA_UTILITY_MANAGE_MEMORY 0
|
||||||
|
|
||||||
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks, ralenti l'exécution)
|
|
||||||
#define NAZARA_UTILITY_MEMORYMANAGER 0
|
|
||||||
|
|
||||||
// Le skinning doit-il prendre avantage du multi-threading ? (Boost de performances sur les processeurs multi-coeurs)
|
// Le skinning doit-il prendre avantage du multi-threading ? (Boost de performances sur les processeurs multi-coeurs)
|
||||||
#define NAZARA_UTILITY_MULTITHREADED_SKINNING 0
|
#define NAZARA_UTILITY_MULTITHREADED_SKINNING 0
|
||||||
|
|
@ -50,7 +47,13 @@
|
||||||
// Protège les classes des accès concurrentiels
|
// Protège les classes des accès concurrentiels
|
||||||
//#define NAZARA_UTILITY_THREADSAFE 1
|
//#define NAZARA_UTILITY_THREADSAFE 1
|
||||||
|
|
||||||
|
// Force les buffers à posséder un stride multiple de 32 bytes (Gain de performances sur certaines cartes/plus de consommation mémoire)
|
||||||
|
#define NAZARA_UTILITY_VERTEX_DECLARATION_FORCE_STRIDE_MULTIPLE_OF_32 0 ///FIXME: Ne peut pas être utilisé pour l'instant
|
||||||
|
|
||||||
// Sous Windows, fait en sorte que les touches ALT et F10 n'activent pas le menu de la fenêtre
|
// Sous Windows, fait en sorte que les touches ALT et F10 n'activent pas le menu de la fenêtre
|
||||||
#define NAZARA_UTILITY_WINDOWS_DISABLE_MENU_KEYS 1
|
#define NAZARA_UTILITY_WINDOWS_DISABLE_MENU_KEYS 1
|
||||||
|
|
||||||
|
/// Vérification des valeurs et types de certaines constantes
|
||||||
|
#include <Nazara/Utility/ConfigCheck.hpp>
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_UTILITY_HPP
|
#endif // NAZARA_CONFIG_UTILITY_HPP
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Utility module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_CONFIG_CHECK_UTILITY_HPP
|
||||||
|
#define NAZARA_CONFIG_CHECK_UTILITY_HPP
|
||||||
|
|
||||||
|
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||||
|
|
||||||
|
// On force la valeur de MANAGE_MEMORY en mode debug
|
||||||
|
#if defined(NAZARA_DEBUG) && !NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
|
#undef NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
|
#define NAZARA_UTILITY_MANAGE_MEMORY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CheckTypeAndVal(NAZARA_UTILITY_SKINNING_MAX_WEIGHTS, integral, >, 0, " shall be a strictly positive integer");
|
||||||
|
|
||||||
|
#endif // NAZARA_CONFIG_CHECK_UTILITY_HPP
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Utility/Config.hpp>
|
#include <Nazara/Utility/Config.hpp>
|
||||||
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
// This file is part of the "Nazara Engine - Utility module"
|
// This file is part of the "Nazara Engine - Utility module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
|
||||||
|
#if NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
#undef delete
|
#undef delete
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Audio/Config.hpp>
|
#include <Nazara/Audio/Config.hpp>
|
||||||
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_AUDIO_MANAGE_MEMORY
|
||||||
|
|
@ -237,10 +237,10 @@ bool NzMusic::FillAndQueueBuffer(unsigned int buffer)
|
||||||
|
|
||||||
void NzMusic::MusicThread()
|
void NzMusic::MusicThread()
|
||||||
{
|
{
|
||||||
ALuint buffers[NAZARA_AUDIO_STREAMEDBUFFERCOUNT];
|
ALuint buffers[NAZARA_AUDIO_STREAMED_BUFFER_COUNT];
|
||||||
alGenBuffers(NAZARA_AUDIO_STREAMEDBUFFERCOUNT, buffers);
|
alGenBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < NAZARA_AUDIO_STREAMEDBUFFERCOUNT; ++i)
|
for (unsigned int i = 0; i < NAZARA_AUDIO_STREAMED_BUFFER_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (FillAndQueueBuffer(buffers[i])) // Fin du fichier ?
|
if (FillAndQueueBuffer(buffers[i])) // Fin du fichier ?
|
||||||
break; // Nous avons atteint la fin du fichier, inutile de rajouter des buffers
|
break; // Nous avons atteint la fin du fichier, inutile de rajouter des buffers
|
||||||
|
|
@ -280,7 +280,7 @@ void NzMusic::MusicThread()
|
||||||
for (ALint i = 0; i < queuedBufferCount; ++i)
|
for (ALint i = 0; i < queuedBufferCount; ++i)
|
||||||
alSourceUnqueueBuffers(m_source, 1, &buffer);
|
alSourceUnqueueBuffers(m_source, 1, &buffer);
|
||||||
|
|
||||||
alDeleteBuffers(NAZARA_AUDIO_STREAMEDBUFFERCOUNT, buffers);
|
alDeleteBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
NzMusicLoader::LoaderList NzMusic::s_loaders;
|
NzMusicLoader::LoaderList NzMusic::s_loaders;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Core/Config.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_CORE_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -27,4 +27,5 @@ void operator delete[](void* pointer) noexcept
|
||||||
{
|
{
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2014 Jérôme Leclercq
|
||||||
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
#if NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
|
||||||
|
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||||
|
|
||||||
|
#include <Nazara/Core/Debug/NewRedefinition.hpp>
|
||||||
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
|
void* operator new(std::size_t size, const char* file, unsigned int line)
|
||||||
|
{
|
||||||
|
return NzMemoryManager::Allocate(size, false, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* operator new[](std::size_t size, const char* file, unsigned int line)
|
||||||
|
{
|
||||||
|
return NzMemoryManager::Allocate(size, true, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr, const char* file, unsigned int line) noexcept
|
||||||
|
{
|
||||||
|
NzMemoryManager::NextFree(file, line);
|
||||||
|
NzMemoryManager::Free(ptr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[](void* ptr, const char* file, unsigned int line) noexcept
|
||||||
|
{
|
||||||
|
NzMemoryManager::NextFree(file, line);
|
||||||
|
NzMemoryManager::Free(ptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NAZARA_CORE_MANAGE_MEMORY
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
@ -259,25 +257,3 @@ void NzMemoryManager::Uninitialize()
|
||||||
|
|
||||||
std::fclose(log);
|
std::fclose(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* operator new(std::size_t size, const char* file, unsigned int line)
|
|
||||||
{
|
|
||||||
return NzMemoryManager::Allocate(size, false, file, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* operator new[](std::size_t size, const char* file, unsigned int line)
|
|
||||||
{
|
|
||||||
return NzMemoryManager::Allocate(size, true, file, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* ptr, const char* file, unsigned int line) noexcept
|
|
||||||
{
|
|
||||||
NzMemoryManager::NextFree(file, line);
|
|
||||||
NzMemoryManager::Free(ptr, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete[](void* ptr, const char* file, unsigned int line) noexcept
|
|
||||||
{
|
|
||||||
NzMemoryManager::NextFree(file, line);
|
|
||||||
NzMemoryManager::Free(ptr, true);
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
// Notre utilisation du placement new n'est pas (encore ?) compatible avec les définitions du MLT
|
// Notre utilisation du placement new n'est pas (encore ?) compatible avec les définitions du MLT
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||||
|
|
||||||
#include <Nazara/Core/ParameterList.hpp>
|
#include <Nazara/Core/ParameterList.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
|
|
||||||
|
|
@ -3930,7 +3930,7 @@ int NzString::Compare(const NzString& first, const NzString& second)
|
||||||
NzString NzString::Number(float number)
|
NzString NzString::Number(float number)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss.precision(NAZARA_CORE_REAL_PRECISION);
|
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
oss << number;
|
oss << number;
|
||||||
|
|
||||||
return NzString(oss.str());
|
return NzString(oss.str());
|
||||||
|
|
@ -3939,7 +3939,7 @@ NzString NzString::Number(float number)
|
||||||
NzString NzString::Number(double number)
|
NzString NzString::Number(double number)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss.precision(NAZARA_CORE_REAL_PRECISION);
|
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
oss << number;
|
oss << number;
|
||||||
|
|
||||||
return NzString(oss.str());
|
return NzString(oss.str());
|
||||||
|
|
@ -3948,7 +3948,7 @@ NzString NzString::Number(double number)
|
||||||
NzString NzString::Number(long double number)
|
NzString NzString::Number(long double number)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss.precision(NAZARA_CORE_REAL_PRECISION);
|
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
|
||||||
oss << number;
|
oss << number;
|
||||||
|
|
||||||
return NzString(oss.str());
|
return NzString(oss.str());
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/Config.hpp>
|
#include <Nazara/Graphics/Config.hpp>
|
||||||
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_GRAPHICS_MANAGE_MEMORY
|
||||||
|
|
@ -247,12 +247,12 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
|
||||||
unsigned int lightIndex = 0;
|
unsigned int lightIndex = 0;
|
||||||
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc();
|
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc();
|
||||||
|
|
||||||
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHTPERPASS + 1;
|
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||||
for (unsigned int pass = 0; pass < passCount; ++pass)
|
for (unsigned int pass = 0; pass < passCount; ++pass)
|
||||||
{
|
{
|
||||||
if (lightUniforms->exists)
|
if (lightUniforms->exists)
|
||||||
{
|
{
|
||||||
unsigned int renderedLightCount = std::min(lightCount, NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
|
unsigned int renderedLightCount = std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
|
||||||
lightCount -= renderedLightCount;
|
lightCount -= renderedLightCount;
|
||||||
|
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
|
|
@ -269,7 +269,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
|
||||||
for (unsigned int i = 0; i < renderedLightCount; ++i)
|
for (unsigned int i = 0; i < renderedLightCount; ++i)
|
||||||
m_directionalLights.GetLight(lightIndex++)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
m_directionalLights.GetLight(lightIndex++)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
||||||
|
|
||||||
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
|
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||||
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,7 +303,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
|
||||||
for (const NzMatrix4f& matrix : instances)
|
for (const NzMatrix4f& matrix : instances)
|
||||||
{
|
{
|
||||||
unsigned int directionalLightCount = m_directionalLights.GetLightCount();
|
unsigned int directionalLightCount = m_directionalLights.GetLightCount();
|
||||||
unsigned int otherLightCount = m_lights.ComputeClosestLights(matrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, m_maxLightPassPerObject*NAZARA_GRAPHICS_MAX_LIGHTPERPASS - directionalLightCount);
|
unsigned int otherLightCount = m_lights.ComputeClosestLights(matrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, m_maxLightPassPerObject*NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS - directionalLightCount);
|
||||||
unsigned int lightCount = directionalLightCount + otherLightCount;
|
unsigned int lightCount = directionalLightCount + otherLightCount;
|
||||||
|
|
||||||
NzRenderer::SetMatrix(nzMatrixType_World, matrix);
|
NzRenderer::SetMatrix(nzMatrixType_World, matrix);
|
||||||
|
|
@ -311,10 +311,10 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
|
||||||
unsigned int otherLightIndex = 0;
|
unsigned int otherLightIndex = 0;
|
||||||
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc(); // Dans le cas où nous aurions à le changer
|
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc(); // Dans le cas où nous aurions à le changer
|
||||||
|
|
||||||
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHTPERPASS + 1;
|
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
|
||||||
for (unsigned int pass = 0; pass < passCount; ++pass)
|
for (unsigned int pass = 0; pass < passCount; ++pass)
|
||||||
{
|
{
|
||||||
unsigned int renderedLightCount = std::min(lightCount, NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
|
unsigned int renderedLightCount = std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
|
||||||
lightCount -= renderedLightCount;
|
lightCount -= renderedLightCount;
|
||||||
|
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
|
|
@ -338,7 +338,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// On désactive l'éventuel surplus
|
// On désactive l'éventuel surplus
|
||||||
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
|
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||||
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
||||||
|
|
||||||
// Et on passe à l'affichage
|
// Et on passe à l'affichage
|
||||||
|
|
@ -478,7 +478,7 @@ void NzForwardRenderTechnique::DrawTransparentModels(const NzScene* scene) const
|
||||||
lightUniforms = GetLightUniforms(shader);
|
lightUniforms = GetLightUniforms(shader);
|
||||||
|
|
||||||
// On envoie les lumières directionnelles s'il y a (Les mêmes pour tous)
|
// On envoie les lumières directionnelles s'il y a (Les mêmes pour tous)
|
||||||
lightCount = std::min(m_directionalLights.GetLightCount(), NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
|
lightCount = std::min(m_directionalLights.GetLightCount(), NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
|
||||||
for (unsigned int i = 0; i < lightCount; ++i)
|
for (unsigned int i = 0; i < lightCount; ++i)
|
||||||
m_directionalLights.GetLight(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
m_directionalLights.GetLight(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
||||||
|
|
||||||
|
|
@ -511,14 +511,14 @@ void NzForwardRenderTechnique::DrawTransparentModels(const NzScene* scene) const
|
||||||
NzRenderer::SetVertexBuffer(vertexBuffer);
|
NzRenderer::SetVertexBuffer(vertexBuffer);
|
||||||
|
|
||||||
// Calcul des lumières les plus proches
|
// Calcul des lumières les plus proches
|
||||||
if (lightCount < NAZARA_GRAPHICS_MAX_LIGHTPERPASS && !m_lights.IsEmpty())
|
if (lightCount < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS && !m_lights.IsEmpty())
|
||||||
{
|
{
|
||||||
unsigned int count = std::min(NAZARA_GRAPHICS_MAX_LIGHTPERPASS - lightCount, m_lights.ComputeClosestLights(matrix.GetTranslation() + modelData.boundingSphere.GetPosition(), modelData.boundingSphere.radius, NAZARA_GRAPHICS_MAX_LIGHTPERPASS));
|
unsigned int count = std::min(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS - lightCount, m_lights.ComputeClosestLights(matrix.GetTranslation() + modelData.boundingSphere.GetPosition(), modelData.boundingSphere.radius, NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS));
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (unsigned int i = 0; i < count; ++i)
|
||||||
m_lights.GetResult(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*(lightCount++));
|
m_lights.GetResult(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*(lightCount++));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
|
for (unsigned int i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
|
||||||
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
|
||||||
|
|
||||||
NzRenderer::SetMatrix(nzMatrixType_World, matrix);
|
NzRenderer::SetMatrix(nzMatrixType_World, matrix);
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Lua/Config.hpp>
|
#include <Nazara/Lua/Config.hpp>
|
||||||
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_LUA_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_LUA_MANAGE_MEMORY
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// This file is part of the "Nazara Engine - Lua scripting module"
|
// This file is part of the "Nazara Engine - Lua scripting module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
|
||||||
|
|
||||||
#include <Nazara/Lua/LuaInstance.hpp>
|
#include <Nazara/Lua/LuaInstance.hpp>
|
||||||
#include <Lua/lauxlib.h>
|
#include <Lua/lauxlib.h>
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Noise/Config.hpp>
|
#include <Nazara/Noise/Config.hpp>
|
||||||
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_NOISE_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_NOISE_MANAGE_MEMORY
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Physics/Config.hpp>
|
#include <Nazara/Physics/Config.hpp>
|
||||||
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_PHYSICS_MANAGE_MEMORY
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Renderer/Config.hpp>
|
#include <Nazara/Renderer/Config.hpp>
|
||||||
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_RENDERER_MANAGE_MEMORY
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Utility/Config.hpp>
|
#include <Nazara/Utility/Config.hpp>
|
||||||
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
|
#if NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
|
|
||||||
#include <Nazara/Core/Debug/MemoryManager.hpp>
|
#include <Nazara/Core/MemoryManager.hpp>
|
||||||
#include <new>
|
#include <new> // Nécessaire ?
|
||||||
|
|
||||||
void* operator new(std::size_t size)
|
void* operator new(std::size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
|
||||||
NzMemoryManager::Free(pointer, true);
|
NzMemoryManager::Free(pointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NAZARA_UTILITY_MANAGE_MEMORY
|
||||||
Loading…
Reference in New Issue