tpalmerstudios / Jeli

A first-person game engine for the beginning developer
GNU General Public License v3.0
2 stars 0 forks source link

[REQUEST] Render and overlay rework #9

Open tpalmerstudios opened 4 years ago

tpalmerstudios commented 4 years ago

Is your feature request related to a problem? Please describe. render () should not do any math or raycasting, rather it should call each of the functions that can do these. In addition every draw function should simply return a vector containing the image overlay they made.

Describe the solution you'd like It should store the buffer and each function will return its overlay (with alpha) and render will call overlay on each one.

Describe alternatives you've considered The overlay may not be needed, but I think it could help a lot if I ever wanted to be able to customize transparency. (mini-map is semi-transparent, or a door becomes transparent as you walk through it)

Additional context This is a big one, but I'll break it down into two separate tasks to complete it

tpalmerstudios commented 4 years ago

I'll start with clear (white);
drawSky ();
drawGrass (); drawWalls (); drawSprites (); drawMap (); All of this is mostly done.... but just a few tweaks, then I'll have to figure out my overlay plan

tpalmerstudios commented 4 years ago

The major pseudocode for the overlay rework.

    FrameBuffer::overlay (std::vector <int> coords, uint32_t color)
    {
        if (coords.size () % 2)
            return;
        uint8_t fgR, fgG, fgB, fgA;
        unpackColor (color, fgR, fgG, fgB, fgA);
        for (int i = 0; i < coords.size (); i += 2)
        {
            uint32_t bgColor = get (coord [i], coord [i + 1]);
            uint8_t bgR, bgG, bgB, bgA;
            unpackColor (bgColor, r, g, b, a);
            // Should I call it separately?
            // Use my overlay function in render.cpp
        }
    }
tpalmerstudios commented 4 years ago

Started on it. The actual overlay works. My next step will be to add sky and everything else that actively draws on the screen