载入中...
搜索中...
未找到
VegetationNormal.cpp
浏览该文件的文档.
2#include <cmath>
3
4namespace eve::graphics {
6 auto invalid = [] {
9 "vegetation normal requires finite unit channels, a known encoding and strength in [-8,8]", {}, {},
10 "graphics.vegetation.normal"));
11 };
12 if (!std::isfinite(strength) || strength < -8.f || strength > 8.f) return invalid();
13 for (unsigned c = 0; c < 4; ++c)
14 if (!std::isfinite(sample[c]) || sample[c] < 0.f || sample[c] > 1.f) return invalid();
15 float x;
16 switch (encoding) {
17 case VegetationNormalEncoding::RedGreen: x = sample.r; break;
18 case VegetationNormalEncoding::RedAlphaGreen: x = sample.r * sample.a; break;
19 case VegetationNormalEncoding::AlphaGreen: x = sample.a; break;
20 default: return invalid();
21 }
22 return Result<glm::vec3>::success(glm::vec3((2.f * x - 1.f) * strength, (2.f * sample.g - 1.f) * strength, 1.f));
23}
24} // namespace eve::graphics
float x
Definition AnimClip.cpp:738
std::int32_t c
std::string encoding
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:164
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
Result< glm::vec3 > decodeVegetationNormal(glm::vec4 sample, VegetationNormalEncoding encoding, float strength)
Evaluate TVE 12.6 primary/detail tangent normal reconstruction.
VegetationNormalEncoding
Channel layout of an already filtered, linear vegetation normal sample.
@ RedGreen
ASTC normal encoding: source red and green.
@ AlphaGreen
UNITY_NO_DXT5nm source branch: alpha and green.
@ RedAlphaGreen
Default Unity encoding: red times alpha, then green.