horde3d / Horde3D

Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.
http://horde3d.org/
1.55k stars 308 forks source link

Added double precision math types #144

Closed kterhorst closed 5 years ago

kterhorst commented 5 years ago

I am interested in using Horde3D for some double precision scene experiments. I added double precision math types and set the inconsistent indentation in utMath.h to tabs.

horde3d commented 5 years ago

Actually I think the tabs were intended this way. At least I think I can remember a discussion about that with "marciano".

Haven't checked how the rest of the code was intended. But utMath.h should be consistent with the rest. Did you check the rest? Personally I would prefer spaces only and no tabs at all. But as mentioned this should be consistent within all the code. Maybe you can split the PR in the double precision part and we check the tabs/spaces in a separate session

algts commented 5 years ago

I have to say that as of now this commit has basically no use, because you have to modify the whole engine to correctly support double precision. Most problems lie with the rendering backends - gl2 does not support double precision, as well as GLES3. GL4 supports double precision, but you have to rewrite the shaders - input should be different, as well as all the calculations. So, without the complex approach to the solution, I'm afraid I'm against this PR.

If you really need double support ASAP, I suggest you should create an extension that should split the input double values and pass them as two separate floats to the shader. Some useful links: https://stackoverflow.com/questions/6769881/emulate-double-using-2-floats

kterhorst commented 5 years ago

Thank you for your quick reply! I made this PR because I thought that somebody might find it useful despite the fact that the engine doesn't support double precision rendering. When it comes to porting the engine to support DP I would like to stay with FP for the rendering process and instead transform absolute DP coordinates into camera concentric FP coordinates. This requires changes at various places including the shadow mapping process. I am still thinking about it. I will close this PR for now. If you think you could make use of the DP math types anyway I could reformat it properly.