...
This commit is contained in:
parent
b842806d0b
commit
3383e8520e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue