Pre shader refactor commit
This commit is contained in:
@@ -11,6 +11,16 @@ import Geometry.Data
|
||||
|
||||
import Control.Lens
|
||||
|
||||
import Foreign
|
||||
|
||||
import Graphics.Rendering.OpenGL hiding (Point (..),translate,scale,imageHeight,imageWidth)
|
||||
|
||||
data VAO = VAO
|
||||
{ _vao :: VertexArrayObject
|
||||
, _vaoBufferTargets :: [(BufferObject,Ptr Float,Int)]
|
||||
}
|
||||
makeLenses ''VAO
|
||||
|
||||
type RGBA = (Float,Float,Float,Float)
|
||||
type Color = (Float,Float,Float,Float)
|
||||
|
||||
@@ -55,6 +65,13 @@ flat4 (x,y,z,w) = [x,y,z,w]
|
||||
{-# INLINE flat3 #-}
|
||||
{-# INLINE flat4 #-}
|
||||
|
||||
data FullShader = FullShader
|
||||
{ _shaderProgram :: Program
|
||||
, _shaderUniforms :: [UniformLocation]
|
||||
, _shaderVAO :: VAO
|
||||
-- , _shaderPokeStrategy :: [Ptr Float] -> F.FoldM IO RenderType Int
|
||||
}
|
||||
|
||||
data RenderType
|
||||
= RenderPoly [(Point3,Point4)]
|
||||
| RenderText [(Point3,Point4,Point3)]
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
module Picture.Preload
|
||||
where
|
||||
|
||||
import Picture.Data
|
||||
|
||||
import Codec.Picture
|
||||
import Graphics.Rendering.OpenGL hiding (Point (..),translate,scale,imageHeight,imageWidth)
|
||||
import qualified Graphics.Rendering.OpenGL as GL
|
||||
@@ -40,13 +42,8 @@ data RenderData = RenderData
|
||||
, _dummyVBO :: BufferObject
|
||||
, _dummyPtr :: Ptr Float
|
||||
}
|
||||
data VAO = VAO
|
||||
{ _vao :: VertexArrayObject
|
||||
, _vaoBufferTargets :: [(BufferObject,Ptr Float,Int)]
|
||||
}
|
||||
|
||||
makeLenses ''RenderData
|
||||
makeLenses ''VAO
|
||||
|
||||
floatSize = sizeOf (0.5 :: GLfloat)
|
||||
|
||||
|
||||
@@ -404,7 +404,6 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
||||
wallPtr2 = (\(_,x,_) -> x) $ (_vaoBufferTargets $ _wallVAO pdata) !! 1
|
||||
foldWalls n ((x,y),(z,w),(a,b),(c,d)) = do
|
||||
pokeFourOff wallPtr n (x,y,z,w)
|
||||
-- pokeElemOff (_dummyPtr pdata) n (fromIntegral n)
|
||||
pokeFourOff wallPtr2 n (a,b,c,d)
|
||||
return $ n+1
|
||||
nWalls <- foldM foldWalls 0 wallPoints
|
||||
@@ -417,10 +416,6 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
||||
bindVertexArrayObject $= Just (_vao $ _wallVAO pdata)
|
||||
uniform (_wssLightPos pdata) $= Vector2 (x) (y)
|
||||
blendFunc $= (Zero,One)
|
||||
-- drawElements Points (fromIntegral nWalls) UnsignedByte (_dummyPtr pdata)
|
||||
-- withArray [0..(nWalls-1)::Int] $ \ptr ->
|
||||
---- --drawElements Points (fromIntegral nWalls) UnsignedByte ptr
|
||||
-- glDrawElements GL_POINTS (fromIntegral $ length wallPoints) GL_UNSIGNED_BYTE ptr
|
||||
drawArrays Points (fromIntegral 0) (fromIntegral $ nWalls)
|
||||
cullFace $= Nothing
|
||||
currentProgram $= Just (fst $ _lightmapCircleShader pdata)
|
||||
|
||||
Reference in New Issue
Block a user