Merge branch 'master' into reflection-mapping

This commit is contained in:
Lynix
2017-10-02 21:11:15 +02:00
518 changed files with 6740 additions and 2355 deletions

View File

@@ -10,7 +10,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Audio/Config.hpp>
#include <Nazara/Audio/Enums.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Vector3.hpp>

View File

@@ -10,6 +10,7 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Audio/Enums.hpp>
#include <Nazara/Audio/SoundEmitter.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceLoader.hpp>
#include <Nazara/Core/ResourceParameters.hpp>
@@ -37,7 +38,7 @@ namespace Nz
public:
Music() = default;
Music(const Music&) = delete;
Music(Music&&) = delete; ///TODO
Music(Music&&) = delete;
~Music();
bool Create(SoundStream* soundStream);
@@ -66,10 +67,10 @@ namespace Nz
void Stop() override;
Music& operator=(const Music&) = delete;
Music& operator=(Music&&) = delete; ///TODO
Music& operator=(Music&&) = delete;
private:
MusicImpl* m_impl = nullptr;
MovablePtr<MusicImpl> m_impl = nullptr;
bool FillAndQueueBuffer(unsigned int buffer);
void MusicThread();

View File

@@ -10,6 +10,7 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Audio/Config.hpp>
#include <Nazara/Audio/Enums.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/ObjectLibrary.hpp>
#include <Nazara/Core/RefCounted.hpp>
@@ -18,7 +19,6 @@
#include <Nazara/Core/ResourceManager.hpp>
#include <Nazara/Core/ResourceParameters.hpp>
#include <Nazara/Core/Signal.hpp>
#include <Nazara/Core/Stream.hpp>
namespace Nz
{
@@ -74,7 +74,7 @@ namespace Nz
template<typename... Args> static SoundBufferRef New(Args&&... args);
SoundBuffer& operator=(const SoundBuffer&) = delete;
SoundBuffer& operator=(SoundBuffer&&) = delete; ///TODO
SoundBuffer& operator=(SoundBuffer&&) = delete;
// Signals:
NazaraSignal(OnSoundBufferDestroy, const SoundBuffer* /*soundBuffer*/);
@@ -86,7 +86,7 @@ namespace Nz
static bool Initialize();
static void Uninitialize();
SoundBufferImpl* m_impl = nullptr;
MovablePtr<SoundBufferImpl> m_impl = nullptr;
static SoundBufferLibrary::LibraryMap s_library;
static SoundBufferLoader::LoaderList s_loaders;

View File

@@ -52,12 +52,12 @@ namespace Nz
virtual void Stop() = 0;
SoundEmitter& operator=(const SoundEmitter&) = delete; ///TODO
SoundEmitter& operator=(SoundEmitter&&) = delete; ///TODO
SoundEmitter& operator=(SoundEmitter&&) = delete;
protected:
SoundEmitter();
SoundEmitter(const SoundEmitter& emitter);
SoundEmitter(SoundEmitter&&) = delete; ///TODO
SoundEmitter(SoundEmitter&&) = delete;
SoundStatus GetInternalStatus() const;

View File

@@ -8,7 +8,6 @@
#define NAZARA_ABSTRACTLOGGER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Core/String.hpp>
namespace Nz

View File

@@ -90,8 +90,8 @@ namespace Nz
void UnboundedSet(std::size_t bit, bool val = true);
bool UnboundedTest(std::size_t bit) const;
Bit operator[](int index);
bool operator[](int index) const;
Bit operator[](std::size_t index);
bool operator[](std::size_t index) const;
Bitset operator~() const;
@@ -145,7 +145,7 @@ namespace Nz
template<bool BadCall = true>
void* operator&() const;
operator bool() const;
explicit operator bool() const;
Bit& operator=(bool val);
Bit& operator=(const Bit& bit);

View File

@@ -958,7 +958,7 @@ namespace Nz
*/
template<typename Block, class Allocator>
typename Bitset<Block, Allocator>::Bit Bitset<Block, Allocator>::operator[](int index)
typename Bitset<Block, Allocator>::Bit Bitset<Block, Allocator>::operator[](std::size_t index)
{
return Bit(m_blocks[GetBlockIndex(index)], Block(1U) << GetBitIndex(index));
}
@@ -969,7 +969,7 @@ namespace Nz
*/
template<typename Block, class Allocator>
bool Bitset<Block, Allocator>::operator[](int index) const
bool Bitset<Block, Allocator>::operator[](std::size_t index) const
{
return Test(index);
}

View File

@@ -3,7 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Error.hpp>
#include <cstdio>
#include <Nazara/Core/Debug.hpp>
namespace Nz

View File

@@ -8,13 +8,14 @@
#define NAZARA_BYTESTREAM_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/SerializationContext.hpp>
#include <Nazara/Core/Stream.hpp>
#include <memory>
namespace Nz
{
class ByteArray;
class Stream;
class NAZARA_CORE_API ByteStream
{
public:

View File

@@ -2,12 +2,9 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Core/StringStream.hpp>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stdexcept>
#include <Nazara/Core/Debug.hpp>
namespace Nz

View File

@@ -8,6 +8,7 @@
#define NAZARA_CONDITIONVARIABLE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
namespace Nz
{
@@ -19,7 +20,7 @@ namespace Nz
public:
ConditionVariable();
ConditionVariable(const ConditionVariable&) = delete;
inline ConditionVariable(ConditionVariable&& condition) noexcept;
ConditionVariable(ConditionVariable&& condition) noexcept = default;
~ConditionVariable();
void Signal();
@@ -29,10 +30,10 @@ namespace Nz
bool Wait(Mutex* mutex, UInt32 timeout);
ConditionVariable& operator=(const ConditionVariable&) = delete;
ConditionVariable& operator=(ConditionVariable&& condition) noexcept;
ConditionVariable& operator=(ConditionVariable&& condition) noexcept = default;
private:
ConditionVariableImpl* m_impl;
MovablePtr<ConditionVariableImpl> m_impl;
};
}

View File

@@ -2,8 +2,6 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/ConditionVariable.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
@@ -11,15 +9,6 @@ namespace Nz
/*!
* \class Nz::ConditionVariable
*/
/*!
* \brief Constructs a ConditionVariable object by moving another one
*/
inline ConditionVariable::ConditionVariable(ConditionVariable&& condition) noexcept :
m_impl(condition.m_impl)
{
condition.m_impl = nullptr;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -73,7 +73,7 @@
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
// Optimize the Windows implementation with technologies of Windows NT 6.0 (and greater) (Break the compatibility with Windows XP)
#define NAZARA_CORE_WINDOWS_NT6 0
#define NAZARA_CORE_WINDOWS_NT6 1
/*

View File

@@ -8,7 +8,6 @@
#define NAZARA_CORE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp>
namespace Nz
{

View File

@@ -8,6 +8,7 @@
#define NAZARA_DIRECTORY_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/String.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
@@ -35,7 +36,7 @@ namespace Nz
Directory();
Directory(const String& dirPath);
Directory(const Directory&) = delete;
Directory(Directory&&) = delete; ///TODO
Directory(Directory&&) noexcept = default;
~Directory();
void Close();
@@ -67,14 +68,14 @@ namespace Nz
static bool SetCurrent(const String& dirPath);
Directory& operator=(const Directory&) = delete;
Directory& operator=(Directory&&) = delete; ///TODO
Directory& operator=(Directory&&) noexcept = delete;
private:
NazaraMutexAttrib(m_mutex, mutable)
String m_dirPath;
String m_pattern;
DirectoryImpl* m_impl;
MovablePtr<DirectoryImpl> m_impl;
};
}

View File

@@ -8,6 +8,7 @@
#define NAZARA_DYNLIB_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/String.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
@@ -28,7 +29,7 @@
namespace Nz
{
using DynLibFunc = int (*)(); // "Generic" type of poiter to function
using DynLibFunc = int (*)(); // "Generic" type of pointer to function
class DynLibImpl;
@@ -37,7 +38,7 @@ namespace Nz
public:
DynLib();
DynLib(const DynLib&) = delete;
DynLib(DynLib&& lib);
DynLib(DynLib&&) noexcept = default;
~DynLib();
String GetLastError() const;
@@ -49,13 +50,13 @@ namespace Nz
void Unload();
DynLib& operator=(const DynLib&) = delete;
DynLib& operator=(DynLib&& lib);
DynLib& operator=(DynLib&& lib) noexcept = default;
private:
NazaraMutexAttrib(m_mutex, mutable)
mutable String m_lastError;
DynLibImpl* m_impl;
MovablePtr<DynLibImpl> m_impl;
};
}

View File

@@ -63,6 +63,7 @@ namespace Nz
enum HashType
{
HashType_CRC32,
HashType_CRC64,
HashType_Fletcher16,
HashType_MD5,
HashType_SHA1,

View File

@@ -8,7 +8,6 @@
#define NAZARA_ERRORFLAGS_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Enums.hpp>
namespace Nz
{

View File

@@ -9,8 +9,8 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/Directory.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Core/String.hpp>
@@ -33,7 +33,7 @@ namespace Nz
File(const String& filePath);
File(const String& filePath, OpenModeFlags openMode);
File(const File&) = delete;
File(File&& file) noexcept;
File(File&& file) noexcept = default;
~File();
bool Copy(const String& newFilePath);
@@ -69,7 +69,7 @@ namespace Nz
File& operator=(const String& filePath);
File& operator=(const File&) = delete;
File& operator=(File&& file) noexcept;
File& operator=(File&& file) noexcept = default;
static String AbsolutePath(const String& filePath);
static inline ByteArray ComputeHash(HashType hash, const String& filePath);
@@ -95,7 +95,7 @@ namespace Nz
std::size_t WriteBlock(const void* buffer, std::size_t size) override;
String m_filePath;
FileImpl* m_impl;
MovablePtr<FileImpl> m_impl;
};
NAZARA_CORE_API bool HashAppend(AbstractHash* hash, const File& originalFile);

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Core/Debug.hpp>

View File

@@ -56,7 +56,7 @@ namespace Nz
};
// Little hack to have them in both Nz and global scope
namespace DetailFlagOperators
namespace FlagsOperators
{
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator~(E lhs);
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator|(E lhs, E rhs);
@@ -64,10 +64,10 @@ namespace Nz
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator^(E lhs, E rhs);
}
using namespace DetailFlagOperators;
using namespace FlagsOperators;
}
using namespace Nz::DetailFlagOperators;
using namespace Nz::FlagsOperators;
#include <Nazara/Core/Flags.inl>

View File

@@ -211,7 +211,7 @@ namespace Nz
}
namespace DetailFlagOperators
namespace FlagsOperators
{
/*!
* \brief Override binary NOT operator on enum to turns into a Flags object.

View File

@@ -11,7 +11,6 @@
#define NAZARA_GUILLOTINEBINPACK_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/SparsePtr.hpp>
#include <Nazara/Math/Rect.hpp>
#include <vector>

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_HASH_CRC64_HPP
#define NAZARA_HASH_CRC64_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/ByteArray.hpp>
namespace Nz
{
class NAZARA_CORE_API HashCRC64 : public AbstractHash
{
public:
HashCRC64() = default;
~HashCRC64() = default;
void Append(const UInt8* data, std::size_t len) override;
void Begin() override;
ByteArray End() override;
std::size_t GetDigestLength() const override;
const char* GetHashName() const override;
private:
Nz::UInt64 m_crc;
};
}
#endif // NAZARA_HASH_CRC64_HPP

View File

@@ -10,7 +10,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractHash.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/String.hpp>
namespace Nz
{

View File

@@ -24,7 +24,7 @@ namespace Nz
bool IsInitialized() const;
void Uninitialize();
operator bool() const;
explicit operator bool() const;
Initializer& operator=(const Initializer&) = delete;
Initializer& operator=(Initializer&&) = delete; ///TODO

View File

@@ -8,11 +8,8 @@
#define NAZARA_LOG_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/AbstractLogger.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Signal.hpp>
#include <Nazara/Core/String.hpp>
#include <memory>
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_LOG
#include <Nazara/Core/ThreadSafety.hpp>
@@ -30,6 +27,8 @@
namespace Nz
{
class AbstractLogger;
class NAZARA_CORE_API Log
{
friend class Core;

View File

@@ -8,8 +8,7 @@
#define NAZARA_MEMORYMANAGER_HPP
#include <Nazara/Prerequesites.hpp>
#include <cstdio>
#include <cstring>
#include <cstddef>
namespace Nz
{

View File

@@ -0,0 +1,38 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_MOVABLE_PTR_HPP
#define NAZARA_MOVABLE_PTR_HPP
namespace Nz
{
template<typename T>
class MovablePtr
{
public:
MovablePtr(T* value = nullptr);
MovablePtr(const MovablePtr&) = default;
MovablePtr(MovablePtr&& ptr) noexcept;
~MovablePtr() = default;
T* Get() const;
T* operator->() const;
operator T*() const;
MovablePtr& operator=(T* value);
MovablePtr& operator=(const MovablePtr&) = default;
MovablePtr& operator=(MovablePtr&& ptr) noexcept;
private:
T* m_value;
};
}
#include <Nazara/Core/MovablePtr.inl>
#endif // NAZARA_MOVABLE_PTR_HPP

View File

@@ -0,0 +1,61 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/MovablePtr.hpp>
#include <utility>
namespace Nz
{
/*!
* \ingroup core
* \class Nz::MovablePtr
* \brief Wraps a raw (non-proprietary) to allows it to be moved implicitly
*/
template<typename T>
MovablePtr<T>::MovablePtr(T* value) :
m_value(value)
{
}
template<typename T>
MovablePtr<T>::MovablePtr(MovablePtr&& ptr) noexcept :
m_value(ptr.m_value)
{
ptr.m_value = nullptr;
}
template<typename T>
inline T* MovablePtr<T>::Get() const
{
return m_value;
}
template<typename T>
T* MovablePtr<T>::operator->() const
{
return m_value;
}
template<typename T>
MovablePtr<T>::operator T*() const
{
return m_value;
}
template<typename T>
inline MovablePtr<T>& MovablePtr<T>::operator=(T* value)
{
m_value = value;
return *this;
}
template<typename T>
MovablePtr<T>& MovablePtr<T>::operator=(MovablePtr&& ptr) noexcept
{
std::swap(m_value, ptr.m_value);
return *this;
}
}

View File

@@ -8,6 +8,7 @@
#define NAZARA_MUTEX_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
namespace Nz
{
@@ -20,7 +21,7 @@ namespace Nz
public:
Mutex();
Mutex(const Mutex&) = delete;
inline Mutex(Mutex&& mutex) noexcept;
Mutex(Mutex&&) noexcept = default;
~Mutex();
void Lock();
@@ -28,10 +29,10 @@ namespace Nz
void Unlock();
Mutex& operator=(const Mutex&) = delete;
Mutex& operator=(Mutex&& mutex) noexcept;
Mutex& operator=(Mutex&&) noexcept = default;
private:
MutexImpl* m_impl;
MovablePtr<MutexImpl> m_impl;
};
}

View File

@@ -12,15 +12,6 @@ namespace Nz
* \ingroup core
* \class Nz::Mutex
*/
/*!
* \brief Constructs a Mutex object by moving another one
*/
inline Mutex::Mutex(Mutex&& mutex) noexcept :
m_impl(mutex.m_impl)
{
mutex.m_impl = nullptr;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -38,7 +38,7 @@ namespace Nz
Nz::String ToString() const;
operator bool() const;
explicit operator bool() const;
operator T*() const;
T* operator->() const;

View File

@@ -31,7 +31,7 @@ namespace Nz
bool Reset(T* object = nullptr);
ObjectRef& Swap(ObjectRef& ref);
operator bool() const;
explicit operator bool() const;
operator T*() const;
T* operator->() const;

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/ParameterList.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz

View File

@@ -9,7 +9,6 @@
#include <Nazara/Prerequesites.hpp>
#include <atomic>
#include <unordered_map>
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_REFCOUNTED
#include <Nazara/Core/ThreadSafety.hpp>

View File

@@ -17,7 +17,7 @@ namespace Nz
public:
Resource() = default;
Resource(const Resource&) = default;
Resource(Resource&&) = default;
Resource(Resource&&) noexcept = default;
virtual ~Resource();
const String& GetFilePath() const;
@@ -25,7 +25,7 @@ namespace Nz
void SetFilePath(const String& filePath);
Resource& operator=(const Resource&) = default;
Resource& operator=(Resource&&) = default;
Resource& operator=(Resource&&) noexcept = default;
private:
String m_filePath;

View File

@@ -8,6 +8,7 @@
#define NAZARA_SEMAPHORE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
namespace Nz
{
@@ -18,7 +19,7 @@ namespace Nz
public:
Semaphore(unsigned int count);
Semaphore(const Semaphore&) = delete;
Semaphore(Semaphore&&) = delete; ///TODO
Semaphore(Semaphore&&) noexcept = default;
~Semaphore();
unsigned int GetCount() const;
@@ -29,10 +30,10 @@ namespace Nz
bool Wait(UInt32 timeout);
Semaphore& operator=(const Semaphore&) = delete;
Semaphore& operator=(Semaphore&&) = delete; ///TODO
Semaphore& operator=(Semaphore&&) noexcept = default;
private:
SemaphoreImpl* m_impl;
MovablePtr<SemaphoreImpl> m_impl;
};
}

View File

@@ -10,9 +10,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <functional>
#include <tuple>
#include <type_traits>
namespace Nz
{

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/SerializationContext.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz

View File

@@ -25,6 +25,7 @@ namespace Nz
SparsePtr();
SparsePtr(T* ptr);
SparsePtr(VoidPtr ptr, int stride);
SparsePtr(VoidPtr ptr, std::size_t stride);
template<typename U> SparsePtr(const SparsePtr<U>& ptr);
SparsePtr(const SparsePtr& ptr) = default;
~SparsePtr() = default;
@@ -41,7 +42,7 @@ namespace Nz
void SetPtr(VoidPtr ptr);
void SetStride(int stride);
operator bool() const;
explicit operator bool() const;
operator T*() const;
T& operator*() const;
T* operator->() const;

View File

@@ -2,7 +2,10 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/SparsePtr.hpp>
#include <cassert>
#include <iterator>
#include <limits>
#include <Nazara/Core/Debug.hpp>
namespace Nz
@@ -48,6 +51,22 @@ namespace Nz
Reset(ptr, stride);
}
/*!
* \brief Constructs a SparsePtr object with a pointer and a step
*
* \param ptr Pointer to data
* \param stride Step between two elements
*
* \remark This constructor only exists because std::size_t is a frequent type for constructing this object, but stride may not be higher than int max
*/
template<typename T>
SparsePtr<T>::SparsePtr(VoidPtr ptr, std::size_t stride)
{
assert(stride <= std::numeric_limits<int>::max());
Reset(ptr, static_cast<int>(stride));
}
/*!
* \brief Constructs a SparsePtr object from another type of SparsePtr
*

View File

@@ -3,7 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Error.hpp>
#include "Stream.hpp"
namespace Nz
{

View File

@@ -9,8 +9,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <Nazara/Core/SerializationContext.hpp>
#include <atomic>
#include <cstdarg>
#include <iosfwd>
#include <memory>
@@ -19,6 +17,8 @@
namespace Nz
{
struct SerializationContext;
class NAZARA_CORE_API String
{
public:

View File

@@ -9,10 +9,12 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Functor.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <iosfwd>
namespace Nz
{
class String;
class ThreadImpl;
class NAZARA_CORE_API Thread
@@ -25,24 +27,26 @@ namespace Nz
template<typename F, typename... Args> Thread(F function, Args&&... args);
template<typename C> Thread(void (C::*function)(), C* object);
Thread(const Thread&) = delete;
Thread(Thread&& other) noexcept;
Thread(Thread&& other) noexcept = default;
~Thread();
void Detach();
Id GetId() const;
bool IsJoinable() const;
void Join();
void SetName(const String& name);
Thread& operator=(const Thread&) = delete;
Thread& operator=(Thread&& thread);
Thread& operator=(Thread&& thread) noexcept = default;
static unsigned int HardwareConcurrency();
static void SetCurrentThreadName(const String& name);
static void Sleep(UInt32 milliseconds);
private:
void CreateImpl(Functor* functor);
ThreadImpl* m_impl;
MovablePtr<ThreadImpl> m_impl;
};
class NAZARA_CORE_API Thread::Id

View File

@@ -13,8 +13,6 @@
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <vector>
namespace Nz
@@ -23,6 +21,7 @@ namespace Nz
class Material;
class Texture;
struct MeshData;
struct VertexStruct_XYZ_Color_UV;
class NAZARA_GRAPHICS_API AbstractRenderQueue
{

View File

@@ -8,16 +8,13 @@
#define NAZARA_ABSTRACTRENDERTECHNIQUE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Color.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/Enums.hpp>
#include <Nazara/Graphics/SceneData.hpp>
namespace Nz
{
class AbstractViewer;
class Background;
class AbstractRenderQueue;
struct SceneData;
class NAZARA_GRAPHICS_API AbstractRenderTechnique

View File

@@ -12,7 +12,7 @@
#include <type_traits>
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// We fore the value of MANAGE_MEMORY in debug
// We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_GRAPHICS_MANAGE_MEMORY
#undef NAZARA_GRAPHICS_MANAGE_MEMORY
#define NAZARA_GRAPHICS_MANAGE_MEMORY 0

View File

@@ -9,18 +9,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/Enums.hpp>
#include <Nazara/Graphics/SceneData.hpp>
#include <Nazara/Math/Vector2.hpp>
namespace Nz
{
class AbstractViewer;
class DeferredRenderTechnique;
class DeferredRenderQueue;
class RenderBuffer;
struct SceneData;
class RenderTexture;
class Scene;
class Texture;
class NAZARA_GRAPHICS_API DeferredRenderPass

View File

@@ -8,7 +8,6 @@
#define NAZARA_DEFERREDRENDERQUEUE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/ForwardRenderQueue.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Math/Box.hpp>
@@ -17,7 +16,6 @@
#include <Nazara/Utility/MeshData.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <map>
#include <tuple>
namespace Nz
{

View File

@@ -9,21 +9,18 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/AbstractRenderTechnique.hpp>
#include <Nazara/Graphics/DeferredRenderPass.hpp>
#include <Nazara/Graphics/DeferredRenderQueue.hpp>
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Renderer/RenderBuffer.hpp>
#include <Nazara/Renderer/RenderStates.hpp>
#include <Nazara/Renderer/RenderTexture.hpp>
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Utility/Mesh.hpp>
#include <map>
#include <memory>
namespace Nz
{
class DeferredRenderPass;
class NAZARA_GRAPHICS_API DeferredRenderTechnique : public AbstractRenderTechnique
{
friend class Graphics;

View File

@@ -8,15 +8,9 @@
#define NAZARA_DEPTHRENDERQUEUE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
#include <Nazara/Graphics/ForwardRenderQueue.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <map>
#include <tuple>
namespace Nz
{

View File

@@ -11,7 +11,6 @@
#include <Nazara/Graphics/AbstractRenderTechnique.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/DepthRenderQueue.hpp>
#include <Nazara/Graphics/Light.hpp>
#include <Nazara/Renderer/Shader.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>

View File

@@ -18,7 +18,6 @@
#include <Nazara/Utility/MeshData.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <map>
#include <tuple>
namespace Nz
{

View File

@@ -8,7 +8,6 @@
#define NAZARA_GRAPHICS_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Graphics/Config.hpp>
namespace Nz

View File

@@ -7,7 +7,6 @@
#ifndef NAZARA_INSTANCEDRENDERABLE_HPP
#define NAZARA_INSTANCEDRENDERABLE_HPP
#include <Nazara/Core/PrimitiveList.hpp>
#include <Nazara/Core/ObjectLibrary.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>

View File

@@ -11,14 +11,10 @@
#include <Nazara/Core/Color.hpp>
#include <Nazara/Graphics/Enums.hpp>
#include <Nazara/Graphics/Renderable.hpp>
#include <Nazara/Renderer/RenderTexture.hpp>
#include <Nazara/Renderer/Texture.hpp>
namespace Nz
{
class Light;
struct LightUniforms;
class NAZARA_GRAPHICS_API Light : public Renderable
{
public:

View File

@@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <memory>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz

View File

@@ -24,7 +24,6 @@
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Renderer/UberShader.hpp>
#include <Nazara/Utility/MaterialData.hpp>
namespace Nz
{

View File

@@ -1465,4 +1465,3 @@ namespace Nz
}
#include <Nazara/Graphics/DebugOff.hpp>
#include "Material.hpp"

View File

@@ -10,10 +10,8 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/Enums.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/RenderPipeline.hpp>
#include <Nazara/Renderer/UberShader.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <array>
namespace Nz

View File

@@ -2,9 +2,8 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/MaterialPipeline.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Renderer/Renderer.hpp>
#include <Nazara/Renderer/UberShaderInstance.hpp>
#include <functional>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/ParticleFunctionController.hpp>
#include <memory>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/ParticleFunctionGenerator.hpp>
#include <memory>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/ParticleFunctionRenderer.hpp>
#include <memory>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -15,9 +15,7 @@
#include <Nazara/Graphics/ParticleGenerator.hpp>
#include <Nazara/Graphics/ParticleRenderer.hpp>
#include <Nazara/Graphics/Renderable.hpp>
#include <Nazara/Math/BoundingVolume.hpp>
#include <functional>
#include <memory>
#include <set>
#include <vector>

View File

@@ -2,8 +2,6 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/ParticleGroup.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz

View File

@@ -1,9 +1,10 @@
// 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
#include <Nazara/Core/Error.hpp>
#include <Nazara/Graphics/Debug.hpp>
#include <Nazara/Utility/Algorithm.hpp>
namespace Nz
{
@@ -26,7 +27,7 @@ namespace Nz
std::size_t offset;
m_declaration->GetComponent(component, &enabled, &type, &offset);
if (enabled)
if (enabled && GetComponentTypeOf<T>() == type)
{
///TODO: Check the ratio between the type of the attribute and the template type ?
return SparsePtr<T>(m_ptr + offset, m_declaration->GetStride());
@@ -57,7 +58,7 @@ namespace Nz
std::size_t offset;
m_declaration->GetComponent(component, &enabled, &type, &offset);
if (enabled)
if (enabled && GetComponentTypeOf<T>() == type)
{
///TODO: Check the ratio between the type of the attribute and the template type ?
return SparsePtr<const T>(m_ptr + offset, m_declaration->GetStride());

View File

@@ -12,9 +12,7 @@
#include <Nazara/Core/Updatable.hpp>
#include <Nazara/Graphics/Model.hpp>
#include <Nazara/Utility/Animation.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <vector>
#include <Nazara/Utility/Skeleton.hpp>
namespace Nz
{

View File

@@ -9,14 +9,12 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/AbstractBackground.hpp>
#include <Nazara/Renderer/Shader.hpp>
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
namespace Nz
{
class AbstractViewer;
class SkyboxBackground;
using SkyboxBackgroundConstRef = ObjectRef<const SkyboxBackground>;

View File

@@ -10,7 +10,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <array>
namespace Nz

View File

@@ -11,13 +11,11 @@
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Utility/AbstractAtlas.hpp>
#include <Nazara/Utility/AbstractTextDrawer.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <memory>
#include <set>
namespace Nz
{
class AbstractTextDrawer;
class TextSprite;
using TextSpriteConstRef = ObjectRef<const TextSprite>;

View File

@@ -10,8 +10,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Graphics/InstancedRenderable.hpp>
#include <Nazara/Graphics/Material.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <array>
#include <set>
namespace Nz

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/TileMap.hpp>
#include <Nazara/Core/Error.hpp>
#include <memory>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -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 - Lua scripting module"
// For conditions of distribution and use, see copyright notice in Config.hpp
@@ -8,7 +8,6 @@
#define NAZARA_LUA_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Lua/Config.hpp>
namespace Nz

View File

@@ -9,8 +9,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Lua/LuaState.hpp>
#include <cstddef>
#include <functional>
namespace Nz
{

View File

@@ -2,8 +2,6 @@
// This file is part of the "Nazara Engine - Lua scripting module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Lua/LuaCoroutine.hpp>
namespace Nz
{
inline LuaCoroutine::LuaCoroutine(LuaCoroutine&& instance) :

View File

@@ -8,9 +8,9 @@
#define NAZARA_LUAINSTANCE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Lua/LuaState.hpp>
#include <cstddef>
#include <functional>
namespace Nz
{

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Lua scripting module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Lua/LuaInstance.hpp>
#include <Nazara/Lua/Debug.hpp>
namespace Nz
@@ -24,7 +23,7 @@ namespace Nz
inline void LuaInstance::SetMemoryLimit(std::size_t memoryLimit)
{
m_memoryLimit = m_memoryLimit;
m_memoryLimit = memoryLimit;
}
inline void LuaInstance::SetTimeLimit(UInt32 limit)

View File

@@ -8,13 +8,12 @@
#define NAZARA_LUASTATE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Lua/Config.hpp>
#include <Nazara/Lua/Enums.hpp>
#include <cstddef>
#include <functional>
#include <type_traits>
struct lua_Debug;
struct lua_State;
@@ -24,6 +23,7 @@ namespace Nz
class LuaCoroutine;
class LuaInstance;
class LuaState;
class Stream;
using LuaCFunction = int (*)(lua_State* internalState);
using LuaFunction = std::function<int(LuaState& state)>;
@@ -32,7 +32,7 @@ namespace Nz
{
public:
LuaState(const LuaState&) = default;
LuaState(LuaState&& instance) noexcept;
inline LuaState(LuaState&& instance) noexcept;
~LuaState() = default;
void ArgCheck(bool condition, unsigned int argNum, const char* error) const;
@@ -173,7 +173,7 @@ namespace Nz
void* ToUserdata(int index, const String& tname) const;
LuaState& operator=(const LuaState&) = default;
LuaState& operator=(LuaState&& instance) noexcept;
inline LuaState& operator=(LuaState&& instance) noexcept;
static int GetIndexOfUpValue(int upValue);
static LuaInstance& GetInstance(lua_State* internalState);
@@ -182,7 +182,8 @@ namespace Nz
protected:
LuaState(lua_State* internalState);
template<typename T> T CheckBounds(int index, long long value) const;
template<typename T> std::enable_if_t<std::is_signed<T>::value, T> CheckBounds(int index, long long value) const;
template<typename T> std::enable_if_t<std::is_unsigned<T>::value, T> CheckBounds(int index, long long value) const;
virtual bool Run(int argCount, int resultCount);
static int ProxyFunc(lua_State* internalState);

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Lua scripting module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Lua/LuaState.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Core/Flags.hpp>
#include <Nazara/Core/MemoryHelper.hpp>
@@ -20,6 +19,13 @@ namespace Nz
{
}
inline LuaState::LuaState(LuaState&& state) noexcept :
m_lastError(state.m_lastError),
m_state(state.m_state)
{
state.m_state = nullptr;
}
inline lua_State* LuaState::GetInternalState() const
{
return m_state;
@@ -770,8 +776,18 @@ namespace Nz
SetMetatable(tname);
}
inline LuaState& LuaState::operator=(LuaState&& state) noexcept
{
m_lastError = std::move(state.m_lastError);
m_state = state.m_state;
state.m_state = nullptr;
return *this;
}
template<typename T>
T LuaState::CheckBounds(int index, long long value) const
std::enable_if_t<std::is_signed<T>::value, T> LuaState::CheckBounds(int index, long long value) const
{
constexpr long long minBounds = std::numeric_limits<T>::min();
constexpr long long maxBounds = std::numeric_limits<T>::max();
@@ -785,6 +801,22 @@ namespace Nz
return static_cast<T>(value);
}
template<typename T>
std::enable_if_t<std::is_unsigned<T>::value, T> LuaState::CheckBounds(int index, long long value) const
{
unsigned long long uValue = static_cast<unsigned long long>(value);
constexpr unsigned long long minBounds = 0;
constexpr unsigned long long maxBounds = std::numeric_limits<T>::max();
if (uValue < minBounds || uValue > maxBounds)
{
Nz::StringStream stream;
stream << "Argument #" << index << " is outside value range [" << minBounds << ", " << maxBounds << "] (" << value << ')';
Error(stream);
}
return static_cast<T>(uValue);
}
inline LuaState LuaState::GetState(lua_State* internalState)
{
return LuaState(internalState);

View File

@@ -481,11 +481,11 @@ namespace Nz
T test = x * y + z * w;
if (test > F(0.499))
// singularity at north pole
return EulerAngles<T>(FromDegrees(F(90.0)), FromRadians(F(2.0) * std::atan2(x, w)), F(0.0));
return EulerAngles<T>(F(0.0), FromRadians(F(2.0) * std::atan2(x, w)), FromDegrees(F(90.0)));
if (test < F(-0.499))
// singularity at south pole
return EulerAngles<T>(FromDegrees(F(-90.0)), FromRadians(F(-2.0) * std::atan2(x, w)), F(0.0));
return EulerAngles<T>(F(0.0), FromRadians(F(-2.0) * std::atan2(x, w)), FromDegrees(F(-90.0)));
return EulerAngles<T>(FromRadians(std::atan2(F(2.0) * x * w - F(2.0) * y * z, F(1.0) - F(2.0) * x * x - F(2.0) * z * z)),
FromRadians(std::atan2(F(2.0) * y * w - F(2.0) * x * z, F(1.0) - F(2.0) * y * y - F(2.0) * z * z)),

View File

@@ -32,6 +32,10 @@
#include <Nazara/Network/AbstractSocket.hpp>
#include <Nazara/Network/Algorithm.hpp>
#include <Nazara/Network/Config.hpp>
#include <Nazara/Network/ENetHost.hpp>
#include <Nazara/Network/ENetPacket.hpp>
#include <Nazara/Network/ENetPeer.hpp>
#include <Nazara/Network/ENetProtocol.hpp>
#include <Nazara/Network/Enums.hpp>
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/NetBuffer.hpp>

View File

@@ -0,0 +1,39 @@
/*
Copyright(c) 2002 - 2016 Lee Salzman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// 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
#pragma once
#ifndef NAZARA_ENETCOMPRESSOR_HPP
#define NAZARA_ENETCOMPRESSOR_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Network/Config.hpp>
#include <Nazara/Network/NetBuffer.hpp>
namespace Nz
{
class ENetPeer;
class NAZARA_NETWORK_API ENetCompressor
{
public:
ENetCompressor() = default;
~ENetCompressor();
virtual std::size_t Compress(const ENetPeer* peer, const NetBuffer* buffers, std::size_t bufferCount, std::size_t totalInputSize, UInt8* output, std::size_t maxOutputSize) = 0;
virtual std::size_t Decompress(const ENetPeer* peer, const UInt8* input, std::size_t inputSize, UInt8* output, std::size_t maxOutputSize) = 0;
};
}
#endif // NAZARA_ENETCOMPRESSOR_HPP

View File

@@ -1,4 +1,4 @@
/*
/*
Copyright(c) 2002 - 2016 Lee Salzman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
@@ -19,8 +19,8 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Bitset.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Core/MemoryPool.hpp>
#include <Nazara/Network/ENetCompressor.hpp>
#include <Nazara/Network/ENetPeer.hpp>
#include <Nazara/Network/ENetProtocol.hpp>
#include <Nazara/Network/IpAddress.hpp>
@@ -28,11 +28,7 @@
#include <Nazara/Network/NetPacket.hpp>
#include <Nazara/Network/SocketPoller.hpp>
#include <Nazara/Network/UdpSocket.hpp>
#include <deque>
#include <queue>
#include <random>
#include <set>
#include <unordered_map>
namespace Nz
{
@@ -55,8 +51,8 @@ namespace Nz
ENetPeer* Connect(const String& hostName, NetProtocol protocol = NetProtocol_Any, const String& service = "http", ResolveError* error = nullptr, std::size_t channelCount = 0, UInt32 data = 0);
inline bool Create(NetProtocol protocol, UInt16 port, std::size_t peerCount, std::size_t channelCount = 0);
bool Create(const IpAddress& address, std::size_t peerCount, std::size_t channelCount = 0);
bool Create(const IpAddress& address, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth);
bool Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount = 0);
bool Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth);
void Destroy();
void Flush();
@@ -66,6 +62,8 @@ namespace Nz
int Service(ENetEvent* event, UInt32 timeout);
inline void SetCompressor(std::unique_ptr<ENetCompressor>&& compressor);
void SimulateNetwork(double packetLossProbability, UInt16 minDelay, UInt16 maxDelay);
ENetHost& operator=(const ENetHost&) = delete;
@@ -130,6 +128,7 @@ namespace Nz
std::size_t m_peerCount;
std::size_t m_receivedDataLength;
std::uniform_int_distribution<UInt16> m_packetDelayDistribution;
std::unique_ptr<ENetCompressor> m_compressor;
std::vector<ENetPeer> m_peers;
std::vector<PendingIncomingPacket> m_pendingIncomingPackets;
std::vector<PendingOutgoingPacket> m_pendingOutgoingPackets;
@@ -152,6 +151,7 @@ namespace Nz
UInt32 m_totalReceivedPackets;
UInt64 m_totalSentData;
UInt64 m_totalReceivedData;
bool m_allowsIncomingConnections;
bool m_continueSending;
bool m_isSimulationEnabled;
bool m_recalculateBandwidthLimits;

View File

@@ -2,7 +2,6 @@
// 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/ENetHost.hpp>
#include <utility>
#include <Nazara/Network/Debug.hpp>
@@ -52,16 +51,21 @@ namespace Nz
m_socket.Close();
}
inline Nz::IpAddress ENetHost::GetBoundAddress() const
inline IpAddress ENetHost::GetBoundAddress() const
{
return m_address;
}
inline UInt32 Nz::ENetHost::GetServiceTime() const
inline UInt32 ENetHost::GetServiceTime() const
{
return m_serviceTime;
}
inline void ENetHost::SetCompressor(std::unique_ptr<ENetCompressor>&& compressor)
{
m_compressor = std::move(compressor);
}
inline ENetPacketRef ENetHost::AllocatePacket(ENetPacketFlags flags, NetPacket&& data)
{
ENetPacketRef ref = AllocatePacket(flags);

View File

@@ -19,12 +19,9 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Bitset.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Network/ENetPacket.hpp>
#include <Nazara/Network/ENetProtocol.hpp>
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/NetPacket.hpp>
#include <Nazara/Network/UdpSocket.hpp>
#include <array>
#include <list>
#include <random>
@@ -82,7 +79,6 @@ namespace Nz
void InitIncoming(std::size_t channelCount, const IpAddress& address, ENetProtocolConnect& incomingCommand);
void InitOutgoing(std::size_t channelCount, const IpAddress& address, UInt32 connectId, UInt32 windowSize);
struct Acknowledgement;
struct Channel;
struct IncomingCommmand;
struct OutgoingCommand;

View File

@@ -2,8 +2,6 @@
// 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/ENetPeer.hpp>
#include <utility>
#include <Nazara/Network/Debug.hpp>
namespace Nz

View File

@@ -50,7 +50,7 @@ namespace Nz
String ToString() const;
inline UInt32 ToUInt32() const;
inline operator bool() const;
inline explicit operator bool() const;
IpAddress& operator=(const IpAddress&) = default;
IpAddress& operator=(IpAddress&&) = default;

View File

@@ -11,7 +11,6 @@
#include <Nazara/Core/ByteStream.hpp>
#include <Nazara/Core/MemoryStream.hpp>
#include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Network/Config.hpp>
namespace Nz

View File

@@ -8,7 +8,6 @@
#define NAZARA_MODULENAME_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Network/Config.hpp>
namespace Nz

View File

@@ -22,8 +22,6 @@
namespace Nz
{
class RUdpClient;
class NAZARA_NETWORK_API RUdpConnection
{
friend class Network;

View File

@@ -2,8 +2,6 @@
// 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/RUdpConnection.hpp>
#include <utility>
#include <Nazara/Network/Debug.hpp>
namespace Nz

View File

@@ -8,8 +8,8 @@
#define NAZARA_SOCKETPOLLER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Network/AbstractSocket.hpp>
#include <Nazara/Network/IpAddress.hpp>
namespace Nz
{
@@ -19,7 +19,7 @@ namespace Nz
{
public:
SocketPoller();
inline SocketPoller(SocketPoller&& socketPoller);
SocketPoller(SocketPoller&&) noexcept = default;
~SocketPoller();
void Clear();
@@ -31,12 +31,12 @@ namespace Nz
bool RegisterSocket(AbstractSocket& socket, SocketPollEventFlags eventFlags);
void UnregisterSocket(AbstractSocket& socket);
bool Wait(UInt64 msTimeout);
bool Wait(int msTimeout);
inline SocketPoller& operator=(SocketPoller&& socketPoller);
SocketPoller& operator=(SocketPoller&&) noexcept = default;
private:
SocketPollerImpl* m_impl;
MovablePtr<SocketPollerImpl> m_impl;
};
}

View File

@@ -2,36 +2,10 @@
// 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/SocketPoller.hpp>
#include <utility>
#include <Nazara/Network/Debug.hpp>
namespace Nz
{
/*!
* \brief Constructs a SocketPoller object with another one by move semantic
*
* \param socketPoller SocketPoller to move into this
*/
inline SocketPoller::SocketPoller(SocketPoller&& socketPoller) :
m_impl(socketPoller.m_impl)
{
socketPoller.m_impl = nullptr;
}
/*!
* \brief Moves the SocketPoller into this
* \return A reference to this
*
* \param socketPoller SocketPoller to move in this
*/
inline SocketPoller& SocketPoller::operator=(SocketPoller&& socketPoller)
{
m_impl = socketPoller.m_impl;
socketPoller.m_impl = nullptr;
return *this;
}
}
#include <Nazara/Network/DebugOff.hpp>

View File

@@ -9,14 +9,13 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/Signal.hpp>
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Network/AbstractSocket.hpp>
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/NetBuffer.hpp>
namespace Nz
{
struct NetBuffer;
class NetPacket;
class NAZARA_NETWORK_API TcpClient : public AbstractSocket, public Stream

View File

@@ -2,7 +2,6 @@
// This file is part of the "Nazara Engine - Network module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <utility>
#include <Nazara/Network/Debug.hpp>
namespace Nz

View File

@@ -10,10 +10,10 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Network/AbstractSocket.hpp>
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/NetBuffer.hpp>
namespace Nz
{
struct NetBuffer;
class NetPacket;
class NAZARA_NETWORK_API UdpSocket : public AbstractSocket
@@ -39,6 +39,7 @@ namespace Nz
std::size_t QueryMaxDatagramSize();
bool Receive(void* buffer, std::size_t size, IpAddress* from, std::size_t* received);
bool ReceiveMultiple(NetBuffer* buffers, std::size_t bufferCount, IpAddress* from, std::size_t* received);
bool ReceivePacket(NetPacket* packet, IpAddress* from);
bool Send(const IpAddress& to, const void* buffer, std::size_t size, std::size_t* sent);

View File

@@ -6,7 +6,6 @@
#define NAZARA_FBM_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/Enums.hpp>
#include <Nazara/Noise/MixerBase.hpp>
namespace Nz

View File

@@ -7,7 +7,6 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
#include <array>
namespace Nz
{

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