License | BSD3 |
---|---|
Maintainer | ziocroc@gmail.com |
Stability | experimental |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
- module Graphics.Rendering.Ombra.OutBuffer
- data Draw o a
- runDraw :: GLES => Int -> Int -> Ctx -> Draw GVec4 a -> IO a
- class (MonadGeometry (m o), MonadProgram (m o), MonadTexture (m o), MonadScreen (m o)) => MonadDraw o m where
- class MonadDrawBuffers m where
- class MonadDraw o m => MonadRead o m where
- class (GLES, Monad m) => MonadScreen m where
- data CullFace
- class GLES => MonadCulling m where
- data ResStatus r
- preloadGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o (Maybe String)
- preloadTexture :: GLES => Texture -> Draw o (Maybe String)
- removeGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o ()
- removeTexture :: GLES => Texture -> Draw o ()
- checkGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o (ResStatus ())
- checkTexture :: (GLES, Num a) => Texture -> Draw o (ResStatus (a, a))
Documentation
An implementation of MonadDraw
and MonadDrawBuffers
.
GLES => MonadDrawBuffers Draw Source # | |
GLES => MonadRead GVec4 Draw Source # | |
(FragmentShaderOutput o, GLES) => MonadDraw o Draw Source # | |
MonadBase IO (Draw o) Source # | |
MonadBaseControl IO (Draw o) Source # | |
Monad (Draw o) Source # | |
Functor (Draw o) Source # | |
Applicative (Draw o) Source # | |
MonadIO (Draw o) Source # | |
GLES => MonadCulling (Draw o) Source # | |
GLES => MonadScreen (Draw o) Source # | |
GLES => MonadTexture (Draw o) Source # | |
type StM (Draw o) a Source # | |
Running the Draw monad
Run a Draw
program.
Draw actions
class (MonadGeometry (m o), MonadProgram (m o), MonadTexture (m o), MonadScreen (m o)) => MonadDraw o m where Source #
Monads that can be used to draw Image
s.
withColorMask :: (Bool, Bool, Bool, Bool) -> m o a -> m o a Source #
Enable/disable writing to one or more color channels.
withDepthTest :: Bool -> m o a -> m o a Source #
Enable/disable depth testing.
withDepthMask :: Bool -> m o a -> m o a Source #
Enable/disable writing to the depth buffer.
clearColor :: m o () Source #
Clear the color buffer.
clearColorWith :: Vec4 -> m o () Source #
Clear the color buffer filling it with the given color.
clearDepth :: m o () Source #
Clear the depth buffer.
clearDepthWith :: Double -> m o () Source #
Clear the depth buffer filling it with the given value.
clearStencil :: m o () Source #
Clear the stencil buffer.
clearStencilWith :: Int -> m o () Source #
Clear the stencil buffer filling it with the given value.
class MonadDrawBuffers m where Source #
Monads that support drawing to GBuffer
s and DepthBuffer
s.
createBuffers :: FragmentShaderOutput o => Int -> Int -> GBufferInfo o -> DepthBufferInfo -> m o a -> m o' (a, BufferPair o) Source #
Create a GBuffer
and a DepthBuffer
and draw something to them.
createGBuffer :: FragmentShaderOutput o => GBufferInfo o -> DepthBuffer -> m o a -> m o' (a, BufferPair o) Source #
createDepthBuffer :: FragmentShaderOutput o => GBuffer o -> DepthBufferInfo -> m o a -> m o' (a, BufferPair o) Source #
drawBuffers :: FragmentShaderOutput o => BufferPair o -> m o a -> m o' a Source #
Draw an image to some buffers.
class MonadDraw o m => MonadRead o m where Source #
readColor :: (Int, Int, Int, Int) -> m o [Color] Source #
Read a rectangle of pixel colors from the screen (or texture).
readColorFloat :: (Int, Int, Int, Int) -> m o [Vec4] Source #
readColor
variant that read color vectors.
readDepth :: (Int, Int, Int, Int) -> m o [Word16] Source #
Read a rectangle of pixel depths from the screen (or texture). Not supported on WebGL!
readDepthFloat :: (Int, Int, Int, Int) -> m o [Float] Source #
readDepth
variants that read floats. Not supported on WebGL as well.
readStencil :: (Int, Int, Int, Int) -> m o [Word8] Source #
Read a rectangle of stencil values from the screen (or texture). Not supported on WebGL!
class (GLES, Monad m) => MonadScreen m where Source #
currentViewport, resizeViewport
GLES => MonadScreen (Draw o) Source # | |
Culling
class GLES => MonadCulling m where Source #
withCulling :: Maybe CullFace -> m a -> m a Source #
GLES => MonadCulling (Draw o) Source # | |
Resources
In Ombra, GPU resources are allocated when they're needed, and they're kept alive by their corresponding CPU resources. Specifically, these resources are Geometries, Textures and Shaders. This means that, when a CPU resource is garbage collected, the GPU resource is also removed. The functions below let you manage allocation and deallocation manually. Note that if you try to use a resource that was deallocated with the remove* functions, it will be allocated again.
preloadGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o (Maybe String) Source #
Manually allocate a Geometry
in the GPU. Eventually returns an error
string.
preloadTexture :: GLES => Texture -> Draw o (Maybe String) Source #
Manually allocate a Texture
in the GPU.
removeGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o () Source #
Manually delete a Geometry
from the GPU.
checkGeometry :: (GLES, GeometryVertex g, ElementType e) => Geometry e g -> Draw o (ResStatus ()) Source #
Check if a Geometry
failed to load.