The MASM Forum

Projects => Game Development => Topic started by: HSE on June 21, 2021, 05:38:38 AM

Title: Sutherland-Hodgman Polygon Clipping
Post by: HSE on June 21, 2021, 05:38:38 AM
Hi All !

This is a test of the polygon clipping algorithm (translated from cpp).

Don't look so amazing, but is used for more complex thing at subpixel level (that I stil don't understand, I have to say  :biggrin:)

In white is polygon to clip, in yellow the clipper window, and in blue or red are clipped polygons:

    ; Show imputs
    invoke Poligono, addr poly_points1, poly_size1, 0FFBBBBBBh
    invoke Poligono, addr clipper_points1, clipper_size1, 0FF00BBBBh
   
    ; Calling the clipping function
    invoke SuthHodgClip, addr poly_points1, addr poly_size1, addr clipper_points1, clipper_size1

    ; Show result
    invoke Poligono, addr poly_points1, poly_size1, 0FF0000FFh


Regards, HSE.
Title: Re: Sutherland-Hodgman Polygon Clipping
Post by: daydreamer on June 21, 2021, 10:47:19 PM
nice :thumbsup:
could also be used for frustrum culling?,clipping with  x-z romb shape,reduces also too far/too near polys
Title: Re: Sutherland-Hodgman Polygon Clipping
Post by: HSE on June 22, 2021, 12:25:48 AM
Quote from: daydreamer on June 21, 2021, 10:47:19 PM
could also be used for frustrum culling?,clipping with  x-z romb shape,reduces also too far/too near polys
:thumbsup: This algorithm is included in more complex algorithms with z.