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

Color abstraction #8

Closed m0ppers closed 6 years ago

m0ppers commented 6 years ago

I finally looked into the color issues that I had on the Amiga and as you might have guessed it was big vs little endian related. I started off adding some #ifdefs in the code but it got ugly super quickly.

What I did now was to create a simple LeColor struct:

struct LeColor {
    uint8_t r;
    uint8_t g;
    uint8_t b;
    uint8_t a;
};

And then I started replacing all the uint32_t by LeColor and change the code super slighly.

Then I changed the draw_win thing and added appropriate bitmasks so that windows renderes it properly. That was it. I now have a version which looks EXACTLY the same on Amiga and Windows.

Is this change desired? How would you do it?

My guess is that I broke the SIMD stuff.

I could start cleaning it up and then provide a pull request. What do you think? What would be your approach to the problem?

m0ppers commented 6 years ago

btw...I am seeing black rectangles from time to time...didn't yet look into it. but also this is now the same on amiga and windows :D (intrasterizer no mmx/simd)

Marzac commented 6 years ago

Sounds good to me. Can you make a pull request so I can test the code?

m0ppers commented 6 years ago

should find some time this evening I guess

Marzac commented 6 years ago

Ok, then I will adapt the asm code if necessary.

m0ppers commented 6 years ago

Pull request opened: https://github.com/Marzac/le3d/pull/9