Finished what I was initially working on for ComputerTile

This commit is contained in:
2024-12-18 16:51:11 -05:00
parent 8529649dc2
commit a656383741

View File

@@ -61,7 +61,7 @@ namespace CaveGame::Core
if (pass > upperBound)
return hiSelect;
if (pass > lowerBound)
if (pass < lowerBound)
return loSelect;
return fallback;
@@ -88,9 +88,11 @@ namespace CaveGame::Core
return Core::AIR;
} else { return base; }*/
float cave_erosion = perlin.Noise(wx / CaveInputScale, wy / CaveInputScale, 0.f) * CaveOutputScale;
//float cave_erosion = perlin.Noise(wx / CaveInputScale, wy / CaveInputScale, 0.f) * CaveOutputScale;
float cave_erosion = ComputePass(wx, wy, CaveInputScale, CaveInputScale, 0.f, CaveOutputScale);
float cave_addition = perlin.Noise(wx / CaveAdditiveInputScale, wy / CaveAdditiveInputScale, 0.f)*CaveAdditiveOutputScale;
//float cave_addition = perlin.Noise(wx / CaveAdditiveInputScale, wy / CaveAdditiveInputScale, 0.f)*CaveAdditiveOutputScale;
float cave_addition = ComputePass(wx, wy, CaveAdditiveInputScale, CaveAdditiveInputScale, 0.f, CaveAdditiveOutputScale);
cave_erosion += cave_addition;
// Make cave openings more narrow
@@ -120,8 +122,7 @@ namespace CaveGame::Core
//float clay_pass = ComputeHiLoPass(clay_pass_1, clay_pass_2, 2.f) - rng;
//std::function<float(float, float, float)>
auto computestage = std::bind(&Generator::ComputePass, this, wx, wy, std::placeholders::_4);
auto computehilo = std::bind(&Generator::ComputePass, this, computestage, computestage, std::placeholders::_1);
//auto computestage = [&] (float hScale, float vScale, float offset, float outputScale){ return ComputePass(wx, wy, hScale, vScale, offset, outputScale) ;};
/*
if (clay_pass > 0.85f) {
@@ -131,16 +132,19 @@ namespace CaveGame::Core
if (clay_pass < -0.75f) {
return TileID::DIRT;
}
*/
*/
/*
float silt_pass_1 = perlin.Noise(wx / 220.f, wy / 205.f, 5.f) * 2.2f;
float silt_pass_2 = perlin.Noise(wx / 27.f, wy / 25.f, 422.f) * 1.25f;
//float rng = GetPrecomputedWhiteNoise2D(wx, wy)*0.175;
float silt_pass = silt_pass_1 + silt_pass_2 + ((silt_pass_1 * silt_pass_2) / 2.f) - rng;
*/
/*
if (silt_pass > 0.85f) {
@@ -152,10 +156,12 @@ namespace CaveGame::Core
}
*/
/*
float stone_pass_1 = perlin.Noise(wx / 30.f, wy / 30.f, 666.f) * 2.4f;
float stone_pass_2 = perlin.Noise(wx / 220.f, wy / 220.f, 0.5f) * 1.75f;
float stone_pass = stone_pass_1 + stone_pass_2 + (stone_pass_1 * stone_pass_2 / 1.75f) + (rng*1.5f);
*/
// Chunks of stone
/*
@@ -179,11 +185,27 @@ namespace CaveGame::Core
// Chunks of clay
return HiLoSelect(
clay_pass, 0.85f, -0.75f, TileID::CLAY, TileID::DIRT,
HiLoSelect(silt_pass, 0.85f, -0.75f, TileID::SILT, TileID::DIRT,
HiLoSelect(stone_pass, 0.7f, -0.7f, TileID::STONE, TileID::STONE, base
)));
// This is actually faster??? - maxine
// The compiler must be doing some optimization for all the function calls
// It feels faster, but maybe I'm mistaken
// I have also discovered that vines are major source of slowness possibly
return HiLoSelect(
ComputeHiLoPass(
ComputePass(wx, wy, ClayVeinHiPassHScale, ClayVeinHiPassVScale, ClayVeinHiPassOffset, ClayVeinHiPassOutputScale),
ComputePass(wx, wy, ClayVeinLoPassHScale, ClayVeinLoPassVScale, ClayVeinLoPassOffset, ClayVeinLoPassOutputScale),
2.f) - rng, 0.85f, -0.75f, TileID::CLAY, TileID::DIRT,
HiLoSelect(
ComputeHiLoPass(
ComputePass(wx, wy, 30.f, 30.f, 666.f, 2.4f),
ComputePass(wx, wy, 220.f, 220.f, 0.5f, 1.75f),
2.f) - rng, 0.85f, -0.75f, TileID::SILT, TileID::DIRT,
HiLoSelect(
ComputeHiLoPass(
ComputePass(wx, wy, 30.f, 30.f, 666.f, 2.4f),
ComputePass(wx, wy, 220.f, 220.f, 0.5f, 1.75f),
1.75) + (rng*1.5f) , 0.7f, -0.7f, TileID::STONE, TileID::STONE, base
)));
}
return base;