Open m-7761 opened 4 years ago
EDITED: I revised them to use averages (which amount to 0 in this case.) I'm more confident about correctness now. I meant to use the midpoint before. I was calculating it wrong.
NOTE: The backgrounds also use m_farOrtho. I forgot to work on that.
I'm not sure what to do with them... they seem to want the background to drawn in front of 0,0 instead of at the back. So I removed the m_farOrtho/2
term. But this assumes the near/far planes have 0,0 in their center (i.e. they aren't offset to make better use of the depth-buffer precision.)
P.S. Sorry about all the posts lately. I know they must spam you (Zack) but it helps me to have a URL I can drop into my source code, so I don't have to make an elaborate C++ comment in the middle of the code I'm working on.
Here is the relevant code from modelviewport.cc. Notice 500000 is hardcoded.
-10000,10000 are better values for a depth-buffer, but ideally they should enclose the model.
Disclaimer: I'm not 100% positive these transformations are correct. They appear to work. If the depth-buffer is too compressed vertices are drawn on the wrong side of the model, and lines poke though, which is particularly noticeable in the modes where the wireframe is drawn over triangles. But it's noticeable too even in wireframe mode with the changes of #96 to eliminate back-facing vertices.
EDITED: I revised them to use averages (which amount to 0 in this case.) I'm more confident about correctness now. I meant to use the midpoint before. I was calculating it wrong.