mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-15 08:08:26 +02:00
Fix warnings in FastNoise.
This commit is contained in:
parent
0edcb0e374
commit
78471f8b05
@ -493,26 +493,38 @@ FN_DECIMAL FastNoise::GetNoise(FN_DECIMAL x, FN_DECIMAL y) const
|
|||||||
// White Noise
|
// White Noise
|
||||||
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z, FN_DECIMAL w) const
|
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,
|
return ValCoord4D(m_seed,
|
||||||
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
|
*xx ^ (*xx >> 16),
|
||||||
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16),
|
*yy ^ (*yy >> 16),
|
||||||
*reinterpret_cast<int*>(&z) ^ (*reinterpret_cast<int*>(&z) >> 16),
|
*zz ^ (*zz >> 16),
|
||||||
*reinterpret_cast<int*>(&w) ^ (*reinterpret_cast<int*>(&w) >> 16));
|
*ww ^ (*ww >> 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z) const
|
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,
|
return ValCoord3D(m_seed,
|
||||||
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
|
*xx ^ (*xx >> 16),
|
||||||
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16),
|
*yy ^ (*yy >> 16),
|
||||||
*reinterpret_cast<int*>(&z) ^ (*reinterpret_cast<int*>(&z) >> 16));
|
*zz ^ (*zz >> 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y) const
|
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,
|
return ValCoord2D(m_seed,
|
||||||
*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
|
*xx ^ (*xx >> 16),
|
||||||
*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16));
|
*yy ^ (*yy >> 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
FN_DECIMAL FastNoise::GetWhiteNoiseInt(int x, int y, int z, int w) const
|
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;
|
FN_DECIMAL xs, ys, zs;
|
||||||
switch (m_interp)
|
switch (m_interp)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case Linear:
|
case Linear:
|
||||||
xs = x - (FN_DECIMAL)x0;
|
xs = x - (FN_DECIMAL)x0;
|
||||||
ys = y - (FN_DECIMAL)y0;
|
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;
|
FN_DECIMAL xs, ys;
|
||||||
switch (m_interp)
|
switch (m_interp)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case Linear:
|
case Linear:
|
||||||
xs = x - (FN_DECIMAL)x0;
|
xs = x - (FN_DECIMAL)x0;
|
||||||
ys = y - (FN_DECIMAL)y0;
|
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;
|
FN_DECIMAL xs, ys, zs;
|
||||||
switch (m_interp)
|
switch (m_interp)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case Linear:
|
case Linear:
|
||||||
xs = x - (FN_DECIMAL)x0;
|
xs = x - (FN_DECIMAL)x0;
|
||||||
ys = y - (FN_DECIMAL)y0;
|
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;
|
FN_DECIMAL xs, ys;
|
||||||
switch (m_interp)
|
switch (m_interp)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case Linear:
|
case Linear:
|
||||||
xs = x - (FN_DECIMAL)x0;
|
xs = x - (FN_DECIMAL)x0;
|
||||||
ys = y - (FN_DECIMAL)y0;
|
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);
|
int zr = FastRound(z);
|
||||||
|
|
||||||
FN_DECIMAL distance = 999999;
|
FN_DECIMAL distance = 999999;
|
||||||
int xc, yc, zc;
|
int xc = 0;
|
||||||
|
int yc = 0;
|
||||||
|
int zc = 0;
|
||||||
|
|
||||||
switch (m_cellularDistanceFunction)
|
switch (m_cellularDistanceFunction)
|
||||||
{
|
{
|
||||||
@ -1938,7 +1956,8 @@ FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL x, FN_DECIMAL y) const
|
|||||||
int yr = FastRound(y);
|
int yr = FastRound(y);
|
||||||
|
|
||||||
FN_DECIMAL distance = 999999;
|
FN_DECIMAL distance = 999999;
|
||||||
int xc, yc;
|
int xc = 0;
|
||||||
|
int yc = 0;
|
||||||
|
|
||||||
switch (m_cellularDistanceFunction)
|
switch (m_cellularDistanceFunction)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user