diff --git a/Makefile b/Makefile index ce497ca..6ab857a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -pg -g -Wall +CFLAGS = -pg -g -Wall LDFLAGS = -pg -g LDLIBS = -lraylib -lm objects = c3d.o diff --git a/c3d.c b/c3d.c index 908e775..e9d5988 100644 --- a/c3d.c +++ b/c3d.c @@ -87,8 +87,8 @@ double Max(double a, double b){ } -int IndexOfZBuff(int row, int col) { - return row*RENDERWIDTH + col; +static inline int IndexOfZBuff(int row, int col) { + return row + RENDERWIDTH*col; } @@ -506,9 +506,9 @@ int main() { } //memset(ZBuff,NULL ,sizeof(Zee) * RENDERHEIGHT*RENDERWIDTH ); - for (int i = 0; i < RENDERHEIGHT*RENDERWIDTH; i ++) { - ZBuff[i] = (Zee){10000,NULL}; - } + // for (int i = 0; i < RENDERHEIGHT*RENDERWIDTH; i ++) { + // ZBuff[i] = (Zee){10000,NULL}; + // } memset(display,0,sizeof(display)); @@ -551,15 +551,14 @@ int main() { display[index+2] = c->b; display[index+3] = c->a; */ - printf("%d\n",IndexOfZBuff(x,y)); - ZBuff[IndexOfZBuff(x,y)].triangle = NULL; + if (ZBuff[IndexOfZBuff(x,y)].triangle != NULL) { //DrawPixel(x,y,ZBuff[x][y].triangle->color); - //display[index] = ZBuff[IndexOfZBuff(x,y)].triangle->color; - Zee test = ZBuff[IndexOfZBuff(x,y)]; - display[index] = test.triangle->color; + display[index] = ZBuff[IndexOfZBuff(x,y)].triangle->color; + // Zee test = ZBuff[IndexOfZBuff(x,y)]; + // display[index] = test.triangle->color; } index = index+1;