module Graphics.LambdaCube.Texture where

import Graphics.LambdaCube.HardwareBuffer
import Graphics.LambdaCube.PixelFormat
import Graphics.LambdaCube.Types

data TextureUsage
    = TextureUsage
    { tuUsage           :: Usage
    , tuAutoMipmap      :: Bool     -- ^ mipmaps will be automatically generated for this texture
    , tuRenderTarget    :: Bool     -- ^ this texture will be a render target, i.e. used as a target for render to texture setting this flag will ignore all other texture usages except TU_AUTOMIPMAP
    }
    deriving (Eq,Ord)

data TextureType
    = TEX_TYPE_1D       -- ^ 1D texture, used in combination with 1D texture coordinates
    | TEX_TYPE_2D       -- ^ 2D texture, used in combination with 2D texture coordinates (default)
    | TEX_TYPE_3D       -- ^ 3D volume texture, used in combination with 3D texture coordinates
    | TEX_TYPE_CUBE_MAP -- ^ 3D cube map, used in combination with 3D texture coordinates
    deriving (Eq,Ord,Show)

data TextureMipmap
    = MIP_UNLIMITED -- ^ Generate mipmaps up to 1x1
    | MIP_DEFAULT   -- ^ Use TextureManager default
    | MIP_NUMBER Int
    deriving (Eq,Ord)

class (Eq a, HardwareBuffer a) => Texture a where
    txName                      :: a -> String
    txWidth                     :: a -> Int
    txHeight                    :: a -> Int
    txDepth                     :: a -> Int
    txNumRequestedMipmaps       :: a -> TextureMipmap
    txNumMipmaps                :: a -> Int
    txMipmapsHardwareGenerated  :: a -> Bool
    txGamma                     :: a -> FloatType
    txHwGamma                   :: a -> Bool
    txFSAA                      :: a -> Int
    txFSAAHint                  :: a -> String
    txTextureType               :: a -> TextureType
    txFormat                    :: a -> PixelFormat

--    txUsage                     :: a -> TextureUsage
--    txAutoMipmap                :: a -> Bool    -- ^ mipmaps will be automatically generated for this texture
--    txRenderTarget              :: a -> Bool    -- ^ this texture will be a render target, i.e. used as a target for render to texture setting this flag will ignore all other texture usages except TU_AUTOMIPMAP

    txSrcFormat                 :: a -> PixelFormat
    txSrcWidth                  :: a -> Int
    txSrcHeight                 :: a -> Int
    txSrcDepth                  :: a -> Int

    txDesiredFormat             :: a -> PixelFormat
    txDesiredIntegerBitDepth    :: a -> Int
    txDesiredFloatBitDepth      :: a -> Int
    txTreatLuminanceAsAlpha     :: a -> Bool