Ara mateix hi ha una generació molt simple amb Perlin noise que només fa un terreny gairebé pla.
https://www.youtube.com/watch?v=CSa5O6knuwI&t=1s
https://www.youtube.com/watch?v=HPao-rNrH5Q
https://dawnosaur.substack.com/p/how-minecraft-generates-worlds-you
|
int height = Y/2 + (int)(glm::perlin(glm::vec2((float)(i + X * posX) / X, (float)(k + Z * posY) / Z)) * 7); |
|
|
|
for (int j = 0; j <= height; j++) { |
|
uint8_t tipus = TERRA; |
|
if (j == height) { // Capa d'adalt |
|
tipus = GESPA; |
|
chunk[i][j][k].top = true; |
|
|
|
float probArbre = (float)(rand()) / (float)(RAND_MAX); |
|
float probFlor = (float)(rand()) / (float)(RAND_MAX); |
|
|
|
if (probArbre < probabilitatArbre) { |
|
// Marquem l'arbre |
|
res.push_back({0, glm::vec3(i + X * posX,j + 1,k + Z * posY) }); |
|
} |
|
else if (probFlor < probabilitatFlor) { |
|
// Marquem la flor |
|
res.push_back({ 1, glm::vec3(i + X * posX,j + 1,k + Z * posY) }); |
|
} |
|
} |
|
else if (j < height - 3) tipus = PEDRA; |
|
else if (j < 2) tipus = BEDROCK; |
|
canviarCub(i, j, k, tipus); |
Ara mateix hi ha una generació molt simple amb Perlin noise que només fa un terreny gairebé pla.
https://www.youtube.com/watch?v=CSa5O6knuwI&t=1s
https://www.youtube.com/watch?v=HPao-rNrH5Q
https://dawnosaur.substack.com/p/how-minecraft-generates-worlds-you
MinecraftGL/MinecraftGL/MinecraftGL/Mon/Chunk2.cpp
Lines 485 to 507 in 63a7b4d