GP2X / Fixed point maths

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
evolutional
Posts: 16
Joined: Mon Apr 11, 2005 2:32 pm
Location: LEEDS, England
Contact:

GP2X / Fixed point maths

Post by evolutional »

I'd like to explore the possibility of using Irrlicht on the GP2X handheld console; the small size and decent speed of Irrlicht would make it an excellent candidate for games. Naturally, the DX and OpenGL renderers are out, but i'm sure the software renderer would be useful, at least until a native HW-accelerated version of it could be hacked together for the device. Several features would also probably need to be culled too as they would have little use on a tiny screen such as the GP2X.

My primary concern is the use of floats in Irrlicht; specifically the GP2X doesn't have a FPU meaning float operations are slow - as a counter, many people would jump onto the fixed-point math bandwagon and go from there. My question, has anyone ever attempted to add fixed-point maths to Irrlicht? If so, how much work was it? Is it something that could be done as another 'option' for the engine, or would it require two source trees to maintain and implement? (In case you haven't guessed, I'm not so experienced in FP maths ;) ).
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

i worked on fixed point platforms and what most people do are float wrappers.

they undefine the float from the compiler and then they define a custom float with appropriate operators

the operators can do the fixed point math via the bit operators by bit shifting

<< or >>

or even better if the cpu has ahrdware fixed point math u can send the appropriate data to hardware registers which do fixed pt stuff
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Since Irrlicht uses f32 instead of float in most places you will have to define your own f32 arithmetics or map f32 to the fixed point type on your target platform if possible. You may encounter several problem due to f32/float mixing which should be fixed to using f32 in Irrlicht core then.
Post Reply