From 6ef21998a490ed120e1caffaad450b6582f0abe5 Mon Sep 17 00:00:00 2001 From: InventorXtreme Date: Wed, 3 Jan 2024 15:37:56 -0500 Subject: [PATCH] yay --- Makefile | 2 +- c3d.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) 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;