packages feed

lambdacube-engine-0.1.1: Graphics/LambdaCube/RenderOperation.hs

module Graphics.LambdaCube.RenderOperation where

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

-- | The rendering operation type to perform
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,Enum)


-- | 'New' rendering operation using vertex buffers.
data (HardwareVertexBuffer vb, HardwareIndexBuffer ib) => RenderOperation vb ib
    = RenderOperation
    { roVertexData      :: VertexData vb        -- ^ Vertex source data
    , roOperationType   :: OperationType        -- ^ The type of operation to perform
    {-| Specifies whether to use indexes to determine the vertices to use as input. If false, the vertices are
        simply read in sequence to define the primitives. If true, indexes are used instead to identify vertices
        anywhere in the buffer, and allowing vertices to be used more than once.
        If true, then the indexBuffer, indexStart and numIndexes properties must be valid.
    -}
    , roIndexData       :: Maybe (IndexData ib) -- ^ Index data - only valid if useIndexes is true
--    , roSrcRenderable   :: Renderable     -- ^ Debug pointer back to renderable which created this
    }
    deriving Eq