Marzac / le3d

A straightforward and easy to use 3D software renderer for real-time retro graphics.
https://marzac.github.io/le3d/
MIT License
60 stars 6 forks source link

Implement LeColor so that the a pixel is RGBA on all platforms #9

Closed m0ppers closed 6 years ago

m0ppers commented 6 years ago

WIP - do not merge yet (unless you know immediately how to fix it or you )

enabling SSE2 results in cyan 👎

rest seems ok

with this change I see the same triangle problems that I have on the Amiga (let the cube rotate for a while - suddenly colors are off).

Will check if I can find out why it is broken and add to this pull request.

Todos:

Marzac commented 6 years ago

Hi M0ppers. I have had a short review of the code. Everything seems to be alright. I have just one concern, you have swapped the whole engine to work with RGBA values whereas 90% of the OS it supports work with ABGR values instead. Also WIN bitmaps (native format of picture representation in engine) are ABGR too.

I understand the little / big endian problematic but could the word be swapped just for big endian systems? Is there a performance problem?

Marzac commented 6 years ago

I have the engine integrated with a QT application now that also need ABGR values. And it does not make use of the window / draw classes (only renders to bitmap). So it makes it incompatible now.

m0ppers commented 6 years ago

fix under way :) you are right

m0ppers commented 6 years ago

This is sufficient for now I think.

Right now the code seems to work for all platforms.

The amiga version right now takes RGBA. This is good because the way the int rasterizer works (colors in first three bytes) right now works as expected :)

Once I go for the native AMMX framebuffer I have to recheck but as the rasterization will be implemented in ASM code the code path is different anyway.

So yeah. Maybe that's it for now?

Right now this is what color.h looks like in my amiga branch:

https://github.com/m0ppers/le3d/blob/ammx-experiments/engine/color.h

This is the only required change. Nothing in the engine code (maybe that changes once I really need ARGB).

What do you think?

This is still not mergeable. There are glitches when the crate is rotating. have to investigate.

m0ppers commented 6 years ago

glitching finally fixed. ready when you are and you are fine with it?

as far as I know it should be possible to squash merge a pull request from the UI (so my commits appear as 1 commit in the main repo). I think that would make sense.

Marzac commented 6 years ago

Ok I merged with the main branch. Now I gonna be testing this with different projects.

Marzac commented 6 years ago

So it compiles and runs fine with VS 2017.

Marzac commented 6 years ago

I am now checking with mingw64.

Marzac commented 6 years ago

Currently checking:

Marzac commented 6 years ago

There is something weird though. The executables (from mingw64) are now mega fett 800kB instead of 150kB before, any idea?

Marzac commented 6 years ago

Any weird C++ feature that would require a load of runtime checks, tables or so?