started grphic.h and cleaned a bit more main.c
This commit is contained in:
parent
0a66fcbd80
commit
97d0e0f955
@ -1,7 +1,22 @@
|
|||||||
#ifndef GRAPHIC_H
|
#ifndef GRAPHIC_H
|
||||||
# define GRAPHIC_H
|
# define GRAPHIC_H
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
//software renderer allowing for system agnostic rendering (other then drawing the frame on the screen)
|
//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
|
#endif
|
||||||
|
|||||||
@ -80,6 +80,11 @@ int main(int ac, char **av) {
|
|||||||
tkn_lst = SeparateString(data);
|
tkn_lst = SeparateString(data);
|
||||||
//second pass on ; and \n
|
//second pass on ; and \n
|
||||||
//third pass on \t and space
|
//third pass on \t and space
|
||||||
|
//give each token a context
|
||||||
|
//let's replace preprocessor
|
||||||
|
//let's do recursive parsing everywhere that need it
|
||||||
|
//compile time reflection
|
||||||
|
//metaprogramming logic annotation if i do it lastly
|
||||||
for (int i = 0; i < tkn_lst.size; i++) {
|
for (int i = 0; i < tkn_lst.size; i++) {
|
||||||
free(tkn_lst.token[i].data);
|
free(tkn_lst.token[i].data);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user