载入中...
搜索中...
未找到
CaveKarren.cpp
浏览该文件的文档.
2
3#include <algorithm>
4#include <cmath>
5
6namespace eve::procgen {
7namespace {
8
9float smoothstep(float lo, float hi, float value) {
10 const float t = std::clamp((value - lo) / std::max(hi - lo, 1e-6f), 0.f, 1.f);
11 return t * t * (3.f - 2.f * t);
12}
13
14} // namespace
15
17 CaveKarrenSample result;
18 // Passage angle is zero at the roof and pi at the gravity-defined floor.
19 result.floorExposure = smoothstep(0.28f, 0.82f, -std::cos(input.passageAngle));
20 const float primary = std::pow(std::clamp(input.primaryFracture, 0.f, 1.f), 0.72f);
21 const float secondary = std::pow(std::clamp(input.secondaryFracture, 0.f, 1.f), 0.72f);
22 result.intersectionPocket = primary * secondary;
23 result.fractureGuidance =
24 std::clamp(primary * 0.68f + secondary * 0.42f + result.intersectionPocket * 0.48f, 0.f, 1.f);
25 const float activeFlow = smoothstep(0.32f, 1.25f, input.hydraulicIntensity);
26 result.erosion = result.floorExposure * result.fractureGuidance * activeFlow;
27 return result;
28}
29
30} // namespace eve::procgen
double value
EvpackChunkInput input
Definition Evpack.cpp:170
int secondary
float t
CaveKarrenSample sampleCaveStreamKarren(const CaveKarrenInput &input)
Sample stream-bed solution grooves guided by the two strongest local fracture sets.
Inputs for fracture-guided dissolution grooves on an exposed cave-stream bed.
Definition CaveKarren.h:8
Observable stream-bed karren response at one cave-space sample.
Definition CaveKarren.h:16