|
|
|
@ -78,11 +78,6 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) { |
|
|
|
|
double sprite_x = double(sprite_pos.location.x) - $pos_x + 0.5; |
|
|
|
|
double sprite_y = double(sprite_pos.location.y) - $pos_y + 0.5; |
|
|
|
|
|
|
|
|
|
//transform sprite with the inverse camera matrix
|
|
|
|
|
// [ $plane_x $dir_x ] -1 [ $dir_y -$dir_x ]
|
|
|
|
|
// [ ] = 1/($plane_x*$dir_y-$dir_x*$plane_y) * [ ]
|
|
|
|
|
// [ $plane_y $dir_y ] [ -$plane_y $plane_x ]
|
|
|
|
|
|
|
|
|
|
double inv_det = 1.0 / ($plane_x * $dir_y - $dir_x * $plane_y); // required for correct matrix multiplication
|
|
|
|
|
|
|
|
|
|
double transform_x = inv_det * ($dir_y * sprite_x - $dir_x * sprite_y); |
|
|
|
|