MCPcopy Create free account
hub / github.com/SFML/SFML / getSnowcapTerrainColor

Function getSnowcapTerrainColor

examples/island/Island.cpp:177–188  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// Get the snowcap terrain color for the given elevation and moisture. ///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

175///
176////////////////////////////////////////////////////////////
177sf::Color getSnowcapTerrainColor(float elevation, float moisture)
178{
179 const sf::Color highlandsColor = getHighlandsTerrainColor(elevation, moisture);
180
181 const sf::Color color = sf::Color::White;
182
183 const float factor = std::min((elevation - snowcapHeight) / 0.05f, 1.f);
184
185 return colorFromFloats(highlandsColor.r * (1.f - factor) + color.r * factor,
186 highlandsColor.g * (1.f - factor) + color.g * factor,
187 highlandsColor.b * (1.f - factor) + color.b * factor);
188}
189
190
191////////////////////////////////////////////////////////////

Callers 1

getTerrainColorFunction · 0.85

Calls 2

getHighlandsTerrainColorFunction · 0.85
colorFromFloatsFunction · 0.85

Tested by

no test coverage detected