This is the documentation for Enlighten.

struct Geo RastFragment

struct Geo::RastFragment

stores a fragment of a triangle i.e. a triangle clipped to a pixel box

Variables

Name Description
Geo::u32 m_NumPts

number of points in fragment polygon

const RastVert * m_Points

fragment polygon points; coordinates are in [0,1]x[0,1] i.e.

const RastTri * m_Tri

reference to triangle that owns this fragment

Geo::s32 m_X

integer coordinates of (top-left of) pixel

Geo::s32 m_Y

integer coordinates of (top-left of) pixel

Functions

Name Description
GetArea()

get signed area of fragment polygon; it's flipped if area < 0

GetBarycentricCoords(float, float, float &, float &)

get barycentric coordinates of a point in the pixel

GetCentroid(RastVert &)

get centroid of fragment polygon (average of vertex positions)

IsPtInPoly(float, float)

is a given point in the fragment polygon?


float Geo::RastFragment::GetArea


public: float GetArea() const


get signed area of fragment polygon; it's flipped if area < 0


void Geo::RastFragment::GetBarycentricCoords


public: void GetBarycentricCoords
(
    float x,
    float y,
    float & u,
    float & v
) const


get barycentric coordinates of a point in the pixel


void Geo::RastFragment::GetCentroid


public: void GetCentroid
(
    RastVert & out
) const


get centroid of fragment polygon (average of vertex positions)


bool Geo::RastFragment::IsPtInPoly


public: bool IsPtInPoly
(
    float x,
    float y
) const


is a given point in the fragment polygon?