{-# OPTIONS_HADDOCK hide #-}
module Brillo.Internals.Rendering.State (
State (..),
initState,
Texture (..),
)
where
import Brillo.Internals.Rendering.Bitmap (BitmapData)
import Data.IORef (IORef, newIORef)
import Data.Word (Word8)
import Foreign.ForeignPtr (ForeignPtr)
import Graphics.Rendering.OpenGL.GL qualified as GL
import System.Mem.StableName (StableName)
data State
= State
{ State -> Bool
stateColor :: !Bool
, State -> Bool
stateWireframe :: !Bool
, State -> Bool
stateBlendAlpha :: !Bool
, State -> Bool
stateLineSmooth :: !Bool
, State -> IORef [Texture]
stateTextures :: !(IORef [Texture])
}
data Texture
= Texture
{ Texture -> StableName BitmapData
texName :: StableName BitmapData
, Texture -> Int
texWidth :: Int
, Texture -> Int
texHeight :: Int
, Texture -> ForeignPtr Word8
texData :: ForeignPtr Word8
, Texture -> TextureObject
texObject :: GL.TextureObject
, Texture -> Bool
texCacheMe :: Bool
}
initState :: IO State
initState :: IO State
initState =
do
IORef [Texture]
textures <- [Texture] -> IO (IORef [Texture])
forall a. a -> IO (IORef a)
newIORef []
State -> IO State
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
State
{ stateColor :: Bool
stateColor = Bool
True
, stateWireframe :: Bool
stateWireframe = Bool
False
, stateBlendAlpha :: Bool
stateBlendAlpha = Bool
True
, stateLineSmooth :: Bool
stateLineSmooth = Bool
False
, stateTextures :: IORef [Texture]
stateTextures = IORef [Texture]
textures
}