Fixed point problem
category: general [glöplog]
I read "http://msdn.microsoft.com/en-us/library/cc953fe1.aspx". wtf? long long should be 64bit...
C++ has no standard 64 bit integer type, so the code is not portable at the first place.
Well, C has, so maybe you could use that instead..
I'm nitpicking, but visual studio is not a C compiler.
True, it compiles most c code. It works well in practice, but it's far from compliant. Neither has it C99 support (stdint.h or complex support anyone?) nor does it support the old stuff like K&R function declarations and the like.
C++ support is much better.
True, it compiles most c code. It works well in practice, but it's far from compliant. Neither has it C99 support (stdint.h or complex support anyone?) nor does it support the old stuff like K&R function declarations and the like.
C++ support is much better.
torus : tried? > cl /Za /TC
Ok. I got it. It was not only the precision issue with long long not being 64bit, but also the math was wrong.
Works nice now. Thanks for helping out.
Code:
const int DUDX = (((((__int64)(UZ2 - UZ1) * (__int64)DY31) - ((__int64)(UZ3 - UZ1) * (__int64)-DY12)) << 4) / ((__int64)C)); //division removes scaling, thus 8.24 format
const int DUDY = (((((__int64)(UZ3 - UZ1) * (__int64)-DX12) - ((__int64)(UZ2 - UZ1) * (__int64)DX31)) << 4) / ((__int64)C)); //division removes scaling, thus 8.24 format
Works nice now. Thanks for helping out.
Result:
looks good!
pouet demands a texturemapped cube!
Will do, sire ;)
I demand that you change your delta variables to DUDE_X and DUDE_Y.
Dude, why?
dude, because.
The pope demands that you morph the cube into a sphere.
The pope smokes dope.
RareWtFailWhale: i demand you rewrite it like
for a less negative approach
Code:
(UZ1-UZ3)*DX12 + (UZ1-UZ2)*DX31
for a less negative approach
I'm happy that it works. Will optimize later. I'll maybe even post the ugly shit for you people to laugh at... ;)
I'm up for a laugh.
I'd rather clean it up first, before I blush and sweat after posting it. :)
I'm laughing already :)