Fixed: #1328 Map time and weather Issue (synced with SVN, thanks!)

This commit is contained in:
kervala 2012-05-18 20:53:59 +02:00
parent d9d9734aee
commit 844c22c16b
5 changed files with 11 additions and 12 deletions

View file

@ -29,7 +29,7 @@ extern int *OptFastFloorCWStackPtr;
extern int *OptFastFloorCWStackEnd; extern int *OptFastFloorCWStackEnd;
// fastFloor function. // fastFloor function.
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) #if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
#include <cfloat> #include <cfloat>

View file

@ -618,7 +618,7 @@ void CPatch::computeTileLightmapPixelAutomatic(uint ts, uint tt, uint s, uint t
c= max(c, 0.f); c= max(c, 0.f);
sint ic; sint ic;
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) #if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
// FastFloor using fistp. Don't care convention. // FastFloor using fistp. Don't care convention.
float fc= c*256; float fc= c*256;
_asm _asm

View file

@ -37,14 +37,14 @@ namespace NL3D
// *************************************************************************** // ***************************************************************************
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) #if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
/* This floor works only for floor with noise, because floor/ceil are only made on decimal coordinates: /* This floor works only for floor with noise, because floor/ceil are only made on decimal coordinates:
sTile =1.25 .... NB: because of difference of mapping (rare case), we may have sometimes values with sTile =1.25 .... NB: because of difference of mapping (rare case), we may have sometimes values with
precision < 1/4 (eg 1.125). Just use f*256 to compute the floor. precision < 1/4 (eg 1.125). Just use f*256 to compute the floor.
NB: using a fastFloor() (fistp changing the controlfp() is not very a good idea here, because NB: using a fastFloor() (fistp changing the controlfp() is not very a good idea here, because
computeNoise() are not "packed", so change on controlFp() would bee to frequent... computeNoise() are not "packed", so change on controlFp() would bee too frequent...
And also because we need either floor() or ceil() here. And also because we need either floor() or ceil() here.
*/ */
inline sint noiseFloor(float f) inline sint noiseFloor(float f)

View file

@ -24,7 +24,7 @@ int OptFastFloorCWStack[OptFastFloorCWStackSize];
int *OptFastFloorCWStackEnd = OptFastFloorCWStack + OptFastFloorCWStackSize; int *OptFastFloorCWStackEnd = OptFastFloorCWStack + OptFastFloorCWStackSize;
int *OptFastFloorCWStackPtr = OptFastFloorCWStack; int *OptFastFloorCWStackPtr = OptFastFloorCWStack;
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) #if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR)
double OptFastFloorMagicConst = pow(2.0,52) + pow(2.0,51); double OptFastFloorMagicConst = pow(2.0,52) + pow(2.0,51);
float OptFastFloorMagicConst24 = (float)pow(2.0,23); float OptFastFloorMagicConst24 = (float)pow(2.0,23);

View file

@ -18,7 +18,7 @@
#include "nel/misc/noise_value.h" #include "nel/misc/noise_value.h"
#include "nel/misc/fast_floor.h" #include "nel/misc/fast_floor.h"
#include "nel/misc/random.h"
namespace NLMISC namespace NLMISC
@ -45,8 +45,7 @@ public:
CRandomGrid3D() CRandomGrid3D()
{ {
//seed //seed
CRandom Random; srand(0);
Random.srand(0);
// init the grid // init the grid
for(uint z=0; z<NL3D_NOISE_GRID_SIZE; z++) for(uint z=0; z<NL3D_NOISE_GRID_SIZE; z++)
@ -57,7 +56,7 @@ public:
{ {
uint id= x + (y<<NL3D_NOISE_GRID_SIZE_SHIFT) + (z<<(NL3D_NOISE_GRID_SIZE_SHIFT*2)); uint id= x + (y<<NL3D_NOISE_GRID_SIZE_SHIFT) + (z<<(NL3D_NOISE_GRID_SIZE_SHIFT*2));
// take higher bits of rand gives better result. // take higher bits of rand gives better result.
uint v= Random.rand() >> 5; uint v= rand() >> 5;
_Texture3d[id]= v&255; _Texture3d[id]= v&255;
} }
} }
@ -81,9 +80,9 @@ public:
// init LevelPhases. // init LevelPhases.
for(i=0; i<NL3D_NOISE_LEVEL; i++) for(i=0; i<NL3D_NOISE_LEVEL; i++)
{ {
_LevelPhase[i].x= Random.frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].x= frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].y= Random.frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].y= frand(NL3D_NOISE_GRID_SIZE);
_LevelPhase[i].z= Random.frand(NL3D_NOISE_GRID_SIZE); _LevelPhase[i].z= frand(NL3D_NOISE_GRID_SIZE);
} }
// not for level 0. // not for level 0.
_LevelPhase[0]= CVector::Null; _LevelPhase[0]= CVector::Null;