| 90 | } |
| 91 | |
| 92 | Vec2I WorldLayout::BlockNoise::apply(Vec2I const& input, Vec2U const& worldSize) const { |
| 93 | float angle = (input[0] / (float)worldSize[0]) * 2 * Constants::pi; |
| 94 | float xc = std::sin(angle) / (2 * Constants::pi) * worldSize[0]; |
| 95 | float zc = std::cos(angle) / (2 * Constants::pi) * worldSize[0]; |
| 96 | |
| 97 | Vec2I noisePos = Vec2I( |
| 98 | floor(input[0] + horizontalNoise.get(input[1]) + xNoise.get(xc, input[1], zc)), |
| 99 | floor(input[1] + verticalNoise.get(xc, zc) + yNoise.get(xc, input[1], zc)) |
| 100 | ); |
| 101 | noisePos[1] = clamp<int>(noisePos[1], 0, worldSize[1]); |
| 102 | |
| 103 | return noisePos; |
| 104 | } |
| 105 | |
| 106 | WorldLayout WorldLayout::buildTerrestrialLayout(TerrestrialWorldParameters const& terrestrialParameters, uint64_t seed) { |
| 107 | auto& root = Root::singleton(); |
no test coverage detected