fogleman / fauxgl

Software-only 3D renderer written in Go.
MIT License
870 stars 69 forks source link

T-Junction solution #13

Open TomWor opened 4 years ago

TomWor commented 4 years ago

Hi @fogleman I'm trying to wrap my head around your voxel optimization and triangulation code and can't seem to find the part that you referenced in your medium article:

"Each rectangular face starts with four edges. These edges are first segmented where T-junctions occur. We still have a quad, but these points indicate where we need the triangle vertices to be when we triangulate the quad. I use a recursive solution, repeatedly splitting the polygon into two polygons."

I was looking for recursion along these lines but can't find it: https://github.com/fogleman/fauxgl/blob/265867c63064a483aebdac57821c42cc0aee6b45/voxel.go#L193

Could you point me to the part where you split the polygons?

fogleman commented 4 years ago

Good question. Looks like I only did that on a branch:

https://github.com/fogleman/fauxgl/commit/52b69ba17a2b8fd3cdf0dca523f320dfe186a68e

TomWor commented 4 years ago

Ha, in a way that's even better as I can look at that code in isolation. Thank you!