Merge branch 'master' into vulkan
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Audio/Music.hpp>
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <Nazara/Audio/SoundStream.hpp>
|
||||
#include <Nazara/Core/Mutex.hpp>
|
||||
|
||||
@@ -3,13 +3,9 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Audio/Sound.hpp>
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/ByteArray.hpp>
|
||||
#include <Nazara/Core/AbstractHash.hpp>
|
||||
#include <ostream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <Nazara/Core/MemoryStream.hpp>
|
||||
#include <Nazara/Core/MemoryView.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <Nazara/Core/Win32/ClockImpl.hpp>
|
||||
|
||||
@@ -102,18 +102,4 @@ namespace Nz
|
||||
NazaraAssert(mutex != nullptr, "Mutex must be valid");
|
||||
return m_impl->Wait(mutex->m_impl, timeout);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves a condition to another ConditionVariable object
|
||||
* \return A reference to the object
|
||||
*/
|
||||
ConditionVariable& ConditionVariable::operator=(ConditionVariable&& condition) noexcept
|
||||
{
|
||||
delete m_impl;
|
||||
|
||||
m_impl = condition.m_impl;
|
||||
condition.m_impl = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/HardwareInfo.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/PluginManager.hpp>
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Sets the pattern of the directory
|
||||
*
|
||||
* \param dirPath Pattern of the directory
|
||||
* \param pattern Pattern of the directory
|
||||
*/
|
||||
|
||||
void Directory::SetPattern(const String& pattern)
|
||||
@@ -327,7 +327,7 @@ namespace Nz
|
||||
* \return true if copy is successful
|
||||
*
|
||||
* \param sourcePath Path of the original directory
|
||||
* \param targetPath Path of the copied directory
|
||||
* \param destPath Path of the copied directory
|
||||
*
|
||||
* \remark Produces a NazaraError if could not create destination directory
|
||||
* \remark Produces a NazaraError if could not open origin directory
|
||||
|
||||
@@ -40,19 +40,6 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a DynLib object by move semantic
|
||||
*
|
||||
* \param lib DynLib to move into this
|
||||
*/
|
||||
|
||||
DynLib::DynLib(DynLib&& lib) :
|
||||
m_lastError(std::move(lib.m_lastError)),
|
||||
m_impl(lib.m_impl)
|
||||
{
|
||||
lib.m_impl = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destructs the object and calls Unload
|
||||
*
|
||||
@@ -150,23 +137,4 @@ namespace Nz
|
||||
m_impl = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the other lib into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param lib DynLib to move in this
|
||||
*/
|
||||
|
||||
DynLib& DynLib::operator=(DynLib&& lib)
|
||||
{
|
||||
Unload();
|
||||
|
||||
m_impl = lib.m_impl;
|
||||
m_lastError = std::move(lib.m_lastError);
|
||||
|
||||
lib.m_impl = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/AbstractHash.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Directory.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <Nazara/Core/Win32/FileImpl.hpp>
|
||||
@@ -70,20 +69,6 @@ namespace Nz
|
||||
Open(filePath, openMode);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a File object by move semantic
|
||||
*
|
||||
* \param file File to move into this
|
||||
*/
|
||||
|
||||
File::File(File&& file) noexcept :
|
||||
Stream(std::move(file)),
|
||||
m_filePath(std::move(file.m_filePath)),
|
||||
m_impl(file.m_impl)
|
||||
{
|
||||
file.m_impl = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destructs the object and calls Close
|
||||
*
|
||||
@@ -487,23 +472,6 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the other file into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param file File to move in this
|
||||
*/
|
||||
|
||||
File& File::operator=(File&& file) noexcept
|
||||
{
|
||||
NazaraLock(m_mutex)
|
||||
|
||||
std::swap(m_filePath, file.m_filePath);
|
||||
std::swap(m_impl, file.m_impl);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the absolute path of the file
|
||||
* \return Absolute path of the file
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <Nazara/Core/GuillotineBinPack.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
@@ -295,7 +293,7 @@ namespace Nz
|
||||
*
|
||||
* \param rects List of rectangles
|
||||
* \param flipped List of flipped rectangles
|
||||
* \param flipped List of inserted rectangles
|
||||
* \param inserted List of inserted rectangles
|
||||
* \param count Count of rectangles
|
||||
* \param merge Merge possible
|
||||
* \param rectChoice Heuristic to use to free
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <Nazara/Core/HardwareInfo.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <Nazara/Core/MemoryManager.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <new>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <windows.h>
|
||||
@@ -94,7 +94,7 @@ namespace Nz
|
||||
* \return Raw memory allocated
|
||||
*
|
||||
* \param size Size to allocate
|
||||
* \parma multi Array or not
|
||||
* \param multi Array or not
|
||||
* \param file File of the allocation
|
||||
* \param line Line of the allocation in the file
|
||||
*/
|
||||
|
||||
@@ -77,18 +77,4 @@ namespace Nz
|
||||
NazaraAssert(m_impl, "Cannot unlock a moved mutex");
|
||||
m_impl->Unlock();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves a mutex to another mutex object
|
||||
* \return A reference to the object
|
||||
*/
|
||||
Mutex& Mutex::operator=(Mutex&& mutex) noexcept
|
||||
{
|
||||
delete m_impl;
|
||||
|
||||
m_impl = mutex.m_impl;
|
||||
mutex.m_impl = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -720,7 +718,6 @@ namespace Nz
|
||||
* \brief Create an uninitialized value of a set name
|
||||
*
|
||||
* \param name Name of the parameter
|
||||
* \param value Value of the parameter
|
||||
*
|
||||
* \remark The previous value if any gets destroyed
|
||||
*/
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Unmounts the plugin with a path
|
||||
*
|
||||
* \param pluginPath Path to the plugin
|
||||
* \param plugin Path to the plugin
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not loaded
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Posix/ClockImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <ctime>
|
||||
#include <sys/time.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <Nazara/Core/Posix/ConditionVariableImpl.hpp>
|
||||
#include <Nazara/Core/Posix/MutexImpl.hpp>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
#include <Nazara/Core/Posix/DirectoryImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include <Nazara/Core/Posix/DynLibImpl.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <dlfcn.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -42,7 +42,7 @@ namespace Nz
|
||||
{
|
||||
String path = libraryPath;
|
||||
|
||||
unsigned int pos = path.FindLast(".so");
|
||||
size_t pos = path.FindLast(".so");
|
||||
if (pos == String::npos || (path.GetLength() > pos+3 && path[pos+3] != '.'))
|
||||
path += ".so";
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_DYNLIBIMPL_HPP
|
||||
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
#include <Nazara/Core/Posix/FileImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <sys/file.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -12,12 +12,8 @@
|
||||
#endif
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <ctime>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Posix/HardwareInfoImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <unistd.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_HARDWAREINFOIMPL_POSIX_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Posix/SemaphoreImpl.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <limits>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Posix/TaskSchedulerImpl.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Functor.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_TASKSCHEDULERIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Functor.hpp>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <pthread.h>
|
||||
@@ -16,6 +15,8 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct Functor;
|
||||
|
||||
class TaskSchedulerImpl
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
#include <Nazara/Core/Posix/ThreadImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Functor.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_THREADIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
|
||||
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE
|
||||
@@ -19,6 +18,7 @@
|
||||
namespace Nz
|
||||
{
|
||||
struct Functor;
|
||||
class String;
|
||||
|
||||
class ThreadImpl
|
||||
{
|
||||
|
||||
@@ -5,13 +5,6 @@
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
|
||||
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_REFCOUNTED
|
||||
#include <Nazara/Core/ThreadSafety.hpp>
|
||||
#else
|
||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||
#endif
|
||||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the character
|
||||
* \brief Checks whether the string contains the character
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param character Single character
|
||||
@@ -311,7 +311,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the "C string"
|
||||
* \brief Checks whether the string contains the "C string"
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param string String to search
|
||||
@@ -327,7 +327,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the string
|
||||
* \brief Checks whether the string contains the string
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param string String to search
|
||||
@@ -2244,7 +2244,7 @@ namespace Nz
|
||||
* \brief Gets the word until next separator
|
||||
* \return Word string
|
||||
*
|
||||
* \param start Index to begin the search
|
||||
* \param index Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
@@ -2289,7 +2289,7 @@ namespace Nz
|
||||
* \brief Gets the word position
|
||||
* \return Position of the beginning of the word
|
||||
*
|
||||
* \param start Index to begin the search
|
||||
* \param index Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
@@ -2729,8 +2729,8 @@ namespace Nz
|
||||
* \brief Replaces the old "C string" by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param oldString Pattern to find
|
||||
* \param replaceString Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2744,10 +2744,10 @@ namespace Nz
|
||||
* \brief Replaces the old "C string" by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param oldString Pattern to find
|
||||
* \param oldLength Length of the old string
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param Length of the new string
|
||||
* \param replaceString Pattern to change for
|
||||
* \param replaceLength of the new string
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2822,8 +2822,8 @@ namespace Nz
|
||||
* \brief Replaces the old string by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param oldString Pattern to find
|
||||
* \param replaceString Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2838,7 +2838,7 @@ namespace Nz
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacters Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param replaceCharacter Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*
|
||||
@@ -3646,7 +3646,7 @@ namespace Nz
|
||||
* \return The number of splits
|
||||
*
|
||||
* \param result Resulting tokens
|
||||
* \param separation List of characters of separation
|
||||
* \param separations List of characters for separation
|
||||
* \param start Index for the beginning of the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -3687,7 +3687,7 @@ namespace Nz
|
||||
* \return The number of splits
|
||||
*
|
||||
* \param result Resulting tokens
|
||||
* \param separation List of characters of separation
|
||||
* \param separations List of characters for separation
|
||||
* \param start Index for the beginning of the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -3885,7 +3885,7 @@ namespace Nz
|
||||
* \brief Returns a sub string of the string from a character
|
||||
* \return SubString
|
||||
*
|
||||
* \param charater Pattern to find
|
||||
* \param character Pattern to find
|
||||
* \param startPos Index for the beginning of the search
|
||||
* \param fromLast beginning by the end
|
||||
* \param include Include the character
|
||||
@@ -3975,7 +3975,7 @@ namespace Nz
|
||||
* \brief Returns a sub string of the string up to a character
|
||||
* \return SubString
|
||||
*
|
||||
* \param charater Pattern to find
|
||||
* \param character Pattern to find
|
||||
* \param startPos Index for the beginning of the search
|
||||
* \param toLast beginning by the end
|
||||
* \param include Include the character
|
||||
@@ -4124,7 +4124,6 @@ namespace Nz
|
||||
* \return true if successful
|
||||
*
|
||||
* \param value Double to convert to
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
bool String::ToDouble(double* value) const
|
||||
@@ -4143,7 +4142,7 @@ namespace Nz
|
||||
* \return true if successful
|
||||
*
|
||||
* \param value Integer to convert to
|
||||
* \param flags Flag for the look up
|
||||
* \param base Base to convert the integer to
|
||||
*/
|
||||
|
||||
bool String::ToInteger(long long* value, UInt8 base) const
|
||||
@@ -5483,7 +5482,7 @@ namespace Nz
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param os The stream
|
||||
* \param str The string to output
|
||||
*/
|
||||
|
||||
@@ -5523,7 +5522,7 @@ namespace Nz
|
||||
* \return String which is the result of the concatenation
|
||||
*
|
||||
* \param string String to add
|
||||
* \param string String in the right hand side
|
||||
* \param nstring String in the right hand side
|
||||
*/
|
||||
|
||||
String operator+(const char* string, const String& nstring)
|
||||
@@ -5549,7 +5548,7 @@ namespace Nz
|
||||
* \return String which is the result of the concatenation
|
||||
*
|
||||
* \param string String to add
|
||||
* \param string String in the right hand side
|
||||
* \param nstring String in the right hand side
|
||||
*/
|
||||
|
||||
String operator+(const std::string& string, const String& nstring)
|
||||
@@ -5667,7 +5666,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(char character, const String& nstring)
|
||||
@@ -5680,7 +5679,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(const char* string, const String& nstring)
|
||||
@@ -5693,7 +5692,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(const std::string& string, const String& nstring)
|
||||
@@ -5706,7 +5705,7 @@ namespace Nz
|
||||
* \return false if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(char character, const String& nstring)
|
||||
@@ -5719,7 +5718,7 @@ namespace Nz
|
||||
* \return false if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(const char* string, const String& nstring)
|
||||
@@ -5732,7 +5731,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(const std::string& string, const String& nstring)
|
||||
@@ -5745,7 +5744,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(char character, const String& nstring)
|
||||
@@ -5758,7 +5757,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(const char* string, const String& nstring)
|
||||
@@ -5771,7 +5770,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(const std::string& string, const String& nstring)
|
||||
@@ -5784,7 +5783,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(char character, const String& nstring)
|
||||
@@ -5797,7 +5796,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(const char* string, const String& nstring)
|
||||
@@ -5810,7 +5809,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(const std::string& string, const String& nstring)
|
||||
@@ -5823,7 +5822,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(char character, const String& nstring)
|
||||
@@ -5836,7 +5835,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(const char* string, const String& nstring)
|
||||
@@ -5849,7 +5848,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(const std::string& string, const String& nstring)
|
||||
@@ -5862,7 +5861,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(char character, const String& nstring)
|
||||
@@ -5875,7 +5874,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(const char* string, const String& nstring)
|
||||
@@ -5888,7 +5887,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(const std::string& string, const String& nstring)
|
||||
@@ -5975,20 +5974,7 @@ namespace std
|
||||
|
||||
istream& getline(istream& is, Nz::String& str)
|
||||
{
|
||||
str.Clear();
|
||||
|
||||
char c;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
is.get(c);
|
||||
if (c != '\n' && c != '\0')
|
||||
str += c;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return is;
|
||||
return getline(is, str, is.widen('\n'));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -6012,7 +5998,11 @@ namespace std
|
||||
if (c != delim && c != '\0')
|
||||
str += c;
|
||||
else
|
||||
{
|
||||
if (c == '\0')
|
||||
is.setstate(std::ios_base::eofbit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return is;
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -13,23 +16,14 @@ namespace Nz
|
||||
* \brief Core class that represents a stream of strings
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a StringStream object by default
|
||||
*/
|
||||
StringStream::StringStream() :
|
||||
m_bufferSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a StringStream object with a string
|
||||
*
|
||||
* \param str First value of the stream
|
||||
*/
|
||||
StringStream::StringStream(const String& str) :
|
||||
m_bufferSize(str.GetSize())
|
||||
StringStream::StringStream(String str) :
|
||||
m_result(std::move(str))
|
||||
{
|
||||
m_strings.push_back(str);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -37,8 +31,7 @@ namespace Nz
|
||||
*/
|
||||
void StringStream::Clear()
|
||||
{
|
||||
m_bufferSize = 0;
|
||||
m_strings.clear();
|
||||
m_result.Clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -47,7 +40,7 @@ namespace Nz
|
||||
*/
|
||||
std::size_t StringStream::GetBufferSize() const
|
||||
{
|
||||
return m_bufferSize;
|
||||
return m_result.GetSize();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -56,13 +49,7 @@ namespace Nz
|
||||
*/
|
||||
String StringStream::ToString() const
|
||||
{
|
||||
String string;
|
||||
string.Reserve(m_bufferSize);
|
||||
|
||||
for (const String& str : m_strings)
|
||||
string += str;
|
||||
|
||||
return string;
|
||||
return m_result;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -73,8 +60,10 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(bool boolean)
|
||||
{
|
||||
m_strings.push_back(String::Boolean(boolean));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
std::size_t size = (boolean) ? 4 : 5;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + size);
|
||||
std::memcpy(&m_result[start], (boolean) ? "true" : "false", size);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -87,8 +76,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(short number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<short>::digits10 + 2;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%hd", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -101,8 +93,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(unsigned short number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<unsigned short>::digits10 + 1;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%hu", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -115,8 +110,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(int number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<int>::digits10 + 2;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%d", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -129,8 +127,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(unsigned int number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<unsigned int>::digits10 + 1;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%u", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -143,8 +144,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<long>::digits10 + 2;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%ld", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -157,8 +161,12 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(unsigned long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<unsigned long>::digits10 + 1;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%lu", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -171,8 +179,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(long long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<long long>::digits10 + 2;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%lld", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -185,8 +196,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(unsigned long long number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = std::numeric_limits<unsigned long long>::digits10 + 1;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "%llu", number);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -199,10 +213,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(float number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
|
||||
return *this;
|
||||
return operator<<(double(number)); //< snprintf doesn't support float anyway
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -213,8 +224,16 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(double number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
// https://stackoverflow.com/questions/1701055/what-is-the-maximum-length-in-chars-needed-to-represent-any-double-value
|
||||
const std::size_t maxSize = 3 + std::numeric_limits<double>::digits - std::numeric_limits<double>::min_exponent;
|
||||
|
||||
// Use a temporary buffer to prevent 1kb string capacity growth
|
||||
std::array<char, maxSize + 1> buffer;
|
||||
std::size_t written = std::snprintf(buffer.data(), buffer.size(), "%.6f", number);
|
||||
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + written);
|
||||
std::memcpy(&m_result[start], buffer.data(), written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -227,8 +246,16 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(long double number)
|
||||
{
|
||||
m_strings.push_back(String::Number(number));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
// https://stackoverflow.com/questions/1701055/what-is-the-maximum-length-in-chars-needed-to-represent-any-double-value
|
||||
const std::size_t maxSize = 3 + std::numeric_limits<long double>::digits - std::numeric_limits<long double>::min_exponent;
|
||||
|
||||
// Use a temporary buffer to prevent 1kb string capacity growth
|
||||
std::array<char, maxSize + 1> buffer;
|
||||
std::size_t written = std::snprintf(buffer.data(), buffer.size(), "%.6Lf", number);
|
||||
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + written);
|
||||
std::memcpy(&m_result[start], buffer.data(), written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -241,9 +268,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(char character)
|
||||
{
|
||||
m_strings.push_back(String(character));
|
||||
m_bufferSize++;
|
||||
|
||||
m_result.Append(character);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -255,9 +280,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(unsigned char character)
|
||||
{
|
||||
m_strings.push_back(String(static_cast<char>(character)));
|
||||
m_bufferSize++;
|
||||
|
||||
m_result.Append(static_cast<unsigned char>(character));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -269,9 +292,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(const char* string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
|
||||
m_result.Append(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -283,9 +304,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(const std::string& string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
m_bufferSize += string.size();
|
||||
|
||||
m_result.Append(string.data(), string.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -297,8 +316,7 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(const String& string)
|
||||
{
|
||||
m_strings.push_back(string);
|
||||
m_bufferSize += string.GetSize();
|
||||
m_result.Append(string);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -311,8 +329,11 @@ namespace Nz
|
||||
*/
|
||||
StringStream& StringStream::operator<<(const void* ptr)
|
||||
{
|
||||
m_strings.push_back(String::Pointer(ptr));
|
||||
m_bufferSize += m_strings.back().GetSize();
|
||||
constexpr std::size_t maxSize = sizeof(void*) * 2 + 2;
|
||||
std::size_t start = m_result.GetSize();
|
||||
m_result.Resize(start + maxSize);
|
||||
std::size_t written = std::snprintf(&m_result[start], maxSize + 1, "0x%p", ptr);
|
||||
m_result.Resize(start + written);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/HardwareInfo.hpp>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <Nazara/Core/Win32/ThreadImpl.hpp>
|
||||
@@ -36,18 +35,6 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Thread<T> object by move semantic
|
||||
*
|
||||
* \param other Thread to move into this
|
||||
*/
|
||||
|
||||
Thread::Thread(Thread&& other) noexcept :
|
||||
m_impl(other.m_impl)
|
||||
{
|
||||
other.m_impl = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Waits that the thread ends and then destroys this
|
||||
*/
|
||||
@@ -136,30 +123,6 @@ namespace Nz
|
||||
m_impl->SetName(name);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the other thread into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param thread Thread to move in this
|
||||
*
|
||||
* \remark Produce a NazaraError if no functor was assigned and NAZARA_CORE_SAFE is defined
|
||||
* \remark And call std::terminate if no functor was assigned and NAZARA_CORE_SAFE is defined
|
||||
*/
|
||||
|
||||
Thread& Thread::operator=(Thread&& thread)
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (m_impl)
|
||||
{
|
||||
NazaraError("This thread cannot be joined");
|
||||
std::terminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::swap(m_impl, thread.m_impl);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of simulatenous threads that can run on the same cpu
|
||||
* \return The number of simulatenous threads
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Nz
|
||||
|
||||
void ThreadImpl::SetThreadName(DWORD threadId, const char* threadName)
|
||||
{
|
||||
#ifdef NAZARA_COMPILER_MSVC
|
||||
// https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
|
||||
constexpr DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
|
||||
@@ -72,8 +73,8 @@ namespace Nz
|
||||
info.dwThreadID = threadId;
|
||||
info.dwFlags = 0;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 6320 6322)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 6320 6322)
|
||||
__try
|
||||
{
|
||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), reinterpret_cast<ULONG_PTR*>(&info));
|
||||
@@ -81,7 +82,10 @@ namespace Nz
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
NazaraWarning("SetThreadName on Windows is only supported with MSVC for now");
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int __stdcall ThreadImpl::ThreadProc(void* userdata)
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/AbstractRenderTechnique.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Graphics/RenderTechniques.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
#include <Nazara/Graphics/Billboard.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -27,11 +23,8 @@ namespace Nz
|
||||
|
||||
void Billboard::AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const
|
||||
{
|
||||
if (!m_material)
|
||||
return;
|
||||
|
||||
Nz::Vector3f position = instanceData.transformMatrix.GetTranslation();
|
||||
renderQueue->AddBillboards(instanceData.renderOrder, m_material, 1, &position, &m_size, &m_sinCos, &m_color);
|
||||
renderQueue->AddBillboards(instanceData.renderOrder, GetMaterial(), 1, &position, &m_size, &m_sinCos, &m_color);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/ColorBackground.hpp>
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Renderer/UberShaderInstance.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <Nazara/Graphics/DeferredBloomPass.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/DeferredDOFPass.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <Nazara/Graphics/DeferredFXAAPass.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Renderer/UberShaderInstance.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/DeferredFinalPass.hpp>
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
#include <Nazara/Renderer/UberShaderInstance.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#include <Nazara/Graphics/DeferredFogPass.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
|
||||
@@ -8,12 +8,9 @@
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <Nazara/Utility/BufferMapper.hpp>
|
||||
#include <Nazara/Utility/StaticMesh.hpp>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/DeferredPhongLightingPass.hpp>
|
||||
#include <Nazara/Core/Primitive.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <Nazara/Utility/StaticMesh.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/DeferredRenderPass.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderQueue.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/DeferredRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/ForwardRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
///TODO: Render billboards using Deferred Shading if possible
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/DeferredBloomPass.hpp>
|
||||
#include <Nazara/Graphics/DeferredDOFPass.hpp>
|
||||
@@ -18,18 +17,13 @@
|
||||
#include <Nazara/Graphics/DeferredFXAAPass.hpp>
|
||||
#include <Nazara/Graphics/DeferredGeometryPass.hpp>
|
||||
#include <Nazara/Graphics/DeferredPhongLightingPass.hpp>
|
||||
#include <Nazara/Graphics/Drawable.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/OpenGL.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
#include <Nazara/Renderer/ShaderStage.hpp>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Graphics/DepthRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -5,19 +5,14 @@
|
||||
#include <Nazara/Graphics/DepthRenderTechnique.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/OffsetOf.hpp>
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/Drawable.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Utility/BufferMapper.hpp>
|
||||
#include <Nazara/Utility/StaticMesh.hpp>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/Formats/MeshLoader.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/Model.hpp>
|
||||
#include <Nazara/Graphics/SkeletalModel.hpp>
|
||||
#include <Nazara/Utility/MaterialData.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -77,7 +75,6 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
model->Reset();
|
||||
model->SetMesh(mesh);
|
||||
|
||||
if (parameters.loadMaterials)
|
||||
@@ -114,7 +111,6 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
model->Reset();
|
||||
model->SetMesh(mesh);
|
||||
|
||||
if (parameters.loadMaterials)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <Nazara/Graphics/Formats/TextureLoader.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <Nazara/Graphics/ForwardRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
///TODO: Replace sinus/cosinus by a lookup table (which will lead to a speed up about 10x)
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
#include <Nazara/Graphics/Drawable.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Graphics/SceneData.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Utility/BufferMapper.hpp>
|
||||
#include <Nazara/Utility/StaticMesh.hpp>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -217,8 +215,15 @@ namespace Nz
|
||||
s_billboardInstanceDeclaration.EnableComponent(VertexComponent_InstanceData1, ComponentType_Float4, NazaraOffsetOf(ForwardRenderQueue::BillboardData, size)); // Englobe sincos
|
||||
s_billboardInstanceDeclaration.EnableComponent(VertexComponent_InstanceData2, ComponentType_Color, NazaraOffsetOf(ForwardRenderQueue::BillboardData, color));
|
||||
|
||||
s_reflectionSampler.SetFilterMode(SamplerFilter_Bilinear);
|
||||
s_reflectionSampler.SetWrapMode(SamplerWrap_Clamp);
|
||||
|
||||
s_shadowSampler.SetFilterMode(SamplerFilter_Bilinear);
|
||||
s_shadowSampler.SetWrapMode(SamplerWrap_Clamp);
|
||||
|
||||
std::array<UInt8, 6> whitePixels = { { 255, 255, 255, 255, 255, 255 } };
|
||||
s_dummyReflection.Create(ImageType_Cubemap, PixelFormatType_L8, 1, 1);
|
||||
s_dummyReflection.Update(whitePixels.data());
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@@ -235,6 +240,7 @@ namespace Nz
|
||||
|
||||
void ForwardRenderTechnique::Uninitialize()
|
||||
{
|
||||
s_dummyReflection.Destroy();
|
||||
s_quadIndexBuffer.Reset();
|
||||
s_quadVertexBuffer.Reset();
|
||||
}
|
||||
@@ -587,6 +593,10 @@ namespace Nz
|
||||
const Shader* lastShader = nullptr;
|
||||
const ShaderUniforms* shaderUniforms = nullptr;
|
||||
|
||||
Texture* reflectionMap = sceneData.globalReflectionTexture;
|
||||
if (!reflectionMap)
|
||||
reflectionMap = &s_dummyReflection;
|
||||
|
||||
for (auto& pipelinePair : layer.opaqueModels)
|
||||
{
|
||||
const MaterialPipeline* pipeline = pipelinePair.first;
|
||||
@@ -622,6 +632,14 @@ namespace Nz
|
||||
{
|
||||
material->Apply(pipelineInstance);
|
||||
|
||||
if (shaderUniforms->reflectionMap != -1)
|
||||
{
|
||||
unsigned int textureUnit = Material::GetTextureUnit(TextureMap_ReflectionCube);
|
||||
|
||||
Renderer::SetTexture(textureUnit, reflectionMap);
|
||||
Renderer::SetTextureSampler(textureUnit, s_reflectionSampler);
|
||||
}
|
||||
|
||||
ForwardRenderQueue::MeshInstanceContainer& meshInstances = matEntry.meshMap;
|
||||
|
||||
// Meshes
|
||||
@@ -1035,6 +1053,7 @@ namespace Nz
|
||||
uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, &ForwardRenderTechnique::OnShaderInvalidated);
|
||||
|
||||
uniforms.eyePosition = shader->GetUniformLocation("EyePosition");
|
||||
uniforms.reflectionMap = shader->GetUniformLocation("ReflectionMap");
|
||||
uniforms.sceneAmbient = shader->GetUniformLocation("SceneAmbient");
|
||||
uniforms.textureOverlay = shader->GetUniformLocation("TextureOverlay");
|
||||
|
||||
@@ -1175,6 +1194,8 @@ namespace Nz
|
||||
}
|
||||
|
||||
IndexBuffer ForwardRenderTechnique::s_quadIndexBuffer;
|
||||
Texture ForwardRenderTechnique::s_dummyReflection;
|
||||
TextureSampler ForwardRenderTechnique::s_reflectionSampler;
|
||||
TextureSampler ForwardRenderTechnique::s_shadowSampler;
|
||||
VertexBuffer ForwardRenderTechnique::s_quadVertexBuffer;
|
||||
VertexDeclaration ForwardRenderTechnique::s_billboardInstanceDeclaration;
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Uninitializes the Core module
|
||||
* \brief Uninitializes the Graphics module
|
||||
*
|
||||
* \remark Produces a NazaraNotice
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/GuillotineTextureAtlas.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/Texture.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <Nazara/Math/Sphere.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
#include <cstring>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
///TODO: Use of UBOs
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/MaterialData.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -388,6 +387,7 @@ namespace Nz
|
||||
m_ambientColor = Color(128, 128, 128);
|
||||
m_diffuseColor = Color::White;
|
||||
m_diffuseSampler = TextureSampler();
|
||||
m_reflectionMode = ReflectionMode_Skybox;
|
||||
m_shadowCastingEnabled = true;
|
||||
m_shininess = 50.f;
|
||||
m_specularColor = Color::White;
|
||||
@@ -395,6 +395,7 @@ namespace Nz
|
||||
m_pipelineInfo = MaterialPipelineInfo();
|
||||
m_pipelineInfo.depthBuffer = true;
|
||||
m_pipelineInfo.faceCulling = true;
|
||||
m_reflectionSize = 256;
|
||||
|
||||
SetShader("Basic");
|
||||
|
||||
|
||||
@@ -79,19 +79,20 @@ namespace Nz
|
||||
NazaraAssert(m_pipelineInfo.uberShader, "Material pipeline has no uber shader");
|
||||
|
||||
ParameterList list;
|
||||
list.SetParameter("ALPHA_MAPPING", m_pipelineInfo.hasAlphaMap);
|
||||
list.SetParameter("ALPHA_TEST", m_pipelineInfo.alphaTest);
|
||||
list.SetParameter("COMPUTE_TBNMATRIX", m_pipelineInfo.hasNormalMap || m_pipelineInfo.hasHeightMap);
|
||||
list.SetParameter("DIFFUSE_MAPPING", m_pipelineInfo.hasDiffuseMap);
|
||||
list.SetParameter("EMISSIVE_MAPPING", m_pipelineInfo.hasEmissiveMap);
|
||||
list.SetParameter("NORMAL_MAPPING", m_pipelineInfo.hasNormalMap);
|
||||
list.SetParameter("PARALLAX_MAPPING", m_pipelineInfo.hasHeightMap);
|
||||
list.SetParameter("SHADOW_MAPPING", m_pipelineInfo.shadowReceive);
|
||||
list.SetParameter("SPECULAR_MAPPING", m_pipelineInfo.hasSpecularMap);
|
||||
list.SetParameter("TEXTURE_MAPPING", m_pipelineInfo.hasAlphaMap || m_pipelineInfo.hasDiffuseMap || m_pipelineInfo.hasEmissiveMap ||
|
||||
m_pipelineInfo.hasNormalMap || m_pipelineInfo.hasHeightMap || m_pipelineInfo.hasSpecularMap ||
|
||||
flags & ShaderFlags_TextureOverlay);
|
||||
list.SetParameter("TRANSFORM", true);
|
||||
list.SetParameter("ALPHA_MAPPING", m_pipelineInfo.hasAlphaMap);
|
||||
list.SetParameter("ALPHA_TEST", m_pipelineInfo.alphaTest);
|
||||
list.SetParameter("COMPUTE_TBNMATRIX", m_pipelineInfo.hasNormalMap || m_pipelineInfo.hasHeightMap);
|
||||
list.SetParameter("DIFFUSE_MAPPING", m_pipelineInfo.hasDiffuseMap);
|
||||
list.SetParameter("EMISSIVE_MAPPING", m_pipelineInfo.hasEmissiveMap);
|
||||
list.SetParameter("NORMAL_MAPPING", m_pipelineInfo.hasNormalMap);
|
||||
list.SetParameter("PARALLAX_MAPPING", m_pipelineInfo.hasHeightMap);
|
||||
list.SetParameter("REFLECTION_MAPPING", m_pipelineInfo.reflectionMapping);
|
||||
list.SetParameter("SHADOW_MAPPING", m_pipelineInfo.shadowReceive);
|
||||
list.SetParameter("SPECULAR_MAPPING", m_pipelineInfo.hasSpecularMap);
|
||||
list.SetParameter("TEXTURE_MAPPING", m_pipelineInfo.hasAlphaMap || m_pipelineInfo.hasDiffuseMap || m_pipelineInfo.hasEmissiveMap ||
|
||||
m_pipelineInfo.hasNormalMap || m_pipelineInfo.hasHeightMap || m_pipelineInfo.hasSpecularMap ||
|
||||
m_pipelineInfo.reflectionMapping || flags & ShaderFlags_TextureOverlay);
|
||||
list.SetParameter("TRANSFORM", true);
|
||||
|
||||
list.SetParameter("FLAG_BILLBOARD", static_cast<bool>((flags & ShaderFlags_Billboard) != 0));
|
||||
list.SetParameter("FLAG_DEFERRED", static_cast<bool>((flags & ShaderFlags_Deferred) != 0));
|
||||
@@ -177,7 +178,7 @@ namespace Nz
|
||||
OverrideShader("Shaders/PhongLighting/core.vert", &vertexShader);
|
||||
#endif
|
||||
|
||||
uberShader->SetShader(ShaderStageType_Fragment, fragmentShader, "FLAG_DEFERRED FLAG_TEXTUREOVERLAY ALPHA_MAPPING ALPHA_TEST AUTO_TEXCOORDS DIFFUSE_MAPPING EMISSIVE_MAPPING NORMAL_MAPPING PARALLAX_MAPPING SHADOW_MAPPING SPECULAR_MAPPING");
|
||||
uberShader->SetShader(ShaderStageType_Fragment, fragmentShader, "FLAG_DEFERRED FLAG_TEXTUREOVERLAY ALPHA_MAPPING ALPHA_TEST AUTO_TEXCOORDS DIFFUSE_MAPPING EMISSIVE_MAPPING NORMAL_MAPPING PARALLAX_MAPPING REFLECTION_MAPPING SHADOW_MAPPING SPECULAR_MAPPING");
|
||||
uberShader->SetShader(ShaderStageType_Vertex, vertexShader, "FLAG_BILLBOARD FLAG_DEFERRED FLAG_INSTANCING FLAG_VERTEXCOLOR COMPUTE_TBNMATRIX PARALLAX_MAPPING SHADOW_MAPPING TEXTURE_MAPPING TRANSFORM UNIFORM_VERTEX_DEPTH");
|
||||
|
||||
UberShaderLibrary::Register("PhongLighting", uberShader);
|
||||
|
||||
@@ -41,26 +41,9 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Model object by default
|
||||
* \brief Destructs the object and cleans resources
|
||||
*/
|
||||
|
||||
Model::Model() :
|
||||
m_matCount(0),
|
||||
m_skin(0),
|
||||
m_skinCount(1)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destructs the object and calls Reset
|
||||
*
|
||||
* \see Reset
|
||||
*/
|
||||
|
||||
Model::~Model()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
Model::~Model() = default;
|
||||
|
||||
/*!
|
||||
* \brief Adds this model to the render queue
|
||||
@@ -75,7 +58,7 @@ namespace Nz
|
||||
for (unsigned int i = 0; i < submeshCount; ++i)
|
||||
{
|
||||
const StaticMesh* mesh = static_cast<const StaticMesh*>(m_mesh->GetSubMesh(i));
|
||||
Material* material = m_materials[mesh->GetMaterialIndex()];
|
||||
const MaterialRef& material = GetMaterial(mesh->GetMaterialIndex());
|
||||
|
||||
MeshData meshData;
|
||||
meshData.indexBuffer = mesh->GetIndexBuffer();
|
||||
@@ -96,54 +79,20 @@ namespace Nz
|
||||
* \remark Produces a NazaraError if there is no subMesh with that name
|
||||
* \remark Produces a NazaraError if material is invalid
|
||||
*/
|
||||
|
||||
Material* Model::GetMaterial(const String& subMeshName) const
|
||||
const MaterialRef& Model::GetMaterial(const String& subMeshName) const
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_mesh)
|
||||
{
|
||||
NazaraError("Model has no mesh");
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(m_mesh, "Model has no mesh");
|
||||
|
||||
SubMesh* subMesh = m_mesh->GetSubMesh(subMeshName);
|
||||
if (!subMesh)
|
||||
{
|
||||
NazaraError("Mesh has no submesh \"" + subMeshName + '"');
|
||||
return nullptr;
|
||||
|
||||
static MaterialRef Invalid;
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
unsigned int matIndex = subMesh->GetMaterialIndex();
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_materials[m_skin * m_matCount + matIndex];
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the material by index
|
||||
* \return Pointer to the current material
|
||||
*
|
||||
* \param matIndex Index of the material
|
||||
*
|
||||
* \remark Produces a NazaraError if index is invalid
|
||||
*/
|
||||
|
||||
Material* Model::GetMaterial(unsigned int matIndex) const
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
return m_materials[m_skin * m_matCount + matIndex];
|
||||
return GetMaterial(subMesh->GetMaterialIndex());
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -157,72 +106,20 @@ namespace Nz
|
||||
* \remark Produces a NazaraError if there is no subMesh with that name
|
||||
* \remark Produces a NazaraError if material index is invalid
|
||||
*/
|
||||
|
||||
Material* Model::GetMaterial(unsigned int skinIndex, const String& subMeshName) const
|
||||
const MaterialRef& Model::GetMaterial(std::size_t skinIndex, const String& subMeshName) const
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + String::Number(skinIndex) + " >= " + String::Number(m_skinCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(m_mesh, "Model has no mesh");
|
||||
|
||||
SubMesh* subMesh = m_mesh->GetSubMesh(subMeshName);
|
||||
if (!subMesh)
|
||||
{
|
||||
NazaraError("Mesh has no submesh \"" + subMeshName + '"');
|
||||
return nullptr;
|
||||
|
||||
static MaterialRef Invalid;
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
unsigned int matIndex = subMesh->GetMaterialIndex();
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_materials[skinIndex * m_matCount + matIndex];
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the material by index with skin
|
||||
* \return Pointer to the current material
|
||||
*
|
||||
* \param skinIndex Index of the skin
|
||||
* \param matIndex Index of the material
|
||||
*
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if skinIndex is invalid
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if matIndex is invalid
|
||||
*/
|
||||
|
||||
Material* Model::GetMaterial(unsigned int skinIndex, unsigned int matIndex) const
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + String::Number(skinIndex) + " >= " + String::Number(m_skinCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
return m_materials[skinIndex * m_matCount + matIndex];
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of materials
|
||||
* \return Current number of materials
|
||||
*/
|
||||
|
||||
unsigned int Model::GetMaterialCount() const
|
||||
{
|
||||
return m_matCount;
|
||||
return GetMaterial(subMesh->GetMaterialIndex());
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -235,26 +132,6 @@ namespace Nz
|
||||
return m_mesh;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the skin
|
||||
* \return Current skin
|
||||
*/
|
||||
|
||||
unsigned int Model::GetSkin() const
|
||||
{
|
||||
return m_skin;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of skins
|
||||
* \return Current number of skins
|
||||
*/
|
||||
|
||||
unsigned int Model::GetSkinCount() const
|
||||
{
|
||||
return m_skinCount;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the model is animated
|
||||
* \return false
|
||||
@@ -305,22 +182,6 @@ namespace Nz
|
||||
return ModelLoader::LoadFromStream(this, stream, params);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Resets the model, cleans everything
|
||||
*/
|
||||
|
||||
void Model::Reset()
|
||||
{
|
||||
m_matCount = 0;
|
||||
m_skinCount = 0;
|
||||
|
||||
if (m_mesh)
|
||||
{
|
||||
m_mesh.Reset();
|
||||
m_materials.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the material of the named submesh
|
||||
* \return true If successful
|
||||
@@ -332,7 +193,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraError if material index is invalid
|
||||
*/
|
||||
|
||||
bool Model::SetMaterial(const String& subMeshName, Material* material)
|
||||
bool Model::SetMaterial(const String& subMeshName, MaterialRef material)
|
||||
{
|
||||
SubMesh* subMesh = m_mesh->GetSubMesh(subMeshName);
|
||||
if (!subMesh)
|
||||
@@ -341,51 +202,10 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int matIndex = subMesh->GetMaterialIndex();
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int index = m_skin * m_matCount + matIndex;
|
||||
|
||||
if (material)
|
||||
m_materials[index] = material;
|
||||
else
|
||||
m_materials[index] = Material::GetDefault();
|
||||
|
||||
SetMaterial(subMesh->GetMaterialIndex(), std::move(material));
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the material by index
|
||||
* \return true If successful
|
||||
*
|
||||
* \param matIndex Index of the material
|
||||
* \param material Pointer to the material
|
||||
*
|
||||
* \remark Produces a NazaraError with if NAZARA_GRAPHICS_SAFE defined index is invalid
|
||||
*/
|
||||
|
||||
void Model::SetMaterial(unsigned int matIndex, Material* material)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int index = m_skin * m_matCount + matIndex;
|
||||
|
||||
if (material)
|
||||
m_materials[index] = material;
|
||||
else
|
||||
m_materials[index] = Material::GetDefault();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the material by index of the named submesh
|
||||
* \return true If successful
|
||||
@@ -398,17 +218,8 @@ namespace Nz
|
||||
* \remark Produces a NazaraError if there is no subMesh with that name
|
||||
* \remark Produces a NazaraError if material index is invalid
|
||||
*/
|
||||
|
||||
bool Model::SetMaterial(unsigned int skinIndex, const String& subMeshName, Material* material)
|
||||
bool Model::SetMaterial(std::size_t skinIndex, const String& subMeshName, MaterialRef material)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + String::Number(skinIndex) + " >= " + String::Number(m_skinCount));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
SubMesh* subMesh = m_mesh->GetSubMesh(subMeshName);
|
||||
if (!subMesh)
|
||||
{
|
||||
@@ -416,59 +227,10 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int matIndex = subMesh->GetMaterialIndex();
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount));
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int index = skinIndex * m_matCount + matIndex;
|
||||
|
||||
if (material)
|
||||
m_materials[index] = material;
|
||||
else
|
||||
m_materials[index] = Material::GetDefault();
|
||||
|
||||
SetMaterial(skinIndex, subMesh->GetMaterialIndex(), std::move(material));
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the material by index with skin
|
||||
* \return true If successful
|
||||
*
|
||||
* \param skinIndex Index of the skin
|
||||
* \param matIndex Index of the material
|
||||
* \param material Pointer to the material
|
||||
*
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if skinIndex is invalid
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if matIndex is invalid
|
||||
*/
|
||||
|
||||
void Model::SetMaterial(unsigned int skinIndex, unsigned int matIndex, Material* material)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + String::Number(skinIndex) + " >= " + String::Number(m_skinCount));
|
||||
return;
|
||||
}
|
||||
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + String::Number(matIndex) + " >= " + String::Number(m_matCount));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int index = skinIndex * m_matCount + matIndex;
|
||||
|
||||
if (material)
|
||||
m_materials[index] = material;
|
||||
else
|
||||
m_materials[index] = Material::GetDefault();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the mesh
|
||||
*
|
||||
@@ -490,65 +252,13 @@ namespace Nz
|
||||
m_mesh = mesh;
|
||||
|
||||
if (m_mesh)
|
||||
{
|
||||
m_matCount = mesh->GetMaterialCount();
|
||||
m_materials.clear();
|
||||
m_materials.resize(m_matCount, Material::GetDefault());
|
||||
m_skinCount = 1;
|
||||
}
|
||||
ResetMaterials(mesh->GetMaterialCount());
|
||||
else
|
||||
{
|
||||
m_matCount = 0;
|
||||
m_materials.clear();
|
||||
m_skinCount = 0;
|
||||
}
|
||||
ResetMaterials(0);
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the skin
|
||||
*
|
||||
* \param skin Skin to use
|
||||
*
|
||||
* \remark Produces a NazaraError if skin is invalid
|
||||
*/
|
||||
|
||||
void Model::SetSkin(unsigned int skin)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skin >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + String::Number(skin) + " >= " + String::Number(m_skinCount) + ')');
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_skin = skin;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the number of skins
|
||||
*
|
||||
* \param skinCount Number of skins
|
||||
*
|
||||
* \remark Produces a NazaraError if skinCount equals zero
|
||||
*/
|
||||
|
||||
void Model::SetSkinCount(unsigned int skinCount)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinCount == 0)
|
||||
{
|
||||
NazaraError("Skin count must be over zero");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_materials.resize(m_matCount*skinCount, Material::GetDefault());
|
||||
m_skinCount = skinCount;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Makes the bounding volume of this billboard
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 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
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/ParticleStruct.hpp>
|
||||
#include <Nazara/Utility/Utility.hpp>
|
||||
#include <cstring>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -287,7 +286,7 @@ namespace Nz
|
||||
// ParticleLayout_Billboard : ParticleStruct_Billboard
|
||||
declaration = &s_declarations[ParticleLayout_Billboard];
|
||||
declaration->EnableComponent(ParticleComponent_Color, ComponentType_Color, NazaraOffsetOf(ParticleStruct_Billboard, color));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Billboard, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Billboard, life));
|
||||
declaration->EnableComponent(ParticleComponent_Normal, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Billboard, normal));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Billboard, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Billboard, rotation));
|
||||
@@ -298,7 +297,7 @@ namespace Nz
|
||||
|
||||
// ParticleLayout_Model : ParticleStruct_Model
|
||||
declaration = &s_declarations[ParticleLayout_Model];
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Model, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Model, life));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Model, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Quaternion, NazaraOffsetOf(ParticleStruct_Model, rotation));
|
||||
declaration->EnableComponent(ParticleComponent_Velocity, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Model, velocity));
|
||||
@@ -308,7 +307,7 @@ namespace Nz
|
||||
// ParticleLayout_Sprite : ParticleStruct_Sprite
|
||||
declaration = &s_declarations[ParticleLayout_Sprite];
|
||||
declaration->EnableComponent(ParticleComponent_Color, ComponentType_Color, NazaraOffsetOf(ParticleStruct_Sprite, color));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Int1, NazaraOffsetOf(ParticleStruct_Sprite, life));
|
||||
declaration->EnableComponent(ParticleComponent_Life, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Sprite, life));
|
||||
declaration->EnableComponent(ParticleComponent_Position, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Sprite, position));
|
||||
declaration->EnableComponent(ParticleComponent_Rotation, ComponentType_Float1, NazaraOffsetOf(ParticleStruct_Sprite, rotation));
|
||||
declaration->EnableComponent(ParticleComponent_Velocity, ComponentType_Float3, NazaraOffsetOf(ParticleStruct_Sprite, velocity));
|
||||
|
||||
@@ -3,13 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/ParticleEmitter.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Graphics/ParticleMapper.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Graphics/ParticleMapper.hpp>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/ParticleMapper.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -1 +1 @@
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,76,117,109,105,110,97,110,99,101,32,61,32,48,46,56,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,77,105,100,100,108,101,71,114,101,121,32,61,32,48,46,53,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,32,61,32,48,46,56,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,9,118,101,99,51,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,13,10,13,10,9,99,111,108,111,114,32,42,61,32,66,114,105,103,104,116,77,105,100,100,108,101,71,114,101,121,47,66,114,105,103,104,116,76,117,109,105,110,97,110,99,101,59,13,10,9,99,111,108,111,114,32,42,61,32,49,46,48,32,43,32,40,99,111,108,111,114,32,47,32,40,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,42,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,41,41,59,13,10,9,99,111,108,111,114,32,45,61,32,48,46,53,59,13,10,9,99,111,108,111,114,32,47,61,32,40,49,46,48,32,43,32,99,111,108,111,114,41,59,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,99,111,108,111,114,44,32,49,46,48,41,59,13,10,125,13,10,
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,10,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,76,117,109,105,110,97,110,99,101,32,61,32,48,46,56,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,77,105,100,100,108,101,71,114,101,121,32,61,32,48,46,53,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,32,61,32,48,46,56,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,10,9,118,101,99,51,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,10,10,9,99,111,108,111,114,32,42,61,32,66,114,105,103,104,116,77,105,100,100,108,101,71,114,101,121,47,66,114,105,103,104,116,76,117,109,105,110,97,110,99,101,59,10,9,99,111,108,111,114,32,42,61,32,49,46,48,32,43,32,40,99,111,108,111,114,32,47,32,40,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,42,66,114,105,103,104,116,84,104,114,101,115,104,111,108,100,41,41,59,10,9,99,111,108,111,114,32,45,61,32,48,46,53,59,10,9,99,111,108,111,114,32,47,61,32,40,49,46,48,32,43,32,99,111,108,111,114,41,59,10,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,99,111,108,111,114,44,32,49,46,48,41,59,10,125,10,
|
||||
@@ -1 +1 @@
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,66,108,111,111,109,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,9,118,101,99,51,32,98,108,111,111,109,67,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,66,108,111,111,109,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,13,10,9,118,101,99,51,32,111,114,105,103,105,110,97,108,67,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,111,114,105,103,105,110,97,108,67,111,108,111,114,32,43,32,98,108,111,111,109,67,111,108,111,114,44,32,49,46,48,41,59,13,10,125,13,10,
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,10,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,66,108,111,111,109,84,101,120,116,117,114,101,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,10,9,118,101,99,51,32,98,108,111,111,109,67,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,66,108,111,111,109,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,10,9,118,101,99,51,32,111,114,105,103,105,110,97,108,67,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,59,10,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,111,114,105,103,105,110,97,108,67,111,108,111,114,32,43,32,98,108,111,111,109,67,111,108,111,114,44,32,49,46,48,41,59,10,125,10,
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,49,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,13,10,9,103,108,95,70,114,97,103,68,101,112,116,104,32,61,32,49,46,48,59,13,10,125,13,10,
|
||||
35,118,101,114,115,105,111,110,32,49,52,48,10,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,49,59,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,50,59,10,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,9,82,101,110,100,101,114,84,97,114,103,101,116,49,32,61,32,118,101,99,52,40,48,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,9,82,101,110,100,101,114,84,97,114,103,101,116,50,32,61,32,118,101,99,52,40,49,46,48,44,32,48,46,48,44,32,48,46,48,44,32,48,46,48,41,59,10,9,103,108,95,70,114,97,103,68,101,112,116,104,32,61,32,49,46,48,59,10,125,10,
|
||||
@@ -1 +1 @@
|
||||
47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,101,101,107,115,51,100,46,99,111,109,47,50,48,49,48,48,57,48,57,47,115,104,97,100,101,114,45,108,105,98,114,97,114,121,45,103,97,117,115,115,105,97,110,45,98,108,117,114,45,112,111,115,116,45,112,114,111,99,101,115,115,105,110,103,45,102,105,108,116,101,114,45,105,110,45,103,108,115,108,47,13,10,35,118,101,114,115,105,111,110,32,49,52,48,13,10,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,70,105,108,116,101,114,59,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,13,10,102,108,111,97,116,32,111,102,102,115,101,116,91,51,93,32,61,32,102,108,111,97,116,91,93,40,48,46,48,44,32,49,46,51,56,52,54,49,53,51,56,52,54,44,32,51,46,50,51,48,55,54,57,50,51,48,56,41,59,13,10,102,108,111,97,116,32,119,101,105,103,104,116,91,51,93,32,61,32,102,108,111,97,116,91,93,40,48,46,50,50,55,48,50,55,48,50,55,48,44,32,48,46,51,49,54,50,49,54,50,49,54,50,44,32,48,46,48,55,48,50,55,48,50,55,48,51,41,59,13,10,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,9,118,101,99,51,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,48,93,59,13,10,13,10,9,102,111,114,32,40,105,110,116,32,105,32,61,32,49,59,32,105,32,60,32,51,59,32,105,43,43,41,13,10,9,123,13,10,9,9,99,111,108,111,114,32,43,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,32,43,32,70,105,108,116,101,114,42,118,101,99,50,40,111,102,102,115,101,116,91,105,93,41,42,73,110,118,84,97,114,103,101,116,83,105,122,101,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,105,93,59,13,10,9,9,99,111,108,111,114,32,43,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,32,45,32,70,105,108,116,101,114,42,118,101,99,50,40,111,102,102,115,101,116,91,105,93,41,42,73,110,118,84,97,114,103,101,116,83,105,122,101,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,105,93,59,13,10,9,125,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,99,111,108,111,114,44,32,49,46,48,41,59,13,10,125,13,10,
|
||||
47,47,32,104,116,116,112,58,47,47,119,119,119,46,103,101,101,107,115,51,100,46,99,111,109,47,50,48,49,48,48,57,48,57,47,115,104,97,100,101,114,45,108,105,98,114,97,114,121,45,103,97,117,115,115,105,97,110,45,98,108,117,114,45,112,111,115,116,45,112,114,111,99,101,115,115,105,110,103,45,102,105,108,116,101,114,45,105,110,45,103,108,115,108,47,10,35,118,101,114,115,105,111,110,32,49,52,48,10,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,67,111,108,111,114,84,101,120,116,117,114,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,70,105,108,116,101,114,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,10,102,108,111,97,116,32,111,102,102,115,101,116,91,51,93,32,61,32,102,108,111,97,116,91,93,40,48,46,48,44,32,49,46,51,56,52,54,49,53,51,56,52,54,44,32,51,46,50,51,48,55,54,57,50,51,48,56,41,59,10,102,108,111,97,116,32,119,101,105,103,104,116,91,51,93,32,61,32,102,108,111,97,116,91,93,40,48,46,50,50,55,48,50,55,48,50,55,48,44,32,48,46,51,49,54,50,49,54,50,49,54,50,44,32,48,46,48,55,48,50,55,48,50,55,48,51,41,59,10,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,9,118,101,99,51,32,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,48,93,59,10,10,9,102,111,114,32,40,105,110,116,32,105,32,61,32,49,59,32,105,32,60,32,51,59,32,105,43,43,41,10,9,123,10,9,9,99,111,108,111,114,32,43,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,32,43,32,70,105,108,116,101,114,42,118,101,99,50,40,111,102,102,115,101,116,91,105,93,41,42,73,110,118,84,97,114,103,101,116,83,105,122,101,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,105,93,59,10,9,9,99,111,108,111,114,32,43,61,32,116,101,120,116,117,114,101,76,111,100,40,67,111,108,111,114,84,101,120,116,117,114,101,44,32,116,101,120,67,111,111,114,100,32,45,32,70,105,108,116,101,114,42,118,101,99,50,40,111,102,102,115,101,116,91,105,93,41,42,73,110,118,84,97,114,103,101,116,83,105,122,101,44,32,48,46,48,41,46,114,103,98,32,42,32,119,101,105,103,104,116,91,105,93,59,10,9,125,10,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,118,101,99,52,40,99,111,108,111,114,44,32,49,46,48,41,59,10,125,10,
|
||||
@@ -1 +1 @@
|
||||
35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,13,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,13,10,35,101,110,100,105,102,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,13,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,13,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,13,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,13,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,13,10,13,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,13,10,118,111,105,100,32,109,97,105,110,40,41,13,10,123,13,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,13,10,13,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,13,10,35,101,108,115,101,13,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,13,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,13,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,13,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,13,10,35,101,110,100,105,102,13,10,13,10,35,105,102,32,65,76,80,72,65,95,84,69,83,84,13,10,9,105,102,32,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,13,10,9,9,100,105,115,99,97,114,100,59,13,10,35,101,110,100,105,102,13,10,13,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,13,10,125,
|
||||
35,105,102,32,69,65,82,76,89,95,70,82,65,71,77,69,78,84,95,84,69,83,84,83,32,38,38,32,33,65,76,80,72,65,95,84,69,83,84,10,108,97,121,111,117,116,40,101,97,114,108,121,95,102,114,97,103,109,101,110,116,95,116,101,115,116,115,41,32,105,110,59,10,35,101,110,100,105,102,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,69,110,116,114,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,105,110,32,118,101,99,52,32,118,67,111,108,111,114,59,10,105,110,32,118,101,99,50,32,118,84,101,120,67,111,111,114,100,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,83,111,114,116,97,110,116,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,111,117,116,32,118,101,99,52,32,82,101,110,100,101,114,84,97,114,103,101,116,48,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,85,110,105,102,111,114,109,101,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,117,110,105,102,111,114,109,32,118,101,99,50,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,59,10,117,110,105,102,111,114,109,32,118,101,99,52,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,84,101,120,116,117,114,101,79,118,101,114,108,97,121,59,10,10,47,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,70,111,110,99,116,105,111,110,115,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,47,10,118,111,105,100,32,109,97,105,110,40,41,10,123,10,9,118,101,99,52,32,102,114,97,103,109,101,110,116,67,111,108,111,114,32,61,32,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,32,42,32,118,67,111,108,111,114,59,10,10,35,105,102,32,65,85,84,79,95,84,69,88,67,79,79,82,68,83,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,32,42,32,73,110,118,84,97,114,103,101,116,83,105,122,101,59,10,35,101,108,115,101,10,9,118,101,99,50,32,116,101,120,67,111,111,114,100,32,61,32,118,84,101,120,67,111,111,114,100,59,10,35,101,110,100,105,102,10,10,35,105,102,32,68,73,70,70,85,83,69,95,77,65,80,80,73,78,71,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,68,105,102,102,117,115,101,77,97,112,44,32,116,101,120,67,111,111,114,100,41,59,10,35,101,110,100,105,102,10,10,35,105,102,32,65,76,80,72,65,95,77,65,80,80,73,78,71,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,32,42,61,32,116,101,120,116,117,114,101,40,77,97,116,101,114,105,97,108,65,108,112,104,97,77,97,112,44,32,116,101,120,67,111,111,114,100,41,46,114,59,10,35,101,110,100,105,102,10,10,35,105,102,32,70,76,65,71,95,84,69,88,84,85,82,69,79,86,69,82,76,65,89,10,9,102,114,97,103,109,101,110,116,67,111,108,111,114,32,42,61,32,116,101,120,116,117,114,101,40,84,101,120,116,117,114,101,79,118,101,114,108,97,121,44,32,116,101,120,67,111,111,114,100,41,59,10,35,101,110,100,105,102,10,10,35,105,102,32,65,76,80,72,65,95,84,69,83,84,10,9,105,102,32,40,102,114,97,103,109,101,110,116,67,111,108,111,114,46,97,32,60,32,77,97,116,101,114,105,97,108,65,108,112,104,97,84,104,114,101,115,104,111,108,100,41,10,9,9,100,105,115,99,97,114,100,59,10,35,101,110,100,105,102,10,10,9,82,101,110,100,101,114,84,97,114,103,101,116,48,32,61,32,102,114,97,103,109,101,110,116,67,111,108,111,114,59,10,125,
|
||||
File diff suppressed because one or more lines are too long
@@ -63,6 +63,7 @@ uniform float ParallaxBias = -0.03;
|
||||
uniform float ParallaxScale = 0.02;
|
||||
uniform vec2 InvTargetSize;
|
||||
uniform vec3 EyePosition;
|
||||
uniform samplerCube ReflectionMap;
|
||||
uniform vec4 SceneAmbient;
|
||||
|
||||
uniform sampler2D TextureOverlay;
|
||||
@@ -451,6 +452,14 @@ void main()
|
||||
#endif
|
||||
|
||||
vec3 lightColor = (lightAmbient + lightDiffuse + lightSpecular);
|
||||
|
||||
#if REFLECTION_MAPPING
|
||||
vec3 eyeVec = normalize(vWorldPos - EyePosition);
|
||||
|
||||
vec3 reflected = normalize(reflect(eyeVec, normal));
|
||||
lightColor *= texture(ReflectionMap, reflected).rgb;
|
||||
#endif
|
||||
|
||||
vec4 fragmentColor = vec4(lightColor, 1.0) * diffuseColor;
|
||||
|
||||
#if EMISSIVE_MAPPING
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -6,8 +6,8 @@
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Graphics/SkinningManager.hpp>
|
||||
#include <Nazara/Utility/BufferMapper.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/Sequence.hpp>
|
||||
#include <Nazara/Utility/SkeletalMesh.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
@@ -62,7 +62,7 @@ namespace Nz
|
||||
for (unsigned int i = 0; i < submeshCount; ++i)
|
||||
{
|
||||
const SkeletalMesh* mesh = static_cast<const SkeletalMesh*>(m_mesh->GetSubMesh(i));
|
||||
const Material* material = m_materials[mesh->GetMaterialIndex()];
|
||||
const Material* material = GetMaterial(mesh->GetMaterialIndex());
|
||||
|
||||
MeshData meshData;
|
||||
meshData.indexBuffer = mesh->GetIndexBuffer();
|
||||
@@ -261,17 +261,6 @@ namespace Nz
|
||||
return SkeletalModelLoader::LoadFromStream(this, stream, params);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Resets the model
|
||||
*/
|
||||
|
||||
void SkeletalModel::Reset()
|
||||
{
|
||||
Model::Reset();
|
||||
|
||||
m_skeleton.Destroy();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the animation for the model
|
||||
* \return true If successful
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 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
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/TaskScheduler.hpp>
|
||||
#include <Nazara/Utility/Algorithm.hpp>
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
#include <Nazara/Utility/Skeleton.hpp>
|
||||
#include <Nazara/Utility/SkeletalMesh.hpp>
|
||||
#include <Nazara/Utility/Skeleton.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <Nazara/Utility/VertexMapper.hpp>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -154,7 +155,7 @@ namespace Nz
|
||||
"{\n"
|
||||
" vec4 WVPVertex = WorldViewProjMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" gl_Position = WVPVertex.xyww;\n"
|
||||
" vTexCoord = vec3(VertexPosition.x, VertexPosition.y, -VertexPosition.z);\n"
|
||||
" vTexCoord = VertexPosition;\n"
|
||||
"}\n";
|
||||
|
||||
try
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -26,11 +24,8 @@ namespace Nz
|
||||
|
||||
void Sprite::AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const
|
||||
{
|
||||
if (!m_material)
|
||||
return;
|
||||
|
||||
const VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast<const VertexStruct_XYZ_Color_UV*>(instanceData.data.data());
|
||||
renderQueue->AddSprites(instanceData.renderOrder, m_material, vertices, 1);
|
||||
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(), vertices, 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -73,7 +68,37 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the texture of the sprite from a name
|
||||
* \brief Sets the material of the sprite from a name for a specific skin
|
||||
*
|
||||
* Tries to get a material from the MaterialLibrary and then the MaterialManager (which will treat the name as a path)
|
||||
* Fails if the texture name is not a part of the MaterialLibrary nor the MaterialManager (which fails if it couldn't load the texture from its filepath)
|
||||
*
|
||||
* \param skinIndex Skin index to change
|
||||
* \param materialName Named texture for the material
|
||||
* \param resizeSprite Should the sprite be resized to the material diffuse map size?
|
||||
*
|
||||
* \return True if the material was found or loaded from its name/path, false if it couldn't
|
||||
*/
|
||||
bool Sprite::SetMaterial(std::size_t skinIndex, String materialName, bool resizeSprite)
|
||||
{
|
||||
MaterialRef material = MaterialLibrary::Query(materialName);
|
||||
if (!material)
|
||||
{
|
||||
material = MaterialManager::Get(materialName);
|
||||
if (!material)
|
||||
{
|
||||
NazaraError("Failed to get material \"" + materialName + "\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SetMaterial(skinIndex, std::move(material), resizeSprite);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the texture of the sprite from a name for the current skin
|
||||
* \return True if the texture was found or loaded from its name/path, false if it couldn't
|
||||
*
|
||||
* Tries to get a texture from the TextureLibrary and then the TextureManager (which will treat the name as a path)
|
||||
* Fails if the texture name is not a part of the TextureLibrary nor the TextureManager (which fails if it couldn't load the texture from its filepath)
|
||||
@@ -81,8 +106,6 @@ namespace Nz
|
||||
* \param textureName Named texture for the sprite
|
||||
* \param resizeSprite Should the sprite be resized to the texture size?
|
||||
*
|
||||
* \return True if the texture was found or loaded from its name/path, false if it couldn't
|
||||
*
|
||||
* \remark The sprite material gets copied to prevent accidentally changing other drawable materials
|
||||
*/
|
||||
bool Sprite::SetTexture(String textureName, bool resizeSprite)
|
||||
@@ -102,6 +125,36 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the texture of the sprite from a name for a specific skin
|
||||
* \return True if the texture was found or loaded from its name/path, false if it couldn't
|
||||
*
|
||||
* Tries to get a texture from the TextureLibrary and then the TextureManager (which will treat the name as a path)
|
||||
* Fails if the texture name is not a part of the TextureLibrary nor the TextureManager (which fails if it couldn't load the texture from its filepath)
|
||||
*
|
||||
* \param skinIndex Named texture for the sprite
|
||||
* \param textureName Named texture for the sprite
|
||||
* \param resizeSprite Should the sprite be resized to the texture size?
|
||||
*
|
||||
* \remark The sprite material gets copied to prevent accidentally changing other drawable materials
|
||||
*/
|
||||
bool Sprite::SetTexture(std::size_t skinIndex, String textureName, bool resizeSprite)
|
||||
{
|
||||
TextureRef texture = TextureLibrary::Query(textureName);
|
||||
if (!texture)
|
||||
{
|
||||
texture = TextureManager::Get(textureName);
|
||||
if (!texture)
|
||||
{
|
||||
NazaraError("Failed to get texture \"" + textureName + "\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SetTexture(skinIndex, std::move(texture), resizeSprite);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Updates the data of the sprite
|
||||
*
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/SparsePtr.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/AbstractTextDrawer.hpp>
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -28,9 +28,6 @@ namespace Nz
|
||||
|
||||
void TextSprite::AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const
|
||||
{
|
||||
if (!m_material)
|
||||
return;
|
||||
|
||||
for (auto& pair : m_renderInfos)
|
||||
{
|
||||
Texture* overlay = pair.first;
|
||||
@@ -39,7 +36,7 @@ namespace Nz
|
||||
if (indices.count > 0)
|
||||
{
|
||||
const VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast<const VertexStruct_XYZ_Color_UV*>(instanceData.data.data());
|
||||
renderQueue->AddSprites(instanceData.renderOrder, m_material, &vertices[indices.first * 4], indices.count, overlay);
|
||||
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(), &vertices[indices.first * 4], indices.count, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include <Nazara/Graphics/TextureBackground.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Renderer/UberShaderInstance.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
#include <Nazara/Graphics/TileMap.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/AbstractViewer.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -29,11 +27,11 @@ namespace Nz
|
||||
{
|
||||
const VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast<const VertexStruct_XYZ_Color_UV*>(instanceData.data.data());
|
||||
|
||||
std::size_t matCount = 0;
|
||||
std::size_t spriteCount = 0;
|
||||
for (const Layer& layer : m_layers)
|
||||
{
|
||||
if (layer.material)
|
||||
renderQueue->AddSprites(instanceData.renderOrder, layer.material, &vertices[spriteCount], layer.tiles.size());
|
||||
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(matCount++), &vertices[spriteCount], layer.tiles.size());
|
||||
|
||||
spriteCount += layer.tiles.size();
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Lua/LuaCoroutine.hpp>
|
||||
#include <Lua/lauxlib.h>
|
||||
#include <Lua/lua.h>
|
||||
#include <Lua/lualib.h>
|
||||
#include <Nazara/Lua/LuaInstance.hpp>
|
||||
#include <Nazara/Lua/Debug.hpp>
|
||||
|
||||
|
||||
@@ -8,14 +8,9 @@
|
||||
#include <Lua/lualib.h>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Core/MemoryView.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Lua/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <Nazara/Lua/LuaState.hpp>
|
||||
#include <Lua/lauxlib.h>
|
||||
#include <Lua/lua.h>
|
||||
#include <Lua/lualib.h>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
@@ -14,9 +13,6 @@
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Lua/LuaCoroutine.hpp>
|
||||
#include <Nazara/Lua/LuaInstance.hpp>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
#include <Nazara/Lua/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -126,12 +122,6 @@ namespace Nz
|
||||
static_assert(sizeof(s_types)/sizeof(int) == LuaType_Max+1, "Lua type array is incomplete");
|
||||
}
|
||||
|
||||
LuaState::LuaState(LuaState&& state) noexcept :
|
||||
m_lastError(state.m_lastError),
|
||||
m_state(state.m_state)
|
||||
{
|
||||
}
|
||||
|
||||
void LuaState::ArgCheck(bool condition, unsigned int argNum, const char* error) const
|
||||
{
|
||||
luaL_argcheck(m_state, condition, argNum, error);
|
||||
@@ -789,14 +779,6 @@ namespace Nz
|
||||
return luaL_testudata(m_state, index, tname.GetConstBuffer());
|
||||
}
|
||||
|
||||
LuaState& LuaState::operator=(LuaState&& state) noexcept
|
||||
{
|
||||
m_lastError = std::move(state.m_lastError);
|
||||
m_state = state.m_state;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool LuaState::Run(int argCount, int resultCount)
|
||||
{
|
||||
LuaInstance& instance = GetInstance(m_state);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <Nazara/Network/AbstractSocket.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <utility>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
|
||||
11
src/Nazara/Network/ENetCompressor.cpp
Normal file
11
src/Nazara/Network/ENetCompressor.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Network module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/ENetCompressor.hpp>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
ENetCompressor::~ENetCompressor() = default;
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/ENetHost.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/OffsetOf.hpp>
|
||||
#include <Nazara/Network/Algorithm.hpp>
|
||||
#include <Nazara/Network/ENetPeer.hpp>
|
||||
@@ -86,7 +85,7 @@ namespace Nz
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_channelLimit = Clamp<std::size_t>(channelCount, ENetConstants::ENetProtocol_MinimumChannelCount, ENetConstants::ENetProtocol_MaximumChannelCount);
|
||||
channelCount = Clamp<std::size_t>(channelCount, ENetConstants::ENetProtocol_MinimumChannelCount, ENetConstants::ENetProtocol_MaximumChannelCount);
|
||||
|
||||
UInt32 windowSize;
|
||||
if (m_outgoingBandwidth == 0)
|
||||
@@ -143,14 +142,14 @@ namespace Nz
|
||||
return Connect(hostnameAddress, channelCount, data);
|
||||
}
|
||||
|
||||
bool ENetHost::Create(const IpAddress& address, std::size_t peerCount, std::size_t channelCount)
|
||||
bool ENetHost::Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount)
|
||||
{
|
||||
return Create(address, peerCount, channelCount, 0, 0);
|
||||
return Create(listenAddress, peerCount, channelCount, 0, 0);
|
||||
}
|
||||
|
||||
bool ENetHost::Create(const IpAddress& address, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth)
|
||||
bool ENetHost::Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth)
|
||||
{
|
||||
NazaraAssert(address.IsValid(), "Invalid listening address");
|
||||
NazaraAssert(listenAddress.IsValid(), "Invalid listening address");
|
||||
|
||||
if (peerCount > ENetConstants::ENetProtocol_MaximumPeerId)
|
||||
{
|
||||
@@ -158,10 +157,11 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!InitSocket(address))
|
||||
if (!InitSocket(listenAddress))
|
||||
return false;
|
||||
|
||||
m_address = address;
|
||||
m_address = listenAddress;
|
||||
m_allowsIncomingConnections = (listenAddress.IsValid() && !listenAddress.IsLoopback());
|
||||
m_randomSeed = *reinterpret_cast<UInt32*>(this);
|
||||
m_randomSeed += s_randomGenerator();
|
||||
m_randomSeed = (m_randomSeed << 16) | (m_randomSeed >> 16);
|
||||
@@ -198,9 +198,9 @@ namespace Nz
|
||||
|
||||
void ENetHost::Flush()
|
||||
{
|
||||
m_serviceTime = GetElapsedMilliseconds();
|
||||
UpdateServiceTime();
|
||||
|
||||
SendOutgoingCommands(nullptr, 0);
|
||||
SendOutgoingCommands(nullptr, false);
|
||||
}
|
||||
|
||||
int ENetHost::Service(ENetEvent* event, UInt32 timeout)
|
||||
@@ -215,7 +215,8 @@ namespace Nz
|
||||
return 1;
|
||||
}
|
||||
|
||||
m_serviceTime = GetElapsedMilliseconds();
|
||||
UpdateServiceTime();
|
||||
|
||||
timeout += m_serviceTime;
|
||||
|
||||
do
|
||||
@@ -236,6 +237,10 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
// Receiving on an unbound socket which has never sent data is an invalid operation
|
||||
if (!m_allowsIncomingConnections && m_totalSentData == 0)
|
||||
return 0;
|
||||
|
||||
switch (ReceiveIncomingCommands(event))
|
||||
{
|
||||
case 1:
|
||||
@@ -274,7 +279,7 @@ namespace Nz
|
||||
|
||||
for (;;)
|
||||
{
|
||||
m_serviceTime = GetElapsedMilliseconds();
|
||||
UpdateServiceTime();
|
||||
|
||||
if (ENetTimeGreaterEqual(m_serviceTime, timeout))
|
||||
return 0;
|
||||
@@ -283,7 +288,7 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
m_serviceTime = GetElapsedMilliseconds();
|
||||
UpdateServiceTime();
|
||||
}
|
||||
while (m_poller.IsReadyToRead(m_socket));
|
||||
|
||||
@@ -323,7 +328,7 @@ namespace Nz
|
||||
m_socket.SetReceiveBufferSize(ENetConstants::ENetHost_ReceiveBufferSize);
|
||||
m_socket.SetSendBufferSize(ENetConstants::ENetHost_SendBufferSize);
|
||||
|
||||
if (!address.IsLoopback())
|
||||
if (address.IsValid() && !address.IsLoopback())
|
||||
{
|
||||
if (m_socket.Bind(address) != SocketState_Bound)
|
||||
{
|
||||
@@ -407,6 +412,9 @@ namespace Nz
|
||||
|
||||
ENetPeer* ENetHost::HandleConnect(ENetProtocolHeader* /*header*/, ENetProtocol* command)
|
||||
{
|
||||
if (!m_allowsIncomingConnections)
|
||||
return nullptr;
|
||||
|
||||
UInt32 channelCount = NetToHost(command->connect.channelCount);
|
||||
|
||||
if (channelCount < ENetProtocol_MinimumChannelCount || channelCount > ENetProtocol_MaximumChannelCount)
|
||||
@@ -513,6 +521,19 @@ namespace Nz
|
||||
}
|
||||
|
||||
// Compression handling
|
||||
if (flags & ENetProtocolHeaderFlag_Compressed)
|
||||
{
|
||||
if (!m_compressor)
|
||||
return false;
|
||||
|
||||
std::size_t newSize = m_compressor->Decompress(peer, m_receivedData + headerSize, m_receivedDataLength - headerSize, m_packetData[1].data() + headerSize, m_packetData[1].size() - headerSize);
|
||||
if (newSize == 0 || newSize > m_packetData[1].size() - headerSize)
|
||||
return false;
|
||||
|
||||
std::memcpy(m_packetData[1].data(), header, headerSize);
|
||||
m_receivedData = m_packetData[1].data();
|
||||
m_receivedDataLength = headerSize + newSize;
|
||||
}
|
||||
|
||||
// Checksum
|
||||
|
||||
@@ -873,8 +894,6 @@ namespace Nz
|
||||
break;
|
||||
}
|
||||
|
||||
++currentCommand;
|
||||
|
||||
if (channel && outgoingCommand->sendAttempts < 1)
|
||||
{
|
||||
channel->usedReliableWindows |= 1 << reliableWindow;
|
||||
@@ -893,7 +912,7 @@ namespace Nz
|
||||
peer->m_nextTimeout = m_serviceTime + outgoingCommand->roundTripTimeout;
|
||||
|
||||
peer->m_sentReliableCommands.emplace_back(std::move(*outgoingCommand));
|
||||
peer->m_outgoingReliableCommands.erase(outgoingCommand);
|
||||
currentCommand = peer->m_outgoingReliableCommands.erase(outgoingCommand);
|
||||
|
||||
outgoingCommand = peer->m_sentReliableCommands.end();
|
||||
--outgoingCommand;
|
||||
@@ -916,7 +935,7 @@ namespace Nz
|
||||
++m_bufferCount;
|
||||
|
||||
NetBuffer& packetBuffer = m_buffers[m_bufferCount];
|
||||
packetBuffer.data = outgoingCommand->packet->data.GetData() + Nz::NetPacket::HeaderSize + outgoingCommand->fragmentOffset;
|
||||
packetBuffer.data = outgoingCommand->packet->data.GetData() + NetPacket::HeaderSize + outgoingCommand->fragmentOffset;
|
||||
packetBuffer.dataLength = outgoingCommand->fragmentLength;
|
||||
|
||||
m_packetSize += packetBuffer.dataLength;
|
||||
@@ -1018,11 +1037,27 @@ namespace Nz
|
||||
else
|
||||
m_buffers[0].dataLength = NazaraOffsetOf(ENetProtocolHeader, sentTime);
|
||||
|
||||
// Compress packet buffers if possible
|
||||
std::size_t compressedSize = 0;
|
||||
if (m_compressor)
|
||||
{
|
||||
compressedSize = m_compressor->Compress(currentPeer, &m_buffers[1], m_bufferCount - 1, m_packetSize - sizeof(ENetProtocolHeader), m_packetData[1].data(), m_packetData[1].size());
|
||||
if (compressedSize > 0)
|
||||
m_headerFlags |= ENetProtocolHeaderFlag_Compressed;
|
||||
}
|
||||
|
||||
if (currentPeer->m_outgoingPeerID < ENetConstants::ENetProtocol_MaximumPeerId)
|
||||
m_headerFlags |= currentPeer->m_outgoingSessionID << ENetProtocolHeaderSessionShift;
|
||||
|
||||
header->peerID = HostToNet(static_cast<UInt16>(currentPeer->m_outgoingPeerID | m_headerFlags));
|
||||
|
||||
if (compressedSize > 0)
|
||||
{
|
||||
m_buffers[1].data = m_packetData[1].data();
|
||||
m_buffers[1].dataLength = compressedSize;
|
||||
m_bufferCount = 2;
|
||||
}
|
||||
|
||||
currentPeer->m_lastSendTime = m_serviceTime;
|
||||
|
||||
// Simulate network by adding delay to packet sending and losing some packets
|
||||
@@ -1032,7 +1067,7 @@ namespace Nz
|
||||
sendNow = false;
|
||||
if (!currentPeer->m_packetLossProbability(s_randomGenerator))
|
||||
{
|
||||
Nz::UInt16 delay = currentPeer->m_packetDelayDistribution(s_randomGenerator);
|
||||
UInt16 delay = currentPeer->m_packetDelayDistribution(s_randomGenerator);
|
||||
if (delay == 0)
|
||||
sendNow = true;
|
||||
else
|
||||
@@ -1146,6 +1181,8 @@ namespace Nz
|
||||
buffer.data = &command;
|
||||
buffer.dataLength = commandSize;
|
||||
|
||||
m_packetSize += buffer.dataLength;
|
||||
|
||||
command = outgoingCommand->command;
|
||||
|
||||
if (outgoingCommand->packet)
|
||||
@@ -1153,7 +1190,7 @@ namespace Nz
|
||||
++m_bufferCount;
|
||||
|
||||
NetBuffer& packetBuffer = m_buffers[m_bufferCount];
|
||||
packetBuffer.data = outgoingCommand->packet->data.GetData() + Nz::NetPacket::HeaderSize + outgoingCommand->fragmentOffset;
|
||||
packetBuffer.data = outgoingCommand->packet->data.GetData() + NetPacket::HeaderSize + outgoingCommand->fragmentOffset;
|
||||
packetBuffer.dataLength = outgoingCommand->fragmentLength;
|
||||
|
||||
m_packetSize += packetBuffer.dataLength;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <Nazara/Network/Algorithm.hpp>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <Nazara/Network/SystemSocket.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <Nazara/Network/Win32/IpAddressImpl.hpp>
|
||||
|
||||
@@ -111,9 +111,6 @@ namespace Nz
|
||||
|
||||
if (m_events[i].events & (EPOLLOUT | EPOLLERR))
|
||||
m_readyToWriteSockets.insert(m_events[i].data.fd);
|
||||
|
||||
if (m_events[i].events & EPOLLERR)
|
||||
NazaraWarning("Descriptor " + String::Number(m_events[i].data.fd) + " was returned by epoll with EPOLLERR status");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <Nazara/Network/Config.hpp>
|
||||
#include <Nazara/Network/NetPacket.hpp>
|
||||
#include <Nazara/Network/RUdpConnection.hpp>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
#include <Nazara/Network/Win32/SocketImpl.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Network/NetBuffer.hpp>
|
||||
#include <Nazara/Network/Posix/IpAddressImpl.hpp>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -566,8 +566,7 @@ namespace Nz
|
||||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
NazaraAssert(buffers && bufferCount > 0, "Invalid buffers");
|
||||
|
||||
StackAllocation memory = NazaraStackAllocation(bufferCount * sizeof(iovec));
|
||||
struct iovec* sysBuffers = static_cast<struct iovec*>(memory.GetPtr());
|
||||
StackArray<iovec> sysBuffers = NazaraStackAllocation(iovec, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
sysBuffers[i].iov_base = buffers[i].data;
|
||||
@@ -577,7 +576,7 @@ namespace Nz
|
||||
struct msghdr msgHdr;
|
||||
std::memset(&msgHdr, 0, sizeof(msgHdr));
|
||||
|
||||
msgHdr.msg_iov = sysBuffers;
|
||||
msgHdr.msg_iov = sysBuffers.data();
|
||||
msgHdr.msg_iovlen = static_cast<int>(bufferCount);
|
||||
|
||||
IpAddressImpl::SockAddrBuffer nameBuffer;
|
||||
@@ -689,8 +688,7 @@ namespace Nz
|
||||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
NazaraAssert(buffers && bufferCount > 0, "Invalid buffers");
|
||||
|
||||
StackAllocation memory = NazaraStackAllocation(bufferCount * sizeof(iovec));
|
||||
struct iovec* sysBuffers = static_cast<struct iovec*>(memory.GetPtr());
|
||||
StackArray<iovec> sysBuffers = NazaraStackAllocation(iovec, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
sysBuffers[i].iov_base = buffers[i].data;
|
||||
@@ -703,7 +701,7 @@ namespace Nz
|
||||
IpAddressImpl::SockAddrBuffer nameBuffer;
|
||||
msgHdr.msg_namelen = IpAddressImpl::ToSockAddr(to, nameBuffer.data());
|
||||
msgHdr.msg_name = nameBuffer.data();
|
||||
msgHdr.msg_iov = sysBuffers;
|
||||
msgHdr.msg_iov = sysBuffers.data();
|
||||
msgHdr.msg_iovlen = static_cast<int>(bufferCount);
|
||||
|
||||
int byteSent = sendmsg(handle, &msgHdr, MSG_NOSIGNAL);
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
#include <Nazara/Network/SocketHandle.hpp>
|
||||
#include <Nazara/Network/Enums.hpp>
|
||||
#include <Nazara/Network/IpAddress.hpp>
|
||||
#include <Nazara/Network/NetBuffer.hpp>
|
||||
|
||||
#define NAZARA_NETWORK_POLL_SUPPORT 1
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct NetBuffer;
|
||||
|
||||
struct PollSocket
|
||||
{
|
||||
SocketHandle fd;
|
||||
|
||||
@@ -90,12 +90,15 @@ namespace Nz
|
||||
int socketRemaining = activeSockets;
|
||||
for (PollSocket& entry : m_sockets)
|
||||
{
|
||||
if (entry.revents != 0)
|
||||
if (!entry.revents)
|
||||
continue;
|
||||
|
||||
if (entry.revents & (POLLRDNORM | POLLWRNORM | POLLHUP | POLLERR))
|
||||
{
|
||||
if (entry.revents & POLLRDNORM)
|
||||
if (entry.revents & (POLLRDNORM | POLLHUP | POLLERR))
|
||||
m_readyToReadSockets.insert(entry.fd);
|
||||
|
||||
if (entry.revents & POLLWRNORM)
|
||||
if (entry.revents & (POLLWRNORM | POLLERR))
|
||||
m_readyToWriteSockets.insert(entry.fd);
|
||||
|
||||
entry.revents = 0;
|
||||
@@ -103,6 +106,11 @@ namespace Nz
|
||||
if (--socketRemaining == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.revents, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef NAZARA_SOCKETPOLLERIMPL_HPP
|
||||
#define NAZARA_SOCKETPOLLERIMPL_HPP
|
||||
|
||||
#include <Nazara/Network/IpAddress.hpp>
|
||||
#include <Nazara/Network/SocketHandle.hpp>
|
||||
#include <Nazara/Network/Posix/SocketImpl.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/TcpServer.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Network/TcpClient.hpp>
|
||||
#include <limits>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
||||
|
||||
@@ -596,8 +596,7 @@ namespace Nz
|
||||
|
||||
IpAddress senderIp;
|
||||
|
||||
StackAllocation memory = NazaraStackAllocation(bufferCount * sizeof(WSABUF));
|
||||
WSABUF* winBuffers = static_cast<WSABUF*>(memory.GetPtr());
|
||||
StackArray<WSABUF> winBuffers = NazaraStackAllocation(WSABUF, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
winBuffers[i].buf = static_cast<CHAR*>(buffers[i].data);
|
||||
@@ -606,7 +605,7 @@ namespace Nz
|
||||
|
||||
DWORD flags = 0;
|
||||
DWORD byteRead;
|
||||
if (WSARecvFrom(handle, winBuffers, static_cast<DWORD>(bufferCount), &byteRead, &flags, reinterpret_cast<sockaddr*>(nameBuffer.data()), &bufferLength, nullptr, nullptr) == SOCKET_ERROR)
|
||||
if (WSARecvFrom(handle, winBuffers.data(), static_cast<DWORD>(bufferCount), &byteRead, &flags, reinterpret_cast<sockaddr*>(nameBuffer.data()), &bufferLength, nullptr, nullptr) == SOCKET_ERROR)
|
||||
{
|
||||
int errorCode = WSAGetLastError();
|
||||
switch (errorCode)
|
||||
@@ -696,8 +695,7 @@ namespace Nz
|
||||
IpAddressImpl::SockAddrBuffer nameBuffer;
|
||||
int bufferLength = IpAddressImpl::ToSockAddr(to, nameBuffer.data());
|
||||
|
||||
StackAllocation memory = NazaraStackAllocation(bufferCount * sizeof(WSABUF));
|
||||
WSABUF* winBuffers = static_cast<WSABUF*>(memory.GetPtr());
|
||||
StackArray<WSABUF> winBuffers = NazaraStackAllocation(WSABUF, bufferCount);
|
||||
for (std::size_t i = 0; i < bufferCount; ++i)
|
||||
{
|
||||
winBuffers[i].buf = static_cast<CHAR*>(buffers[i].data);
|
||||
@@ -705,7 +703,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
DWORD byteSent;
|
||||
if (WSASendTo(handle, winBuffers, static_cast<DWORD>(bufferCount), &byteSent, 0, reinterpret_cast<const sockaddr*>(nameBuffer.data()), bufferLength, nullptr, nullptr) == SOCKET_ERROR)
|
||||
if (WSASendTo(handle, winBuffers.data(), static_cast<DWORD>(bufferCount), &byteSent, 0, reinterpret_cast<const sockaddr*>(nameBuffer.data()), bufferLength, nullptr, nullptr) == SOCKET_ERROR)
|
||||
{
|
||||
int errorCode = WSAGetLastError();
|
||||
switch (errorCode)
|
||||
|
||||
@@ -143,12 +143,15 @@ namespace Nz
|
||||
int socketRemaining = activeSockets;
|
||||
for (PollSocket& entry : m_sockets)
|
||||
{
|
||||
if (entry.revents != 0)
|
||||
if (!entry.revents)
|
||||
continue;
|
||||
|
||||
if (entry.revents & (POLLRDNORM | POLLWRNORM | POLLHUP | POLLERR))
|
||||
{
|
||||
if (entry.revents & POLLRDNORM)
|
||||
if (entry.revents & (POLLRDNORM | POLLHUP | POLLERR))
|
||||
m_readyToReadSockets.insert(entry.fd);
|
||||
|
||||
if (entry.revents & POLLWRNORM)
|
||||
if (entry.revents & (POLLWRNORM | POLLERR))
|
||||
m_readyToWriteSockets.insert(entry.fd);
|
||||
|
||||
entry.revents = 0;
|
||||
@@ -156,9 +159,13 @@ namespace Nz
|
||||
if (--socketRemaining == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.revents, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
fd_set* readSet = nullptr;
|
||||
fd_set* writeSet = nullptr;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user