Move main to allow for new executables

This commit is contained in:
jgk
2021-08-11 17:54:48 +02:00
parent b74bb45a4c
commit 4bbe5d0cf1
64 changed files with 521 additions and 345 deletions
+2 -3
View File
@@ -47,7 +47,7 @@ makeShaderUsingShaderVAO
makeShaderUsingShaderVAO s shaderlist pm fs = do
prog <- makeSourcedShader s shaderlist
return $ fs
{_shaderProgram = prog
{ _shaderProgram = prog
, _shaderDrawPrimitive = pm
, _shaderTexture = Nothing
, _shaderCustomUnis = []
@@ -60,8 +60,7 @@ makeShader
:: String -- ^ First part of the name of the shader
-> [ShaderType] -- ^ Filetype extensions
-> [Int] -- ^ The input vertex sizes
-> EPrimitiveMode
-> IO FullShader
-> EPrimitiveMode -> IO FullShader
makeShader s shaderlist sizes pm = do
prog <- makeSourcedShader s shaderlist
vaob <- setupVAO sizes
+10 -11
View File
@@ -33,6 +33,10 @@ module Shader.Data
, psText
, psArc
, psEll
, vert
, geom
, frag
-- TODO make lenses for VBO object
-- , textureObject
@@ -138,8 +142,6 @@ instance Traversable PicShads where
, _psArc = x4
, _psEll = x5
} = PicShads <$> f x0 <*> f x1 <*> f x2 <*> f x3 <*> f x4 <*> f x5
{- | Datatype containing the necessary information for a single shader. -}
data FullShader = FullShader
{ _shaderProgram :: Program
@@ -151,15 +153,6 @@ data FullShader = FullShader
{- | Datatype containing the reference to a texture object. -}
newtype ShaderTexture = ShaderTexture
{ _textureObject :: TextureObject }
--data PicVerxs = PicVerxs
-- { _pvPoly :: (Point3,Point4)
-- , _pvPolyz :: (Point3,Point4,Float)
-- , _pvBez :: (Point3,Point4,Point4)
-- , _pvText :: (Point3,Point4,Point2)
-- , _pvArc :: (Point3,Point3,Point3)
-- , _pvEll :: (Point3,Point4)
-- }
data EPrimitiveMode
= EPoints
| ELines
@@ -174,6 +167,12 @@ data EPrimitiveMode
| EPolygon
| EPatches
-- | Short synonyms for shader types
vert, geom, frag :: ShaderType
vert = VertexShader
geom = GeometryShader
frag = FragmentShader
makeLenses ''VAO
makeLenses ''FullShader
makeLenses ''VShader
+2 -2
View File
@@ -45,7 +45,7 @@ vToPicShad mv = mapM (MV.unsafeRead mv) $ PicShads 0 1 2 3 4 5
pokeVerx :: PicShads VBO -> MV.MVector (PrimState IO) Int -> Verx -> IO ()
--{-# INLINE pokeVerx #-}
pokeVerx vbos offsets !Verx{_vxPos=thePos,_vxCol=theCol,_vxExt=ext,_vxShadNum=theShadNum} = do
pokeVerx vbos offsets Verx{_vxPos=thePos,_vxCol=theCol,_vxExt=ext,_vxShadNum=theShadNum} = do
typeOff <- MV.unsafeRead offsets sn
let thePtr = plusPtr (_vboPtr $ vboFromType vbos sn) (typeOff * pokeStride sn * floatSize)
poke34 thePtr thePos theCol
@@ -73,7 +73,7 @@ pokePoint33s :: Ptr Float -> [(Point3,Point3)] -> IO Int
pokePoint33s ptr vals0 = go vals0 0
where
go [] n = return n
go ( !(V3 a b c,V3 d e f):vals) !n = do
go ( (V3 a b c,V3 d e f):vals) !n = do
pokeElemOff ptr (off 0) a
pokeElemOff ptr (off 1) b
pokeElemOff ptr (off 2) c