Supermodel icon indicating copy to clipboard operation
Supermodel copied to clipboard

Improve precision for vp computation

Open toxieainc opened this issue 1 year ago • 3 comments

...to fix regression for at least SRally2 and HarleyD

fixes/improves #201

toxieainc avatar Oct 13 '24 20:10 toxieainc

Are these functionally the same?

float x = 2.0F / (right - left);
float y = 2.0F / (top - bottom);
float a = (right + left) / (right - left);
float b = (top + bottom) / (top - bottom);

float x = 2.0f / (right - left);
float y = 2.0f / (top - bottom);
float a = left*x + 1.0f;
float b = bottom*y + 1.0f;

Some games use off-axis projection, harley etc. Also a small request :) If you could put less changes in each pull request lol. It's hard to know what has really changed with all the factoring.

Also c++ has automatic type promotion. It's really not necessary to cast an int to a float when multiplying by another float. I mean, you can, but it happens automatically anyway. But maybe this is just style bitching :)

dukeeeey avatar Oct 13 '24 21:10 dukeeeey

I personally prefer it like that, so that its clear whats happening. And in theory you can loose precision, depending on the integer value.

And the code is the same, yes. This way you can share more of the same potential error.

toxieainc avatar Oct 14 '24 06:10 toxieainc

As for putting additional stuff into such PRs: Sorry, i will try to be more careful then. I have a lot of local changes piled up, so if some are in the same file as my 'actual fix', and these are rather harmless, then i tend to just squeeze them in, too.

toxieainc avatar Oct 14 '24 12:10 toxieainc

@dukeeeey Small ping on this one, before i forget all the details..

toxieainc avatar Nov 25 '24 17:11 toxieainc

I've pushed your changes here locally :) Without the changes for the matrix stuff. I'll test the other code soon.

dukeeeey avatar Nov 25 '24 21:11 dukeeeey