Skip to content

Commit

Permalink
Remove unnecessary static casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Sep 23, 2024
1 parent 344246f commit e222e4f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions examples/island/Island.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
namespace
{
// Width and height of the application window
const sf::Vector2u windowSize(800, 600);
constexpr sf::Vector2u windowSize(800, 600);

// Resolution of the generated terrain
const sf::Vector2u resolution(800, 600);
constexpr sf::Vector2u resolution(800, 600);

// Thread pool parameters
const unsigned int threadCount = 4;
Expand Down Expand Up @@ -66,7 +66,7 @@ float edgeDropoffExponent = 1.5f;
float snowcapHeight = 0.6f;

// Terrain lighting parameters
float heightFactor = static_cast<float>(windowSize.y) / 2.0f;
float heightFactor = float{windowSize.y} / 2.0f;
float heightFlatten = 3.0f;
float lightFactor = 0.7f;
} // namespace
Expand Down Expand Up @@ -286,9 +286,8 @@ float getElevation(sf::Vector2u position)

for (int i = 0; i < perlinOctaves; ++i)
{
const sf::Vector2f scaled = normalized * perlinFrequency * static_cast<float>(std::pow(perlinFrequencyBase, i));
elevation += stb_perlin_noise3(scaled.x, scaled.y, 0, 0, 0, 0) *
static_cast<float>(std::pow(perlinFrequencyBase, -i));
const sf::Vector2f scaled = normalized * perlinFrequency * std::powf(perlinFrequencyBase, i);
elevation += stb_perlin_noise3(scaled.x, scaled.y, 0, 0, 0, 0) * std::powf(perlinFrequencyBase, -i);
}

elevation = (elevation + 1.f) / 2.f;
Expand Down

0 comments on commit e222e4f

Please sign in to comment.