23 lines
534 B
C
23 lines
534 B
C
#ifndef GRAPHIC_H
|
|
# define GRAPHIC_H
|
|
#include <math.h>
|
|
|
|
//software renderer allowing for system agnostic rendering (other then drawing the frame on the screen)
|
|
typedef struct Vec3_s{
|
|
float x, y, z;
|
|
} Vec3_t;
|
|
|
|
//internal framebuffer
|
|
char framebuffer[65536]; //256 * 256
|
|
|
|
|
|
//limited to 255 color
|
|
void DrawPoint(Vec3_t point, char color) {
|
|
int x = floorf(point.x / point.z);
|
|
int y = floorf(point.y / point.z);
|
|
//need to work on projection, screen space and 3d space
|
|
framebuffer[x + y * 256] = color;
|
|
}
|
|
|
|
#endif
|