This commit is contained in:
Alexandre 2024-08-27 19:50:36 +02:00
parent b842806d0b
commit 3383e8520e
10 changed files with 11 additions and 5 deletions

BIN
bin/back

Binary file not shown.

BIN
obj/base.o Normal file

Binary file not shown.

BIN
obj/display.o Normal file

Binary file not shown.

BIN
obj/generation.o Normal file

Binary file not shown.

BIN
obj/hash.o Normal file

Binary file not shown.

BIN
obj/main.o Normal file

Binary file not shown.

BIN
obj/move.o Normal file

Binary file not shown.

BIN
obj/threed.o Normal file

Binary file not shown.

View File

@ -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 ;
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);

View File

@ -197,10 +197,12 @@ void drawPolygonToBuffer(int count, ...) {
printf("(%d -> %d)\n", pmin, pmax);*/
for(int i = 0; i < poly_length; i++) {
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);
}
}
}
}
pt_3d adjust(pt_3d p) {
pt_3d res;
@ -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;
}