module Graphics.LambdaCube.RenderOperation where

import Graphics.LambdaCube.HardwareIndexBuffer
import Graphics.LambdaCube.HardwareVertexBuffer
import Graphics.LambdaCube.VertexIndexData

-- | The interpretation of a sequence of vertices.
data OperationType
    = OT_POINT_LIST     -- ^ A list of points, 1 vertex per point.
    | OT_LINE_LIST      -- ^ A list of lines, 2 vertices per line.
    | OT_LINE_STRIP     -- ^ A strip of connected lines, 1 vertex per line plus 1 start vertex.
    | OT_TRIANGLE_LIST  -- ^ A list of triangles, 3 vertices per triangle.
    | OT_TRIANGLE_STRIP -- ^ A strip of triangles, 3 vertices for the first triangle, and 1 per triangle after that.
    | OT_TRIANGLE_FAN   -- ^ A fan of triangles, 3 vertices for the first triangle, and 1 per triangle after that.
    deriving (Eq,Ord,Enum)

data (HardwareVertexBuffer vb, HardwareIndexBuffer ib) => RenderOperation vb ib
    = RenderOperation
    { roVertexData      :: VertexData vb        -- ^ Vertex source data
    , roOperationType   :: OperationType        -- ^ The type of operation to perform
    , roIndexData       :: Maybe (IndexData ib) -- ^ Index data - only valid if useIndexes is true
    }
    deriving (Eq,Ord)