Log In  

Cart #nituzapitu-1 | 2020-05-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

Here's a little experiment for a technique to render water with some very rough-and-ready sprites.

It works by simply using memcpy to copy rows of pixels from the screen memory straight to another location in the screen memory, using some simple offset calculations.

After that a rectfill is used with the newly (ish) revealed bitmask poke to cheaply tint the water area.

There's a few rough edges and caveats - namely the water area (defined as a rectangle needs to ideally be aligned on a 2-pixel boundary, since it's copying whole bytes of screen data at a time and a single byte contains 2 pixles.

Secondly using a bitmask is cheap but crude in that you don't have complete control over the result since it depends on what is being reflected. However for water I think it ends up fine.

The third point is that you can't merge pixels behind the water area - it's reflection or nothing :)

P#76518 2020-05-13 20:02

warter

P#78017 2020-06-13 00:34

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 00:18:26 | 0.009s | Q:16