Skip to content

Commit

Permalink
Changes to match noise function
Browse files Browse the repository at this point in the history
  • Loading branch information
fonzy1243 committed May 14, 2024
1 parent 35b0f7d commit feef22d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/world/chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ extern Shader *cube_shader;
extern int screen_height;
extern int screen_width;

int max_offset = 0;

extern const int chunk_size;
extern const int half_chunk_size;
extern const int buff_size;
Expand All @@ -30,9 +28,9 @@ Chunk::Chunk(glm::ivec3 coordinates, std::vector<float> noise) {
int globalX = m_position.x * chunk_size + x;
int globalZ = m_position.z * chunk_size + z;
// Calculate the index into the noise array.
int noiseIndex = globalX * 2048 + globalZ;
int noiseIndex = globalX * 8000 + globalZ;
// Scale the noise value to the range of the chunk height.
int height = static_cast<int>(noise[noiseIndex] * chunk_size);
float height = noise[noiseIndex] * chunk_size;
// Fill the blocks in the chunk up to the calculated height.
for (int y = 0; y < height; y++) {
m_blocks[x][y][z].set_active(true);
Expand Down
2 changes: 1 addition & 1 deletion src/world/noise_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Noise::Noise(int seed) : shader(*noise_shader) {
glCheckError();

shader.use();
glDispatchCompute(ceil(dim / 4), ceil(dim / 4), 1);
glDispatchCompute(dim / 8, dim / 8, 1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
glCheckError();

Expand Down

0 comments on commit feef22d

Please sign in to comment.