module Graphics.FieldTrip.Render
(
ErrorBound, MaterialTrans
, GContext(..), defaultGC, onErr
, enableNormals
, Renderer
) where
import Graphics.FieldTrip.Misc (R,Unop)
import Graphics.FieldTrip.Material (Material)
import Graphics.FieldTrip.Color (Col)
type ErrorBound = R
type MaterialTrans = Unop Material
data GContext = GC { gcErr :: ErrorBound
, gcMaterialTrans :: MaterialTrans
, gcNormals :: Maybe Col
}
defaultGC :: GContext
defaultGC = GC { gcErr = 0.01, gcMaterialTrans = id, gcNormals = Nothing }
onErr :: Unop ErrorBound -> Unop GContext
onErr f gc = gc { gcErr = f (gcErr gc) }
enableNormals :: Col -> GContext -> GContext
enableNormals col gc = gc { gcNormals = Just col }
type Renderer = GContext -> IO ()