#include "engine.h" NS_ENGINE_BEGIN internal void render_weird_graident(OffscreenBuffer* buffer, u32 x_offset, u32 y_offset ) { // TODO(Ed): See if with optimizer if buffer should be passed by value. struct Pixel { u8 Blue; u8 Green; u8 Red; u8 Alpha; }; u8* row = rcast( u8*, buffer->Memory); local_persist float wildcard = 0; for ( u32 y = 0; y < buffer->Height; ++ y ) { // u8* pixel = rcast(u8*, row); // Pixel* pixel = rcast( Pixel*, row ); u32* pixel = rcast(u32*, row); for ( u32 x = 0; x < buffer->Width; ++ x ) { /* Pixel in memory: ----------------------------------------------- Pixel + 0 Pixel + 1 Pixel + 2 Pixel + 3 RR GG GG XX ----------------------------------------------- x86-64 : Little Endian Arch 0x XX BB GG RR */ #if 0 u8 blue = scast(u8, x + x_offset * u8(wildcard) % 256); u8 green = scast(u8, y + y_offset - u8(wildcard) % 128); u8 red = scast(u8, wildcard) % 256 - x * 0.4f; #else u8 blue = scast(u8, x + x_offset); u8 green = scast(u8, y + y_offset); u8 red = 0; #endif *pixel++ = (red << 16) | (green << 8) | blue; } wildcard += 0.5375f; row += buffer->Pitch; } } internal void update_and_render( OffscreenBuffer* back_buffer // Temp (for feature parity) , u32 x_offset, u32 y_offset ) { render_weird_graident( back_buffer, x_offset, y_offset ); } NS_ENGINE_END