blob: bf148bdf80e4f34cf4c557c431e8eec8b51faf6c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "FrameRender.h"
#include <string.h>
void RenderFrame(RGBImage buffer, const PixelCallback** callbacks, usize sizeCallbacks) {
struct PixelContext pc;
for (u32 x = 0; x < buffer.width; ++x) {
for (u32 y = 0; y < buffer.height; ++y) {
pc.x = x;
pc.y = y;
pc.pixel.a = pc.pixel.r = pc.pixel.g = pc.pixel.b = 0;
for (usize i = 0; i < sizeCallbacks; ++i) {
// Soft context reset
if (callbacks[i] == NULL) {
pc.x = x;
pc.y = y;
}
else
callbacks[i]->callback(callbacks[i]->callback_self, &pc);
}
memcpy(RGBImage_at(buffer, y, x), &pc.pixel, sizeof(pc.pixel));
}
}
}
|