Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)

Enlighten API 3.10 Documentation
Results will update as you type.
  • Modules
    • module Enlighten
    • module Infrastructure (GeoBase)
    • module Infrastructure (GeoCore)
      • module 3DPlane
      • module Colours
      • module Containers
      • module Endian Conversion
      • module Half Precision Scalars
      • module Maths
      • module Matrices
      • module Object Lifetime
      • module Quaternions
      • module Scalars
      • module Serialisation
      • module Simple CPU texture formats.
      • module Triangle Rasteriser
      • module Vectors
  • Namespaces
  • Notes
    Calendars

You‘re viewing this with anonymous access, so some content might be blocked.
/
module Triangle Rasteriser

    This is the documentation for Enlighten.

    module Triangle Rasteriser

    Nov 21, 2019

    2D triangle rasterizer

    A triangle is defined by three sets of floating-point coordinates A pixel is defined as the product of two half-open sets [x,x+1)*[y,y+1) Thus any point is specifically inside one pixel

    The aim of this rasterizer is to produce a VERY GOOD rasterization which is suitable for multiple purposes; thus, speed is less of a factor. Formally, instead of producing the set of pixels whose centers lie within the triangle, we produce a set of pixels which overlap the triangle AT ALL and, for each pixel, we produce a set of vertices which define the convex intersection of the pixel square and the triangle. This allows us to calculate the "correct" centroid-sampled position, calculate atlas masks, etc.

    To ensure proper seaming between adjacent triangles, all edges are scan-converted from top to bottom.

    Note: pixel coordinates are in usual "screen space" i.e. all coordinates positive, (0,0) is top-left

    Classes

    Name Description
    Geo::RastFragment

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

    Geo::RastTri

    records details of the input triangle

    Geo::RastVert

    stores a rasterization vertex, including barycentric coordinates

    Functions

    Name Description
    GetArea()

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

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

    Gets the barycentric coords of the given point (x, y).

    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?

    RasterizeTriangle(float, float, float, float, float, float, RasterizationClient, void *)

    rasterize a triangle

    RasterizeWindingAgnosticTriangle(float, float, float, float, float, float, RasterizationClient, void *)

    rasterize a triangle regardless of winding order

    RastTri(float, float, float, float, float, float)

    Constructor.

    RastVert()

    Constructors.

    RastVert(float, float, float, float)

    Constructors.

    Variables

    Name Description
    float m_dX2

    x2-x1, y2-y1

    float m_dX3

    x3-x1, y3-y1

    float m_dY2

    x2-x1, y2-y1

    float m_dY3

    x3-x1, y3-y1

    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

    float m_U

    Barycentric coordinates.

    float m_V

    Barycentric coordinates.

    float m_X

    Vertex position.

    Geo::s32 m_X

    integer coordinates of (top-left of) pixel

    float m_X1

    x1, y1

    float m_Y

    Vertex position.

    Geo::s32 m_Y

    integer coordinates of (top-left of) pixel

    float m_Y1

    x1, y1

    Typedefs

    Name Description
    void(* RasterizationClient)(const RastFragment *fragment, void *user)

    callback function for rasterization


    float Geo::RastFragment::GetArea


    public: float GetArea() const


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


    void Geo::RastTri::GetBarycentricCoords


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


    Gets the barycentric coords of the given point (x, y).


    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?


    void Geo::RasterizeTriangle


    public: void RasterizeTriangle
    (
        float x1,
        float y1,
        float x2,
        float y2,
        float x3,
        float y3,
        RasterizationClient emitter,
        void * user
    )


    rasterize a triangle


    void Geo::RasterizeWindingAgnosticTriangle


    public: void RasterizeWindingAgnosticTriangle
    (
        float x1,
        float y1,
        float x2,
        float y2,
        float x3,
        float y3,
        RasterizationClient emitter,
        void * user
    )


    rasterize a triangle regardless of winding order


    Geo::RastTri::RastTri


    public: RastTri
    (
        float x1,
        float y1,
        float x2,
        float y2,
        float x3,
        float y3
    )


    Constructor.


    Geo::RastVert::RastVert


    public: RastVert()


    Constructors.


    Geo::RastVert::RastVert


    public: RastVert
    (
        float x,
        float y,
        float u,
        float v
    )


    Constructors.

    , multiple selections available,
    {"serverDuration": 10, "requestCorrelationId": "0692e9390b044431b5a04bb31a6ac784"}