yay
This commit is contained in:
parent
3a274a9d61
commit
6ef21998a4
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
|||
CC = gcc
|
||||
CFLAGS = -pg -g -Wall
|
||||
CFLAGS = -pg -g -Wall
|
||||
LDFLAGS = -pg -g
|
||||
LDLIBS = -lraylib -lm
|
||||
objects = c3d.o
|
||||
|
|
19
c3d.c
19
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;
|
||||
|
|
Loading…
Reference in a new issue