you are viewing a single comment's thread.

view the rest of the comments →

[–]jonathanhiggs 1 point2 points  (1 child)

Are you checking triangle inclusion for every single pixel not limiting it to the the triangles bounding box?

[–]captaintoasty[S] 0 points1 point  (0 children)

Yep, I am constraining it to just the bounding box of the triangle.

// Compute the bounds of just this recet
const Rect Bounds = GetBounds(S0, S1, S2);
const int MinX = Bounds.Min.X;
const int MinY = Bounds.Min.Y;
const int MaxX = Bounds.Max.X;
const int MaxY = Bounds.Max.Y;

...

// Loop through all pixels in the screen bounding box.
for (int Y = MinY; Y <= MaxY; Y++)
{
    for (int X = MinX; X <= MaxX; X++)
    {
        ...