View Single Post
Old 11 September 2015, 13:11   #31
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
Quote:
Originally Posted by ReadOnlyCat View Post
The binary encoding must be re-performed on each line
Yes, that is correct

Quote:
Not to mention that having to handle different displacements per Y means that one must not only mask the columns to shift up but also the existing data from the previous line.
I don't understand what you mean here, the data from the previous line has been shifted off the top of the strip. You copy the top line of the strip to the screen for each Y-position.

Quote:
Maybe it is possible to somehow precompute delta-Y mask tables depending on Z, Y and the wall's angle but it seems like this would require a huge lot of memory.
Z, Y and the wall's angle are all irrelevant... you only need the screen co-ordinates of the top and bottom (i.e. the height) of the wall for each screen X co-ordinate.

[/quote]The right wall on the image below illustrates pretty nicely the range of possible distortions on a single 16 pixels wide strip depending on Z, X and Y.[/QUOTE]
Yes i know, but i don't know what is the problem here... maybe there is something you miss.

On each line you distort the previously distorted strip, you don't redraw the entire thing for every line. So as long as you are only "stretching" the columns, each pixel column of the 16-pixel tall strip need move upwards only 0 or 1 pixels.

In fact we can do better than that, because the stretch is symmetrical (even if the texture is not), so we only need to do half the number of blits really.

And i have thought about how to calculate the masks more efficiently, basically you need to draw lines along the walls onto a buffer, with 1 pixel per x-coordinate. When a set pixel is encountered in the mask image, it shifts the corresponding column of the texture strip upwards.
Mrs Beanbag is offline  
 
Page generated in 0.33894 seconds with 11 queries