Convert spaces to tabs

Former-commit-id: b459cfe0c83f651cc660d42f7d3014c3b146f345
This commit is contained in:
Lynix 2015-09-24 00:55:57 +02:00
parent ce3bbf6c78
commit dea3fb4e39
87 changed files with 1206 additions and 1205 deletions

View File

@ -260,9 +260,9 @@ namespace Ndk
namespace std namespace std
{ {
template<> template<>
struct hash<Ndk::EntityHandle> struct hash<Ndk::EntityHandle>
{ {
size_t operator()(const Ndk::EntityHandle& handle) const size_t operator()(const Ndk::EntityHandle& handle) const
{ {
// Hasher le pointeur fonctionnerait jusqu'à ce que l'entité soit mise à jour et déplacée // Hasher le pointeur fonctionnerait jusqu'à ce que l'entité soit mise à jour et déplacée
@ -271,9 +271,9 @@ namespace std
return hash<Ndk::EntityId>()(id); return hash<Ndk::EntityId>()(id);
} }
}; };
inline void swap(Ndk::EntityHandle& lhs, Ndk::EntityHandle& rhs) inline void swap(Ndk::EntityHandle& lhs, Ndk::EntityHandle& rhs)
{ {
lhs.Swap(rhs); lhs.Swap(rhs);
} }

View File

@ -26,8 +26,8 @@ namespace Ndk
using EntityList = std::vector<EntityHandle>; using EntityList = std::vector<EntityHandle>;
inline World(bool addDefaultSystems = true); inline World(bool addDefaultSystems = true);
World(const World&) = delete; World(const World&) = delete;
World(World&&) = delete; ///TODO World(World&&) = delete; ///TODO
~World(); ~World();
void AddDefaultSystems(); void AddDefaultSystems();
@ -61,8 +61,8 @@ namespace Ndk
void Update(); void Update();
inline void Update(float elapsedTime); inline void Update(float elapsedTime);
World& operator=(const World&) = delete; World& operator=(const World&) = delete;
World& operator=(World&&) = delete; ///TODO World& operator=(World&&) = delete; ///TODO
private: private:
inline void Invalidate(); inline void Invalidate();

View File

@ -17,15 +17,15 @@ namespace Ndk
if (!entity) if (!entity)
return false; return false;
const NzBitset<>& components = entity->GetComponentBits(); const NzBitset<>& components = entity->GetComponentBits();
m_filterResult.PerformsAND(m_requiredComponents, components); m_filterResult.PerformsAND(m_requiredComponents, components);
if (m_filterResult != m_requiredComponents) if (m_filterResult != m_requiredComponents)
return false; // Au moins un component requis n'est pas présent return false; // Au moins un component requis n'est pas présent
m_filterResult.PerformsAND(m_excludedComponents, components); m_filterResult.PerformsAND(m_excludedComponents, components);
if (m_filterResult.TestAny()) if (m_filterResult.TestAny())
return false; // Au moins un component exclu est présent return false; // Au moins un component exclu est présent
// Si nous avons une liste de composants nécessaires // Si nous avons une liste de composants nécessaires
if (m_requiredAnyComponents.TestAny()) if (m_requiredAnyComponents.TestAny())
@ -34,7 +34,7 @@ namespace Ndk
return false; return false;
} }
return true; return true;
} }
void BaseSystem::OnEntityAdded(Entity* entity) void BaseSystem::OnEntityAdded(Entity* entity)

View File

@ -11,7 +11,7 @@ void NzMixToMono(T* input, T* output, unsigned int channelCount, unsigned int fr
///DOC: Le buffer d'entrée peut être le même que le buffer de sortie ///DOC: Le buffer d'entrée peut être le même que le buffer de sortie
// Pour éviter l'overflow, on utilise comme accumulateur un type assez grand, (u)int 64 bits pour les entiers, double pour les flottants // Pour éviter l'overflow, on utilise comme accumulateur un type assez grand, (u)int 64 bits pour les entiers, double pour les flottants
typedef typename std::conditional<std::is_unsigned<T>::value, nzUInt64, nzInt64>::type BiggestInt; typedef typename std::conditional<std::is_unsigned<T>::value, nzUInt64, nzInt64>::type BiggestInt;
typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest; typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest;
for (unsigned int i = 0; i < frameCount; ++i) for (unsigned int i = 0; i < frameCount; ++i)
{ {

View File

@ -33,8 +33,8 @@ class NAZARA_AUDIO_API NzMusic : public NzResource, public NzSoundEmitter
public: public:
NzMusic() = default; NzMusic() = default;
NzMusic(const NzMusic&) = delete; NzMusic(const NzMusic&) = delete;
NzMusic(NzMusic&&) = delete; ///TODO NzMusic(NzMusic&&) = delete; ///TODO
~NzMusic(); ~NzMusic();
bool Create(NzSoundStream* soundStream); bool Create(NzSoundStream* soundStream);
@ -62,8 +62,8 @@ class NAZARA_AUDIO_API NzMusic : public NzResource, public NzSoundEmitter
void Stop(); void Stop();
NzMusic& operator=(const NzMusic&) = delete; NzMusic& operator=(const NzMusic&) = delete;
NzMusic& operator=(NzMusic&&) = delete; ///TODO NzMusic& operator=(NzMusic&&) = delete; ///TODO
private: private:
NzMusicImpl* m_impl = nullptr; NzMusicImpl* m_impl = nullptr;

View File

@ -48,8 +48,8 @@ class NAZARA_AUDIO_API NzSoundBuffer : public NzRefCounted, public NzResource
public: public:
NzSoundBuffer() = default; NzSoundBuffer() = default;
NzSoundBuffer(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples); NzSoundBuffer(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples);
NzSoundBuffer(const NzSoundBuffer&) = delete; NzSoundBuffer(const NzSoundBuffer&) = delete;
NzSoundBuffer(NzSoundBuffer&&) = delete; NzSoundBuffer(NzSoundBuffer&&) = delete;
~NzSoundBuffer(); ~NzSoundBuffer();
bool Create(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples); bool Create(nzAudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const nzInt16* samples);
@ -70,8 +70,8 @@ class NAZARA_AUDIO_API NzSoundBuffer : public NzRefCounted, public NzResource
static bool IsFormatSupported(nzAudioFormat format); static bool IsFormatSupported(nzAudioFormat format);
template<typename... Args> static NzSoundBufferRef New(Args&&... args); template<typename... Args> static NzSoundBufferRef New(Args&&... args);
NzSoundBuffer& operator=(const NzSoundBuffer&) = delete; NzSoundBuffer& operator=(const NzSoundBuffer&) = delete;
NzSoundBuffer& operator=(NzSoundBuffer&&) = delete; ///TODO NzSoundBuffer& operator=(NzSoundBuffer&&) = delete; ///TODO
// Signals: // Signals:
NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer* /*soundBuffer*/); NazaraSignal(OnSoundBufferDestroy, const NzSoundBuffer* /*soundBuffer*/);

View File

@ -50,13 +50,13 @@ class NAZARA_AUDIO_API NzSoundEmitter
virtual void Stop() = 0; virtual void Stop() = 0;
NzSoundEmitter& operator=(const NzSoundEmitter&) = delete; ///TODO NzSoundEmitter& operator=(const NzSoundEmitter&) = delete; ///TODO
NzSoundEmitter& operator=(NzSoundEmitter&&) = delete; ///TODO NzSoundEmitter& operator=(NzSoundEmitter&&) = delete; ///TODO
protected: protected:
NzSoundEmitter(); NzSoundEmitter();
NzSoundEmitter(const NzSoundEmitter& emitter); NzSoundEmitter(const NzSoundEmitter& emitter);
NzSoundEmitter(NzSoundEmitter&&) = delete; ///TODO NzSoundEmitter(NzSoundEmitter&&) = delete; ///TODO
nzSoundStatus GetInternalStatus() const; nzSoundStatus GetInternalStatus() const;

View File

@ -15,16 +15,16 @@ class NAZARA_CORE_API NzAbstractHash
{ {
public: public:
NzAbstractHash() = default; NzAbstractHash() = default;
NzAbstractHash(const NzAbstractHash&) = delete; NzAbstractHash(const NzAbstractHash&) = delete;
NzAbstractHash(NzAbstractHash&&) = default; NzAbstractHash(NzAbstractHash&&) = default;
virtual ~NzAbstractHash(); virtual ~NzAbstractHash();
virtual void Append(const nzUInt8* data, unsigned int len) = 0; virtual void Append(const nzUInt8* data, unsigned int len) = 0;
virtual void Begin() = 0; virtual void Begin() = 0;
virtual NzHashDigest End() = 0; virtual NzHashDigest End() = 0;
NzAbstractHash& operator=(const NzAbstractHash&) = delete; NzAbstractHash& operator=(const NzAbstractHash&) = delete;
NzAbstractHash& operator=(NzAbstractHash&&) = default; NzAbstractHash& operator=(NzAbstractHash&&) = default;
}; };
#endif // NAZARA_ABSTRACTHASH_HPP #endif // NAZARA_ABSTRACTHASH_HPP

View File

@ -12,7 +12,7 @@
template<typename F, typename Tuple, size_t... S> template<typename F, typename Tuple, size_t... S>
auto NzApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence<S...>) auto NzApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence<S...>)
{ {
return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...); return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...);
} }
template<typename F, typename Tuple> template<typename F, typename Tuple>
@ -26,7 +26,7 @@ auto NzApply(F&& fn, Tuple&& t)
template<typename O, typename F, typename Tuple, size_t... S> template<typename O, typename F, typename Tuple, size_t... S>
auto NzApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence<S...>) auto NzApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence<S...>)
{ {
return (object .* std::forward<F>(fn))(std::get<S>(std::forward<Tuple>(t))...); return (object .* std::forward<F>(fn))(std::get<S>(std::forward<Tuple>(t))...);
} }
template<typename O, typename F, typename Tuple> template<typename O, typename F, typename Tuple>
@ -41,16 +41,16 @@ auto NzApply(O& object, F&& fn, Tuple&& t)
template<typename T> template<typename T>
void NzHashCombine(std::size_t& seed, const T& v) void NzHashCombine(std::size_t& seed, const T& v)
{ {
const nzUInt64 kMul = 0x9ddfea08eb382d69ULL; const nzUInt64 kMul = 0x9ddfea08eb382d69ULL;
std::hash<T> hasher; std::hash<T> hasher;
nzUInt64 a = (hasher(v) ^ seed) * kMul; nzUInt64 a = (hasher(v) ^ seed) * kMul;
a ^= (a >> 47); a ^= (a >> 47);
nzUInt64 b = (seed ^ a) * kMul; nzUInt64 b = (seed ^ a) * kMul;
b ^= (b >> 47); b ^= (b >> 47);
seed = static_cast<std::size_t>(b * kMul); seed = static_cast<std::size_t>(b * kMul);
} }
#include <Nazara/Core/DebugOff.hpp> #include <Nazara/Core/DebugOff.hpp>

View File

@ -16,15 +16,15 @@ class NzCallOnExit
public: public:
NzCallOnExit(Func func = nullptr); NzCallOnExit(Func func = nullptr);
NzCallOnExit(const NzCallOnExit&) = delete; NzCallOnExit(const NzCallOnExit&) = delete;
NzCallOnExit(NzCallOnExit&&) = delete; NzCallOnExit(NzCallOnExit&&) = delete;
~NzCallOnExit(); ~NzCallOnExit();
void CallAndReset(Func func = nullptr); void CallAndReset(Func func = nullptr);
void Reset(Func func = nullptr); void Reset(Func func = nullptr);
NzCallOnExit& operator=(const NzCallOnExit&) = delete; NzCallOnExit& operator=(const NzCallOnExit&) = delete;
NzCallOnExit& operator=(NzCallOnExit&&) = default; NzCallOnExit& operator=(NzCallOnExit&&) = default;
private: private:
Func m_func; Func m_func;

View File

@ -16,8 +16,8 @@ class NAZARA_CORE_API NzConditionVariable
{ {
public: public:
NzConditionVariable(); NzConditionVariable();
NzConditionVariable(const NzConditionVariable&) = delete; NzConditionVariable(const NzConditionVariable&) = delete;
NzConditionVariable(NzConditionVariable&&) = delete; ///TODO NzConditionVariable(NzConditionVariable&&) = delete; ///TODO
~NzConditionVariable(); ~NzConditionVariable();
void Signal(); void Signal();
@ -26,8 +26,8 @@ class NAZARA_CORE_API NzConditionVariable
void Wait(NzMutex* mutex); void Wait(NzMutex* mutex);
bool Wait(NzMutex* mutex, nzUInt32 timeout); bool Wait(NzMutex* mutex, nzUInt32 timeout);
NzConditionVariable& operator=(const NzConditionVariable&) = delete; NzConditionVariable& operator=(const NzConditionVariable&) = delete;
NzConditionVariable& operator=(NzConditionVariable&&) = delete; ///TODO NzConditionVariable& operator=(NzConditionVariable&&) = delete; ///TODO
private: private:
NzConditionVariableImpl* m_impl; NzConditionVariableImpl* m_impl;

View File

@ -31,9 +31,9 @@ class NAZARA_CORE_API NzDirectory
{ {
public: public:
NzDirectory(); NzDirectory();
NzDirectory(const NzString& dirPath); NzDirectory(const NzString& dirPath);
NzDirectory(const NzDirectory&) = delete; NzDirectory(const NzDirectory&) = delete;
NzDirectory(NzDirectory&&) = delete; ///TODO NzDirectory(NzDirectory&&) = delete; ///TODO
~NzDirectory(); ~NzDirectory();
void Close(); void Close();
@ -64,8 +64,8 @@ class NAZARA_CORE_API NzDirectory
static bool Remove(const NzString& dirPath, bool emptyDirectory = false); static bool Remove(const NzString& dirPath, bool emptyDirectory = false);
static bool SetCurrent(const NzString& dirPath); static bool SetCurrent(const NzString& dirPath);
NzDirectory& operator=(const NzDirectory&) = delete; NzDirectory& operator=(const NzDirectory&) = delete;
NzDirectory& operator=(NzDirectory&&) = delete; ///TODO NzDirectory& operator=(NzDirectory&&) = delete; ///TODO
private: private:
NazaraMutexAttrib(m_mutex, mutable) NazaraMutexAttrib(m_mutex, mutable)

View File

@ -34,8 +34,8 @@ class NAZARA_CORE_API NzDynLib
{ {
public: public:
NzDynLib(); NzDynLib();
NzDynLib(const NzDynLib&) = delete; NzDynLib(const NzDynLib&) = delete;
NzDynLib(NzDynLib&& lib); NzDynLib(NzDynLib&& lib);
~NzDynLib(); ~NzDynLib();
NzString GetLastError() const; NzString GetLastError() const;
@ -46,8 +46,8 @@ class NAZARA_CORE_API NzDynLib
bool Load(const NzString& libraryPath); bool Load(const NzString& libraryPath);
void Unload(); void Unload();
NzDynLib& operator=(const NzDynLib&) = delete; NzDynLib& operator=(const NzDynLib&) = delete;
NzDynLib& operator=(NzDynLib&& lib); NzDynLib& operator=(NzDynLib&& lib);
private: private:
NazaraMutexAttrib(m_mutex, mutable) NazaraMutexAttrib(m_mutex, mutable)

View File

@ -14,16 +14,16 @@ class NAZARA_CORE_API NzErrorFlags
{ {
public: public:
NzErrorFlags(nzUInt32 flags, bool replace = false); NzErrorFlags(nzUInt32 flags, bool replace = false);
NzErrorFlags(const NzErrorFlags&) = delete; NzErrorFlags(const NzErrorFlags&) = delete;
NzErrorFlags(NzErrorFlags&&) = delete; NzErrorFlags(NzErrorFlags&&) = delete;
~NzErrorFlags(); ~NzErrorFlags();
nzUInt32 GetPreviousFlags() const; nzUInt32 GetPreviousFlags() const;
void SetFlags(nzUInt32 flags, bool replace = false); void SetFlags(nzUInt32 flags, bool replace = false);
NzErrorFlags& operator=(const NzErrorFlags&) = delete; NzErrorFlags& operator=(const NzErrorFlags&) = delete;
NzErrorFlags& operator=(NzErrorFlags&&) = delete; NzErrorFlags& operator=(NzErrorFlags&&) = delete;
private: private:
nzUInt32 m_previousFlags; nzUInt32 m_previousFlags;

View File

@ -32,8 +32,8 @@ class NAZARA_CORE_API NzFile : public NzHashable, public NzInputStream
NzFile(); NzFile();
NzFile(const NzString& filePath); NzFile(const NzString& filePath);
NzFile(const NzString& filePath, unsigned int openMode); NzFile(const NzString& filePath, unsigned int openMode);
NzFile(const NzFile&) = delete; NzFile(const NzFile&) = delete;
NzFile(NzFile&& file) noexcept; NzFile(NzFile&& file) noexcept;
~NzFile(); ~NzFile();
bool Copy(const NzString& newFilePath); bool Copy(const NzString& newFilePath);
@ -76,8 +76,8 @@ class NAZARA_CORE_API NzFile : public NzHashable, public NzInputStream
bool Write(const NzString& string); bool Write(const NzString& string);
std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count); std::size_t Write(const void* buffer, std::size_t typeSize, unsigned int count);
NzFile& operator=(const NzString& filePath); NzFile& operator=(const NzString& filePath);
NzFile& operator=(const NzFile&) = delete; NzFile& operator=(const NzFile&) = delete;
NzFile& operator=(NzFile&& file) noexcept; NzFile& operator=(NzFile&& file) noexcept;
static NzString AbsolutePath(const NzString& filePath); static NzString AbsolutePath(const NzString& filePath);

View File

@ -17,14 +17,14 @@ class NAZARA_CORE_API NzHash
public: public:
NzHash(nzHash hash); NzHash(nzHash hash);
NzHash(NzAbstractHash* hashImpl); NzHash(NzAbstractHash* hashImpl);
NzHash(const NzHash&) = delete; NzHash(const NzHash&) = delete;
NzHash(NzHash&&) = delete; ///TODO NzHash(NzHash&&) = delete; ///TODO
~NzHash(); ~NzHash();
NzHashDigest Hash(const NzHashable& hashable); NzHashDigest Hash(const NzHashable& hashable);
NzHash& operator=(const NzHash&) = delete; NzHash& operator=(const NzHash&) = delete;
NzHash& operator=(NzHash&&) = delete; ///TODO NzHash& operator=(NzHash&&) = delete; ///TODO
private: private:
NzAbstractHash* m_impl; NzAbstractHash* m_impl;

View File

@ -49,12 +49,12 @@ class NAZARA_CORE_API NzLog
private: private:
NzLog(); NzLog();
NzLog(const NzLog&) = delete; NzLog(const NzLog&) = delete;
NzLog(NzLog&&) = delete; NzLog(NzLog&&) = delete;
~NzLog(); ~NzLog();
NzLog& operator=(const NzLog&) = delete; NzLog& operator=(const NzLog&) = delete;
NzLog& operator=(NzLog&&) = delete; NzLog& operator=(NzLog&&) = delete;
NazaraMutexAttrib(m_mutex, mutable) NazaraMutexAttrib(m_mutex, mutable)

View File

@ -17,16 +17,16 @@ class NAZARA_CORE_API NzMutex
public: public:
NzMutex(); NzMutex();
NzMutex(const NzMutex&) = delete; NzMutex(const NzMutex&) = delete;
NzMutex(NzMutex&&) = delete; ///TODO NzMutex(NzMutex&&) = delete; ///TODO
~NzMutex(); ~NzMutex();
void Lock(); void Lock();
bool TryLock(); bool TryLock();
void Unlock(); void Unlock();
NzMutex& operator=(const NzMutex&) = delete; NzMutex& operator=(const NzMutex&) = delete;
NzMutex& operator=(NzMutex&&) = delete; ///TODO NzMutex& operator=(NzMutex&&) = delete; ///TODO
private: private:
NzMutexImpl* m_impl; NzMutexImpl* m_impl;

View File

@ -15,8 +15,8 @@ class NAZARA_CORE_API NzSemaphore
{ {
public: public:
NzSemaphore(unsigned int count); NzSemaphore(unsigned int count);
NzSemaphore(const NzSemaphore&) = delete; NzSemaphore(const NzSemaphore&) = delete;
NzSemaphore(NzSemaphore&&) = delete; ///TODO NzSemaphore(NzSemaphore&&) = delete; ///TODO
~NzSemaphore(); ~NzSemaphore();
unsigned int GetCount() const; unsigned int GetCount() const;
@ -26,8 +26,8 @@ class NAZARA_CORE_API NzSemaphore
void Wait(); void Wait();
bool Wait(nzUInt32 timeout); bool Wait(nzUInt32 timeout);
NzSemaphore& operator=(const NzSemaphore&) = delete; NzSemaphore& operator=(const NzSemaphore&) = delete;
NzSemaphore& operator=(NzSemaphore&&) = delete; ///TODO NzSemaphore& operator=(NzSemaphore&&) = delete; ///TODO
private: private:
NzSemaphoreImpl* m_impl; NzSemaphoreImpl* m_impl;

View File

@ -56,40 +56,40 @@ template<typename... Args>
template<typename O> template<typename O>
typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(O& object, void (O::*method) (Args...)) typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(O& object, void (O::*method) (Args...))
{ {
return Connect([&object, method] (Args&&... args) return Connect([&object, method] (Args&&... args)
{ {
return (object .* method) (std::forward<Args>(args)...); return (object .* method) (std::forward<Args>(args)...);
}); });
} }
template<typename... Args> template<typename... Args>
template<typename O> template<typename O>
typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(O* object, void (O::*method)(Args...)) typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(O* object, void (O::*method)(Args...))
{ {
return Connect([object, method] (Args&&... args) return Connect([object, method] (Args&&... args)
{ {
return (object ->* method) (std::forward<Args>(args)...); return (object ->* method) (std::forward<Args>(args)...);
}); });
} }
template<typename... Args> template<typename... Args>
template<typename O> template<typename O>
typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(const O& object, void (O::*method) (Args...) const) typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(const O& object, void (O::*method) (Args...) const)
{ {
return Connect([&object, method] (Args&&... args) return Connect([&object, method] (Args&&... args)
{ {
return (object .* method) (std::forward<Args>(args)...); return (object .* method) (std::forward<Args>(args)...);
}); });
} }
template<typename... Args> template<typename... Args>
template<typename O> template<typename O>
typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(const O* object, void (O::*method)(Args...) const) typename NzSignal<Args...>::Connection NzSignal<Args...>::Connect(const O* object, void (O::*method)(Args...) const)
{ {
return Connect([object, method] (Args&&... args) return Connect([object, method] (Args&&... args)
{ {
return (object ->* method) (std::forward<Args>(args)...); return (object ->* method) (std::forward<Args>(args)...);
}); });
} }
template<typename... Args> template<typename... Args>

View File

@ -22,8 +22,8 @@ class NAZARA_CORE_API NzThread
template<typename F> NzThread(F function); template<typename F> NzThread(F function);
template<typename F, typename... Args> NzThread(F function, Args&&... args); template<typename F, typename... Args> NzThread(F function, Args&&... args);
template<typename C> NzThread(void (C::*function)(), C* object); template<typename C> NzThread(void (C::*function)(), C* object);
NzThread(const NzThread&) = delete; NzThread(const NzThread&) = delete;
NzThread(NzThread&& other); NzThread(NzThread&& other);
~NzThread(); ~NzThread();
void Detach(); void Detach();
@ -31,8 +31,8 @@ class NAZARA_CORE_API NzThread
bool IsJoinable() const; bool IsJoinable() const;
void Join(); void Join();
NzThread& operator=(const NzThread&) = delete; NzThread& operator=(const NzThread&) = delete;
NzThread& operator=(NzThread&& thread); NzThread& operator=(NzThread&& thread);
static unsigned int HardwareConcurrency(); static unsigned int HardwareConcurrency();
static void Sleep(nzUInt32 milliseconds); static void Sleep(nzUInt32 milliseconds);

View File

@ -30,8 +30,8 @@ class NAZARA_GRAPHICS_API NzAbstractRenderQueue
struct SpotLight; struct SpotLight;
NzAbstractRenderQueue() = default; NzAbstractRenderQueue() = default;
NzAbstractRenderQueue(const NzAbstractRenderQueue&) = delete; NzAbstractRenderQueue(const NzAbstractRenderQueue&) = delete;
NzAbstractRenderQueue(NzAbstractRenderQueue&&) = default; NzAbstractRenderQueue(NzAbstractRenderQueue&&) = default;
virtual ~NzAbstractRenderQueue(); virtual ~NzAbstractRenderQueue();
// Je ne suis vraiment pas fan du nombre de surcharges pour AddBillboards, // Je ne suis vraiment pas fan du nombre de surcharges pour AddBillboards,
@ -54,8 +54,8 @@ class NAZARA_GRAPHICS_API NzAbstractRenderQueue
virtual void Clear(bool fully = false); virtual void Clear(bool fully = false);
NzAbstractRenderQueue& operator=(const NzAbstractRenderQueue&) = delete; NzAbstractRenderQueue& operator=(const NzAbstractRenderQueue&) = delete;
NzAbstractRenderQueue& operator=(NzAbstractRenderQueue&&) = default; NzAbstractRenderQueue& operator=(NzAbstractRenderQueue&&) = default;
struct DirectionalLight struct DirectionalLight
{ {

View File

@ -22,8 +22,8 @@ class NAZARA_GRAPHICS_API NzAbstractRenderTechnique
{ {
public: public:
NzAbstractRenderTechnique(); NzAbstractRenderTechnique();
NzAbstractRenderTechnique(const NzAbstractRenderTechnique&) = delete; NzAbstractRenderTechnique(const NzAbstractRenderTechnique&) = delete;
NzAbstractRenderTechnique(NzAbstractRenderTechnique&&) = default; NzAbstractRenderTechnique(NzAbstractRenderTechnique&&) = default;
virtual ~NzAbstractRenderTechnique(); virtual ~NzAbstractRenderTechnique();
virtual bool Draw(const NzSceneData& sceneData) const = 0; virtual bool Draw(const NzSceneData& sceneData) const = 0;
@ -36,8 +36,8 @@ class NAZARA_GRAPHICS_API NzAbstractRenderTechnique
virtual bool IsInstancingEnabled() const; virtual bool IsInstancingEnabled() const;
NzAbstractRenderTechnique& operator=(const NzAbstractRenderTechnique&) = delete; NzAbstractRenderTechnique& operator=(const NzAbstractRenderTechnique&) = delete;
NzAbstractRenderTechnique& operator=(NzAbstractRenderTechnique&&) = default; NzAbstractRenderTechnique& operator=(NzAbstractRenderTechnique&&) = default;
protected: protected:
bool m_instancingEnabled; bool m_instancingEnabled;

View File

@ -30,8 +30,8 @@ class NAZARA_GRAPHICS_API NzInstancedRenderable : public NzRefCounted
struct InstanceData; struct InstanceData;
NzInstancedRenderable() = default; NzInstancedRenderable() = default;
inline NzInstancedRenderable(const NzInstancedRenderable& renderable); inline NzInstancedRenderable(const NzInstancedRenderable& renderable);
NzInstancedRenderable(NzInstancedRenderable&& renderable) = delete; NzInstancedRenderable(NzInstancedRenderable&& renderable) = delete;
virtual ~NzInstancedRenderable(); virtual ~NzInstancedRenderable();
inline void EnsureBoundingVolumeUpdated() const; inline void EnsureBoundingVolumeUpdated() const;
@ -44,7 +44,7 @@ class NAZARA_GRAPHICS_API NzInstancedRenderable : public NzRefCounted
virtual void UpdateData(InstanceData* instanceData) const; virtual void UpdateData(InstanceData* instanceData) const;
inline NzInstancedRenderable& operator=(const NzInstancedRenderable& renderable); inline NzInstancedRenderable& operator=(const NzInstancedRenderable& renderable);
NzInstancedRenderable& operator=(NzInstancedRenderable&& renderable) = delete; NzInstancedRenderable& operator=(NzInstancedRenderable&& renderable) = delete;
// Signals: // Signals:
NazaraSignal(OnInstancedRenderableInvalidateData, const NzInstancedRenderable* /*instancedRenderable*/, nzUInt32 /*flags*/); NazaraSignal(OnInstancedRenderableInvalidateData, const NzInstancedRenderable* /*instancedRenderable*/, nzUInt32 /*flags*/);

View File

@ -19,17 +19,17 @@ class NAZARA_GRAPHICS_API NzRenderable
public: public:
NzRenderable() = default; NzRenderable() = default;
NzRenderable(const NzRenderable& renderable) = default; NzRenderable(const NzRenderable& renderable) = default;
NzRenderable(NzRenderable&&) = default; NzRenderable(NzRenderable&&) = default;
virtual ~NzRenderable(); virtual ~NzRenderable();
virtual void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const = 0; virtual void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const = 0;
virtual bool Cull(const NzFrustumf& frustum, const NzMatrix4f& transformMatrix) const; virtual bool Cull(const NzFrustumf& frustum, const NzMatrix4f& transformMatrix) const;
inline void EnsureBoundingVolumeUpdated() const; inline void EnsureBoundingVolumeUpdated() const;
virtual const NzBoundingVolumef& GetBoundingVolume() const; virtual const NzBoundingVolumef& GetBoundingVolume() const;
virtual void UpdateBoundingVolume(const NzMatrix4f& transformMatrix); virtual void UpdateBoundingVolume(const NzMatrix4f& transformMatrix);
NzRenderable& operator=(const NzRenderable& renderable) = default; NzRenderable& operator=(const NzRenderable& renderable) = default;
NzRenderable& operator=(NzRenderable&& renderable) = default; NzRenderable& operator=(NzRenderable&& renderable) = default;
protected: protected:
virtual void MakeBoundingVolume() const = 0; virtual void MakeBoundingVolume() const = 0;

View File

@ -28,8 +28,8 @@ class NAZARA_LUA_API NzLuaInstance
{ {
public: public:
NzLuaInstance(); NzLuaInstance();
NzLuaInstance(const NzLuaInstance&) = delete; NzLuaInstance(const NzLuaInstance&) = delete;
NzLuaInstance(NzLuaInstance&&) = delete; ///TODO NzLuaInstance(NzLuaInstance&&) = delete; ///TODO
~NzLuaInstance(); ~NzLuaInstance();
void ArgCheck(bool condition, unsigned int argNum, const char* error); void ArgCheck(bool condition, unsigned int argNum, const char* error);
@ -149,8 +149,8 @@ class NAZARA_LUA_API NzLuaInstance
void* ToUserdata(int index, const char* tname) const; void* ToUserdata(int index, const char* tname) const;
void* ToUserdata(int index, const NzString& tname) const; void* ToUserdata(int index, const NzString& tname) const;
NzLuaInstance& operator=(const NzLuaInstance&) = delete; NzLuaInstance& operator=(const NzLuaInstance&) = delete;
NzLuaInstance& operator=(NzLuaInstance&&) = delete; ///TODO NzLuaInstance& operator=(NzLuaInstance&&) = delete; ///TODO
static int GetIndexOfUpValue(int upValue); static int GetIndexOfUpValue(int upValue);
static NzLuaInstance* GetInstance(lua_State* state); static NzLuaInstance* GetInstance(lua_State* state);

View File

@ -160,7 +160,7 @@ void NzLuaInstance::PushFunction(R(*func)(Args...))
PushFunction([func](NzLuaInstance& instance) -> int PushFunction([func](NzLuaInstance& instance) -> int
{ {
NzLuaImplFunctionProxy<Args...> handler(instance); NzLuaImplFunctionProxy<Args...> handler(instance);
handler.ProcessArgs(); handler.ProcessArgs();
return handler.Invoke(func); return handler.Invoke(func);
}); });

View File

@ -12,12 +12,12 @@
class NAZARA_NOISE_API NzAbstract2DNoise : public NzMappedNoiseBase class NAZARA_NOISE_API NzAbstract2DNoise : public NzMappedNoiseBase
{ {
public: public:
virtual ~NzAbstract2DNoise(); virtual ~NzAbstract2DNoise();
float GetBasicValue(float x, float y); float GetBasicValue(float x, float y);
float GetMappedValue(float x, float y); float GetMappedValue(float x, float y);
virtual float GetValue(float x, float y, float resolution) = 0; virtual float GetValue(float x, float y, float resolution) = 0;
}; };
#endif // NAZARA_ABSTRACT2DNOISE_HPP #endif // NAZARA_ABSTRACT2DNOISE_HPP

View File

@ -12,12 +12,12 @@
class NAZARA_NOISE_API NzAbstract3DNoise : public NzMappedNoiseBase class NAZARA_NOISE_API NzAbstract3DNoise : public NzMappedNoiseBase
{ {
public: public:
virtual ~NzAbstract3DNoise(); virtual ~NzAbstract3DNoise();
float GetBasicValue(float x, float y, float z); float GetBasicValue(float x, float y, float z);
float GetMappedValue(float x, float y, float z); float GetMappedValue(float x, float y, float z);
virtual float GetValue(float x, float y, float z, float resolution) = 0; virtual float GetValue(float x, float y, float z, float resolution) = 0;
}; };
#endif // NAZARA_ABSTRACT3DNOISE_HPP #endif // NAZARA_ABSTRACT3DNOISE_HPP

View File

@ -12,12 +12,12 @@
class NAZARA_NOISE_API NzAbstract4DNoise : public NzMappedNoiseBase class NAZARA_NOISE_API NzAbstract4DNoise : public NzMappedNoiseBase
{ {
public: public:
virtual ~NzAbstract4DNoise(); virtual ~NzAbstract4DNoise();
float GetBasicValue(float x, float y, float z, float w); float GetBasicValue(float x, float y, float z, float w);
float GetMappedValue(float x, float y, float z, float w); float GetMappedValue(float x, float y, float z, float w);
virtual float GetValue(float x, float y, float z, float w, float resolution) = 0; virtual float GetValue(float x, float y, float z, float w, float resolution) = 0;
}; };
#endif // NAZARA_ABSTRACT4DNOISE_HPP #endif // NAZARA_ABSTRACT4DNOISE_HPP

View File

@ -12,26 +12,27 @@
class NAZARA_NOISE_API NzComplexNoiseBase class NAZARA_NOISE_API NzComplexNoiseBase
{ {
public: public:
NzComplexNoiseBase(); NzComplexNoiseBase();
~NzComplexNoiseBase() = default; ~NzComplexNoiseBase() = default;
float GetHurstParameter() const; float GetHurstParameter() const;
float GetLacunarity() const; float GetLacunarity() const;
float GetOctaveNumber() const; float GetOctaveNumber() const;
void SetHurstParameter(float h); void SetHurstParameter(float h);
void SetLacunarity(float lacunarity); void SetLacunarity(float lacunarity);
void SetOctavesNumber(float octaves); void SetOctavesNumber(float octaves);
void RecomputeExponentArray(); void RecomputeExponentArray();
protected: protected:
float m_lacunarity; float m_lacunarity;
float m_hurst; float m_hurst;
float m_octaves; float m_octaves;
std::array<float, 30> m_exponent_array; std::array<float, 30> m_exponent_array;
float m_sum; float m_sum;
private:
bool m_parametersModified; private:
bool m_parametersModified;
}; };
#endif // COMPLEXNOISEBASE_HPP #endif // COMPLEXNOISEBASE_HPP

View File

@ -13,16 +13,16 @@
class NAZARA_NOISE_API NzFBM2D : public NzAbstract2DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzFBM2D : public NzAbstract2DNoise, public NzComplexNoiseBase
{ {
public: public:
NzFBM2D(nzNoises source, unsigned int seed); NzFBM2D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float resolution); float GetValue(float x, float y, float resolution);
~NzFBM2D(); ~NzFBM2D();
protected:
private: private:
NzAbstract2DNoise* m_source; NzAbstract2DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // FBM2D_HPP #endif // FBM2D_HPP

View File

@ -13,16 +13,16 @@
class NAZARA_NOISE_API NzFBM3D : public NzAbstract3DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzFBM3D : public NzAbstract3DNoise, public NzComplexNoiseBase
{ {
public: public:
NzFBM3D(nzNoises source, unsigned int seed); NzFBM3D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float z, float resolution); float GetValue(float x, float y, float z, float resolution);
~NzFBM3D(); ~NzFBM3D();
protected:
private: private:
NzAbstract3DNoise* m_source; NzAbstract3DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // FBM3D_HPP #endif // FBM3D_HPP

View File

@ -13,16 +13,16 @@
class NAZARA_NOISE_API NzFBM4D : public NzAbstract4DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzFBM4D : public NzAbstract4DNoise, public NzComplexNoiseBase
{ {
public: public:
NzFBM4D(nzNoises source, unsigned int seed); NzFBM4D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float z, float w, float resolution); float GetValue(float x, float y, float z, float w, float resolution);
~NzFBM4D(); ~NzFBM4D();
protected:
private: private:
NzAbstract4DNoise* m_source; NzAbstract4DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // FBM4D_HPP #endif // FBM4D_HPP

View File

@ -13,19 +13,19 @@
class NAZARA_NOISE_API NzHybridMultiFractal3D : public NzAbstract3DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzHybridMultiFractal3D : public NzAbstract3DNoise, public NzComplexNoiseBase
{ {
public: public:
NzHybridMultiFractal3D(nzNoises source, unsigned int seed); NzHybridMultiFractal3D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float z, float resolution); float GetValue(float x, float y, float z, float resolution);
~NzHybridMultiFractal3D(); ~NzHybridMultiFractal3D();
protected: protected:
private: private:
NzAbstract3DNoise* m_source; NzAbstract3DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
float m_offset; float m_offset;
float m_weight; float m_weight;
float m_signal; float m_signal;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // HYBRIDMULTIFRACTAL3D_HPP #endif // HYBRIDMULTIFRACTAL3D_HPP

View File

@ -13,19 +13,19 @@
class NAZARA_NOISE_API NzHybridMultiFractal4D : public NzAbstract4DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzHybridMultiFractal4D : public NzAbstract4DNoise, public NzComplexNoiseBase
{ {
public: public:
NzHybridMultiFractal4D(nzNoises source, unsigned int seed); NzHybridMultiFractal4D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float z, float w, float resolution); float GetValue(float x, float y, float z, float w, float resolution);
~NzHybridMultiFractal4D(); ~NzHybridMultiFractal4D();
protected: protected:
private: private:
NzAbstract4DNoise* m_source; NzAbstract4DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
float m_offset; float m_offset;
float m_weight; float m_weight;
float m_signal; float m_signal;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // HYBRIDMULTIFRACTAL4D_HPP #endif // HYBRIDMULTIFRACTAL4D_HPP

View File

@ -13,19 +13,19 @@
class NAZARA_NOISE_API NzHybridMultiFractal2D : public NzAbstract2DNoise, public NzComplexNoiseBase class NAZARA_NOISE_API NzHybridMultiFractal2D : public NzAbstract2DNoise, public NzComplexNoiseBase
{ {
public: public:
NzHybridMultiFractal2D(nzNoises source, unsigned int seed); NzHybridMultiFractal2D(nzNoises source, unsigned int seed);
float GetValue(float x, float y, float resolution); float GetValue(float x, float y, float resolution);
~NzHybridMultiFractal2D(); ~NzHybridMultiFractal2D();
protected:
private: private:
NzAbstract2DNoise* m_source; NzAbstract2DNoise* m_source;
float m_value; float m_value;
float m_remainder; float m_remainder;
float m_offset; float m_offset;
float m_weight; float m_weight;
float m_signal; float m_signal;
nzNoises m_noiseType; nzNoises m_noiseType;
}; };
#endif // HYBRIDMULTIFRACTAL2D_HPP #endif // HYBRIDMULTIFRACTAL2D_HPP

View File

@ -12,20 +12,20 @@
class NAZARA_NOISE_API NzMappedNoiseBase : public NzNoiseBase class NAZARA_NOISE_API NzMappedNoiseBase : public NzNoiseBase
{ {
public: public:
NzMappedNoiseBase(); NzMappedNoiseBase();
~NzMappedNoiseBase() = default; ~NzMappedNoiseBase() = default;
float GetGain() const; float GetGain() const;
float GetOffset() const; float GetOffset() const;
float GetResolution() const; float GetResolution() const;
void SetGain(float gain); void SetGain(float gain);
void SetOffset(float offset); void SetOffset(float offset);
void SetResolution(float resolution); void SetResolution(float resolution);
protected: protected:
float m_gain; float m_gain;
float m_offset; float m_offset;
float m_resolution; float m_resolution;
}; };
#endif // NAZARA_MAPPEDNOISEBASE_HPP #endif // NAZARA_MAPPEDNOISEBASE_HPP

View File

@ -12,31 +12,31 @@
enum nzNoises enum nzNoises
{ {
PERLIN, PERLIN,
SIMPLEX, SIMPLEX,
CELL CELL
}; };
class NAZARA_NOISE_API NzNoiseBase class NAZARA_NOISE_API NzNoiseBase
{ {
public: public:
NzNoiseBase(unsigned int seed = 0); NzNoiseBase(unsigned int seed = 0);
~NzNoiseBase() = default; ~NzNoiseBase() = default;
void SetNewSeed(unsigned int seed); void SetNewSeed(unsigned int seed);
void ShufflePermutationTable(); void ShufflePermutationTable();
unsigned int GetUniformRandomValue(); unsigned int GetUniformRandomValue();
int fastfloor(float n); int fastfloor(float n);
int JenkinsHash(int a, int b, int c); int JenkinsHash(int a, int b, int c);
protected: protected:
unsigned int perm[512]; unsigned int perm[512];
private: private:
unsigned int Ua, Uc, Um; unsigned int Ua, Uc, Um;
unsigned int UcurrentSeed; unsigned int UcurrentSeed;
unsigned int Uprevious, Ulast; unsigned int Uprevious, Ulast;
}; };

View File

@ -14,21 +14,21 @@
class NAZARA_NOISE_API NzPerlin2D : public NzAbstract2DNoise class NAZARA_NOISE_API NzPerlin2D : public NzAbstract2DNoise
{ {
public: public:
NzPerlin2D(); NzPerlin2D();
NzPerlin2D(unsigned int seed); NzPerlin2D(unsigned int seed);
float GetValue(float x, float y, float resolution); float GetValue(float x, float y, float resolution);
~NzPerlin2D() = default; ~NzPerlin2D() = default;
protected: protected:
private: private:
int x0, y0; int x0, y0;
int gi0,gi1,gi2,gi3; int gi0,gi1,gi2,gi3;
int ii, jj; int ii, jj;
float gradient2[8][2]; float gradient2[8][2];
float s,t,u,v; float s,t,u,v;
float Cx,Cy; float Cx,Cy;
float Li1, Li2; float Li1, Li2;
NzVector2<float> temp; NzVector2<float> temp;
}; };
#endif // PERLIN2D_HPP #endif // PERLIN2D_HPP

View File

@ -14,23 +14,23 @@
class NAZARA_NOISE_API NzPerlin3D : public NzAbstract3DNoise class NAZARA_NOISE_API NzPerlin3D : public NzAbstract3DNoise
{ {
public: public:
NzPerlin3D(); NzPerlin3D();
NzPerlin3D(unsigned int seed); NzPerlin3D(unsigned int seed);
float GetValue(float x, float y, float z, float resolution); float GetValue(float x, float y, float z, float resolution);
~NzPerlin3D() = default; ~NzPerlin3D() = default;
protected: protected:
private: private:
int x0,y0,z0; int x0,y0,z0;
int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7; int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7;
int ii,jj,kk; int ii,jj,kk;
float gradient3[16][3]; float gradient3[16][3];
float Li1,Li2,Li3,Li4,Li5,Li6; float Li1,Li2,Li3,Li4,Li5,Li6;
float s[2],t[2],u[2],v[2]; float s[2],t[2],u[2],v[2];
float Cx,Cy,Cz; float Cx,Cy,Cz;
float nx,ny,nz; float nx,ny,nz;
float tmp; float tmp;
NzVector3<float> temp; NzVector3<float> temp;
}; };
#endif // PERLIN3D_HPP #endif // PERLIN3D_HPP

View File

@ -14,22 +14,22 @@
class NAZARA_NOISE_API NzPerlin4D : public NzAbstract4DNoise class NAZARA_NOISE_API NzPerlin4D : public NzAbstract4DNoise
{ {
public: public:
NzPerlin4D(); NzPerlin4D();
NzPerlin4D(unsigned int seed); NzPerlin4D(unsigned int seed);
float GetValue(float x, float y, float z, float w, float resolution); float GetValue(float x, float y, float z, float w, float resolution);
~NzPerlin4D() = default; ~NzPerlin4D() = default;
protected: protected:
private: private:
int x0,y0,z0,w0; int x0,y0,z0,w0;
int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7,gi8,gi9,gi10,gi11,gi12,gi13,gi14,gi15; int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7,gi8,gi9,gi10,gi11,gi12,gi13,gi14,gi15;
int ii,jj,kk,ll; int ii,jj,kk,ll;
float gradient4[32][4]; float gradient4[32][4];
float Li1,Li2,Li3,Li4,Li5,Li6,Li7,Li8,Li9,Li10,Li11,Li12,Li13,Li14; float Li1,Li2,Li3,Li4,Li5,Li6,Li7,Li8,Li9,Li10,Li11,Li12,Li13,Li14;
float s[4],t[4],u[4],v[4]; float s[4],t[4],u[4],v[4];
float Cx,Cy,Cz,Cw; float Cx,Cy,Cz,Cw;
float tmp; float tmp;
NzVector4<float> temp; NzVector4<float> temp;
}; };
#endif // PERLIN4D_HPP #endif // PERLIN4D_HPP

View File

@ -14,24 +14,24 @@
class NAZARA_NOISE_API NzSimplex2D : public NzAbstract2DNoise class NAZARA_NOISE_API NzSimplex2D : public NzAbstract2DNoise
{ {
public: public:
NzSimplex2D(); NzSimplex2D();
NzSimplex2D(unsigned int seed); NzSimplex2D(unsigned int seed);
float GetValue(float x, float y, float resolution); float GetValue(float x, float y, float resolution);
virtual ~NzSimplex2D() = default; virtual ~NzSimplex2D() = default;
protected: protected:
private: private:
int ii,jj; int ii,jj;
int gi0,gi1,gi2; int gi0,gi1,gi2;
NzVector2i skewedCubeOrigin,off1; NzVector2i skewedCubeOrigin,off1;
float n1,n2,n3; float n1,n2,n3;
float c1,c2,c3; float c1,c2,c3;
float gradient2[8][2]; float gradient2[8][2];
float UnskewCoeff2D; float UnskewCoeff2D;
float SkewCoeff2D; float SkewCoeff2D;
float sum; float sum;
NzVector2<float> unskewedCubeOrigin, unskewedDistToOrigin; NzVector2<float> unskewedCubeOrigin, unskewedDistToOrigin;
NzVector2<float> d1,d2,d3; NzVector2<float> d1,d2,d3;
}; };
#endif // SIMPLEX2D_HPP #endif // SIMPLEX2D_HPP

View File

@ -14,24 +14,24 @@
class NAZARA_NOISE_API NzSimplex3D : public NzAbstract3DNoise class NAZARA_NOISE_API NzSimplex3D : public NzAbstract3DNoise
{ {
public: public:
NzSimplex3D(); NzSimplex3D();
NzSimplex3D(unsigned int seed); NzSimplex3D(unsigned int seed);
float GetValue(float x, float y, float z, float resolution); float GetValue(float x, float y, float z, float resolution);
~NzSimplex3D() = default; ~NzSimplex3D() = default;
protected: protected:
private: private:
int ii,jj,kk; int ii,jj,kk;
int gi0,gi1,gi2,gi3; int gi0,gi1,gi2,gi3;
NzVector3i skewedCubeOrigin,off1,off2; NzVector3i skewedCubeOrigin,off1,off2;
float n1,n2,n3,n4; float n1,n2,n3,n4;
float c1,c2,c3,c4; float c1,c2,c3,c4;
float gradient3[12][3]; float gradient3[12][3];
float UnskewCoeff3D; float UnskewCoeff3D;
float SkewCoeff3D; float SkewCoeff3D;
float sum; float sum;
NzVector3<float> unskewedCubeOrigin, unskewedDistToOrigin; NzVector3<float> unskewedCubeOrigin, unskewedDistToOrigin;
NzVector3<float> d1,d2,d3,d4; NzVector3<float> d1,d2,d3,d4;
}; };
#endif // SIMPLEX3D_HPP #endif // SIMPLEX3D_HPP

View File

@ -14,26 +14,26 @@
class NAZARA_NOISE_API NzSimplex4D : public NzAbstract4DNoise class NAZARA_NOISE_API NzSimplex4D : public NzAbstract4DNoise
{ {
public: public:
NzSimplex4D(); NzSimplex4D();
NzSimplex4D(unsigned int seed); NzSimplex4D(unsigned int seed);
float GetValue(float x, float y, float z, float w, float resolution); float GetValue(float x, float y, float z, float w, float resolution);
~NzSimplex4D() = default; ~NzSimplex4D() = default;
protected: protected:
private: private:
int ii,jj,kk,ll; int ii,jj,kk,ll;
int gi0,gi1,gi2,gi3,gi4; int gi0,gi1,gi2,gi3,gi4;
NzVector4i skewedCubeOrigin,off1,off2,off3; NzVector4i skewedCubeOrigin,off1,off2,off3;
int lookupTable4D[64][4]; int lookupTable4D[64][4];
int c; int c;
float n1,n2,n3,n4,n5; float n1,n2,n3,n4,n5;
float c1,c2,c3,c4,c5,c6; float c1,c2,c3,c4,c5,c6;
float gradient4[32][4]; float gradient4[32][4];
float UnskewCoeff4D; float UnskewCoeff4D;
float SkewCoeff4D; float SkewCoeff4D;
float sum; float sum;
NzVector4<float> unskewedCubeOrigin, unskewedDistToOrigin; NzVector4<float> unskewedCubeOrigin, unskewedDistToOrigin;
NzVector4<float> d1,d2,d3,d4,d5; NzVector4<float> d1,d2,d3,d4,d5;
}; };
#endif // SIMPLEX4D_H #endif // SIMPLEX4D_H

View File

@ -38,8 +38,8 @@ class NAZARA_PHYSICS_API NzPhysGeom : public NzRefCounted
{ {
public: public:
NzPhysGeom() = default; NzPhysGeom() = default;
NzPhysGeom(const NzPhysGeom&) = delete; NzPhysGeom(const NzPhysGeom&) = delete;
NzPhysGeom(NzPhysGeom&&) = delete; NzPhysGeom(NzPhysGeom&&) = delete;
virtual ~NzPhysGeom(); virtual ~NzPhysGeom();
NzBoxf ComputeAABB(const NzVector3f& translation, const NzQuaternionf& rotation, const NzVector3f& scale) const; NzBoxf ComputeAABB(const NzVector3f& translation, const NzQuaternionf& rotation, const NzVector3f& scale) const;
@ -50,8 +50,8 @@ class NAZARA_PHYSICS_API NzPhysGeom : public NzRefCounted
NewtonCollision* GetHandle(NzPhysWorld* world) const; NewtonCollision* GetHandle(NzPhysWorld* world) const;
virtual nzGeomType GetType() const = 0; virtual nzGeomType GetType() const = 0;
NzPhysGeom& operator=(const NzPhysGeom&) = delete; NzPhysGeom& operator=(const NzPhysGeom&) = delete;
NzPhysGeom& operator=(NzPhysGeom&&) = delete; NzPhysGeom& operator=(NzPhysGeom&&) = delete;
static NzPhysGeomRef Build(const NzPrimitiveList& list); static NzPhysGeomRef Build(const NzPrimitiveList& list);

View File

@ -18,8 +18,8 @@ class NAZARA_PHYSICS_API NzPhysWorld
{ {
public: public:
NzPhysWorld(); NzPhysWorld();
NzPhysWorld(const NzPhysWorld&) = delete; NzPhysWorld(const NzPhysWorld&) = delete;
NzPhysWorld(NzPhysWorld&&) = delete; ///TODO NzPhysWorld(NzPhysWorld&&) = delete; ///TODO
~NzPhysWorld(); ~NzPhysWorld();
NzVector3f GetGravity() const; NzVector3f GetGravity() const;
@ -32,8 +32,8 @@ class NAZARA_PHYSICS_API NzPhysWorld
void Step(float timestep); void Step(float timestep);
NzPhysWorld& operator=(const NzPhysWorld&) = delete; NzPhysWorld& operator=(const NzPhysWorld&) = delete;
NzPhysWorld& operator=(NzPhysWorld&&) = delete; ///TODO NzPhysWorld& operator=(NzPhysWorld&&) = delete; ///TODO
private: private:
NzVector3f m_gravity; NzVector3f m_gravity;

View File

@ -15,8 +15,8 @@ class NAZARA_RENDERER_API NzGpuQuery
{ {
public: public:
NzGpuQuery(); NzGpuQuery();
NzGpuQuery(const NzGpuQuery&) = delete; NzGpuQuery(const NzGpuQuery&) = delete;
NzGpuQuery(NzGpuQuery&&) = delete; ///TODO NzGpuQuery(NzGpuQuery&&) = delete; ///TODO
~NzGpuQuery(); ~NzGpuQuery();
void Begin(nzGpuQueryMode mode); void Begin(nzGpuQueryMode mode);
@ -29,8 +29,8 @@ class NAZARA_RENDERER_API NzGpuQuery
// Fonctions OpenGL // Fonctions OpenGL
unsigned int GetOpenGLID() const; unsigned int GetOpenGLID() const;
NzGpuQuery& operator=(const NzGpuQuery&) = delete; NzGpuQuery& operator=(const NzGpuQuery&) = delete;
NzGpuQuery& operator=(NzGpuQuery&&) = delete; ///TODO NzGpuQuery& operator=(NzGpuQuery&&) = delete; ///TODO
static bool IsModeSupported(nzGpuQueryMode mode); static bool IsModeSupported(nzGpuQueryMode mode);
static bool IsSupported(); static bool IsSupported();

View File

@ -28,8 +28,8 @@ class NAZARA_RENDERER_API NzRenderBuffer : public NzRefCounted
public: public:
NzRenderBuffer(); NzRenderBuffer();
NzRenderBuffer(const NzRenderBuffer&) = delete; NzRenderBuffer(const NzRenderBuffer&) = delete;
NzRenderBuffer(NzRenderBuffer&&) = delete; NzRenderBuffer(NzRenderBuffer&&) = delete;
~NzRenderBuffer(); ~NzRenderBuffer();
bool Create(nzPixelFormat format, unsigned int width, unsigned int height); bool Create(nzPixelFormat format, unsigned int width, unsigned int height);
@ -44,8 +44,8 @@ class NAZARA_RENDERER_API NzRenderBuffer : public NzRefCounted
bool IsValid() const; bool IsValid() const;
NzRenderBuffer& operator=(const NzRenderBuffer&) = delete; NzRenderBuffer& operator=(const NzRenderBuffer&) = delete;
NzRenderBuffer& operator=(NzRenderBuffer&&) = delete; NzRenderBuffer& operator=(NzRenderBuffer&&) = delete;
static bool IsSupported(); static bool IsSupported();
template<typename... Args> static NzRenderBufferRef New(Args&&... args); template<typename... Args> static NzRenderBufferRef New(Args&&... args);

View File

@ -26,8 +26,8 @@ class NAZARA_RENDERER_API NzRenderTexture : public NzRenderTarget
{ {
public: public:
inline NzRenderTexture(); inline NzRenderTexture();
NzRenderTexture(const NzRenderTexture&) = delete; NzRenderTexture(const NzRenderTexture&) = delete;
NzRenderTexture(NzRenderTexture&&) = delete; ///TODO NzRenderTexture(NzRenderTexture&&) = delete; ///TODO
inline ~NzRenderTexture(); inline ~NzRenderTexture();
bool AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, NzRenderBuffer* buffer); bool AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 index, NzRenderBuffer* buffer);
@ -60,8 +60,8 @@ class NAZARA_RENDERER_API NzRenderTexture : public NzRenderTarget
unsigned int GetOpenGLID() const; unsigned int GetOpenGLID() const;
bool HasContext() const override; bool HasContext() const override;
NzRenderTexture& operator=(const NzRenderTexture&) = delete; NzRenderTexture& operator=(const NzRenderTexture&) = delete;
NzRenderTexture& operator=(NzRenderTexture&&) = delete; ///TODO NzRenderTexture& operator=(NzRenderTexture&&) = delete; ///TODO
static inline void Blit(NzRenderTexture* src, NzRenderTexture* dst, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false); static inline void Blit(NzRenderTexture* src, NzRenderTexture* dst, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false);
static void Blit(NzRenderTexture* src, NzRectui srcRect, NzRenderTexture* dst, NzRectui dstRect, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false); static void Blit(NzRenderTexture* src, NzRectui srcRect, NzRenderTexture* dst, NzRectui dstRect, nzUInt32 buffers = nzRendererBuffer_Color | nzRendererBuffer_Depth | nzRendererBuffer_Stencil, bool bilinearFilter = false);

View File

@ -36,8 +36,8 @@ class NAZARA_RENDERER_API NzShader : public NzRefCounted
public: public:
NzShader(); NzShader();
NzShader(const NzShader&) = delete; NzShader(const NzShader&) = delete;
NzShader(NzShader&&) = delete; NzShader(NzShader&&) = delete;
~NzShader(); ~NzShader();
void AttachStage(nzShaderStage stage, const NzShaderStage& shaderStage); void AttachStage(nzShaderStage stage, const NzShaderStage& shaderStage);
@ -99,8 +99,8 @@ class NAZARA_RENDERER_API NzShader : public NzRefCounted
// Fonctions OpenGL // Fonctions OpenGL
unsigned int GetOpenGLID() const; unsigned int GetOpenGLID() const;
NzShader& operator=(const NzShader&) = delete; NzShader& operator=(const NzShader&) = delete;
NzShader& operator=(NzShader&&) = delete; NzShader& operator=(NzShader&&) = delete;
static bool IsStageSupported(nzShaderStage stage); static bool IsStageSupported(nzShaderStage stage);
template<typename... Args> static NzShaderRef New(Args&&... args); template<typename... Args> static NzShaderRef New(Args&&... args);

View File

@ -17,8 +17,8 @@ class NAZARA_RENDERER_API NzShaderStage
public: public:
NzShaderStage(); NzShaderStage();
NzShaderStage(nzShaderStage stage); NzShaderStage(nzShaderStage stage);
NzShaderStage(const NzShaderStage&) = delete; NzShaderStage(const NzShaderStage&) = delete;
NzShaderStage(NzShaderStage&& stage); NzShaderStage(NzShaderStage&& stage);
~NzShaderStage(); ~NzShaderStage();
bool Compile(); bool Compile();
@ -36,8 +36,8 @@ class NAZARA_RENDERER_API NzShaderStage
void SetSource(const NzString& source); void SetSource(const NzString& source);
bool SetSourceFromFile(const NzString& filePath); bool SetSourceFromFile(const NzString& filePath);
NzShaderStage& operator=(const NzShaderStage&) = delete; NzShaderStage& operator=(const NzShaderStage&) = delete;
NzShaderStage& operator=(NzShaderStage&& shader); NzShaderStage& operator=(NzShaderStage&& shader);
// Fonctions OpenGL // Fonctions OpenGL
unsigned int GetOpenGLID() const; unsigned int GetOpenGLID() const;

View File

@ -39,8 +39,8 @@ class NAZARA_RENDERER_API NzTexture : public NzAbstractImage, public NzRefCounte
NzTexture() = default; NzTexture() = default;
NzTexture(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1); NzTexture(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
explicit NzTexture(const NzImage& image); explicit NzTexture(const NzImage& image);
NzTexture(const NzTexture&) = delete; NzTexture(const NzTexture&) = delete;
NzTexture(NzTexture&&) = delete; NzTexture(NzTexture&&) = delete;
~NzTexture(); ~NzTexture();
bool Create(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1); bool Create(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
@ -103,8 +103,8 @@ class NAZARA_RENDERER_API NzTexture : public NzAbstractImage, public NzRefCounte
// Fonctions OpenGL // Fonctions OpenGL
unsigned int GetOpenGLID() const; unsigned int GetOpenGLID() const;
NzTexture& operator=(const NzTexture&) = delete; NzTexture& operator=(const NzTexture&) = delete;
NzTexture& operator=(NzTexture&&) = delete; NzTexture& operator=(NzTexture&&) = delete;
static unsigned int GetValidSize(unsigned int size); static unsigned int GetValidSize(unsigned int size);
static bool IsFormatSupported(nzPixelFormat format); static bool IsFormatSupported(nzPixelFormat format);

View File

@ -30,8 +30,8 @@ class NAZARA_UTILITY_API NzBuffer : public NzRefCounted
NzBuffer(nzBufferType type); NzBuffer(nzBufferType type);
NzBuffer(nzBufferType type, unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static); NzBuffer(nzBufferType type, unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
NzBuffer(const NzBuffer&) = delete; NzBuffer(const NzBuffer&) = delete;
NzBuffer(NzBuffer&&) = delete; NzBuffer(NzBuffer&&) = delete;
~NzBuffer(); ~NzBuffer();
bool CopyContent(const NzBuffer& buffer); bool CopyContent(const NzBuffer& buffer);
@ -57,8 +57,8 @@ class NAZARA_UTILITY_API NzBuffer : public NzRefCounted
void Unmap() const; void Unmap() const;
NzBuffer& operator=(const NzBuffer&) = delete; NzBuffer& operator=(const NzBuffer&) = delete;
NzBuffer& operator=(NzBuffer&&) = delete; NzBuffer& operator=(NzBuffer&&) = delete;
static bool IsStorageSupported(nzUInt32 storage); static bool IsStorageSupported(nzUInt32 storage);
template<typename... Args> static NzBufferRef New(Args&&... args); template<typename... Args> static NzBufferRef New(Args&&... args);

View File

@ -44,8 +44,8 @@ class NAZARA_UTILITY_API NzFont : public NzRefCounted, public NzResource
struct SizeInfo; struct SizeInfo;
NzFont(); NzFont();
NzFont(const NzFont&) = delete; NzFont(const NzFont&) = delete;
NzFont(NzFont&&) = delete; NzFont(NzFont&&) = delete;
~NzFont(); ~NzFont();
void ClearGlyphCache(); void ClearGlyphCache();
@ -82,8 +82,8 @@ class NAZARA_UTILITY_API NzFont : public NzRefCounted, public NzResource
void SetGlyphBorder(unsigned int borderSize); void SetGlyphBorder(unsigned int borderSize);
void SetMinimumStepSize(unsigned int minimumStepSize); void SetMinimumStepSize(unsigned int minimumStepSize);
NzFont& operator=(const NzFont&) = delete; NzFont& operator=(const NzFont&) = delete;
NzFont& operator=(NzFont&&) = delete; NzFont& operator=(NzFont&&) = delete;
static std::shared_ptr<NzAbstractAtlas> GetDefaultAtlas(); static std::shared_ptr<NzAbstractAtlas> GetDefaultAtlas();
static NzFont* GetDefault(); static NzFont* GetDefault();

View File

@ -43,7 +43,7 @@ class NAZARA_UTILITY_API NzGuillotineImageAtlas : public NzAbstractAtlas
struct QueuedGlyph struct QueuedGlyph
{ {
NzImage image; NzImage image;
NzRectui rect; NzRectui rect;
bool flipped; bool flipped;
}; };

View File

@ -39,8 +39,8 @@ class NAZARA_UTILITY_API NzWindow
NzWindow(); NzWindow();
NzWindow(NzVideoMode mode, const NzString& title, nzUInt32 style = nzWindowStyle_Default); NzWindow(NzVideoMode mode, const NzString& title, nzUInt32 style = nzWindowStyle_Default);
NzWindow(NzWindowHandle handle); NzWindow(NzWindowHandle handle);
NzWindow(const NzWindow&) = delete; NzWindow(const NzWindow&) = delete;
NzWindow(NzWindow&&) = delete; ///TODO NzWindow(NzWindow&&) = delete; ///TODO
virtual ~NzWindow(); virtual ~NzWindow();
void Close(); void Close();
@ -90,8 +90,8 @@ class NAZARA_UTILITY_API NzWindow
bool WaitEvent(NzEvent* event); bool WaitEvent(NzEvent* event);
NzWindow& operator=(const NzWindow&) = delete; NzWindow& operator=(const NzWindow&) = delete;
NzWindow& operator=(NzWindow&&) = delete; ///TODO NzWindow& operator=(NzWindow&&) = delete; ///TODO
protected: protected:
virtual bool OnWindowCreated(); virtual bool OnWindowCreated();

View File

@ -25,21 +25,21 @@ namespace
{ {
sf_count_t GetSize(void* user_data) sf_count_t GetSize(void* user_data)
{ {
NzInputStream* stream = static_cast<NzInputStream*>(user_data); NzInputStream* stream = static_cast<NzInputStream*>(user_data);
return stream->GetSize(); return stream->GetSize();
} }
sf_count_t Read(void* ptr, sf_count_t count, void* user_data) sf_count_t Read(void* ptr, sf_count_t count, void* user_data)
{ {
NzInputStream* stream = static_cast<NzInputStream*>(user_data); NzInputStream* stream = static_cast<NzInputStream*>(user_data);
return static_cast<sf_count_t>(stream->Read(ptr, static_cast<std::size_t>(count))); return static_cast<sf_count_t>(stream->Read(ptr, static_cast<std::size_t>(count)));
} }
sf_count_t Seek(sf_count_t offset, int whence, void* user_data) sf_count_t Seek(sf_count_t offset, int whence, void* user_data)
{ {
NzInputStream* stream = static_cast<NzInputStream*>(user_data); NzInputStream* stream = static_cast<NzInputStream*>(user_data);
switch (whence) switch (whence)
{ {
case SEEK_CUR: case SEEK_CUR:
stream->Read(nullptr, static_cast<std::size_t>(offset)); stream->Read(nullptr, static_cast<std::size_t>(offset));
break; break;
@ -54,16 +54,16 @@ namespace
default: default:
NazaraInternalError("Seek mode not handled"); NazaraInternalError("Seek mode not handled");
} }
return stream->GetCursorPos(); return stream->GetCursorPos();
} }
sf_count_t Tell(void* user_data) sf_count_t Tell(void* user_data)
{ {
NzInputStream* stream = static_cast<NzInputStream*>(user_data); NzInputStream* stream = static_cast<NzInputStream*>(user_data);
return stream->GetCursorPos(); return stream->GetCursorPos();
} }
static SF_VIRTUAL_IO callbacks = {GetSize, Seek, Read, nullptr, Tell}; static SF_VIRTUAL_IO callbacks = {GetSize, Seek, Read, nullptr, Tell};

View File

@ -121,28 +121,28 @@ nzUInt32 NzMusic::GetPlayingOffset() const
nzUInt32 NzMusic::GetSampleCount() const nzUInt32 NzMusic::GetSampleCount() const
{ {
#if NAZARA_AUDIO_SAFE #if NAZARA_AUDIO_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Music not created"); NazaraError("Music not created");
return 0; return 0;
} }
#endif #endif
return m_impl->stream->GetSampleCount(); return m_impl->stream->GetSampleCount();
} }
nzUInt32 NzMusic::GetSampleRate() const nzUInt32 NzMusic::GetSampleRate() const
{ {
#if NAZARA_AUDIO_SAFE #if NAZARA_AUDIO_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Music not created"); NazaraError("Music not created");
return 0; return 0;
} }
#endif #endif
return m_impl->stream->GetSampleRate(); return m_impl->stream->GetSampleRate();
} }
nzSoundStatus NzMusic::GetStatus() const nzSoundStatus NzMusic::GetStatus() const

View File

@ -104,7 +104,7 @@ bool NzDeferredPhongLightingPass::Process(const NzSceneData& sceneData, unsigned
{ {
m_directionalLightShader->SendColor(m_directionalLightUniforms.locations.color, light.color); m_directionalLightShader->SendColor(m_directionalLightUniforms.locations.color, light.color);
m_directionalLightShader->SendVector(m_directionalLightUniforms.locations.factors, NzVector2f(light.ambientFactor, light.diffuseFactor)); m_directionalLightShader->SendVector(m_directionalLightUniforms.locations.factors, NzVector2f(light.ambientFactor, light.diffuseFactor));
m_directionalLightShader->SendVector(m_directionalLightUniforms.locations.parameters1, NzVector4f(light.direction)); m_directionalLightShader->SendVector(m_directionalLightUniforms.locations.parameters1, NzVector4f(light.direction));
NzRenderer::DrawFullscreenQuad(); NzRenderer::DrawFullscreenQuad();
} }

View File

@ -375,8 +375,8 @@ NzDeferredRenderPass* NzDeferredRenderTechnique::ResetPass(nzRenderPassType rend
if (oldPass && !oldPass->IsEnabled()) if (oldPass && !oldPass->IsEnabled())
smartPtr->Enable(false); smartPtr->Enable(false);
SetPass(renderPass, position, smartPtr.get()); SetPass(renderPass, position, smartPtr.get());
return smartPtr.release(); return smartPtr.release();
} }
void NzDeferredRenderTechnique::SetPass(nzRenderPassType relativeTo, int position, NzDeferredRenderPass* pass) void NzDeferredRenderTechnique::SetPass(nzRenderPassType relativeTo, int position, NzDeferredRenderPass* pass)

View File

@ -15,13 +15,13 @@
namespace namespace
{ {
struct BufferData struct BufferData
{ {
NazaraSlot(NzSkeletalMesh, OnSkeletalMeshDestroy, skeletalMeshDestroySlot); NazaraSlot(NzSkeletalMesh, OnSkeletalMeshDestroy, skeletalMeshDestroySlot);
NzVertexBufferRef buffer; NzVertexBufferRef buffer;
bool updated; bool updated;
}; };
using MeshMap = std::unordered_map<const NzSkeletalMesh*, BufferData>; using MeshMap = std::unordered_map<const NzSkeletalMesh*, BufferData>;
@ -115,9 +115,9 @@ NzVertexBuffer* NzSkinningManager::GetBuffer(const NzSkeletalMesh* mesh, const N
NzVertexBuffer* buffer; NzVertexBuffer* buffer;
MeshMap& meshMap = it->second.meshMap; MeshMap& meshMap = it->second.meshMap;
MeshMap::iterator it2 = meshMap.find(mesh); MeshMap::iterator it2 = meshMap.find(mesh);
if (it2 == meshMap.end()) if (it2 == meshMap.end())
{ {
NzVertexBufferRef vertexBuffer = NzVertexBuffer::New(NzVertexDeclaration::Get(nzVertexLayout_XYZ_Normal_UV_Tangent), mesh->GetVertexCount(), nzDataStorage_Hardware, nzBufferUsage_Dynamic); NzVertexBufferRef vertexBuffer = NzVertexBuffer::New(NzVertexDeclaration::Get(nzVertexLayout_XYZ_Normal_UV_Tangent), mesh->GetVertexCount(), nzDataStorage_Hardware, nzBufferUsage_Dynamic);

View File

@ -12,10 +12,10 @@ NzAbstract2DNoise::~NzAbstract2DNoise() = default;
float NzAbstract2DNoise::GetBasicValue(float x, float y) float NzAbstract2DNoise::GetBasicValue(float x, float y)
{ {
return this->GetValue(x,y,m_resolution); return this->GetValue(x,y,m_resolution);
} }
float NzAbstract2DNoise::GetMappedValue(float x, float y) float NzAbstract2DNoise::GetMappedValue(float x, float y)
{ {
return (this->GetValue(x,y,m_resolution) + m_offset) * m_gain; return (this->GetValue(x,y,m_resolution) + m_offset) * m_gain;
} }

View File

@ -12,10 +12,10 @@ NzAbstract3DNoise::~NzAbstract3DNoise() = default;
float NzAbstract3DNoise::GetBasicValue(float x, float y, float z) float NzAbstract3DNoise::GetBasicValue(float x, float y, float z)
{ {
return this->GetValue(x,y,z,m_resolution); return this->GetValue(x,y,z,m_resolution);
} }
float NzAbstract3DNoise::GetMappedValue(float x, float y, float z) float NzAbstract3DNoise::GetMappedValue(float x, float y, float z)
{ {
return (this->GetValue(x,y,z,m_resolution) + m_offset) * m_gain ; return (this->GetValue(x,y,z,m_resolution) + m_offset) * m_gain ;
} }

View File

@ -12,10 +12,10 @@ NzAbstract4DNoise::~NzAbstract4DNoise() = default;
float NzAbstract4DNoise::GetBasicValue(float x, float y, float z, float w) float NzAbstract4DNoise::GetBasicValue(float x, float y, float z, float w)
{ {
return this->GetValue(x,y,z,w,m_resolution); return this->GetValue(x,y,z,w,m_resolution);
} }
float NzAbstract4DNoise::GetMappedValue(float x, float y, float z, float w) float NzAbstract4DNoise::GetMappedValue(float x, float y, float z, float w)
{ {
return (this->GetValue(x,y,z,w,m_resolution) + m_offset) * m_gain ; return (this->GetValue(x,y,z,w,m_resolution) + m_offset) * m_gain ;
} }

View File

@ -10,71 +10,71 @@
NzComplexNoiseBase::NzComplexNoiseBase() NzComplexNoiseBase::NzComplexNoiseBase()
{ {
m_parametersModified = true; m_parametersModified = true;
m_lacunarity = 5.0f; m_lacunarity = 5.0f;
m_hurst = 1.2f; m_hurst = 1.2f;
m_octaves = 3.0f; m_octaves = 3.0f;
for (int i(0) ; i < m_octaves; ++i) for (int i(0) ; i < m_octaves; ++i)
{ {
m_exponent_array[i] = 0; m_exponent_array[i] = 0;
} }
} }
float NzComplexNoiseBase::GetLacunarity() const float NzComplexNoiseBase::GetLacunarity() const
{ {
return m_lacunarity; return m_lacunarity;
} }
float NzComplexNoiseBase::GetHurstParameter() const float NzComplexNoiseBase::GetHurstParameter() const
{ {
return m_hurst; return m_hurst;
} }
float NzComplexNoiseBase::GetOctaveNumber() const float NzComplexNoiseBase::GetOctaveNumber() const
{ {
return m_octaves; return m_octaves;
} }
void NzComplexNoiseBase::SetLacunarity(float lacunarity) void NzComplexNoiseBase::SetLacunarity(float lacunarity)
{ {
m_lacunarity = lacunarity; m_lacunarity = lacunarity;
m_parametersModified = true; m_parametersModified = true;
} }
void NzComplexNoiseBase::SetHurstParameter(float h) void NzComplexNoiseBase::SetHurstParameter(float h)
{ {
m_hurst = h; m_hurst = h;
m_parametersModified = true; m_parametersModified = true;
} }
void NzComplexNoiseBase::SetOctavesNumber(float octaves) void NzComplexNoiseBase::SetOctavesNumber(float octaves)
{ {
if(octaves <= 30.0f) if(octaves <= 30.0f)
m_octaves = octaves; m_octaves = octaves;
else else
m_octaves = 30.0f; m_octaves = 30.0f;
m_parametersModified = true; m_parametersModified = true;
} }
void NzComplexNoiseBase::RecomputeExponentArray() void NzComplexNoiseBase::RecomputeExponentArray()
{ {
if(m_parametersModified) if(m_parametersModified)
{ {
float frequency = 1.0; float frequency = 1.0;
m_sum = 0.f; m_sum = 0.f;
for (int i(0) ; i < static_cast<int>(m_octaves) ; ++i) for (int i(0) ; i < static_cast<int>(m_octaves) ; ++i)
{ {
m_exponent_array[i] = std::pow( frequency, -m_hurst ); m_exponent_array[i] = std::pow( frequency, -m_hurst );
frequency *= m_lacunarity; frequency *= m_lacunarity;
m_sum += m_exponent_array[i]; m_sum += m_exponent_array[i];
} }
m_parametersModified = false; m_parametersModified = false;
} }
} }

View File

@ -11,41 +11,41 @@
NzFBM2D::NzFBM2D(nzNoises source, unsigned int seed) NzFBM2D::NzFBM2D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin2D(); m_source = new NzPerlin2D();
break; break;
default: default:
m_source = new NzSimplex2D(); m_source = new NzSimplex2D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzFBM2D::GetValue(float x, float y, float resolution) float NzFBM2D::GetValue(float x, float y, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_value = 0.0; m_value = 0.0;
for (int i(0); i < m_octaves; ++i) for (int i(0); i < m_octaves; ++i)
{ {
m_value += m_source->GetValue(x,y,resolution) * m_exponent_array[i]; m_value += m_source->GetValue(x,y,resolution) * m_exponent_array[i];
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if(!NzNumberEquals(m_remainder, static_cast<float>(0.0))) if(!NzNumberEquals(m_remainder, static_cast<float>(0.0)))
m_value += m_remainder * m_source->GetValue(x,y,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum; return m_value/this->m_sum;
} }
NzFBM2D::~NzFBM2D() NzFBM2D::~NzFBM2D()
{ {
delete m_source; delete m_source;
} }

View File

@ -11,41 +11,41 @@
NzFBM3D::NzFBM3D(nzNoises source, unsigned int seed) NzFBM3D::NzFBM3D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin3D(); m_source = new NzPerlin3D();
break; break;
default: default:
m_source = new NzSimplex3D(); m_source = new NzSimplex3D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzFBM3D::GetValue(float x, float y, float z, float resolution) float NzFBM3D::GetValue(float x, float y, float z, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_value = 0.0; m_value = 0.0;
for (int i(0); i < m_octaves; ++i) for (int i(0); i < m_octaves; ++i)
{ {
m_value += m_source->GetValue(x,y,z,resolution) * m_exponent_array[i]; m_value += m_source->GetValue(x,y,z,resolution) * m_exponent_array[i];
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if(!NzNumberEquals(m_remainder, static_cast<float>(0.0))) if(!NzNumberEquals(m_remainder, static_cast<float>(0.0)))
m_value += m_remainder * m_source->GetValue(x,y,z,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,z,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum; return m_value/this->m_sum;
} }
NzFBM3D::~NzFBM3D() NzFBM3D::~NzFBM3D()
{ {
delete m_source; delete m_source;
} }

View File

@ -11,41 +11,41 @@
NzFBM4D::NzFBM4D(nzNoises source, unsigned int seed) NzFBM4D::NzFBM4D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin4D(); m_source = new NzPerlin4D();
break; break;
default: default:
m_source = new NzSimplex4D(); m_source = new NzSimplex4D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzFBM4D::GetValue(float x, float y, float z, float w, float resolution) float NzFBM4D::GetValue(float x, float y, float z, float w, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_value = 0.0; m_value = 0.0;
for (int i(0); i < m_octaves; ++i) for (int i(0); i < m_octaves; ++i)
{ {
m_value += m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[i]; m_value += m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[i];
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if(!NzNumberEquals(m_remainder, static_cast<float>(0.0))) if(!NzNumberEquals(m_remainder, static_cast<float>(0.0)))
m_value += m_remainder * m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum; return m_value/this->m_sum;
} }
NzFBM4D::~NzFBM4D() NzFBM4D::~NzFBM4D()
{ {
delete m_source; delete m_source;
} }

View File

@ -11,54 +11,54 @@
NzHybridMultiFractal3D::NzHybridMultiFractal3D(nzNoises source, unsigned int seed) NzHybridMultiFractal3D::NzHybridMultiFractal3D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin3D(); m_source = new NzPerlin3D();
break; break;
default: default:
m_source = new NzSimplex3D(); m_source = new NzSimplex3D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzHybridMultiFractal3D::GetValue(float x, float y, float z, float resolution) float NzHybridMultiFractal3D::GetValue(float x, float y, float z, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_offset = 1.0f; m_offset = 1.0f;
m_value = (m_source->GetValue(x,y,z,resolution) + m_offset) * m_exponent_array[0]; m_value = (m_source->GetValue(x,y,z,resolution) + m_offset) * m_exponent_array[0];
m_weight = m_value; m_weight = m_value;
m_signal = 0.f; m_signal = 0.f;
resolution *= m_lacunarity; resolution *= m_lacunarity;
for(int i(1) ; i < m_octaves; ++i) for(int i(1) ; i < m_octaves; ++i)
{ {
if (m_weight > 1.f) if (m_weight > 1.f)
m_weight = 1.f; m_weight = 1.f;
m_signal = (m_source->GetValue(x,y,z,resolution) + m_offset) * m_exponent_array[i]; m_signal = (m_source->GetValue(x,y,z,resolution) + m_offset) * m_exponent_array[i];
m_value += m_weight * m_signal; m_value += m_weight * m_signal;
m_weight *= m_signal; m_weight *= m_signal;
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if (m_remainder > 0.f) if (m_remainder > 0.f)
m_value += m_remainder * m_source->GetValue(x,y,z,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,z,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum - m_offset; return m_value/this->m_sum - m_offset;
} }
NzHybridMultiFractal3D::~NzHybridMultiFractal3D() NzHybridMultiFractal3D::~NzHybridMultiFractal3D()
{ {
delete m_source; delete m_source;
} }

View File

@ -11,54 +11,54 @@
NzHybridMultiFractal4D::NzHybridMultiFractal4D(nzNoises source, unsigned int seed) NzHybridMultiFractal4D::NzHybridMultiFractal4D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin4D(); m_source = new NzPerlin4D();
break; break;
default: default:
m_source = new NzSimplex4D(); m_source = new NzSimplex4D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzHybridMultiFractal4D::GetValue(float x, float y, float z, float w, float resolution) float NzHybridMultiFractal4D::GetValue(float x, float y, float z, float w, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_offset = 1.0f; m_offset = 1.0f;
m_value = (m_source->GetValue(x,y,z,w,resolution) + m_offset) * m_exponent_array[0]; m_value = (m_source->GetValue(x,y,z,w,resolution) + m_offset) * m_exponent_array[0];
m_weight = m_value; m_weight = m_value;
m_signal = 0.f; m_signal = 0.f;
resolution *= m_lacunarity; resolution *= m_lacunarity;
for(int i(1) ; i < m_octaves; ++i) for(int i(1) ; i < m_octaves; ++i)
{ {
if (m_weight > 1.f) if (m_weight > 1.f)
m_weight = 1.f; m_weight = 1.f;
m_signal = (m_source->GetValue(x,y,z,w,resolution) + m_offset) * m_exponent_array[i]; m_signal = (m_source->GetValue(x,y,z,w,resolution) + m_offset) * m_exponent_array[i];
m_value += m_weight * m_signal; m_value += m_weight * m_signal;
m_weight *= m_signal; m_weight *= m_signal;
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if (m_remainder > 0.f) if (m_remainder > 0.f)
m_value += m_remainder * m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,z,w,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum - m_offset; return m_value/this->m_sum - m_offset;
} }
NzHybridMultiFractal4D::~NzHybridMultiFractal4D() NzHybridMultiFractal4D::~NzHybridMultiFractal4D()
{ {
delete m_source; delete m_source;
} }

View File

@ -11,54 +11,54 @@
NzHybridMultiFractal2D::NzHybridMultiFractal2D(nzNoises source, unsigned int seed) NzHybridMultiFractal2D::NzHybridMultiFractal2D(nzNoises source, unsigned int seed)
{ {
switch(source) switch(source)
{ {
case PERLIN: case PERLIN:
m_source = new NzPerlin2D(); m_source = new NzPerlin2D();
break; break;
default: default:
m_source = new NzSimplex2D(); m_source = new NzSimplex2D();
break; break;
} }
m_source->SetNewSeed(seed); m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable(); m_source->ShufflePermutationTable();
m_noiseType = source; m_noiseType = source;
} }
float NzHybridMultiFractal2D::GetValue(float x, float y, float resolution) float NzHybridMultiFractal2D::GetValue(float x, float y, float resolution)
{ {
this->RecomputeExponentArray(); this->RecomputeExponentArray();
m_offset = 1.0f; m_offset = 1.0f;
m_value = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[0]; m_value = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[0];
m_weight = m_value; m_weight = m_value;
m_signal = 0.f; m_signal = 0.f;
resolution *= m_lacunarity; resolution *= m_lacunarity;
for(int i(1) ; i < m_octaves; ++i) for(int i(1) ; i < m_octaves; ++i)
{ {
if (m_weight > 1.f) if (m_weight > 1.f)
m_weight = 1.f; m_weight = 1.f;
m_signal = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[i]; m_signal = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[i];
m_value += m_weight * m_signal; m_value += m_weight * m_signal;
m_weight *= m_signal; m_weight *= m_signal;
resolution *= m_lacunarity; resolution *= m_lacunarity;
} }
m_remainder = m_octaves - static_cast<int>(m_octaves); m_remainder = m_octaves - static_cast<int>(m_octaves);
if (m_remainder > 0.f) if (m_remainder > 0.f)
m_value += m_remainder * m_source->GetValue(x,y,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)]; m_value += m_remainder * m_source->GetValue(x,y,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
return m_value/this->m_sum - m_offset; return m_value/this->m_sum - m_offset;
} }
NzHybridMultiFractal2D::~NzHybridMultiFractal2D() NzHybridMultiFractal2D::~NzHybridMultiFractal2D()
{ {
delete m_source; delete m_source;
} }

View File

@ -17,37 +17,37 @@ NzMappedNoiseBase::NzMappedNoiseBase() : m_gain(1.f), m_offset(0.f), m_resolutio
float NzMappedNoiseBase::GetGain() const float NzMappedNoiseBase::GetGain() const
{ {
return m_gain; return m_gain;
} }
float NzMappedNoiseBase::GetOffset() const float NzMappedNoiseBase::GetOffset() const
{ {
return m_offset; return m_offset;
} }
float NzMappedNoiseBase::GetResolution() const float NzMappedNoiseBase::GetResolution() const
{ {
return m_resolution; return m_resolution;
} }
void NzMappedNoiseBase::SetGain(float gain) void NzMappedNoiseBase::SetGain(float gain)
{ {
m_gain = gain; m_gain = gain;
} }
void NzMappedNoiseBase::SetOffset(float offset) void NzMappedNoiseBase::SetOffset(float offset)
{ {
m_offset = offset; m_offset = offset;
} }
void NzMappedNoiseBase::SetResolution(float resolution) void NzMappedNoiseBase::SetResolution(float resolution)
{ {
if (NzNumberEquals(resolution, 0.f)) if (NzNumberEquals(resolution, 0.f))
{ {
NzStringStream ss; NzStringStream ss;
ss << __FILE__ << ':' << __LINE__ << " : resolution cannot be 0.0f"; ss << __FILE__ << ':' << __LINE__ << " : resolution cannot be 0.0f";
throw std::domain_error(ss.ToString()); throw std::domain_error(ss.ToString());
} }
m_resolution = resolution; m_resolution = resolution;
} }

View File

@ -9,68 +9,68 @@
NzNoiseBase::NzNoiseBase(unsigned int seed) NzNoiseBase::NzNoiseBase(unsigned int seed)
{ {
Ua = 16807; Ua = 16807;
Uc = 0; Uc = 0;
Um = 2147483647; Um = 2147483647;
UcurrentSeed = 0; UcurrentSeed = 0;
Uprevious = 0; Uprevious = 0;
SetNewSeed(seed); SetNewSeed(seed);
for(int i(0) ; i < 512 ; i++) for(int i(0) ; i < 512 ; i++)
perm[i] = i & 255; perm[i] = i & 255;
} }
void NzNoiseBase::SetNewSeed(unsigned int seed) void NzNoiseBase::SetNewSeed(unsigned int seed)
{ {
Uprevious = seed; Uprevious = seed;
UcurrentSeed = seed; UcurrentSeed = seed;
} }
unsigned int NzNoiseBase::GetUniformRandomValue() unsigned int NzNoiseBase::GetUniformRandomValue()
{ {
Ulast = Ua*Uprevious + Uc%Um; Ulast = Ua*Uprevious + Uc%Um;
Uprevious = Ulast; Uprevious = Ulast;
return Ulast; return Ulast;
} }
void NzNoiseBase::ShufflePermutationTable() void NzNoiseBase::ShufflePermutationTable()
{ {
int xchanger; int xchanger;
unsigned int ncase; unsigned int ncase;
for(unsigned int i(0) ; i < 256 ; i++) for(unsigned int i(0) ; i < 256 ; i++)
perm[i] = i; perm[i] = i;
for(unsigned int j(0) ; j < 20 ; ++j) for(unsigned int j(0) ; j < 20 ; ++j)
for (unsigned int i(0); i < 256 ; ++i) for (unsigned int i(0); i < 256 ; ++i)
{ {
ncase = this->GetUniformRandomValue() & 255; ncase = this->GetUniformRandomValue() & 255;
xchanger = perm[i]; xchanger = perm[i];
perm[i] = perm[ncase]; perm[i] = perm[ncase];
perm[ncase] = xchanger; perm[ncase] = xchanger;
} }
for(unsigned int i(256) ; i < 512; ++i) for(unsigned int i(256) ; i < 512; ++i)
perm[i] = perm[i & 255]; perm[i] = perm[i & 255];
} }
int NzNoiseBase::fastfloor(float n) int NzNoiseBase::fastfloor(float n)
{ {
return (n >= 0) ? static_cast<int>(n) : static_cast<int>(n-1); return (n >= 0) ? static_cast<int>(n) : static_cast<int>(n-1);
} }
int NzNoiseBase::JenkinsHash(int a, int b, int c) int NzNoiseBase::JenkinsHash(int a, int b, int c)
{ {
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 13); a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 13);
b = b-c; b = b - a; b = b^(a << 8); b = b-c; b = b - a; b = b^(a << 8);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 13); c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 13);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 12); a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 12);
b = b-c; b = b - a; b = b^(a << 16); b = b-c; b = b - a; b = b^(a << 16);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 5); c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 5);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 3); a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 3);
b = b-c; b = b - a; b = b^(a << 10); b = b-c; b = b - a; b = b^(a << 10);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 15); c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 15);
return c; return c;
} }

View File

@ -9,7 +9,7 @@
NzPerlin2D::NzPerlin2D() NzPerlin2D::NzPerlin2D()
{ {
float grad2Temp[][2] = { float grad2Temp[][2] = {
{1.f,1.f}, {1.f,1.f},
{-1.f,1.f}, {-1.f,1.f},
{1.f,-1.f}, {1.f,-1.f},
@ -21,52 +21,52 @@ NzPerlin2D::NzPerlin2D()
{0.f,-1.f} {0.f,-1.f}
}; };
for(int i(0) ; i < 8 ; ++i) for(int i(0) ; i < 8 ; ++i)
for(int j(0) ; j < 2 ; ++j) for(int j(0) ; j < 2 ; ++j)
gradient2[i][j] = grad2Temp[i][j]; gradient2[i][j] = grad2Temp[i][j];
} }
NzPerlin2D::NzPerlin2D(unsigned int seed) : NzPerlin2D() NzPerlin2D::NzPerlin2D(unsigned int seed) : NzPerlin2D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzPerlin2D::GetValue(float x, float y, float resolution) float NzPerlin2D::GetValue(float x, float y, float resolution)
{ {
x *= resolution; x *= resolution;
y *= resolution; y *= resolution;
x0 = fastfloor(x); x0 = fastfloor(x);
y0 = fastfloor(y); y0 = fastfloor(y);
ii = x0 & 255; ii = x0 & 255;
jj = y0 & 255; jj = y0 & 255;
gi0 = perm[ii + perm[jj]] & 7; gi0 = perm[ii + perm[jj]] & 7;
gi1 = perm[ii + 1 + perm[jj]] & 7; gi1 = perm[ii + 1 + perm[jj]] & 7;
gi2 = perm[ii + perm[jj + 1]] & 7; gi2 = perm[ii + perm[jj + 1]] & 7;
gi3 = perm[ii + 1 + perm[jj + 1]] & 7; gi3 = perm[ii + 1 + perm[jj + 1]] & 7;
temp.x = x-x0; temp.x = x-x0;
temp.y = y-y0; temp.y = y-y0;
Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10); Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10);
Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10); Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10);
s = gradient2[gi0][0]*temp.x + gradient2[gi0][1]*temp.y; s = gradient2[gi0][0]*temp.x + gradient2[gi0][1]*temp.y;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t = gradient2[gi1][0]*temp.x + gradient2[gi1][1]*temp.y; t = gradient2[gi1][0]*temp.x + gradient2[gi1][1]*temp.y;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v = gradient2[gi3][0]*temp.x + gradient2[gi3][1]*temp.y; v = gradient2[gi3][0]*temp.x + gradient2[gi3][1]*temp.y;
temp.x = x-x0; temp.x = x-x0;
u = gradient2[gi2][0]*temp.x + gradient2[gi2][1]*temp.y; u = gradient2[gi2][0]*temp.x + gradient2[gi2][1]*temp.y;
Li1 = s + Cx*(t-s); Li1 = s + Cx*(t-s);
Li2 = u + Cx*(v-u); Li2 = u + Cx*(v-u);
return Li1 + Cy*(Li2-Li1); return Li1 + Cy*(Li2-Li1);
} }

View File

@ -9,87 +9,87 @@
NzPerlin3D::NzPerlin3D() NzPerlin3D::NzPerlin3D()
{ {
float grad3Temp[][3] = { float grad3Temp[][3] = {
{1,1,0},{-1,1,0},{1,-1,0},{-1,-1,0}, {1,1,0},{-1,1,0},{1,-1,0},{-1,-1,0},
{1,0,1},{-1,0,1},{1,0,-1},{-1,0,-1}, {1,0,1},{-1,0,1},{1,0,-1},{-1,0,-1},
{0,1,1},{0,-1,1},{0,1,-1},{0,-1,-1}, {0,1,1},{0,-1,1},{0,1,-1},{0,-1,-1},
{1,1,0},{-1,1,0},{0,-1,1},{0,-1,-1} {1,1,0},{-1,1,0},{0,-1,1},{0,-1,-1}
}; };
for(int i(0) ; i < 16 ; ++i) for(int i(0) ; i < 16 ; ++i)
for(int j(0) ; j < 3 ; ++j) for(int j(0) ; j < 3 ; ++j)
gradient3[i][j] = grad3Temp[i][j]; gradient3[i][j] = grad3Temp[i][j];
} }
NzPerlin3D::NzPerlin3D(unsigned int seed) : NzPerlin3D() NzPerlin3D::NzPerlin3D(unsigned int seed) : NzPerlin3D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzPerlin3D::GetValue(float x, float y, float z, float resolution) float NzPerlin3D::GetValue(float x, float y, float z, float resolution)
{ {
x /= resolution; x /= resolution;
y /= resolution; y /= resolution;
z /= resolution; z /= resolution;
x0 = fastfloor(x); x0 = fastfloor(x);
y0 = fastfloor(y); y0 = fastfloor(y);
z0 = fastfloor(z); z0 = fastfloor(z);
ii = x0 & 255; ii = x0 & 255;
jj = y0 & 255; jj = y0 & 255;
kk = z0 & 255; kk = z0 & 255;
gi0 = perm[ii + perm[jj + perm[kk]]] & 15; gi0 = perm[ii + perm[jj + perm[kk]]] & 15;
gi1 = perm[ii + 1 + perm[jj + perm[kk]]] & 15; gi1 = perm[ii + 1 + perm[jj + perm[kk]]] & 15;
gi2 = perm[ii + perm[jj + 1 + perm[kk]]] & 15; gi2 = perm[ii + perm[jj + 1 + perm[kk]]] & 15;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk]]] & 15; gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk]]] & 15;
gi4 = perm[ii + perm[jj + perm[kk + 1]]] & 15; gi4 = perm[ii + perm[jj + perm[kk + 1]]] & 15;
gi5 = perm[ii + 1 + perm[jj + perm[kk + 1]]] & 15; gi5 = perm[ii + 1 + perm[jj + perm[kk + 1]]] & 15;
gi6 = perm[ii + perm[jj + 1 + perm[kk + 1]]] & 15; gi6 = perm[ii + perm[jj + 1 + perm[kk + 1]]] & 15;
gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]] & 15; gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]] & 15;
temp.x = x-x0; temp.x = x-x0;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-z0; temp.z = z-z0;
Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10); Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10);
Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10); Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10);
Cz = temp.z * temp.z * temp.z * (temp.z * (temp.z * 6 - 15) + 10); Cz = temp.z * temp.z * temp.z * (temp.z * (temp.z * 6 - 15) + 10);
s[0] = gradient3[gi0][0]*temp.x + gradient3[gi0][1]*temp.y + gradient3[gi0][2]*temp.z; s[0] = gradient3[gi0][0]*temp.x + gradient3[gi0][1]*temp.y + gradient3[gi0][2]*temp.z;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[0] = gradient3[gi1][0]*temp.x + gradient3[gi1][1]*temp.y + gradient3[gi1][2]*temp.z; t[0] = gradient3[gi1][0]*temp.x + gradient3[gi1][1]*temp.y + gradient3[gi1][2]*temp.z;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[0] = gradient3[gi3][0]*temp.x + gradient3[gi3][1]*temp.y + gradient3[gi3][2]*temp.z; v[0] = gradient3[gi3][0]*temp.x + gradient3[gi3][1]*temp.y + gradient3[gi3][2]*temp.z;
temp.x = x-x0; temp.x = x-x0;
u[0] = gradient3[gi2][0]*temp.x + gradient3[gi2][1]*temp.y + gradient3[gi2][2]*temp.z; u[0] = gradient3[gi2][0]*temp.x + gradient3[gi2][1]*temp.y + gradient3[gi2][2]*temp.z;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-(z0+1); temp.z = z-(z0+1);
s[1] = gradient3[gi4][0]*temp.x + gradient3[gi4][1]*temp.y + gradient3[gi4][2]*temp.z; s[1] = gradient3[gi4][0]*temp.x + gradient3[gi4][1]*temp.y + gradient3[gi4][2]*temp.z;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[1] = gradient3[gi5][0]*temp.x + gradient3[gi5][1]*temp.y + gradient3[gi5][2]*temp.z; t[1] = gradient3[gi5][0]*temp.x + gradient3[gi5][1]*temp.y + gradient3[gi5][2]*temp.z;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[1] = gradient3[gi7][0]*temp.x + gradient3[gi7][1]*temp.y + gradient3[gi7][2]*temp.z; v[1] = gradient3[gi7][0]*temp.x + gradient3[gi7][1]*temp.y + gradient3[gi7][2]*temp.z;
temp.x = x-x0; temp.x = x-x0;
u[1] = gradient3[gi6][0]*temp.x + gradient3[gi6][1]*temp.y + gradient3[gi6][2]*temp.z; u[1] = gradient3[gi6][0]*temp.x + gradient3[gi6][1]*temp.y + gradient3[gi6][2]*temp.z;
Li1 = s[0] + Cx*(t[0]-s[0]); Li1 = s[0] + Cx*(t[0]-s[0]);
Li2 = u[0] + Cx*(v[0]-u[0]); Li2 = u[0] + Cx*(v[0]-u[0]);
Li3 = s[1] + Cx*(t[1]-s[1]); Li3 = s[1] + Cx*(t[1]-s[1]);
Li4 = u[1] + Cx*(v[1]-u[1]); Li4 = u[1] + Cx*(v[1]-u[1]);
Li5 = Li1 + Cy*(Li2-Li1); Li5 = Li1 + Cy*(Li2-Li1);
Li6 = Li3 + Cy*(Li4-Li3); Li6 = Li3 + Cy*(Li4-Li3);
return Li5 + Cz*(Li6-Li5); return Li5 + Cz*(Li6-Li5);
} }

View File

@ -9,145 +9,145 @@
NzPerlin4D::NzPerlin4D() NzPerlin4D::NzPerlin4D()
{ {
float grad4Temp[][4] = float grad4Temp[][4] =
{ {
{0,1,1,1}, {0,1,1,-1}, {0,1,-1,1}, {0,1,-1,-1}, {0,1,1,1}, {0,1,1,-1}, {0,1,-1,1}, {0,1,-1,-1},
{0,-1,1,1},{0,-1,1,-1},{0,-1,-1,1},{0,-1,-1,-1}, {0,-1,1,1},{0,-1,1,-1},{0,-1,-1,1},{0,-1,-1,-1},
{1,0,1,1}, {1,0,1,-1}, {1,0,-1,1}, {1,0,-1,-1}, {1,0,1,1}, {1,0,1,-1}, {1,0,-1,1}, {1,0,-1,-1},
{-1,0,1,1},{-1,0,1,-1},{-1,0,-1,1},{-1,0,-1,-1}, {-1,0,1,1},{-1,0,1,-1},{-1,0,-1,1},{-1,0,-1,-1},
{1,1,0,1}, {1,1,0,-1}, {1,-1,0,1}, {1,-1,0,-1}, {1,1,0,1}, {1,1,0,-1}, {1,-1,0,1}, {1,-1,0,-1},
{-1,1,0,1},{-1,1,0,-1},{-1,-1,0,1},{-1,-1,0,-1}, {-1,1,0,1},{-1,1,0,-1},{-1,-1,0,1},{-1,-1,0,-1},
{1,1,1,0}, {1,1,-1,0}, {1,-1,1,0}, {1,-1,-1,0}, {1,1,1,0}, {1,1,-1,0}, {1,-1,1,0}, {1,-1,-1,0},
{-1,1,1,0},{-1,1,-1,0},{-1,-1,1,0},{-1,-1,-1,0} {-1,1,1,0},{-1,1,-1,0},{-1,-1,1,0},{-1,-1,-1,0}
}; };
for(int i(0) ; i < 32 ; ++i) for(int i(0) ; i < 32 ; ++i)
for(int j(0) ; j < 4 ; ++j) for(int j(0) ; j < 4 ; ++j)
gradient4[i][j] = grad4Temp[i][j]; gradient4[i][j] = grad4Temp[i][j];
} }
NzPerlin4D::NzPerlin4D(unsigned int seed) : NzPerlin4D() NzPerlin4D::NzPerlin4D(unsigned int seed) : NzPerlin4D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzPerlin4D::GetValue(float x, float y, float z, float w, float resolution) float NzPerlin4D::GetValue(float x, float y, float z, float w, float resolution)
{ {
x *= resolution; x *= resolution;
y *= resolution; y *= resolution;
z *= resolution; z *= resolution;
w *= resolution; w *= resolution;
x0 = fastfloor(x); x0 = fastfloor(x);
y0 = fastfloor(y); y0 = fastfloor(y);
z0 = fastfloor(z); z0 = fastfloor(z);
w0 = fastfloor(w); w0 = fastfloor(w);
ii = x0 & 255; ii = x0 & 255;
jj = y0 & 255; jj = y0 & 255;
kk = z0 & 255; kk = z0 & 255;
ll = w0 & 255; ll = w0 & 255;
gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] & 31; gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] & 31;
gi1 = perm[ii + 1 + perm[jj + perm[kk + perm[ll]]]] & 31; gi1 = perm[ii + 1 + perm[jj + perm[kk + perm[ll]]]] & 31;
gi2 = perm[ii + perm[jj + 1 + perm[kk + perm[ll]]]] & 31; gi2 = perm[ii + perm[jj + 1 + perm[kk + perm[ll]]]] & 31;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll]]]] & 31; gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll]]]] & 31;
gi4 = perm[ii + perm[jj + + perm[kk + 1 + perm[ll]]]] & 31; gi4 = perm[ii + perm[jj + + perm[kk + 1 + perm[ll]]]] & 31;
gi5 = perm[ii + 1 + perm[jj + + perm[kk + 1 + perm[ll]]]] & 31; gi5 = perm[ii + 1 + perm[jj + + perm[kk + 1 + perm[ll]]]] & 31;
gi6 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll]]]] & 31; gi6 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll]]]] & 31;
gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll]]]] & 31; gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll]]]] & 31;
gi8 = perm[ii + perm[jj + perm[kk + perm[ll + 1]]]] & 31; gi8 = perm[ii + perm[jj + perm[kk + perm[ll + 1]]]] & 31;
gi9 = perm[ii + 1 + perm[jj + perm[kk + perm[ll + 1]]]] & 31; gi9 = perm[ii + 1 + perm[jj + perm[kk + perm[ll + 1]]]] & 31;
gi10 = perm[ii + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31; gi10 = perm[ii + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31;
gi11 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31; gi11 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31;
gi12 = perm[ii + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31; gi12 = perm[ii + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi13 = perm[ii + 1 + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31; gi13 = perm[ii + 1 + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi14 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31; gi14 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi15 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31; gi15 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
temp.x = x-x0; temp.x = x-x0;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-z0; temp.z = z-z0;
temp.w = w-w0; temp.w = w-w0;
Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10); Cx = temp.x * temp.x * temp.x * (temp.x * (temp.x * 6 - 15) + 10);
Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10); Cy = temp.y * temp.y * temp.y * (temp.y * (temp.y * 6 - 15) + 10);
Cz = temp.z * temp.z * temp.z * (temp.z * (temp.z * 6 - 15) + 10); Cz = temp.z * temp.z * temp.z * (temp.z * (temp.z * 6 - 15) + 10);
Cw = temp.w * temp.w * temp.w * (temp.w * (temp.w * 6 - 15) + 10); Cw = temp.w * temp.w * temp.w * (temp.w * (temp.w * 6 - 15) + 10);
s[0] = gradient4[gi0][0]*temp.x + gradient4[gi0][1]*temp.y + gradient4[gi0][2]*temp.z + gradient4[gi0][3]*temp.w; s[0] = gradient4[gi0][0]*temp.x + gradient4[gi0][1]*temp.y + gradient4[gi0][2]*temp.z + gradient4[gi0][3]*temp.w;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[0] = gradient4[gi1][0]*temp.x + gradient4[gi1][1]*temp.y + gradient4[gi1][2]*temp.z + gradient4[gi1][3]*temp.w; t[0] = gradient4[gi1][0]*temp.x + gradient4[gi1][1]*temp.y + gradient4[gi1][2]*temp.z + gradient4[gi1][3]*temp.w;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[0] = gradient4[gi3][0]*temp.x + gradient4[gi3][1]*temp.y + gradient4[gi3][2]*temp.z + gradient4[gi3][3]*temp.w; v[0] = gradient4[gi3][0]*temp.x + gradient4[gi3][1]*temp.y + gradient4[gi3][2]*temp.z + gradient4[gi3][3]*temp.w;
temp.x = x-x0; temp.x = x-x0;
u[0] = gradient4[gi2][0]*temp.x + gradient4[gi2][1]*temp.y + gradient4[gi2][2]*temp.z + gradient4[gi2][3]*temp.w; u[0] = gradient4[gi2][0]*temp.x + gradient4[gi2][1]*temp.y + gradient4[gi2][2]*temp.z + gradient4[gi2][3]*temp.w;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-(z0+1); temp.z = z-(z0+1);
s[1] = gradient4[gi4][0]*temp.x + gradient4[gi4][1]*temp.y + gradient4[gi4][2]*temp.z + gradient4[gi4][3]*temp.w; s[1] = gradient4[gi4][0]*temp.x + gradient4[gi4][1]*temp.y + gradient4[gi4][2]*temp.z + gradient4[gi4][3]*temp.w;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[1] = gradient4[gi5][0]*temp.x + gradient4[gi5][1]*temp.y + gradient4[gi5][2]*temp.z + gradient4[gi5][3]*temp.w; t[1] = gradient4[gi5][0]*temp.x + gradient4[gi5][1]*temp.y + gradient4[gi5][2]*temp.z + gradient4[gi5][3]*temp.w;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[1] = gradient4[gi7][0]*temp.x + gradient4[gi7][1]*temp.y + gradient4[gi7][2]*temp.z + gradient4[gi7][3]*temp.w; v[1] = gradient4[gi7][0]*temp.x + gradient4[gi7][1]*temp.y + gradient4[gi7][2]*temp.z + gradient4[gi7][3]*temp.w;
temp.x = x-x0; temp.x = x-x0;
u[1] = gradient4[gi6][0]*temp.x + gradient4[gi6][1]*temp.y + gradient4[gi6][2]*temp.z + gradient4[gi6][3]*temp.w; u[1] = gradient4[gi6][0]*temp.x + gradient4[gi6][1]*temp.y + gradient4[gi6][2]*temp.z + gradient4[gi6][3]*temp.w;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-z0; temp.z = z-z0;
temp.w = w-(w0+1); temp.w = w-(w0+1);
s[2] = gradient4[gi8][0]*temp.x + gradient4[gi8][1]*temp.y + gradient4[gi8][2]*temp.z + gradient4[gi8][3]*temp.w; s[2] = gradient4[gi8][0]*temp.x + gradient4[gi8][1]*temp.y + gradient4[gi8][2]*temp.z + gradient4[gi8][3]*temp.w;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[2] = gradient4[gi9][0]*temp.x + gradient4[gi9][1]*temp.y + gradient4[gi9][2]*temp.z + gradient4[gi9][3]*temp.w; t[2] = gradient4[gi9][0]*temp.x + gradient4[gi9][1]*temp.y + gradient4[gi9][2]*temp.z + gradient4[gi9][3]*temp.w;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[2] = gradient4[gi11][0]*temp.x + gradient4[gi11][1]*temp.y + gradient4[gi11][2]*temp.z + gradient4[gi11][3]*temp.w; v[2] = gradient4[gi11][0]*temp.x + gradient4[gi11][1]*temp.y + gradient4[gi11][2]*temp.z + gradient4[gi11][3]*temp.w;
temp.x = x-x0; temp.x = x-x0;
u[2] = gradient4[gi10][0]*temp.x + gradient4[gi10][1]*temp.y + gradient4[gi10][2]*temp.z + gradient4[gi10][3]*temp.w; u[2] = gradient4[gi10][0]*temp.x + gradient4[gi10][1]*temp.y + gradient4[gi10][2]*temp.z + gradient4[gi10][3]*temp.w;
temp.y = y-y0; temp.y = y-y0;
temp.z = z-(z0+1); temp.z = z-(z0+1);
s[3] = gradient4[gi12][0]*temp.x + gradient4[gi12][1]*temp.y + gradient4[gi12][2]*temp.z + gradient4[gi12][3]*temp.w; s[3] = gradient4[gi12][0]*temp.x + gradient4[gi12][1]*temp.y + gradient4[gi12][2]*temp.z + gradient4[gi12][3]*temp.w;
temp.x = x-(x0+1); temp.x = x-(x0+1);
t[3] = gradient4[gi13][0]*temp.x + gradient4[gi13][1]*temp.y + gradient4[gi13][2]*temp.z + gradient4[gi13][3]*temp.w; t[3] = gradient4[gi13][0]*temp.x + gradient4[gi13][1]*temp.y + gradient4[gi13][2]*temp.z + gradient4[gi13][3]*temp.w;
temp.y = y-(y0+1); temp.y = y-(y0+1);
v[3] = gradient4[gi15][0]*temp.x + gradient4[gi15][1]*temp.y + gradient4[gi15][2]*temp.z + gradient4[gi15][3]*temp.w; v[3] = gradient4[gi15][0]*temp.x + gradient4[gi15][1]*temp.y + gradient4[gi15][2]*temp.z + gradient4[gi15][3]*temp.w;
temp.x = x-x0; temp.x = x-x0;
u[3] = gradient4[gi14][0]*temp.x + gradient4[gi14][1]*temp.y + gradient4[gi14][2]*temp.z + gradient4[gi14][3]*temp.w; u[3] = gradient4[gi14][0]*temp.x + gradient4[gi14][1]*temp.y + gradient4[gi14][2]*temp.z + gradient4[gi14][3]*temp.w;
Li1 = s[0] + Cx*(t[0]-s[0]); Li1 = s[0] + Cx*(t[0]-s[0]);
Li2 = u[0] + Cx*(v[0]-u[0]); Li2 = u[0] + Cx*(v[0]-u[0]);
Li3 = s[1] + Cx*(t[1]-s[1]); Li3 = s[1] + Cx*(t[1]-s[1]);
Li4 = u[1] + Cx*(v[1]-u[1]); Li4 = u[1] + Cx*(v[1]-u[1]);
Li5 = s[2] + Cx*(t[2]-s[2]); Li5 = s[2] + Cx*(t[2]-s[2]);
Li6 = u[2] + Cx*(v[2]-u[2]); Li6 = u[2] + Cx*(v[2]-u[2]);
Li7 = s[3] + Cx*(t[3]-s[3]); Li7 = s[3] + Cx*(t[3]-s[3]);
Li8 = u[3] + Cx*(v[3]-u[3]); Li8 = u[3] + Cx*(v[3]-u[3]);
Li9 = Li1 + Cy*(Li2-Li1); Li9 = Li1 + Cy*(Li2-Li1);
Li10 = Li3 + Cy*(Li4-Li3); Li10 = Li3 + Cy*(Li4-Li3);
Li11 = Li5 + Cy*(Li6-Li5); Li11 = Li5 + Cy*(Li6-Li5);
Li12 = Li7 + Cy*(Li8-Li7); Li12 = Li7 + Cy*(Li8-Li7);
Li13 = Li9 + Cz*(Li10-Li9); Li13 = Li9 + Cz*(Li10-Li9);
Li14 = Li11 + Cz*(Li12-Li11); Li14 = Li11 + Cz*(Li12-Li11);
return Li13 + Cw*(Li14-Li13); return Li13 + Cw*(Li14-Li13);
} }

View File

@ -9,83 +9,83 @@
NzSimplex2D::NzSimplex2D() NzSimplex2D::NzSimplex2D()
{ {
float grad2Temp[][2] = {{1,1},{-1,1},{1,-1},{-1,-1}, float grad2Temp[][2] = {{1,1},{-1,1},{1,-1},{-1,-1},
{1,0},{-1,0},{0,1},{0,-1}}; {1,0},{-1,0},{0,1},{0,-1}};
for(int i(0) ; i < 8 ; ++i) for(int i(0) ; i < 8 ; ++i)
for(int j(0) ; j < 2 ; ++j) for(int j(0) ; j < 2 ; ++j)
gradient2[i][j] = grad2Temp[i][j]; gradient2[i][j] = grad2Temp[i][j];
SkewCoeff2D = 0.5f*(std::sqrt(3.f) - 1.f); SkewCoeff2D = 0.5f*(std::sqrt(3.f) - 1.f);
UnskewCoeff2D = (3.f-std::sqrt(3.f))/6.f; UnskewCoeff2D = (3.f-std::sqrt(3.f))/6.f;
} }
NzSimplex2D::NzSimplex2D(unsigned int seed) : NzSimplex2D() NzSimplex2D::NzSimplex2D(unsigned int seed) : NzSimplex2D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzSimplex2D::GetValue(float x, float y, float resolution) float NzSimplex2D::GetValue(float x, float y, float resolution)
{ {
x *= resolution; x *= resolution;
y *= resolution; y *= resolution;
sum = (x + y) * SkewCoeff2D; sum = (x + y) * SkewCoeff2D;
skewedCubeOrigin.x = fastfloor(x + sum); skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum); skewedCubeOrigin.y = fastfloor(y + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y) * UnskewCoeff2D; sum = (skewedCubeOrigin.x + skewedCubeOrigin.y) * UnskewCoeff2D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum; unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
unskewedCubeOrigin.y = skewedCubeOrigin.y - sum; unskewedCubeOrigin.y = skewedCubeOrigin.y - sum;
unskewedDistToOrigin.x = x - unskewedCubeOrigin.x; unskewedDistToOrigin.x = x - unskewedCubeOrigin.x;
unskewedDistToOrigin.y = y - unskewedCubeOrigin.y; unskewedDistToOrigin.y = y - unskewedCubeOrigin.y;
if(unskewedDistToOrigin.x > unskewedDistToOrigin.y) if(unskewedDistToOrigin.x > unskewedDistToOrigin.y)
{ {
off1.x = 1; off1.x = 1;
off1.y = 0; off1.y = 0;
} }
else else
{ {
off1.x = 0; off1.x = 0;
off1.y = 1; off1.y = 1;
} }
d1 = - unskewedDistToOrigin; d1 = - unskewedDistToOrigin;
d2.x = d1.x + off1.x - UnskewCoeff2D; d2.x = d1.x + off1.x - UnskewCoeff2D;
d2.y = d1.y + off1.y - UnskewCoeff2D; d2.y = d1.y + off1.y - UnskewCoeff2D;
d3.x = d1.x + 1.f - 2.f * UnskewCoeff2D; d3.x = d1.x + 1.f - 2.f * UnskewCoeff2D;
d3.y = d1.y + 1.f - 2.f * UnskewCoeff2D; d3.y = d1.y + 1.f - 2.f * UnskewCoeff2D;
ii = skewedCubeOrigin.x & 255; ii = skewedCubeOrigin.x & 255;
jj = skewedCubeOrigin.y & 255; jj = skewedCubeOrigin.y & 255;
gi0 = perm[ii + perm[jj ]] & 7; gi0 = perm[ii + perm[jj ]] & 7;
gi1 = perm[ii + off1.x + perm[jj + off1.y]] & 7; gi1 = perm[ii + off1.x + perm[jj + off1.y]] & 7;
gi2 = perm[ii + 1 + perm[jj + 1 ]] & 7; gi2 = perm[ii + 1 + perm[jj + 1 ]] & 7;
c1 = 0.5f - d1.x * d1.x - d1.y * d1.y; c1 = 0.5f - d1.x * d1.x - d1.y * d1.y;
c2 = 0.5f - d2.x * d2.x - d2.y * d2.y; c2 = 0.5f - d2.x * d2.x - d2.y * d2.y;
c3 = 0.5f - d3.x * d3.x - d3.y * d3.y; c3 = 0.5f - d3.x * d3.x - d3.y * d3.y;
if(c1 < 0) if(c1 < 0)
n1 = 0; n1 = 0;
else else
n1 = c1*c1*c1*c1*(gradient2[gi0][0] * d1.x + gradient2[gi0][1] * d1.y); n1 = c1*c1*c1*c1*(gradient2[gi0][0] * d1.x + gradient2[gi0][1] * d1.y);
if(c2 < 0) if(c2 < 0)
n2 = 0; n2 = 0;
else else
n2 = c2*c2*c2*c2*(gradient2[gi1][0] * d2.x + gradient2[gi1][1] * d2.y); n2 = c2*c2*c2*c2*(gradient2[gi1][0] * d2.x + gradient2[gi1][1] * d2.y);
if(c3 < 0) if(c3 < 0)
n3 = 0; n3 = 0;
else else
n3 = c3*c3*c3*c3*(gradient2[gi2][0] * d3.x + gradient2[gi2][1] * d3.y); n3 = c3*c3*c3*c3*(gradient2[gi2][0] * d3.x + gradient2[gi2][1] * d3.y);
return (n1+n2+n3)*70.f; return (n1+n2+n3)*70.f;
} }

View File

@ -9,10 +9,10 @@
NzSimplex3D::NzSimplex3D() NzSimplex3D::NzSimplex3D()
{ {
SkewCoeff3D = 1/3.f; SkewCoeff3D = 1/3.f;
UnskewCoeff3D = 1/6.f; UnskewCoeff3D = 1/6.f;
float grad3Temp[][3] = { float grad3Temp[][3] = {
{1.f,1.f,0.f}, {1.f,1.f,0.f},
{-1.f,1.f,0.f}, {-1.f,1.f,0.f},
{1.f,-1.f,0.f}, {1.f,-1.f,0.f},
@ -29,145 +29,145 @@ NzSimplex3D::NzSimplex3D()
{0.f,-1.f,-1.f} {0.f,-1.f,-1.f}
}; };
for(int i(0) ; i < 12 ; ++i) for(int i(0) ; i < 12 ; ++i)
for(int j(0) ; j < 3 ; ++j) for(int j(0) ; j < 3 ; ++j)
gradient3[i][j] = grad3Temp[i][j]; gradient3[i][j] = grad3Temp[i][j];
} }
NzSimplex3D::NzSimplex3D(unsigned int seed) : NzSimplex3D() NzSimplex3D::NzSimplex3D(unsigned int seed) : NzSimplex3D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzSimplex3D::GetValue(float x, float y, float z, float resolution) float NzSimplex3D::GetValue(float x, float y, float z, float resolution)
{ {
x *= resolution; x *= resolution;
y *= resolution; y *= resolution;
z *= resolution; z *= resolution;
sum = (x + y + z) * SkewCoeff3D; sum = (x + y + z) * SkewCoeff3D;
skewedCubeOrigin.x = fastfloor(x + sum); skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum); skewedCubeOrigin.y = fastfloor(y + sum);
skewedCubeOrigin.z = fastfloor(z + sum); skewedCubeOrigin.z = fastfloor(z + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z) * UnskewCoeff3D; sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z) * UnskewCoeff3D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum; unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
unskewedCubeOrigin.y = skewedCubeOrigin.y - sum; unskewedCubeOrigin.y = skewedCubeOrigin.y - sum;
unskewedCubeOrigin.z = skewedCubeOrigin.z - sum; unskewedCubeOrigin.z = skewedCubeOrigin.z - sum;
unskewedDistToOrigin.x = x - unskewedCubeOrigin.x; unskewedDistToOrigin.x = x - unskewedCubeOrigin.x;
unskewedDistToOrigin.y = y - unskewedCubeOrigin.y; unskewedDistToOrigin.y = y - unskewedCubeOrigin.y;
unskewedDistToOrigin.z = z - unskewedCubeOrigin.z; unskewedDistToOrigin.z = z - unskewedCubeOrigin.z;
if(unskewedDistToOrigin.x >= unskewedDistToOrigin.y) if(unskewedDistToOrigin.x >= unskewedDistToOrigin.y)
{ {
if(unskewedDistToOrigin.y >= unskewedDistToOrigin.z) if(unskewedDistToOrigin.y >= unskewedDistToOrigin.z)
{ {
off1.x = 1; off1.x = 1;
off1.y = 0; off1.y = 0;
off1.z = 0; off1.z = 0;
off2.x = 1; off2.x = 1;
off2.y = 1; off2.y = 1;
off2.z = 0; off2.z = 0;
} }
else if(unskewedDistToOrigin.x >= unskewedDistToOrigin.z) else if(unskewedDistToOrigin.x >= unskewedDistToOrigin.z)
{ {
off1.x = 1; off1.x = 1;
off1.y = 0; off1.y = 0;
off1.z = 0; off1.z = 0;
off2.x = 1; off2.x = 1;
off2.y = 0; off2.y = 0;
off2.z = 1; off2.z = 1;
} }
else else
{ {
off1.x = 0; off1.x = 0;
off1.y = 0; off1.y = 0;
off1.z = 1; off1.z = 1;
off2.x = 1; off2.x = 1;
off2.y = 0; off2.y = 0;
off2.z = 1; off2.z = 1;
} }
} }
else else
{ {
if(unskewedDistToOrigin.y < unskewedDistToOrigin.z) if(unskewedDistToOrigin.y < unskewedDistToOrigin.z)
{ {
off1.x = 0; off1.x = 0;
off1.y = 0; off1.y = 0;
off1.z = 1; off1.z = 1;
off2.x = 0; off2.x = 0;
off2.y = 1; off2.y = 1;
off2.z = 1; off2.z = 1;
} }
else if(unskewedDistToOrigin.x < unskewedDistToOrigin.z) else if(unskewedDistToOrigin.x < unskewedDistToOrigin.z)
{ {
off1.x = 0; off1.x = 0;
off1.y = 1; off1.y = 1;
off1.z = 0; off1.z = 0;
off2.x = 0; off2.x = 0;
off2.y = 1; off2.y = 1;
off2.z = 1; off2.z = 1;
} }
else else
{ {
off1.x = 0; off1.x = 0;
off1.y = 1; off1.y = 1;
off1.z = 0; off1.z = 0;
off2.x = 1; off2.x = 1;
off2.y = 1; off2.y = 1;
off2.z = 0; off2.z = 0;
} }
} }
d1 = unskewedDistToOrigin; d1 = unskewedDistToOrigin;
d2.x = d1.x - off1.x + UnskewCoeff3D; d2.x = d1.x - off1.x + UnskewCoeff3D;
d2.y = d1.y - off1.y + UnskewCoeff3D; d2.y = d1.y - off1.y + UnskewCoeff3D;
d2.z = d1.z - off1.z + UnskewCoeff3D; d2.z = d1.z - off1.z + UnskewCoeff3D;
d3.x = d1.x - off2.x + 2.f*UnskewCoeff3D; d3.x = d1.x - off2.x + 2.f*UnskewCoeff3D;
d3.y = d1.y - off2.y + 2.f*UnskewCoeff3D; d3.y = d1.y - off2.y + 2.f*UnskewCoeff3D;
d3.z = d1.z - off2.z + 2.f*UnskewCoeff3D; d3.z = d1.z - off2.z + 2.f*UnskewCoeff3D;
d4.x = d1.x - 1.f + 3.f*UnskewCoeff3D; d4.x = d1.x - 1.f + 3.f*UnskewCoeff3D;
d4.y = d1.y - 1.f + 3.f*UnskewCoeff3D; d4.y = d1.y - 1.f + 3.f*UnskewCoeff3D;
d4.z = d1.z - 1.f + 3.f*UnskewCoeff3D; d4.z = d1.z - 1.f + 3.f*UnskewCoeff3D;
ii = skewedCubeOrigin.x & 255; ii = skewedCubeOrigin.x & 255;
jj = skewedCubeOrigin.y & 255; jj = skewedCubeOrigin.y & 255;
kk = skewedCubeOrigin.z & 255; kk = skewedCubeOrigin.z & 255;
gi0 = perm[ii + perm[jj + perm[kk ]]] % 12; gi0 = perm[ii + perm[jj + perm[kk ]]] % 12;
gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z]]] % 12; gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z]]] % 12;
gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z]]] % 12; gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z]]] % 12;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 ]]] % 12; gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 ]]] % 12;
c1 = 0.6f - d1.x * d1.x - d1.y * d1.y - d1.z * d1.z; c1 = 0.6f - d1.x * d1.x - d1.y * d1.y - d1.z * d1.z;
c2 = 0.6f - d2.x * d2.x - d2.y * d2.y - d2.z * d2.z; c2 = 0.6f - d2.x * d2.x - d2.y * d2.y - d2.z * d2.z;
c3 = 0.6f - d3.x * d3.x - d3.y * d3.y - d3.z * d3.z; c3 = 0.6f - d3.x * d3.x - d3.y * d3.y - d3.z * d3.z;
c4 = 0.6f - d4.x * d4.x - d4.y * d4.y - d4.z * d4.z; c4 = 0.6f - d4.x * d4.x - d4.y * d4.y - d4.z * d4.z;
if(c1 < 0) if(c1 < 0)
n1 = 0; n1 = 0;
else else
n1 = c1*c1*c1*c1*(gradient3[gi0][0] * d1.x + gradient3[gi0][1] * d1.y + gradient3[gi0][2] * d1.z); n1 = c1*c1*c1*c1*(gradient3[gi0][0] * d1.x + gradient3[gi0][1] * d1.y + gradient3[gi0][2] * d1.z);
if(c2 < 0) if(c2 < 0)
n2 = 0; n2 = 0;
else else
n2 = c2*c2*c2*c2*(gradient3[gi1][0] * d2.x + gradient3[gi1][1] * d2.y + gradient3[gi1][2] * d2.z); n2 = c2*c2*c2*c2*(gradient3[gi1][0] * d2.x + gradient3[gi1][1] * d2.y + gradient3[gi1][2] * d2.z);
if(c3 < 0) if(c3 < 0)
n3 = 0; n3 = 0;
else else
n3 = c3*c3*c3*c3*(gradient3[gi2][0] * d3.x + gradient3[gi2][1] * d3.y + gradient3[gi2][2] * d3.z); n3 = c3*c3*c3*c3*(gradient3[gi2][0] * d3.x + gradient3[gi2][1] * d3.y + gradient3[gi2][2] * d3.z);
if(c4 < 0) if(c4 < 0)
n4 = 0; n4 = 0;
else else
n4 = c4*c4*c4*c4*(gradient3[gi3][0] * d4.x + gradient3[gi3][1] * d4.y + gradient3[gi3][2] * d4.z); n4 = c4*c4*c4*c4*(gradient3[gi3][0] * d4.x + gradient3[gi3][1] * d4.y + gradient3[gi3][2] * d4.z);
return (n1+n2+n3+n4)*32; return (n1+n2+n3+n4)*32;
} }

View File

@ -9,158 +9,158 @@
NzSimplex4D::NzSimplex4D() NzSimplex4D::NzSimplex4D()
{ {
SkewCoeff4D = (std::sqrt(5.f) - 1.f)/4.f; SkewCoeff4D = (std::sqrt(5.f) - 1.f)/4.f;
UnskewCoeff4D = (5.f - std::sqrt(5.f))/20.f; UnskewCoeff4D = (5.f - std::sqrt(5.f))/20.f;
int lookupTemp4D[][4] = int lookupTemp4D[][4] =
{ {
{0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,3,0}, {0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,3,0},
{0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,3,2,0}, {0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,3,2,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}, {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0}, {1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0},
{1,0,2,3},{1,0,3,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0}, {1,0,2,3},{1,0,3,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}, {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{2,0,1,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0}, {2,0,1,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0},
{2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},{3,2,1,0} {2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},{3,2,1,0}
}; };
for(int i(0) ; i < 64 ; ++i) for(int i(0) ; i < 64 ; ++i)
for(int j(0) ; j < 4 ; ++j) for(int j(0) ; j < 4 ; ++j)
lookupTable4D[i][j] = lookupTemp4D[i][j]; lookupTable4D[i][j] = lookupTemp4D[i][j];
float grad4Temp[][4] = float grad4Temp[][4] =
{ {
{0.f,1.f,1.f,1.f}, {0.f,1.f,1.f,-1.f}, {0.f,1.f,-1.f,1.f}, {0.f,1.f,-1.f,-1.f}, {0.f,1.f,1.f,1.f}, {0.f,1.f,1.f,-1.f}, {0.f,1.f,-1.f,1.f}, {0.f,1.f,-1.f,-1.f},
{0.f,-1.f,1.f,1.f},{0.f,-1.f,1.f,-1.f},{0.f,-1.f,-1.f,1.f},{0.f,-1.f,-1.f,-1.f}, {0.f,-1.f,1.f,1.f},{0.f,-1.f,1.f,-1.f},{0.f,-1.f,-1.f,1.f},{0.f,-1.f,-1.f,-1.f},
{1.f,0.f,1.f,1.f}, {1.f,0.f,1.f,-1.f}, {1.f,0.f,-1.f,1.f}, {1.f,0.f,-1.f,-1.f}, {1.f,0.f,1.f,1.f}, {1.f,0.f,1.f,-1.f}, {1.f,0.f,-1.f,1.f}, {1.f,0.f,-1.f,-1.f},
{-1.f,0.f,1.f,1.f},{-1.f,0.f,1.f,-1.f},{-1.f,0.f,-1.f,1.f},{-1.f,0.f,-1.f,-1.f}, {-1.f,0.f,1.f,1.f},{-1.f,0.f,1.f,-1.f},{-1.f,0.f,-1.f,1.f},{-1.f,0.f,-1.f,-1.f},
{1.f,1.f,0.f,1.f}, {1.f,1.f,0.f,-1.f}, {1.f,-1.f,0.f,1.f}, {1.f,-1.f,0.f,-1.f}, {1.f,1.f,0.f,1.f}, {1.f,1.f,0.f,-1.f}, {1.f,-1.f,0.f,1.f}, {1.f,-1.f,0.f,-1.f},
{-1.f,1.f,0.f,1.f},{-1.f,1.f,0.f,-1.f},{-1.f,-1.f,0.f,1.f},{-1.f,-1.f,0.f,-1.f}, {-1.f,1.f,0.f,1.f},{-1.f,1.f,0.f,-1.f},{-1.f,-1.f,0.f,1.f},{-1.f,-1.f,0.f,-1.f},
{1.f,1.f,1.f,0.f}, {1.f,1.f,-1.f,0.f}, {1.f,-1.f,1.f,0.f}, {1.f,-1.f,-1.f,0.f}, {1.f,1.f,1.f,0.f}, {1.f,1.f,-1.f,0.f}, {1.f,-1.f,1.f,0.f}, {1.f,-1.f,-1.f,0.f},
{-1.f,1.f,1.f,0.f},{-1.f,1.f,-1.f,0.f},{-1.f,-1.f,1.f,0.f},{-1.f,-1.f,-1.f,0.f} {-1.f,1.f,1.f,0.f},{-1.f,1.f,-1.f,0.f},{-1.f,-1.f,1.f,0.f},{-1.f,-1.f,-1.f,0.f}
}; };
for(int i(0) ; i < 32 ; ++i) for(int i(0) ; i < 32 ; ++i)
for(int j(0) ; j < 4 ; ++j) for(int j(0) ; j < 4 ; ++j)
gradient4[i][j] = grad4Temp[i][j]; gradient4[i][j] = grad4Temp[i][j];
} }
NzSimplex4D::NzSimplex4D(unsigned int seed) : NzSimplex4D() NzSimplex4D::NzSimplex4D(unsigned int seed) : NzSimplex4D()
{ {
this->SetNewSeed(seed); this->SetNewSeed(seed);
this->ShufflePermutationTable(); this->ShufflePermutationTable();
} }
float NzSimplex4D::GetValue(float x, float y, float z, float w, float resolution) float NzSimplex4D::GetValue(float x, float y, float z, float w, float resolution)
{ {
x *= resolution; x *= resolution;
y *= resolution; y *= resolution;
z *= resolution; z *= resolution;
w *= resolution; w *= resolution;
sum = (x + y + z + w) * SkewCoeff4D; sum = (x + y + z + w) * SkewCoeff4D;
skewedCubeOrigin.x = fastfloor(x + sum); skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum); skewedCubeOrigin.y = fastfloor(y + sum);
skewedCubeOrigin.z = fastfloor(z + sum); skewedCubeOrigin.z = fastfloor(z + sum);
skewedCubeOrigin.w = fastfloor(w + sum); skewedCubeOrigin.w = fastfloor(w + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z + skewedCubeOrigin.w) * UnskewCoeff4D; sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z + skewedCubeOrigin.w) * UnskewCoeff4D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum; unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
unskewedCubeOrigin.y = skewedCubeOrigin.y - sum; unskewedCubeOrigin.y = skewedCubeOrigin.y - sum;
unskewedCubeOrigin.z = skewedCubeOrigin.z - sum; unskewedCubeOrigin.z = skewedCubeOrigin.z - sum;
unskewedCubeOrigin.w = skewedCubeOrigin.w - sum; unskewedCubeOrigin.w = skewedCubeOrigin.w - sum;
unskewedDistToOrigin.x = x - unskewedCubeOrigin.x; unskewedDistToOrigin.x = x - unskewedCubeOrigin.x;
unskewedDistToOrigin.y = y - unskewedCubeOrigin.y; unskewedDistToOrigin.y = y - unskewedCubeOrigin.y;
unskewedDistToOrigin.z = z - unskewedCubeOrigin.z; unskewedDistToOrigin.z = z - unskewedCubeOrigin.z;
unskewedDistToOrigin.w = w - unskewedCubeOrigin.w; unskewedDistToOrigin.w = w - unskewedCubeOrigin.w;
c1 = (unskewedDistToOrigin.x > unskewedDistToOrigin.y) ? 32 : 0; c1 = (unskewedDistToOrigin.x > unskewedDistToOrigin.y) ? 32 : 0;
c2 = (unskewedDistToOrigin.x > unskewedDistToOrigin.z) ? 16 : 0; c2 = (unskewedDistToOrigin.x > unskewedDistToOrigin.z) ? 16 : 0;
c3 = (unskewedDistToOrigin.y > unskewedDistToOrigin.z) ? 8 : 0; c3 = (unskewedDistToOrigin.y > unskewedDistToOrigin.z) ? 8 : 0;
c4 = (unskewedDistToOrigin.x > unskewedDistToOrigin.w) ? 4 : 0; c4 = (unskewedDistToOrigin.x > unskewedDistToOrigin.w) ? 4 : 0;
c5 = (unskewedDistToOrigin.y > unskewedDistToOrigin.w) ? 2 : 0; c5 = (unskewedDistToOrigin.y > unskewedDistToOrigin.w) ? 2 : 0;
c6 = (unskewedDistToOrigin.z > unskewedDistToOrigin.w) ? 1 : 0; c6 = (unskewedDistToOrigin.z > unskewedDistToOrigin.w) ? 1 : 0;
c = c1 + c2 + c3 + c4 + c5 + c6; c = c1 + c2 + c3 + c4 + c5 + c6;
off1.x = lookupTable4D[c][0] >= 3 ? 1 : 0; off1.x = lookupTable4D[c][0] >= 3 ? 1 : 0;
off1.y = lookupTable4D[c][1] >= 3 ? 1 : 0; off1.y = lookupTable4D[c][1] >= 3 ? 1 : 0;
off1.z = lookupTable4D[c][2] >= 3 ? 1 : 0; off1.z = lookupTable4D[c][2] >= 3 ? 1 : 0;
off1.w = lookupTable4D[c][3] >= 3 ? 1 : 0; off1.w = lookupTable4D[c][3] >= 3 ? 1 : 0;
off2.x = lookupTable4D[c][0] >= 2 ? 1 : 0; off2.x = lookupTable4D[c][0] >= 2 ? 1 : 0;
off2.y = lookupTable4D[c][1] >= 2 ? 1 : 0; off2.y = lookupTable4D[c][1] >= 2 ? 1 : 0;
off2.z = lookupTable4D[c][2] >= 2 ? 1 : 0; off2.z = lookupTable4D[c][2] >= 2 ? 1 : 0;
off2.w = lookupTable4D[c][3] >= 2 ? 1 : 0; off2.w = lookupTable4D[c][3] >= 2 ? 1 : 0;
off3.x = lookupTable4D[c][0] >= 1 ? 1 : 0; off3.x = lookupTable4D[c][0] >= 1 ? 1 : 0;
off3.y = lookupTable4D[c][1] >= 1 ? 1 : 0; off3.y = lookupTable4D[c][1] >= 1 ? 1 : 0;
off3.z = lookupTable4D[c][2] >= 1 ? 1 : 0; off3.z = lookupTable4D[c][2] >= 1 ? 1 : 0;
off3.w = lookupTable4D[c][3] >= 1 ? 1 : 0; off3.w = lookupTable4D[c][3] >= 1 ? 1 : 0;
d1 = unskewedDistToOrigin; d1 = unskewedDistToOrigin;
d2.x = d1.x - off1.x + UnskewCoeff4D; d2.x = d1.x - off1.x + UnskewCoeff4D;
d2.y = d1.y - off1.y + UnskewCoeff4D; d2.y = d1.y - off1.y + UnskewCoeff4D;
d2.z = d1.z - off1.z + UnskewCoeff4D; d2.z = d1.z - off1.z + UnskewCoeff4D;
d2.w = d1.w - off1.w + UnskewCoeff4D; d2.w = d1.w - off1.w + UnskewCoeff4D;
d3.x = d1.x - off2.x + 2.f*UnskewCoeff4D; d3.x = d1.x - off2.x + 2.f*UnskewCoeff4D;
d3.y = d1.y - off2.y + 2.f*UnskewCoeff4D; d3.y = d1.y - off2.y + 2.f*UnskewCoeff4D;
d3.z = d1.z - off2.z + 2.f*UnskewCoeff4D; d3.z = d1.z - off2.z + 2.f*UnskewCoeff4D;
d3.w = d1.w - off2.w + 2.f*UnskewCoeff4D; d3.w = d1.w - off2.w + 2.f*UnskewCoeff4D;
d4.x = d1.x - off3.x + 3.f*UnskewCoeff4D; d4.x = d1.x - off3.x + 3.f*UnskewCoeff4D;
d4.y = d1.y - off3.y + 3.f*UnskewCoeff4D; d4.y = d1.y - off3.y + 3.f*UnskewCoeff4D;
d4.z = d1.z - off3.z + 3.f*UnskewCoeff4D; d4.z = d1.z - off3.z + 3.f*UnskewCoeff4D;
d4.w = d1.w - off3.w + 3.f*UnskewCoeff4D; d4.w = d1.w - off3.w + 3.f*UnskewCoeff4D;
d5.x = d1.x - 1.f + 4*UnskewCoeff4D; d5.x = d1.x - 1.f + 4*UnskewCoeff4D;
d5.y = d1.y - 1.f + 4*UnskewCoeff4D; d5.y = d1.y - 1.f + 4*UnskewCoeff4D;
d5.z = d1.z - 1.f + 4*UnskewCoeff4D; d5.z = d1.z - 1.f + 4*UnskewCoeff4D;
d5.w = d1.w - 1.f + 4*UnskewCoeff4D; d5.w = d1.w - 1.f + 4*UnskewCoeff4D;
ii = skewedCubeOrigin.x & 255; ii = skewedCubeOrigin.x & 255;
jj = skewedCubeOrigin.y & 255; jj = skewedCubeOrigin.y & 255;
kk = skewedCubeOrigin.z & 255; kk = skewedCubeOrigin.z & 255;
ll = skewedCubeOrigin.w & 255; ll = skewedCubeOrigin.w & 255;
gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] & 31; gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] & 31;
gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z + perm[ll + off1.w]]]] & 31; gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z + perm[ll + off1.w]]]] & 31;
gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z + perm[ll + off2.w]]]] & 31; gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z + perm[ll + off2.w]]]] & 31;
gi3 = perm[ii + off3.x + perm[jj + off3.y + perm[kk + off3.z + perm[ll + off3.w]]]] & 31; gi3 = perm[ii + off3.x + perm[jj + off3.y + perm[kk + off3.z + perm[ll + off3.w]]]] & 31;
gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32; gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;
c1 = 0.6f - d1.x*d1.x - d1.y*d1.y - d1.z*d1.z - d1.w*d1.w; c1 = 0.6f - d1.x*d1.x - d1.y*d1.y - d1.z*d1.z - d1.w*d1.w;
c2 = 0.6f - d2.x*d2.x - d2.y*d2.y - d2.z*d2.z - d2.w*d2.w; c2 = 0.6f - d2.x*d2.x - d2.y*d2.y - d2.z*d2.z - d2.w*d2.w;
c3 = 0.6f - d3.x*d3.x - d3.y*d3.y - d3.z*d3.z - d3.w*d3.w; c3 = 0.6f - d3.x*d3.x - d3.y*d3.y - d3.z*d3.z - d3.w*d3.w;
c4 = 0.6f - d4.x*d4.x - d4.y*d4.y - d4.z*d4.z - d4.w*d4.w; c4 = 0.6f - d4.x*d4.x - d4.y*d4.y - d4.z*d4.z - d4.w*d4.w;
c5 = 0.6f - d5.x*d5.x - d5.y*d5.y - d5.z*d5.z - d5.w*d5.w; c5 = 0.6f - d5.x*d5.x - d5.y*d5.y - d5.z*d5.z - d5.w*d5.w;
if(c1 < 0) if(c1 < 0)
n1 = 0; n1 = 0;
else else
n1 = c1*c1*c1*c1*(gradient4[gi0][0]*d1.x + gradient4[gi0][1]*d1.y + gradient4[gi0][2]*d1.z + gradient4[gi0][3]*d1.w); n1 = c1*c1*c1*c1*(gradient4[gi0][0]*d1.x + gradient4[gi0][1]*d1.y + gradient4[gi0][2]*d1.z + gradient4[gi0][3]*d1.w);
if(c2 < 0) if(c2 < 0)
n2 = 0; n2 = 0;
else else
n2 = c2*c2*c2*c2*(gradient4[gi1][0]*d2.x + gradient4[gi1][1]*d2.y + gradient4[gi1][2]*d2.z + gradient4[gi1][3]*d2.w); n2 = c2*c2*c2*c2*(gradient4[gi1][0]*d2.x + gradient4[gi1][1]*d2.y + gradient4[gi1][2]*d2.z + gradient4[gi1][3]*d2.w);
if(c3 < 0) if(c3 < 0)
n3 = 0; n3 = 0;
else else
n3 = c3*c3*c3*c3*(gradient4[gi2][0]*d3.x + gradient4[gi2][1]*d3.y + gradient4[gi2][2]*d3.z + gradient4[gi2][3]*d3.w); n3 = c3*c3*c3*c3*(gradient4[gi2][0]*d3.x + gradient4[gi2][1]*d3.y + gradient4[gi2][2]*d3.z + gradient4[gi2][3]*d3.w);
if(c4 < 0) if(c4 < 0)
n4 = 0; n4 = 0;
else else
n4 = c4*c4*c4*c4*(gradient4[gi3][0]*d4.x + gradient4[gi3][1]*d4.y + gradient4[gi3][2]*d4.z + gradient4[gi3][3]*d4.w); n4 = c4*c4*c4*c4*(gradient4[gi3][0]*d4.x + gradient4[gi3][1]*d4.y + gradient4[gi3][2]*d4.z + gradient4[gi3][3]*d4.w);
if(c5 < 0) if(c5 < 0)
n5 = 0; n5 = 0;
else else
n5 = c5*c5*c5*c5*(gradient4[gi4][0]*d5.x + gradient4[gi4][1]*d5.y + gradient4[gi4][2]*d5.z + gradient4[gi4][3]*d5.w); n5 = c5*c5*c5*c5*(gradient4[gi4][0]*d5.x + gradient4[gi4][1]*d5.y + gradient4[gi4][2]*d5.z + gradient4[gi4][3]*d5.w);
return (n1+n2+n3+n4+n5)*27.f; return (n1+n2+n3+n4+n5)*27.f;
} }

View File

@ -647,7 +647,7 @@ unsigned int NzRenderTexture::GetOpenGLID() const
} }
#endif #endif
return m_impl->fbo; return m_impl->fbo;
} }
bool NzRenderTexture::HasContext() const bool NzRenderTexture::HasContext() const

View File

@ -351,7 +351,7 @@ bool NzShader::LoadFromBinary(const void* buffer, unsigned int size)
bool NzShader::LoadFromBinary(const NzByteArray& byteArray) bool NzShader::LoadFromBinary(const NzByteArray& byteArray)
{ {
return LoadFromBinary(byteArray.GetConstBuffer(), byteArray.GetSize()); return LoadFromBinary(byteArray.GetConstBuffer(), byteArray.GetSize());
} }
void NzShader::SendBoolean(int location, bool value) const void NzShader::SendBoolean(int location, bool value) const

View File

@ -1041,11 +1041,11 @@ unsigned int NzTexture::GetValidSize(unsigned int size)
return size; return size;
else else
{ {
unsigned int pot = 1; unsigned int pot = 1;
while (pot < size) while (pot < size)
pot <<= 1; pot <<= 1;
return pot; return pot;
} }
} }

View File

@ -111,15 +111,15 @@ NzUberShaderInstance* NzUberShaderPreprocessor::Get(const NzParameterList& param
void NzUberShaderPreprocessor::SetShader(nzShaderStage stage, const NzString& source, const NzString& shaderFlags, const NzString& requiredFlags) void NzUberShaderPreprocessor::SetShader(nzShaderStage stage, const NzString& source, const NzString& shaderFlags, const NzString& requiredFlags)
{ {
Shader& shader = m_shaders[stage]; Shader& shader = m_shaders[stage];
shader.present = true; shader.present = true;
shader.source = source; shader.source = source;
// On extrait les flags de la chaîne // On extrait les flags de la chaîne
std::vector<NzString> flags; std::vector<NzString> flags;
shaderFlags.Split(flags, ' '); shaderFlags.Split(flags, ' ');
for (NzString& flag : flags) for (NzString& flag : flags)
{ {
auto it = m_flags.find(flag); auto it = m_flags.find(flag);
if (it == m_flags.end()) if (it == m_flags.end())
@ -136,7 +136,7 @@ void NzUberShaderPreprocessor::SetShader(nzShaderStage stage, const NzString& so
flags.clear(); flags.clear();
requiredFlags.Split(flags, ' '); requiredFlags.Split(flags, ' ');
for (NzString& flag : flags) for (NzString& flag : flags)
{ {
nzUInt32 flagVal; nzUInt32 flagVal;

View File

@ -106,7 +106,7 @@ namespace
SetCharacterSize(characterSize); SetCharacterSize(characterSize);
if (FT_Load_Char(m_face, character, FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL) != 0) if (FT_Load_Char(m_face, character, FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL) != 0)
{ {
NazaraError("Failed to load character"); NazaraError("Failed to load character");
return false; return false;

View File

@ -21,11 +21,11 @@ namespace
return static_cast<int>(stream->Read(data, size)); return static_cast<int>(stream->Read(data, size));
} }
void Skip(void* userdata, int size) void Skip(void* userdata, int size)
{ {
NzInputStream* stream = static_cast<NzInputStream*>(userdata); NzInputStream* stream = static_cast<NzInputStream*>(userdata);
stream->SetCursorPos(static_cast<nzInt64>(stream->GetCursorPos()) + static_cast<nzInt64>(size)); stream->SetCursorPos(static_cast<nzInt64>(stream->GetCursorPos()) + static_cast<nzInt64>(size));
} }
int Eof(void* userdata) int Eof(void* userdata)
{ {

View File

@ -29,7 +29,7 @@
// N'est pas défini avec MinGW // N'est pas défini avec MinGW
#ifndef MAPVK_VK_TO_VSC #ifndef MAPVK_VK_TO_VSC
#define MAPVK_VK_TO_VSC 0 #define MAPVK_VK_TO_VSC 0
#endif #endif
#undef IsMinimized // Conflit avec la méthode du même nom #undef IsMinimized // Conflit avec la méthode du même nom