started to render iqm - nothing visible now.

This commit is contained in:
Stefan Dresselhaus
2014-05-03 15:17:33 +02:00
parent 2150e8d7af
commit 91fbbb7350
6 changed files with 373 additions and 0 deletions

View File

@ -132,6 +132,8 @@ initMapShader tessFac (buf, vertDes) = do
, _mapVert = vertDes
, _overviewTexture = overTex
, _mapTextures = texts
, _objectsProgram = program
, _mapObjects = []
}
initHud :: IO GLHud
@ -265,6 +267,10 @@ renderOverview = do
checkError "draw map"
-}
renderObject :: MapObject -> IO ()
renderObject (MapObject model (L.V3 x y z) _{-state-}) =
undefined
render :: Pioneers ()
render = do
@ -356,6 +362,12 @@ render = do
glDrawArrays gl_PATCHES 0 (fromIntegral numVert)
checkError "draw map"
---- RENDER MAPOBJECTS --------------------------------------------
currentProgram $= Just (state ^. gl.glMap.objectsProgram)
mapM_ renderObject (state ^. gl.glMap.mapObjects)
-- set sample 1 as target in renderbuffer
{-framebufferRenderbuffer
DrawFramebuffer --write-only

View File

@ -8,11 +8,13 @@ import Foreign.C (CFloat)
import qualified Data.HashMap.Strict as Map
import Data.Time (UTCTime)
import Linear.Matrix (M44)
import Linear (V3)
import Control.Monad.RWS.Strict (RWST)
import Control.Lens
import Graphics.Rendering.OpenGL.GL.Texturing.Objects (TextureObject)
import Render.Types
import UI.UIBaseData
import Importer.IQM.Types
--Static Read-Only-State
@ -113,8 +115,16 @@ data GLMapState = GLMapState
, _renderedMapTexture :: !TextureObject --TODO: Probably move to UI?
, _overviewTexture :: !TextureObject
, _mapTextures :: ![TextureObject] --TODO: Fix size on list?
, _objectsProgram :: !GL.Program
, _mapObjects :: ![MapObject]
}
data MapObject = MapObject !IQM !MapCoordinates !MapObjectState
data MapObjectState = MapObjectState ()
type MapCoordinates = V3 CFloat
data GLHud = GLHud
{ _hudTexture :: !TextureObject -- ^ HUD-Texture itself
, _hudTexIndex :: !GL.UniformLocation -- ^ Position of Overlay-Texture in Shader