MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / apply

Method apply

source/game/StarWorldLayout.cpp:92–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92Vec2I 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
106WorldLayout WorldLayout::buildTerrestrialLayout(TerrestrialWorldParameters const& terrestrialParameters, uint64_t seed) {
107 auto& root = Root::singleton();

Callers 15

DrawableMethod · 0.45
behaviorNodeMethod · 0.45
VehicleMethod · 0.45
buildAsteroidsLayoutMethod · 0.45
WorldLayoutMethod · 0.45
toJsonMethod · 0.45
blockBiomeInfoMethod · 0.45
getBlockInfoMethod · 0.45
readTenantMethod · 0.45
pathMoveMethod · 0.45
tickMasterMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected