Indev450 / SRB2Kart-Saturn

GNU General Public License v2.0
24 stars 9 forks source link

port R_PointToPseudoAngle for Opengl sector clipping from PrBoom+ #98

Closed alufolie91 closed 7 months ago

alufolie91 commented 8 months ago

this should speed up opengl sector clipping a bit didnt notice any negative side effects or rendering issues at all but gave me a slight performance boost on certain maps that suffer from view distance related performance issue Note: Software renderer wont use this as it kinda needs more precision/ somewhat exact angles or else itll break

R_PointToPseudoAngle Returns the pseudoangle between the line p1 to (infinity, p1.y) and the line from p1 to p2. The pseudoangle has the property that the ordering of points by true angle anround p1 and ordering of points by pseudoangle are the same.

For clipping exact angles are not needed. Only the ordering matters. This is about as fast as the fixed point R_PointToAngle2 but without the precision issues associated with that function.

alufolie91 commented 7 months ago

actually, after profiling some more, this actually seems slower than R_PointToAngle64 it doesent clip things well enough and while the function itself may be faster, it makes the game render alot more things making this optimization useless (tho didnt compare to R_PointToAngleEX yet) so im gonna close this