Make perlin nosie repeatable for consistent ground textures
This commit is contained in:
@@ -316,6 +316,8 @@ static void normalize3(F32 v[3])
|
|||||||
|
|
||||||
static void init(void)
|
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;
|
int i, j, k;
|
||||||
|
|
||||||
for (i = 0 ; i < B ; i++) {
|
for (i = 0 ; i < B ; i++) {
|
||||||
@@ -346,6 +348,9 @@ static void init(void)
|
|||||||
for (j = 0 ; j < 3 ; j++)
|
for (j = 0 ; j < 3 ; j++)
|
||||||
g3[B + i][j] = g3[i][j];
|
g3[B + i][j] = g3[i][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reintroduce entropy
|
||||||
|
srand(time(NULL)); // Flawfinder: ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef B
|
#undef B
|
||||||
|
|||||||
Reference in New Issue
Block a user