Skip to content

Commit

Permalink
Fix a bug w/ more than 1 octave
Browse files Browse the repository at this point in the history
  • Loading branch information
scallyw4g committed Oct 6, 2024
1 parent 2d55b11 commit 231d494
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions examples/terrain_gen/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,10 @@ BONSAI_API_WORKER_THREAD_CALLBACK()
{

/* // FBM params */
/* v3 Period = V3(18000); */
/* s32 Amplititude = 10000; */
/* s32 StartingZDepth = 5000; */
/* u32 Octaves = 6; */
v3 Period = V3(100000);
s32 Amplititude = 20000;
s32 StartingZDepth = 5000;
u32 Octaves = 7;

/* v3 Period = V3(500); */
/* s32 Amplititude = 500; */
Expand All @@ -504,10 +504,10 @@ BONSAI_API_WORKER_THREAD_CALLBACK()
/* u32 Octaves = 1; */
/* /1* u32 Octaves = 4; *1/ */

v3 Period = V3(50);
s32 Amplititude = 60;
s32 StartingZDepth = 60;
u32 Octaves = 1;
/* v3 Period = V3(50); */
/* s32 Amplititude = 60; */
/* s32 StartingZDepth = 60; */
/* u32 Octaves = 4; */
/* u32 Octaves = 4; */


Expand Down
4 changes: 2 additions & 2 deletions examples/terrain_gen/game_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ WORLD_CHUNK_DIM = Chunk_Dimension(32, 32, 8);
global_variable chunk_dimension
/* g_VisibleRegion = Chunk_Dimension(8192, 8192, 8192); */
/* g_VisibleRegion = Chunk_Dimension(4096, 4096, 4096); */ // 26km
/* g_VisibleRegion = Chunk_Dimension(2048, 2048, 2048); // 13.11 km */
g_VisibleRegion = Chunk_Dimension(2048, 2048, 2048); // 13.11 km
/* g_VisibleRegion = Chunk_Dimension(512, 512, 512); // 3.28 km */
/* g_VisibleRegion = Chunk_Dimension(256, 256, 256); */
/* g_VisibleRegion = Chunk_Dimension(128, 128, 128); */
/* g_VisibleRegion = Chunk_Dimension(64, 64, 64); */
/* g_VisibleRegion = Chunk_Dimension(32, 32, 32); */
/* g_VisibleRegion = Chunk_Dimension(16, 16, 16); */
g_VisibleRegion = Chunk_Dimension(8, 8, 8);
/* g_VisibleRegion = Chunk_Dimension(8, 8, 8); */
/* g_VisibleRegion = Chunk_Dimension(4, 4, 4); */
/* g_VisibleRegion = Chunk_Dimension(2, 2, 2); */

Expand Down
2 changes: 1 addition & 1 deletion external/bonsai_stdlib
Submodule bonsai_stdlib updated 1 files
+3 −47 src/perlin.h
4 changes: 2 additions & 2 deletions src/engine/terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ Terrain_FBM2D( world_chunk *Chunk,
auto _x1 = U32_8X( xCoords[8], xCoords[9], xCoords[10], xCoords[11], xCoords[12], xCoords[13], xCoords[14], xCoords[15] );
u32 xParamsIndex = (OctaveIndex*2);
Assert(xParamsIndex < 15);
xParams[OctaveIndex] = ComputePerlinParameters(U32_8X(WorldBasis.x), _x0, xChunkResolution, U32_8X(u32(InteriorPeriod.x)), PrimeX);
xParams[OctaveIndex+1] = ComputePerlinParameters(U32_8X(WorldBasis.x), _x1, xChunkResolution, U32_8X(u32(InteriorPeriod.x)), PrimeX);
xParams[(OctaveIndex*2)] = ComputePerlinParameters(U32_8X(WorldBasis.x), _x0, xChunkResolution, U32_8X(u32(InteriorPeriod.x)), PrimeX);
xParams[(OctaveIndex*2)+1] = ComputePerlinParameters(U32_8X(WorldBasis.x), _x1, xChunkResolution, U32_8X(u32(InteriorPeriod.x)), PrimeX);
InteriorPeriod = Max(V3i(1), InteriorPeriod/2);
}

Expand Down

0 comments on commit 231d494

Please sign in to comment.