refactor: extract color write mask, name frustum epsilon, add comments

- vk_pipeline: extract kColorWriteAll constant from 4 duplicated RGBA
  bitmask expressions across blend mode functions, with why-comment
- frustum: name kMinNormalLenSq epsilon (1e-8) with why-comment —
  prevents division by zero on degenerate planes
- dbc_loader: add why-comment on DBC field width validation — all
  fields are fixed 4-byte uint32 per format spec
- pin_auth: replace 0x30 hex literal with '0' char constant, add
  why-comment on ASCII encoding for server HMAC compatibility
This commit is contained in:
Kelsi 2026-03-30 15:02:47 -07:00
parent ef787624fe
commit 548828f2ee
4 changed files with 19 additions and 11 deletions

View file

@ -64,7 +64,10 @@ void Frustum::extractFromMatrix(const glm::mat4& vp) {
void Frustum::normalizePlane(Plane& plane) {
float lenSq = glm::dot(plane.normal, plane.normal);
if (lenSq > 0.00000001f) {
// Skip normalization for degenerate planes (near-zero normal) to avoid
// division by zero or amplifying floating-point noise into huge normals.
constexpr float kMinNormalLenSq = 1e-8f;
if (lenSq > kMinNormalLenSq) {
float invLen = glm::inversesqrt(lenSq);
plane.normal *= invLen;
plane.distance *= invLen;