Skip to content

Commit a24a8c2

Browse files
committed
Update 2025-07-22-face-culling.md
1 parent ba8bdfd commit a24a8c2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

_posts/2025-07-22-face-culling.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ fn should_cull_face_stairs(block, face_direction, neighbor_block) -> bool {
9595

9696
Here, `check_faces_aligned()` means orientation and geometry match exactly.
9797

98+
```rust
99+
fn check_faces_aligned(a: Block, b: Block, face: BlockFace) -> bool {
100+
a.shape == b.shape && a.rotation == b.rotation
101+
}
102+
```
103+
98104
---
99105

100106
## 4. Implementation Details (from my code)
@@ -103,6 +109,8 @@ Here, `check_faces_aligned()` means orientation and geometry match exactly.
103109
You only check culling for **border faces** - faces at the edge of the block:
104110

105111
```rust
112+
// This avoids checking inner faces of multi-element shapes (like stairs)
113+
// Only the faces that lie exactly on block borders are relevant for culling
106114
fn is_border_face(face, vertices, axis, border) -> bool {
107115
vertices.all(|v| abs(v[axis] - border) < epsilon)
108116
}

0 commit comments

Comments
 (0)