diff --git a/bin/back b/bin/back index 8aabf2e..e174293 100755 Binary files a/bin/back and b/bin/back differ diff --git a/obj/base.o b/obj/base.o new file mode 100644 index 0000000..44784a8 Binary files /dev/null and b/obj/base.o differ diff --git a/obj/display.o b/obj/display.o new file mode 100644 index 0000000..98b1f40 Binary files /dev/null and b/obj/display.o differ diff --git a/obj/generation.o b/obj/generation.o new file mode 100644 index 0000000..618997f Binary files /dev/null and b/obj/generation.o differ diff --git a/obj/hash.o b/obj/hash.o new file mode 100644 index 0000000..4633f4e Binary files /dev/null and b/obj/hash.o differ diff --git a/obj/main.o b/obj/main.o new file mode 100644 index 0000000..215ac70 Binary files /dev/null and b/obj/main.o differ diff --git a/obj/move.o b/obj/move.o new file mode 100644 index 0000000..f2e7792 Binary files /dev/null and b/obj/move.o differ diff --git a/obj/threed.o b/obj/threed.o new file mode 100644 index 0000000..46acbc5 Binary files /dev/null and b/obj/threed.o differ diff --git a/src/main.c b/src/main.c index b20633e..121908d 100644 --- a/src/main.c +++ b/src/main.c @@ -78,8 +78,12 @@ int main(int argc, char** argv) { p3.x = 12.0 ; p3.y = 8.0 ; p3.z = 1.0 ; p4.x = 0.0 ; p4.y = 8.0 ; p4.z = 1.0 ; - project_rectangle(p1, p2, p3, p4); - bufferUpdateRenderer(rend); + for(int i = 0; i < 359; i++) { + resetBuffer(); + project_rectangle(p1, p2, p3, p4); + bufferUpdateRenderer(rend); + three_angle = i+1 ; + } printf("pass\n"); usleep(3000000); diff --git a/src/threed.c b/src/threed.c index eec0abe..96b75f4 100644 --- a/src/threed.c +++ b/src/threed.c @@ -197,7 +197,9 @@ void drawPolygonToBuffer(int count, ...) { printf("(%d -> %d)\n", pmin, pmax);*/ for(int i = 0; i < poly_length; i++) { - drawLineWithThiccToBuffer(4, polygon_b[i].x, polygon_b[(i+1)%poly_length].x, (int)polygon_b[i].y, (int)polygon_b[(i+1)%poly_length].y, (int)polygon_b[i].z, (int)polygon_b[(i+1)%poly_length].z, 255, 255, 255); + if(polygon_b[i].x >= draw_const || polygon_b[(i+1)%pt_count].x >= draw_const) { + drawLineWithThiccToBuffer(4, polygon_b[i].x, polygon_b[(i+1)%poly_length].x, (int)polygon_b[i].y, (int)polygon_b[(i+1)%poly_length].y, (int)polygon_b[i].z, (int)polygon_b[(i+1)%poly_length].z, 255, 255, 255); + } } } } @@ -208,8 +210,8 @@ pt_3d adjust(pt_3d p) { res.y = p.y - (player_cy * 8 + player_y + εy) ; res.z = p.z - 1.8 ; // height of player - res.x = res.y * sinuses[three_angle] + res.x * cosinuses[three_angle]; - res.y = (p.y - (player_cy * 8 + player_y + εy)) * cosinuses[three_angle] + res.x * sinuses[three_angle] ; + res.x = res.x * cosinuses[three_angle] - (p.y - (player_cy * 8 + player_y + εy)) * sinuses[three_angle] ; + res.y = res.y * cosinuses[three_angle] + (p.x - (player_cx * 8 + player_x + εx)) * sinuses[three_angle] ; return res; }