Make perlin nosie repeatable for consistent ground textures

This commit is contained in:
Drake Arconis
2013-08-25 03:02:59 -04:00
parent 01bba31c8d
commit 4ec56904e7

View File

@@ -316,6 +316,8 @@ static void normalize3(F32 v[3])
static void init(void)
{
// we want repeatable noise (e.g. for stable terrain texturing), so seed with known value
srand(42);
int i, j, k;
for (i = 0 ; i < B ; i++) {
@@ -346,6 +348,9 @@ static void init(void)
for (j = 0 ; j < 3 ; j++)
g3[B + i][j] = g3[i][j];
}
// reintroduce entropy
srand(time(NULL)); // Flawfinder: ignore
}
#undef B