{-# LANGUAGE KindSignatures #-}
module Graphics.Rendering.OpenGL.GL.Evaluators (
Order, maxOrder, Domain, MapDescriptor(..), ControlPoint,
Map1(..), GLmap1, map1,
Map2(..), GLmap2, map2,
evalCoord1, evalCoord1v, evalCoord2, evalCoord2v,
mapGrid1, mapGrid2,
evalMesh1, evalMesh2,
evalPoint1, evalPoint2,
autoNormal
) where
import Control.Monad
import Data.List
import Data.StateVar
import Foreign.ForeignPtr
import Foreign.Marshal.Array
import Foreign.Marshal.Utils
import Foreign.Ptr
import Foreign.Storable
import Graphics.Rendering.OpenGL.GL.Capability
import Graphics.Rendering.OpenGL.GL.ControlPoint
import Graphics.Rendering.OpenGL.GL.Domain
import Graphics.Rendering.OpenGL.GL.PeekPoke
import Graphics.Rendering.OpenGL.GL.PolygonMode
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.Rendering.OpenGL.GL.VertexArrays
import Graphics.GL
type Order = GLint
maxOrder :: GettableStateVar Order
maxOrder :: GettableStateVar Order
maxOrder = forall a. IO a -> IO a
makeGettableStateVar (forall p a. GetPName1I p => (Order -> a) -> p -> IO a
getInteger1 forall a. a -> a
id PName1I
GetMaxEvalOrder)
data MapDescriptor d =
MapDescriptor (d, d) Stride Order NumComponents
deriving ( MapDescriptor d -> MapDescriptor d -> Bool
forall d. Eq d => MapDescriptor d -> MapDescriptor d -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MapDescriptor d -> MapDescriptor d -> Bool
$c/= :: forall d. Eq d => MapDescriptor d -> MapDescriptor d -> Bool
== :: MapDescriptor d -> MapDescriptor d -> Bool
$c== :: forall d. Eq d => MapDescriptor d -> MapDescriptor d -> Bool
Eq, MapDescriptor d -> MapDescriptor d -> Bool
MapDescriptor d -> MapDescriptor d -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {d}. Ord d => Eq (MapDescriptor d)
forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Bool
forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Ordering
forall d.
Ord d =>
MapDescriptor d -> MapDescriptor d -> MapDescriptor d
min :: MapDescriptor d -> MapDescriptor d -> MapDescriptor d
$cmin :: forall d.
Ord d =>
MapDescriptor d -> MapDescriptor d -> MapDescriptor d
max :: MapDescriptor d -> MapDescriptor d -> MapDescriptor d
$cmax :: forall d.
Ord d =>
MapDescriptor d -> MapDescriptor d -> MapDescriptor d
>= :: MapDescriptor d -> MapDescriptor d -> Bool
$c>= :: forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Bool
> :: MapDescriptor d -> MapDescriptor d -> Bool
$c> :: forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Bool
<= :: MapDescriptor d -> MapDescriptor d -> Bool
$c<= :: forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Bool
< :: MapDescriptor d -> MapDescriptor d -> Bool
$c< :: forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Bool
compare :: MapDescriptor d -> MapDescriptor d -> Ordering
$ccompare :: forall d. Ord d => MapDescriptor d -> MapDescriptor d -> Ordering
Ord, Int -> MapDescriptor d -> ShowS
forall d. Show d => Int -> MapDescriptor d -> ShowS
forall d. Show d => [MapDescriptor d] -> ShowS
forall d. Show d => MapDescriptor d -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MapDescriptor d] -> ShowS
$cshowList :: forall d. Show d => [MapDescriptor d] -> ShowS
show :: MapDescriptor d -> String
$cshow :: forall d. Show d => MapDescriptor d -> String
showsPrec :: Int -> MapDescriptor d -> ShowS
$cshowsPrec :: forall d. Show d => Int -> MapDescriptor d -> ShowS
Show )
totalComponents1 :: MapDescriptor d -> Int
totalComponents1 :: forall d. MapDescriptor d -> Int
totalComponents1 (MapDescriptor (d, d)
_ Order
stride Order
order Order
numComp) =
forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
stride forall a. Num a => a -> a -> a
* (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
order forall a. Num a => a -> a -> a
- Int
1) forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
numComp
totalComponents2 :: MapDescriptor d -> MapDescriptor d -> Int
totalComponents2 :: forall d. MapDescriptor d -> MapDescriptor d -> Int
totalComponents2 MapDescriptor d
uDescriptor vDescriptor :: MapDescriptor d
vDescriptor@(MapDescriptor (d, d)
_ Order
_ Order
_ Order
numComp) =
forall d. MapDescriptor d -> Int
totalComponents1 MapDescriptor d
uDescriptor forall a. Num a => a -> a -> a
+ forall d. MapDescriptor d -> Int
totalComponents1 MapDescriptor d
vDescriptor forall a. Num a => a -> a -> a
- forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
numComp
peekControlPoints1 ::
(ControlPoint c, Domain d) => MapDescriptor d -> Ptr d -> IO [c d]
peekControlPoints1 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> IO [c d]
peekControlPoints1 MapDescriptor d
descriptor Ptr d
ptr =
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
Ptr (c d) -> IO (c d)
peekControlPoint (forall d a. Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 MapDescriptor d
descriptor Ptr d
ptr)
peekControlPoints2 ::
(ControlPoint c, Domain d)
=> MapDescriptor d -> MapDescriptor d -> Ptr d -> IO [[c d]]
peekControlPoints2 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> IO [[c d]]
peekControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr =
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
Ptr (c d) -> IO (c d)
peekControlPoint) (forall d a.
Domain d =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[Ptr a]]
controlPointPtrs2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr)
pokeControlPoints1 ::
(ControlPoint c, Domain d) => MapDescriptor d -> Ptr d -> [c d] -> IO ()
pokeControlPoints1 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> [c d] -> IO ()
pokeControlPoints1 MapDescriptor d
descriptor Ptr d
ptr =
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> m c) -> [a] -> [b] -> m ()
zipWithM_ forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
Ptr (c d) -> c d -> IO ()
pokeControlPoint (forall d a. Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 MapDescriptor d
descriptor Ptr d
ptr)
pokeControlPoints2 ::
(ControlPoint c, Domain d)
=> MapDescriptor d -> MapDescriptor d -> Ptr d -> [[c d]] -> IO ()
pokeControlPoints2 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[c d]] -> IO ()
pokeControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr =
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> m c) -> [a] -> [b] -> m ()
zipWithM_ (forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> m c) -> [a] -> [b] -> m ()
zipWithM_ forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
Ptr (c d) -> c d -> IO ()
pokeControlPoint)
(forall d a.
Domain d =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[Ptr a]]
controlPointPtrs2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr)
controlPointPtrs1 :: Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 :: forall d a. Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 (MapDescriptor (d, d)
_ Order
stride Order
order Order
_) Ptr d
ptr =
[ Ptr d
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
o forall a. Num a => a -> a -> a
* Int
s) | Int
o <- [ Int
0 .. forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
order forall a. Num a => a -> a -> a
- Int
1 ] ]
where s :: Int
s = forall a. Storable a => Ptr a -> Int
sizeOfPtr Ptr d
ptr forall a. Num a => a -> a -> a
* forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
stride
controlPointPtrs2 ::
Domain d => MapDescriptor d -> MapDescriptor d -> Ptr d -> [[Ptr a]]
controlPointPtrs2 :: forall d a.
Domain d =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[Ptr a]]
controlPointPtrs2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr =
[ forall d a. Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 MapDescriptor d
vDescriptor Ptr d
p | Ptr d
p <- forall d a. Domain d => MapDescriptor d -> Ptr d -> [Ptr a]
controlPointPtrs1 MapDescriptor d
uDescriptor Ptr d
ptr ]
sizeOfPtr :: Storable a => Ptr a -> Int
sizeOfPtr :: forall a. Storable a => Ptr a -> Int
sizeOfPtr = forall a. Storable a => a -> Int
sizeOf forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a b. a -> b -> a
const forall a. HasCallStack => a
undefined :: Ptr a -> a)
class Map1 m where
withNewMap1 :: (ControlPoint c, Domain d)
=> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withMap1 :: (ControlPoint c, Domain d)
=> m c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a
newMap1 :: (ControlPoint c, Domain d)
=> (d, d) -> [c d] -> IO (m c d)
getMap1Components :: (ControlPoint c, Domain d)
=> m c d -> IO ((d, d), [c d])
withNewMap1 descriptor :: MapDescriptor d
descriptor@(MapDescriptor (d, d)
domain Order
_ Order
_ Order
_) Ptr d -> IO ()
act = do
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray (forall d. MapDescriptor d -> Int
totalComponents1 MapDescriptor d
descriptor) forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
Ptr d -> IO ()
act Ptr d
ptr
[c d]
controlPoints <- forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> IO [c d]
peekControlPoints1 MapDescriptor d
descriptor Ptr d
ptr
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
(d, d) -> [c d] -> IO (m c d)
newMap1 (d, d)
domain [c d]
controlPoints
withMap1 m c d
m MapDescriptor d -> Ptr d -> IO a
act = do
((d, d)
domain, [c d]
controlPoints) <- forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
m c d -> IO ((d, d), [c d])
getMap1Components m c d
m
let stride :: Order
stride = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents (forall a. [a] -> a
head [c d]
controlPoints)
order :: Order
order = forall i a. Num i => [a] -> i
genericLength [c d]
controlPoints
descriptor :: MapDescriptor d
descriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
domain Order
stride Order
order (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
stride)
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray (forall d. MapDescriptor d -> Int
totalComponents1 MapDescriptor d
descriptor) forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> [c d] -> IO ()
pokeControlPoints1 MapDescriptor d
descriptor Ptr d
ptr [c d]
controlPoints
MapDescriptor d -> Ptr d -> IO a
act MapDescriptor d
descriptor Ptr d
ptr
newMap1 (d, d)
domain [c d]
controlPoints = do
let stride :: Order
stride = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents (forall a. [a] -> a
head [c d]
controlPoints)
order :: Order
order = forall i a. Num i => [a] -> i
genericLength [c d]
controlPoints
descriptor :: MapDescriptor d
descriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
domain Order
stride Order
order (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
stride)
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withNewMap1 MapDescriptor d
descriptor forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr ->
forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> [c d] -> IO ()
pokeControlPoints1 MapDescriptor d
descriptor Ptr d
ptr [c d]
controlPoints
getMap1Components m c d
m =
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d a.
(Map1 m, ControlPoint c, Domain d) =>
m c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap1 m c d
m forall a b. (a -> b) -> a -> b
$ \descriptor :: MapDescriptor d
descriptor@(MapDescriptor (d, d)
domain Order
_ Order
_ Order
_) Ptr d
ptr -> do
[c d]
controlPoints <- forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> Ptr d -> IO [c d]
peekControlPoints1 MapDescriptor d
descriptor Ptr d
ptr
forall (m :: * -> *) a. Monad m => a -> m a
return ((d, d)
domain, [c d]
controlPoints)
data GLmap1 (c :: * -> *) d =
GLmap1 (MapDescriptor d) (ForeignPtr d)
deriving ( GLmap1 c d -> GLmap1 c d -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (c :: * -> *) d. Eq d => GLmap1 c d -> GLmap1 c d -> Bool
/= :: GLmap1 c d -> GLmap1 c d -> Bool
$c/= :: forall (c :: * -> *) d. Eq d => GLmap1 c d -> GLmap1 c d -> Bool
== :: GLmap1 c d -> GLmap1 c d -> Bool
$c== :: forall (c :: * -> *) d. Eq d => GLmap1 c d -> GLmap1 c d -> Bool
Eq, GLmap1 c d -> GLmap1 c d -> Bool
GLmap1 c d -> GLmap1 c d -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {c :: * -> *} {d}. Ord d => Eq (GLmap1 c d)
forall (c :: * -> *) d. Ord d => GLmap1 c d -> GLmap1 c d -> Bool
forall (c :: * -> *) d.
Ord d =>
GLmap1 c d -> GLmap1 c d -> Ordering
forall (c :: * -> *) d.
Ord d =>
GLmap1 c d -> GLmap1 c d -> GLmap1 c d
min :: GLmap1 c d -> GLmap1 c d -> GLmap1 c d
$cmin :: forall (c :: * -> *) d.
Ord d =>
GLmap1 c d -> GLmap1 c d -> GLmap1 c d
max :: GLmap1 c d -> GLmap1 c d -> GLmap1 c d
$cmax :: forall (c :: * -> *) d.
Ord d =>
GLmap1 c d -> GLmap1 c d -> GLmap1 c d
>= :: GLmap1 c d -> GLmap1 c d -> Bool
$c>= :: forall (c :: * -> *) d. Ord d => GLmap1 c d -> GLmap1 c d -> Bool
> :: GLmap1 c d -> GLmap1 c d -> Bool
$c> :: forall (c :: * -> *) d. Ord d => GLmap1 c d -> GLmap1 c d -> Bool
<= :: GLmap1 c d -> GLmap1 c d -> Bool
$c<= :: forall (c :: * -> *) d. Ord d => GLmap1 c d -> GLmap1 c d -> Bool
< :: GLmap1 c d -> GLmap1 c d -> Bool
$c< :: forall (c :: * -> *) d. Ord d => GLmap1 c d -> GLmap1 c d -> Bool
compare :: GLmap1 c d -> GLmap1 c d -> Ordering
$ccompare :: forall (c :: * -> *) d.
Ord d =>
GLmap1 c d -> GLmap1 c d -> Ordering
Ord, Int -> GLmap1 c d -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (c :: * -> *) d. Show d => Int -> GLmap1 c d -> ShowS
forall (c :: * -> *) d. Show d => [GLmap1 c d] -> ShowS
forall (c :: * -> *) d. Show d => GLmap1 c d -> String
showList :: [GLmap1 c d] -> ShowS
$cshowList :: forall (c :: * -> *) d. Show d => [GLmap1 c d] -> ShowS
show :: GLmap1 c d -> String
$cshow :: forall (c :: * -> *) d. Show d => GLmap1 c d -> String
showsPrec :: Int -> GLmap1 c d -> ShowS
$cshowsPrec :: forall (c :: * -> *) d. Show d => Int -> GLmap1 c d -> ShowS
Show )
instance Map1 GLmap1 where
withNewMap1 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap1 c d)
withNewMap1 MapDescriptor d
descriptor Ptr d -> IO ()
act = do
ForeignPtr d
fp <- forall a. Storable a => Int -> IO (ForeignPtr a)
mallocForeignPtrArray (forall d. MapDescriptor d -> Int
totalComponents1 MapDescriptor d
descriptor)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr d
fp Ptr d -> IO ()
act
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (c :: * -> *) d.
MapDescriptor d -> ForeignPtr d -> GLmap1 c d
GLmap1 MapDescriptor d
descriptor ForeignPtr d
fp
withMap1 :: forall (c :: * -> *) d a.
(ControlPoint c, Domain d) =>
GLmap1 c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap1 (GLmap1 MapDescriptor d
descriptor ForeignPtr d
fp) MapDescriptor d -> Ptr d -> IO a
act =
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr d
fp forall a b. (a -> b) -> a -> b
$ MapDescriptor d -> Ptr d -> IO a
act MapDescriptor d
descriptor
map1 :: (Map1 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
map1 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
StateVar (Maybe (m c d))
map1 = forall (c :: * -> *) d (m :: (* -> *) -> * -> *).
(c d -> EnableCap)
-> (c d -> IO (m c d))
-> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap1StateVar forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
c d -> EnableCap
enableCap1 forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
c d -> IO (m c d)
getMap1 forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
c d -> m c d -> IO ()
setMap1
makeMap1StateVar ::
(c d -> EnableCap) -> (c d -> IO (m c d)) -> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap1StateVar :: forall (c :: * -> *) d (m :: (* -> *) -> * -> *).
(c d -> EnableCap)
-> (c d -> IO (m c d))
-> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap1StateVar c d -> EnableCap
getCap c d -> IO (m c d)
getAct c d -> m c d -> IO ()
setAct =
forall a.
IO EnableCap -> IO a -> (a -> IO ()) -> StateVar (Maybe a)
makeStateVarMaybe
(forall (m :: * -> *) a. Monad m => a -> m a
return (c d -> EnableCap
getCap forall a. HasCallStack => a
undefined))
(c d -> IO (m c d)
getAct forall a. HasCallStack => a
undefined)
(c d -> m c d -> IO ()
setAct forall a. HasCallStack => a
undefined)
getMap1 :: (Map1 m, ControlPoint c, Domain d) => c d -> IO (m c d)
getMap1 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
c d -> IO (m c d)
getMap1 c d
dummyControlPoint = do
let target :: GLenum
target = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> GLenum
map1Target c d
dummyControlPoint
numComp :: Order
numComp = forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents c d
dummyControlPoint)
(d, d)
domain <- forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
2 forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
forall d. Domain d => GLenum -> GLenum -> Ptr d -> IO ()
glGetMapv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Domain) Ptr d
ptr
forall a b. Storable a => (a -> a -> b) -> Ptr a -> IO b
peek2 (,) Ptr d
ptr
Order
order <- forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Order
0 forall a b. (a -> b) -> a -> b
$ \Ptr Order
ptr -> do
forall (m :: * -> *).
MonadIO m =>
GLenum -> GLenum -> Ptr Order -> m ()
glGetMapiv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Order) Ptr Order
ptr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> IO a
peek Ptr Order
ptr
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withNewMap1 (forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
domain (forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents c d
dummyControlPoint) Order
order Order
numComp) forall a b. (a -> b) -> a -> b
$
forall d. Domain d => GLenum -> GLenum -> Ptr d -> IO ()
glGetMapv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Coeff)
setMap1 :: (Map1 m, ControlPoint c, Domain d) => c d -> m c d -> IO ()
setMap1 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map1 m, ControlPoint c, Domain d) =>
c d -> m c d -> IO ()
setMap1 c d
dummyControlPoint m c d
m =
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d a.
(Map1 m, ControlPoint c, Domain d) =>
m c d -> (MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap1 m c d
m forall a b. (a -> b) -> a -> b
$ \(MapDescriptor (d
u1, d
u2) Order
stride Order
order Order
_) ->
forall d.
Domain d =>
GLenum -> d -> d -> Order -> Order -> Ptr d -> IO ()
glMap1 (forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> GLenum
map1Target c d
dummyControlPoint) d
u1 d
u2
(forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
stride) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
order)
class Map2 m where
withNewMap2 :: (ControlPoint c, Domain d)
=> MapDescriptor d -> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withMap2 :: (ControlPoint c, Domain d)
=> m c d -> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a
newMap2 :: (ControlPoint c, Domain d)
=> (d, d) -> (d, d) -> [[c d]] -> IO (m c d)
getMap2Components :: (ControlPoint c, Domain d)
=> m c d -> IO ((d, d), (d, d), [[c d]])
withNewMap2 uDescriptor :: MapDescriptor d
uDescriptor@(MapDescriptor (d, d)
uDomain Order
_ Order
_ Order
_)
vDescriptor :: MapDescriptor d
vDescriptor@(MapDescriptor (d, d)
vDomain Order
_ Order
_ Order
_) Ptr d -> IO ()
act =
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray (forall d. MapDescriptor d -> MapDescriptor d -> Int
totalComponents2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor) forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
Ptr d -> IO ()
act Ptr d
ptr
[[c d]]
controlPoints <- forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> IO [[c d]]
peekControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
(d, d) -> (d, d) -> [[c d]] -> IO (m c d)
newMap2 (d, d)
uDomain (d, d)
vDomain [[c d]]
controlPoints
withMap2 m c d
m MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a
act = do
((d, d)
uDomain, (d, d)
vDomain, [[c d]]
controlPoints) <- forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
m c d -> IO ((d, d), (d, d), [[c d]])
getMap2Components m c d
m
let vStride :: Order
vStride = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents (forall a. [a] -> a
head (forall a. [a] -> a
head [[c d]]
controlPoints))
vOrder :: Order
vOrder = forall i a. Num i => [a] -> i
genericLength (forall a. [a] -> a
head [[c d]]
controlPoints)
uStride :: Order
uStride = Order
vStride forall a. Num a => a -> a -> a
* forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vOrder
uOrder :: Order
uOrder = forall i a. Num i => [a] -> i
genericLength [[c d]]
controlPoints
numComp :: Order
numComp = forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vStride
uDescriptor :: MapDescriptor d
uDescriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
uDomain Order
uStride Order
uOrder Order
numComp
vDescriptor :: MapDescriptor d
vDescriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
vDomain Order
vStride Order
vOrder Order
numComp
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray (forall d. MapDescriptor d -> MapDescriptor d -> Int
totalComponents2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor) forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[c d]] -> IO ()
pokeControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr [[c d]]
controlPoints
MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a
act MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr
newMap2 (d, d)
uDomain (d, d)
vDomain [[c d]]
controlPoints = do
let vStride :: Order
vStride = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents (forall a. [a] -> a
head (forall a. [a] -> a
head [[c d]]
controlPoints))
vOrder :: Order
vOrder = forall i a. Num i => [a] -> i
genericLength (forall a. [a] -> a
head [[c d]]
controlPoints)
uStride :: Order
uStride = Order
vStride forall a. Num a => a -> a -> a
* forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vOrder
uOrder :: Order
uOrder = forall i a. Num i => [a] -> i
genericLength [[c d]]
controlPoints
numComp :: Order
numComp = forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vStride
uDescriptor :: MapDescriptor d
uDescriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
uDomain Order
uStride Order
uOrder Order
numComp
vDescriptor :: MapDescriptor d
vDescriptor = forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
vDomain Order
vStride Order
vOrder Order
numComp
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
MapDescriptor d
-> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withNewMap2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr ->
forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> [[c d]] -> IO ()
pokeControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr [[c d]]
controlPoints
getMap2Components m c d
m =
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d a.
(Map2 m, ControlPoint c, Domain d) =>
m c d
-> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap2 m c d
m forall a b. (a -> b) -> a -> b
$ \uDescriptor :: MapDescriptor d
uDescriptor@(MapDescriptor (d, d)
uDomain Order
_ Order
_ Order
_)
vDescriptor :: MapDescriptor d
vDescriptor@(MapDescriptor (d, d)
vDomain Order
_ Order
_ Order
_) Ptr d
ptr -> do
[[c d]]
controlPoints <- forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d -> MapDescriptor d -> Ptr d -> IO [[c d]]
peekControlPoints2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d
ptr
forall (m :: * -> *) a. Monad m => a -> m a
return ((d, d)
uDomain, (d, d)
vDomain, [[c d]]
controlPoints)
data GLmap2 (c :: * -> *) d =
GLmap2 (MapDescriptor d) (MapDescriptor d) (ForeignPtr d)
deriving ( GLmap2 c d -> GLmap2 c d -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (c :: * -> *) d. Eq d => GLmap2 c d -> GLmap2 c d -> Bool
/= :: GLmap2 c d -> GLmap2 c d -> Bool
$c/= :: forall (c :: * -> *) d. Eq d => GLmap2 c d -> GLmap2 c d -> Bool
== :: GLmap2 c d -> GLmap2 c d -> Bool
$c== :: forall (c :: * -> *) d. Eq d => GLmap2 c d -> GLmap2 c d -> Bool
Eq, GLmap2 c d -> GLmap2 c d -> Bool
GLmap2 c d -> GLmap2 c d -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {c :: * -> *} {d}. Ord d => Eq (GLmap2 c d)
forall (c :: * -> *) d. Ord d => GLmap2 c d -> GLmap2 c d -> Bool
forall (c :: * -> *) d.
Ord d =>
GLmap2 c d -> GLmap2 c d -> Ordering
forall (c :: * -> *) d.
Ord d =>
GLmap2 c d -> GLmap2 c d -> GLmap2 c d
min :: GLmap2 c d -> GLmap2 c d -> GLmap2 c d
$cmin :: forall (c :: * -> *) d.
Ord d =>
GLmap2 c d -> GLmap2 c d -> GLmap2 c d
max :: GLmap2 c d -> GLmap2 c d -> GLmap2 c d
$cmax :: forall (c :: * -> *) d.
Ord d =>
GLmap2 c d -> GLmap2 c d -> GLmap2 c d
>= :: GLmap2 c d -> GLmap2 c d -> Bool
$c>= :: forall (c :: * -> *) d. Ord d => GLmap2 c d -> GLmap2 c d -> Bool
> :: GLmap2 c d -> GLmap2 c d -> Bool
$c> :: forall (c :: * -> *) d. Ord d => GLmap2 c d -> GLmap2 c d -> Bool
<= :: GLmap2 c d -> GLmap2 c d -> Bool
$c<= :: forall (c :: * -> *) d. Ord d => GLmap2 c d -> GLmap2 c d -> Bool
< :: GLmap2 c d -> GLmap2 c d -> Bool
$c< :: forall (c :: * -> *) d. Ord d => GLmap2 c d -> GLmap2 c d -> Bool
compare :: GLmap2 c d -> GLmap2 c d -> Ordering
$ccompare :: forall (c :: * -> *) d.
Ord d =>
GLmap2 c d -> GLmap2 c d -> Ordering
Ord, Int -> GLmap2 c d -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (c :: * -> *) d. Show d => Int -> GLmap2 c d -> ShowS
forall (c :: * -> *) d. Show d => [GLmap2 c d] -> ShowS
forall (c :: * -> *) d. Show d => GLmap2 c d -> String
showList :: [GLmap2 c d] -> ShowS
$cshowList :: forall (c :: * -> *) d. Show d => [GLmap2 c d] -> ShowS
show :: GLmap2 c d -> String
$cshow :: forall (c :: * -> *) d. Show d => GLmap2 c d -> String
showsPrec :: Int -> GLmap2 c d -> ShowS
$cshowsPrec :: forall (c :: * -> *) d. Show d => Int -> GLmap2 c d -> ShowS
Show )
instance Map2 GLmap2 where
withNewMap2 :: forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
MapDescriptor d
-> MapDescriptor d -> (Ptr d -> IO ()) -> IO (GLmap2 c d)
withNewMap2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor Ptr d -> IO ()
act = do
ForeignPtr d
fp <- forall a. Storable a => Int -> IO (ForeignPtr a)
mallocForeignPtrArray (forall d. MapDescriptor d -> MapDescriptor d -> Int
totalComponents2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr d
fp Ptr d -> IO ()
act
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (c :: * -> *) d.
MapDescriptor d -> MapDescriptor d -> ForeignPtr d -> GLmap2 c d
GLmap2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor ForeignPtr d
fp
withMap2 :: forall (c :: * -> *) d a.
(ControlPoint c, Domain d) =>
GLmap2 c d
-> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap2 (GLmap2 MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor ForeignPtr d
fp) MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a
act =
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr d
fp forall a b. (a -> b) -> a -> b
$ MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a
act MapDescriptor d
uDescriptor MapDescriptor d
vDescriptor
map2 :: (Map2 m, ControlPoint c, Domain d) => StateVar (Maybe (m c d))
map2 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
StateVar (Maybe (m c d))
map2 = forall (c :: * -> *) d (m :: (* -> *) -> * -> *).
(c d -> EnableCap)
-> (c d -> IO (m c d))
-> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap2StateVar forall (c :: * -> *) d.
(ControlPoint c, Domain d) =>
c d -> EnableCap
enableCap2 forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
c d -> IO (m c d)
getMap2 forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
c d -> m c d -> IO ()
setMap2
makeMap2StateVar ::
(c d -> EnableCap) -> (c d -> IO (m c d)) -> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap2StateVar :: forall (c :: * -> *) d (m :: (* -> *) -> * -> *).
(c d -> EnableCap)
-> (c d -> IO (m c d))
-> (c d -> m c d -> IO ())
-> StateVar (Maybe (m c d))
makeMap2StateVar c d -> EnableCap
getCap c d -> IO (m c d)
getAct c d -> m c d -> IO ()
setAct =
forall a.
IO EnableCap -> IO a -> (a -> IO ()) -> StateVar (Maybe a)
makeStateVarMaybe
(forall (m :: * -> *) a. Monad m => a -> m a
return (c d -> EnableCap
getCap forall a. HasCallStack => a
undefined))
(c d -> IO (m c d)
getAct forall a. HasCallStack => a
undefined)
(c d -> m c d -> IO ()
setAct forall a. HasCallStack => a
undefined)
getMap2 :: (Map2 m, ControlPoint c, Domain d) => c d -> IO (m c d)
getMap2 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
c d -> IO (m c d)
getMap2 c d
dummyControlPoint = do
let target :: GLenum
target = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> GLenum
map2Target c d
dummyControlPoint
((d, d)
uDomain, (d, d)
vDomain) <- forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
4 forall a b. (a -> b) -> a -> b
$ \Ptr d
ptr -> do
forall d. Domain d => GLenum -> GLenum -> Ptr d -> IO ()
glGetMapv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Domain) Ptr d
ptr
forall a b. Storable a => (a -> a -> a -> a -> b) -> Ptr a -> IO b
peek4 (\d
u1 d
u2 d
v1 d
v2 -> ((d
u1, d
u2), (d
v1, d
v2))) Ptr d
ptr
(Order
uOrder, Order
vOrder) <- forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [Order
0,Order
0] forall a b. (a -> b) -> a -> b
$ \Ptr Order
ptr -> do
forall (m :: * -> *).
MonadIO m =>
GLenum -> GLenum -> Ptr Order -> m ()
glGetMapiv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Order) Ptr Order
ptr
forall a b. Storable a => (a -> a -> b) -> Ptr a -> IO b
peek2 (,) Ptr Order
ptr
let vStride :: Order
vStride = forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> Order
numComponents c d
dummyControlPoint
uStride :: Order
uStride = Order
vStride forall a. Num a => a -> a -> a
* forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vOrder
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
MapDescriptor d
-> MapDescriptor d -> (Ptr d -> IO ()) -> IO (m c d)
withNewMap2 (forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
uDomain Order
uStride Order
uOrder (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vStride))
(forall d. (d, d) -> Order -> Order -> Order -> MapDescriptor d
MapDescriptor (d, d)
vDomain Order
vStride Order
vOrder (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vStride)) forall a b. (a -> b) -> a -> b
$
forall d. Domain d => GLenum -> GLenum -> Ptr d -> IO ()
glGetMapv GLenum
target (GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
Coeff)
setMap2 :: (Map2 m, ControlPoint c, Domain d) => c d -> m c d -> IO ()
setMap2 :: forall (m :: (* -> *) -> * -> *) (c :: * -> *) d.
(Map2 m, ControlPoint c, Domain d) =>
c d -> m c d -> IO ()
setMap2 c d
dummyControlPoint m c d
m =
forall (m :: (* -> *) -> * -> *) (c :: * -> *) d a.
(Map2 m, ControlPoint c, Domain d) =>
m c d
-> (MapDescriptor d -> MapDescriptor d -> Ptr d -> IO a) -> IO a
withMap2 m c d
m forall a b. (a -> b) -> a -> b
$ \(MapDescriptor (d
u1, d
u2) Order
uStride Order
uOrder Order
_)
(MapDescriptor (d
v1, d
v2) Order
vStride Order
vOrder Order
_) ->
forall d.
Domain d =>
GLenum
-> d
-> d
-> Order
-> Order
-> d
-> d
-> Order
-> Order
-> Ptr d
-> IO ()
glMap2 (forall (c :: * -> *) d. (ControlPoint c, Domain d) => c d -> GLenum
map2Target c d
dummyControlPoint)
d
u1 d
u2 (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
uStride) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
uOrder)
d
v1 d
v2 (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vStride) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Order
vOrder)
data GetMapQuery =
Coeff
| Order
| Domain
marshalGetMapQuery :: GetMapQuery -> GLenum
marshalGetMapQuery :: GetMapQuery -> GLenum
marshalGetMapQuery GetMapQuery
x = case GetMapQuery
x of
GetMapQuery
Coeff -> GLenum
GL_COEFF
GetMapQuery
Order -> GLenum
GL_ORDER
GetMapQuery
Domain -> GLenum
GL_DOMAIN
mapGrid1 :: Domain d => StateVar (GLint, (d, d))
mapGrid1 :: forall d. Domain d => StateVar (Order, (d, d))
mapGrid1 =
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
(do Order
n <- forall p a. GetPName1I p => (Order -> a) -> p -> IO a
getInteger1 forall a. a -> a
id PName1I
GetMap1GridSegments
(d, d)
domain <- forall d p a.
(Domain d, GetPName2F p) =>
(d -> d -> a) -> p -> IO a
get2 (,) PName2F
GetMap1GridDomain
forall (m :: * -> *) a. Monad m => a -> m a
return (Order
n, (d, d)
domain))
(\(Order
n, (d
u1, d
u2)) -> forall d. Domain d => Order -> d -> d -> IO ()
glMapGrid1 Order
n d
u1 d
u2)
mapGrid2 :: Domain d => StateVar ((GLint, (d, d)), (GLint, (d, d)))
mapGrid2 :: forall d. Domain d => StateVar ((Order, (d, d)), (Order, (d, d)))
mapGrid2 =
forall a. IO a -> (a -> IO ()) -> StateVar a
makeStateVar
(do (Order
un, Order
vn) <- forall p a. GetPName2I p => (Order -> Order -> a) -> p -> IO a
getInteger2 (,) PName2I
GetMap2GridSegments
(d
u1, d
u2, d
v1, d
v2) <- forall d p a.
(Domain d, GetPName4F p) =>
(d -> d -> d -> d -> a) -> p -> IO a
get4 (,,,) PName4F
GetMap2GridDomain
forall (m :: * -> *) a. Monad m => a -> m a
return ((Order
un, (d
u1, d
u2)), (Order
vn, (d
v1, d
v2))))
(\((Order
un, (d
u1, d
u2)), (Order
vn, (d
v1, d
v2))) -> forall d. Domain d => Order -> d -> d -> Order -> d -> d -> IO ()
glMapGrid2 Order
un d
u1 d
u2 Order
vn d
v1 d
v2)
evalMesh1 :: PolygonMode -> (GLint, GLint) -> IO ()
evalMesh1 :: PolygonMode -> (Order, Order) -> IO ()
evalMesh1 PolygonMode
m (Order
p1, Order
p2) = forall (m :: * -> *). MonadIO m => GLenum -> Order -> Order -> m ()
glEvalMesh1 (PolygonMode -> GLenum
marshalPolygonMode PolygonMode
m) Order
p1 Order
p2
evalMesh2 :: PolygonMode -> (GLint, GLint) -> (GLint, GLint) -> IO ()
evalMesh2 :: PolygonMode -> (Order, Order) -> (Order, Order) -> IO ()
evalMesh2 PolygonMode
m (Order
p1, Order
p2) (Order
q1, Order
q2) = forall (m :: * -> *).
MonadIO m =>
GLenum -> Order -> Order -> Order -> Order -> m ()
glEvalMesh2 (PolygonMode -> GLenum
marshalPolygonMode PolygonMode
m) Order
p1 Order
p2 Order
q1 Order
q2
evalPoint1 :: GLint -> IO ()
evalPoint1 :: Order -> IO ()
evalPoint1 = forall (m :: * -> *). MonadIO m => Order -> m ()
glEvalPoint1
evalPoint2 :: (GLint, GLint) -> IO ()
evalPoint2 :: (Order, Order) -> IO ()
evalPoint2 = forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry forall (m :: * -> *). MonadIO m => Order -> Order -> m ()
glEvalPoint2
autoNormal :: StateVar Capability
autoNormal :: StateVar Capability
autoNormal = EnableCap -> StateVar Capability
makeCapability EnableCap
CapAutoNormal