Fix warnings in FastNoise.

This commit is contained in:
Relintai 2022-03-16 09:57:18 +01:00
parent 0edcb0e374
commit 78471f8b05

View File

@ -493,26 +493,38 @@ FN_DECIMAL FastNoise::GetNoise(FN_DECIMAL x, FN_DECIMAL y) const
// White Noise
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z, FN_DECIMAL w) const
{
int32_t* xx = reinterpret_cast<int32_t*>(&x);
int32_t* yy = reinterpret_cast<int32_t*>(&y);
int32_t* zz = reinterpret_cast<int32_t*>(&z);
int32_t* ww = reinterpret_cast<int32_t*>(&w);
return ValCoord4D(m_seed,
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16),
*reinterpret_cast<int*>(&z) ^ (*reinterpret_cast<int*>(&z) >> 16),
*reinterpret_cast<int*>(&w) ^ (*reinterpret_cast<int*>(&w) >> 16));
*xx ^ (*xx >> 16),
*yy ^ (*yy >> 16),
*zz ^ (*zz >> 16),
*ww ^ (*ww >> 16));
}
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z) const
{
int32_t* xx = reinterpret_cast<int32_t*>(&x);
int32_t* yy = reinterpret_cast<int32_t*>(&y);
int32_t* zz = reinterpret_cast<int32_t*>(&z);
return ValCoord3D(m_seed,
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16),
*reinterpret_cast<int*>(&z) ^ (*reinterpret_cast<int*>(&z) >> 16));
*xx ^ (*xx >> 16),
*yy ^ (*yy >> 16),
*zz ^ (*zz >> 16));
}
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y) const
{
int32_t* xx = reinterpret_cast<int32_t*>(&x);
int32_t* yy = reinterpret_cast<int32_t*>(&y);
return ValCoord2D(m_seed,
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16));
*xx ^ (*xx >> 16),
*yy ^ (*yy >> 16));
}
FN_DECIMAL FastNoise::GetWhiteNoiseInt(int x, int y, int z, int w) const
@ -624,6 +636,7 @@ FN_DECIMAL FastNoise::SingleValue(unsigned char offset, FN_DECIMAL x, FN_DECIMAL
FN_DECIMAL xs, ys, zs;
switch (m_interp)
{
default:
case Linear:
xs = x - (FN_DECIMAL)x0;
ys = y - (FN_DECIMAL)y0;
@ -738,6 +751,7 @@ FN_DECIMAL FastNoise::SingleValue(unsigned char offset, FN_DECIMAL x, FN_DECIMAL
FN_DECIMAL xs, ys;
switch (m_interp)
{
default:
case Linear:
xs = x - (FN_DECIMAL)x0;
ys = y - (FN_DECIMAL)y0;
@ -852,6 +866,7 @@ FN_DECIMAL FastNoise::SinglePerlin(unsigned char offset, FN_DECIMAL x, FN_DECIMA
FN_DECIMAL xs, ys, zs;
switch (m_interp)
{
default:
case Linear:
xs = x - (FN_DECIMAL)x0;
ys = y - (FN_DECIMAL)y0;
@ -974,6 +989,7 @@ FN_DECIMAL FastNoise::SinglePerlin(unsigned char offset, FN_DECIMAL x, FN_DECIMA
FN_DECIMAL xs, ys;
switch (m_interp)
{
default:
case Linear:
xs = x - (FN_DECIMAL)x0;
ys = y - (FN_DECIMAL)y0;
@ -1714,7 +1730,9 @@ FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z) c
int zr = FastRound(z);
FN_DECIMAL distance = 999999;
int xc, yc, zc;
int xc = 0;
int yc = 0;
int zc = 0;
switch (m_cellularDistanceFunction)
{
@ -1938,7 +1956,8 @@ FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL x, FN_DECIMAL y) const
int yr = FastRound(y);
FN_DECIMAL distance = 999999;
int xc, yc;
int xc = 0;
int yc = 0;
switch (m_cellularDistanceFunction)
{