mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Exclude last row in rasterization
This commit is contained in:
parent
0a27bbe2b5
commit
d585310b97
1 changed files with 8 additions and 5 deletions
13
s3l.h
13
s3l.h
|
@ -94,9 +94,9 @@
|
||||||
transformation to triangle A first and then rasterizing it. Even the number
|
transformation to triangle A first and then rasterizing it. Even the number
|
||||||
of rasterized pixels is usually different.
|
of rasterized pixels is usually different.
|
||||||
- If specifying a triangle with integer coordinates, then:
|
- If specifying a triangle with integer coordinates, then:
|
||||||
- a Bottom-most corner (or side) of a triangle is never rasterized (because
|
- The bottom-most corner (or side) of a triangle is never rasterized
|
||||||
it is connected to a right side).
|
(because it is connected to a right side).
|
||||||
- Top-most corner can only be rasterized on completely horizontal side
|
- The top-most corner can only be rasterized on completely horizontal side
|
||||||
(otherwise it is connected to a right side).
|
(otherwise it is connected to a right side).
|
||||||
- Vertically middle corner is rasterized if and only if it is on the left
|
- Vertically middle corner is rasterized if and only if it is on the left
|
||||||
of the triangle and at the same time is also not the bottom-most corner.
|
of the triangle and at the same time is also not the bottom-most corner.
|
||||||
|
@ -791,7 +791,7 @@ void S3L_drawTriangle(
|
||||||
infinite substracting loop */
|
infinite substracting loop */
|
||||||
|
|
||||||
#define stepSide(s)\
|
#define stepSide(s)\
|
||||||
while (s##Err > s##Dy)\
|
while (s##Err >= s##Dy)\
|
||||||
{\
|
{\
|
||||||
s##X += s##Inc;\
|
s##X += s##Inc;\
|
||||||
s##Err -= s##ErrSub;\
|
s##Err -= s##ErrSub;\
|
||||||
|
@ -801,7 +801,10 @@ void S3L_drawTriangle(
|
||||||
initSide(r,t,r,1,1)
|
initSide(r,t,r,1,1)
|
||||||
initSide(l,t,l,1,0)
|
initSide(l,t,l,1,0)
|
||||||
|
|
||||||
while (currentY <= endY) // draw the triangle from top to bottom
|
while (currentY < endY) /* draw the triangle from top to bottom -- the
|
||||||
|
bottom-most row is left out because, following
|
||||||
|
from the rasterization rules (see top of the
|
||||||
|
source), it is to never be rasterized. */
|
||||||
{
|
{
|
||||||
if (currentY == splitY) // reached a vertical split of the triangle?
|
if (currentY == splitY) // reached a vertical split of the triangle?
|
||||||
{ // then reinit one side
|
{ // then reinit one side
|
||||||
|
|
Loading…
Reference in a new issue