refactor: transparent render (#14)

* fix(renderer): defer uniform location retrieval and add view matrix in outline rendering

* refactor(gameplay): encapsulate per-type vertex data into VertexData struct

* feat(rendering): separate transparent blocks into discard and blend modes

* feat(renderer): implement order-independent transparency

* fix(shaders): reduce alpha discard threshold to 0.8
This commit is contained in:
zhenyan121
2026-06-11 12:21:19 +08:00
committed by GitHub
parent 2906106597
commit d0bc8d627f
29 changed files with 572 additions and 284 deletions

View File

@@ -45,6 +45,21 @@ float smootherstep(float edge0, float edge1, float x) {
return x * x * x * (x * (6.0f * x - 15.0f) + 10.0f);
}
bool is_aabb_in_frustum(const glm::vec3& center, const glm::vec3& half_extents,
const std::vector<glm::vec4>& planes) {
for (const auto& plane : planes) {
// distance
float d = glm::dot(glm::vec3(plane), center) + plane.w;
float r = half_extents.x * std::abs(plane.x) +
half_extents.y * std::abs(plane.y) +
half_extents.z * std::abs(plane.z);
if (d + r < 0) {
return false;
}
}
return true;
}
} // namespace Math
} // namespace Cubed