Posted: Tue Apr 07, 2009 2:10 am
Nah that looks right, except you used float instead of double.
Also, that pi despite being different from #PI should still produce almost the same result.
And you are storing the pi value in a float which does not have enough precision to hold such a big erm... I mean "small" float number, again doubles is the thing here.
Anyway, I ported my online calc, you can find the source under the zlib license here:
http://www.purebasic.fr/english/viewtopic.php?t=37014
Normally you would not need the string parsing procedure since you would obviously have the old aspect hardcoded (be it 4:3 or 16:10 or 16:9) as what the developer designed the game under, same with oldfov.
The newaspect would be fetched from the user's current resolution at game startup or when they change resolution in the game for example.
Vertical FOV is not included as that is normally a fixed or automatically scaled value in almost all games (or game engines), and as I said the standards out there counts the height of a screen as being 1 thus you see aspect ratios like 2.35:1 etc. (the 1 is vertical aspect)
The reason we also see 4:3 etc is because to a consumer 1.3333333333:1 looks just damn ugly
so the shorter decimal form is just easier to read for people.
It shouldn't be too hard to roll your own vertical FOV calculation based on my code either, the math should be pretty much the same.
Enjoy!
Also, that pi despite being different from #PI should still produce almost the same result.
And you are storing the pi value in a float which does not have enough precision to hold such a big erm... I mean "small" float number, again doubles is the thing here.
Anyway, I ported my online calc, you can find the source under the zlib license here:
http://www.purebasic.fr/english/viewtopic.php?t=37014
Normally you would not need the string parsing procedure since you would obviously have the old aspect hardcoded (be it 4:3 or 16:10 or 16:9) as what the developer designed the game under, same with oldfov.
The newaspect would be fetched from the user's current resolution at game startup or when they change resolution in the game for example.
Vertical FOV is not included as that is normally a fixed or automatically scaled value in almost all games (or game engines), and as I said the standards out there counts the height of a screen as being 1 thus you see aspect ratios like 2.35:1 etc. (the 1 is vertical aspect)
The reason we also see 4:3 etc is because to a consumer 1.3333333333:1 looks just damn ugly
It shouldn't be too hard to roll your own vertical FOV calculation based on my code either, the math should be pretty much the same.
Enjoy!