28 March 2021, 21:29 | #1 |
Registered User
Join Date: Apr 2013
Location: paris
Posts: 133
|
Normal horizontal line drawing issue
Hi!
I have no issue drawing line with blitter in order to do blitter polygon fill later. But now I want to draw normal lines. I patched the BLTCON0 & BLTCON1 to set "bset" instead of "xor" and also to draw all pixels ( and not only one per scanline ). Everything is working well, except for horizonal lines! Look at screenshot, when drawing horizontal lines of a standard cube, the lines are drawn like "vertical"??!! Any idea? |
28 March 2021, 22:03 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Wrong octant when y1 == y2? Should be fine if you handle zero delta the same way as positive delta. So maybe just a case of a simple bpl/bgt/bge change...
|
28 March 2021, 22:07 | #3 |
Registered User
Join Date: Apr 2013
Location: paris
Posts: 133
|
the thing is the original line rout I used obviously has early out when y0 == y1 ( that's normal for polygon filling ). So I guess the octant selection for y0==y1 of this rout has never been tested ( and I never really get how amiga octant are working )
|
29 March 2021, 12:08 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Code:
(x1,y1)(x2,y2) dx=|x1-x2| dy=|y1-y2| \ | / \6 | 7/ 5 \ | / 8 \|/ ----X---- /|\ 4 / | \ 1 /3 | 2\ / | \ Octant (based on line start): 1-|SUD=1 2-|SUD=0 3-|SUD=0 4-|SUD=1 |SUL=0 |SUL=0 |SUL=1 |SUL=0 |AUL=0 |AUL=0 |AUL=0 |AUL=1 5-|SUD=1 6-|SUD=0 7-|SUD=0 8-|SUD=1 |SUL=1 |SUL=1 |SUL=0 |SUL=1 |AUL=1 |AUL=1 |AUL=1 |AUL=0 100 : y1< y2, x1< x2, dx>=dy 000 : y1< y2, x1< x2, dx< dy 010 : y1< y2, x1>=x2, dx< dy 101 : y1< y2, x1>=x2, dx>=dy 111 : y1>=y2, x1>=x2, dx>=dy 011 : y1>=y2, x1>=x2, dx< dy 001 : y1>=y2, x1< x2, dx< dy 110 : y1>=y2, x1< x2, dx>=dy You will find discordant notations about the octant numbering almost everywhere. I opted for the 'natural' one for y increasing downwards (therefore in a clockwise direction, it is practically mirrored on x with respect to the Cartesian one). EDIT: when the point straddles two octants, you can choose any; I put condition (>=), but using (<=) instead of (<) could be fine too [I should try it] Last edited by ross; 29 March 2021 at 12:56. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Blitter Line reverse drawing question | sandruzzo | Coders. Asm / Hardware | 9 | 20 February 2021 05:52 |
Puzzling: Blitter line drawing faster on second execution | Yragael | Coders. Asm / Hardware | 10 | 02 June 2019 22:52 |
Blitter line-drawing mode? | E-Penguin | Coders. Blitz Basic | 2 | 13 April 2019 21:37 |
Blitter line drawing: nothing happens | Crank | Coders. General | 21 | 25 April 2018 21:43 |
Drawing a line... | Lonewolf10 | Coders. Tutorials | 24 | 06 September 2011 00:46 |
|
|