Noise: Refresh module using ZNoise
https://github.com/Overdrivr/ZNoise Former-commit-id: ea7bbeb58a7147934523e2f600b1bd02f1cae5ed [formerly 581ab53941abbda68e00417592240f52ebd482e6] Former-commit-id: e948aca78eb101292f0458365cfa39e6564d0462
This commit is contained in:
28
src/Nazara/Noise/NoiseTools.cpp
Normal file
28
src/Nazara/Noise/NoiseTools.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2016 Rémi Bèges
|
||||
// This file is part of the "Nazara Engine - Noise module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/NoiseTools.hpp>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
int fastfloor(float n)
|
||||
{
|
||||
return (n >= 0) ? static_cast<int>(n) : static_cast<int>(n-1);
|
||||
}
|
||||
|
||||
int JenkinsHash(int a, int b, int c)
|
||||
{
|
||||
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 13);
|
||||
b = b-c; b = b - a; b = b^(a << 8);
|
||||
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);
|
||||
b = b-c; b = b - a; b = b^(a << 16);
|
||||
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);
|
||||
b = b-c; b = b - a; b = b^(a << 10);
|
||||
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 15);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user