载入中...
搜索中...
未找到
CaveScallops.cpp
浏览该文件的文档.
16float scallopCell(float along, float angle, float radius, float scale, float phaseOffset, float exponent,
20 const float crossPhase = angle * float(cells) + 0.5f * std::sin(flowPhase * 0.5f) + phaseOffset * 0.37f;
22 const float separatedPhase = flowPhase + (0.32f + 0.24f * (1.f - exponent)) * std::cos(flowPhase);
23 const float separatedWave = 0.5f + 0.5f * std::cos(separatedPhase) + 0.1f * std::sin(separatedPhase);
24 const float shiftedWave = std::clamp(stationaryWave + flowSeparation * (separatedWave - stationaryWave), 0.f, 1.f);
30CaveHydrologyVec3 sub(CaveHydrologyVec3 a, CaveHydrologyVec3 b) { return {a.x - b.x, a.y - b.y, a.z - b.z}; }
31CaveHydrologyVec3 add(CaveHydrologyVec3 a, CaveHydrologyVec3 b) { return {a.x + b.x, a.y + b.y, a.z + b.z}; }
32CaveHydrologyVec3 mul(CaveHydrologyVec3 a, float scale) { return {a.x * scale, a.y * scale, a.z * scale}; }
38 const float hydraulicScale = 1.f / std::sqrt(std::clamp(input.hydraulicIntensity, 0.25f, 1.45f));
41 const float correlatedField = 0.68f * std::sin(input.along * 2.f * Pi / patchScale + seedPhase) +
44 result.scale = input.baseScale * (1.f + input.hydraulicScaling * (hydraulicScale - 1.f)) * result.scaleMultiplier;
45 const float wallMask = 1.f - smoothstep(input.radius * 1.25f, input.radius * 2.2f, input.distance);
48 scallopCell(input.along, input.angle, input.radius, result.scale, 0.f, crestExponent, input.flowSeparation);
53 scallopCell(input.along, input.angle, input.radius, matureScale, 1.17f, crestExponent, input.flowSeparation);
54 const float coarsenedCell = std::max(youngCell * (1.f - input.maturity * 0.68f), matureCell * input.maturity);
64CavePassageFrame nearestCavePassageFrame(const CaveHydrologyVec3& point, const std::vector<CaveHydrologyPoint>& path,
88 length2 > 1e-8f ? std::clamp(dot(sub(point, path[i - 1].position), segment) / length2, 0.f, 1.f) : 0.f;
97 binormal = binormalLength > 1e-6f ? mul(binormal, 1.f / binormalLength) : CaveHydrologyVec3{1.f, 0.f, 0.f};
102 nearest.hydraulicIntensity = nodeIntensity(i - 1) + (nodeIntensity(i) - nodeIntensity(i - 1)) * t;
Definition EvpackPointGraphLoader.h:12
CaveScallopSample sampleCaveScallops(const CaveScallopInput &input)
Sample cave scallops.
Definition CaveScallops.cpp:36
CavePassageFrame nearestCavePassageFrame(const CaveHydrologyVec3 &point, const std::vector< CaveHydrologyPoint > &path, const std::vector< float > &hydraulicIntensity)
Nearest cave passage frame.
Definition CaveScallops.cpp:64
float hydraulicIntensity
Definition CaveScallops.h:43