WIP DOES NOT WORK
This commit is contained in:
parent
c4b5e69fcf
commit
1f6551cf08
@ -22,6 +22,7 @@ import Types
|
|||||||
import Render.Misc
|
import Render.Misc
|
||||||
import Render.Types
|
import Render.Types
|
||||||
import Graphics.GLUtil.BufferObjects (makeBuffer)
|
import Graphics.GLUtil.BufferObjects (makeBuffer)
|
||||||
|
import Importer.IQM.Parser
|
||||||
|
|
||||||
mapVertexShaderFile :: String
|
mapVertexShaderFile :: String
|
||||||
mapVertexShaderFile = "shaders/map/vertex.shader"
|
mapVertexShaderFile = "shaders/map/vertex.shader"
|
||||||
@ -32,6 +33,11 @@ mapTessEvalShaderFile = "shaders/map/tessEval.shader"
|
|||||||
mapFragmentShaderFile :: String
|
mapFragmentShaderFile :: String
|
||||||
mapFragmentShaderFile = "shaders/map/fragment.shader"
|
mapFragmentShaderFile = "shaders/map/fragment.shader"
|
||||||
|
|
||||||
|
objectVertexShaderFile :: String
|
||||||
|
objectVertexShaderFile = "shaders/objects/vertex.shader"
|
||||||
|
objectFragmentShaderFile :: String
|
||||||
|
objectFragmentShaderFile = "shaders/objects/fragment.shader"
|
||||||
|
|
||||||
uiVertexShaderFile :: String
|
uiVertexShaderFile :: String
|
||||||
uiVertexShaderFile = "shaders/ui/vertex.shader"
|
uiVertexShaderFile = "shaders/ui/vertex.shader"
|
||||||
uiFragmentShaderFile :: String
|
uiFragmentShaderFile :: String
|
||||||
@ -113,6 +119,21 @@ initMapShader tessFac (buf, vertDes) = do
|
|||||||
|
|
||||||
texts <- genObjectNames 6
|
texts <- genObjectNames 6
|
||||||
|
|
||||||
|
testobj <- parseIQM "sample.iqm"
|
||||||
|
|
||||||
|
let
|
||||||
|
objs = [GLObject testobj (Coord3D 0 10 0)]
|
||||||
|
|
||||||
|
! vertexSource' <- B.readFile objectVertexShaderFile
|
||||||
|
! fragmentSource' <- B.readFile objectFragmentShaderFile
|
||||||
|
vertexShader' <- compileShaderSource VertexShader vertexSource'
|
||||||
|
checkError "compile Object-Vertex"
|
||||||
|
fragmentShader' <- compileShaderSource FragmentShader fragmentSource'
|
||||||
|
checkError "compile Object-Fragment"
|
||||||
|
objProgram <- createProgramUsing [vertexShader', fragmentShader']
|
||||||
|
checkError "compile Object-Program"
|
||||||
|
|
||||||
|
currentProgram $= Just objProgram
|
||||||
|
|
||||||
checkError "initShader"
|
checkError "initShader"
|
||||||
return GLMapState
|
return GLMapState
|
||||||
@ -132,6 +153,8 @@ initMapShader tessFac (buf, vertDes) = do
|
|||||||
, _mapVert = vertDes
|
, _mapVert = vertDes
|
||||||
, _overviewTexture = overTex
|
, _overviewTexture = overTex
|
||||||
, _mapTextures = texts
|
, _mapTextures = texts
|
||||||
|
, _mapObjects = objs
|
||||||
|
, _objectProgram = objProgram
|
||||||
}
|
}
|
||||||
|
|
||||||
initHud :: IO GLHud
|
initHud :: IO GLHud
|
||||||
@ -354,6 +377,11 @@ render = do
|
|||||||
cullFace $= Just Front
|
cullFace $= Just Front
|
||||||
|
|
||||||
glDrawArrays gl_PATCHES 0 (fromIntegral numVert)
|
glDrawArrays gl_PATCHES 0 (fromIntegral numVert)
|
||||||
|
|
||||||
|
|
||||||
|
currentProgram $= Just (state ^. gl.glMap.objectProgram)
|
||||||
|
|
||||||
|
|
||||||
checkError "draw map"
|
checkError "draw map"
|
||||||
|
|
||||||
-- set sample 1 as target in renderbuffer
|
-- set sample 1 as target in renderbuffer
|
||||||
|
@ -13,7 +13,9 @@ import Control.Lens
|
|||||||
import Graphics.Rendering.OpenGL.GL.Texturing.Objects (TextureObject)
|
import Graphics.Rendering.OpenGL.GL.Texturing.Objects (TextureObject)
|
||||||
import Render.Types
|
import Render.Types
|
||||||
import UI.UIBaseData
|
import UI.UIBaseData
|
||||||
|
import Importer.IQM.Types
|
||||||
|
|
||||||
|
data Coord3D a = Coord3D a a a
|
||||||
|
|
||||||
--Static Read-Only-State
|
--Static Read-Only-State
|
||||||
data Env = Env
|
data Env = Env
|
||||||
@ -113,8 +115,12 @@ data GLMapState = GLMapState
|
|||||||
, _renderedMapTexture :: !TextureObject --TODO: Probably move to UI?
|
, _renderedMapTexture :: !TextureObject --TODO: Probably move to UI?
|
||||||
, _overviewTexture :: !TextureObject
|
, _overviewTexture :: !TextureObject
|
||||||
, _mapTextures :: ![TextureObject] --TODO: Fix size on list?
|
, _mapTextures :: ![TextureObject] --TODO: Fix size on list?
|
||||||
|
, _objectProgram :: !GL.Program
|
||||||
|
, _mapObjects :: ![GLObject]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data GLObject = GLObject IQM (Coord3D Double)
|
||||||
|
|
||||||
data GLHud = GLHud
|
data GLHud = GLHud
|
||||||
{ _hudTexture :: !TextureObject -- ^ HUD-Texture itself
|
{ _hudTexture :: !TextureObject -- ^ HUD-Texture itself
|
||||||
, _hudTexIndex :: !GL.UniformLocation -- ^ Position of Overlay-Texture in Shader
|
, _hudTexIndex :: !GL.UniformLocation -- ^ Position of Overlay-Texture in Shader
|
||||||
|
Loading…
Reference in New Issue
Block a user