From 1cded31eccace9d6818f2b0ca46893893b4e226b Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Mon, 19 May 2014 22:29:16 +0200 Subject: [PATCH] works now again - still renders nothing. --- src/Render/Render.hs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Render/Render.hs b/src/Render/Render.hs index d09493f..773cc80 100644 --- a/src/Render/Render.hs +++ b/src/Render/Render.hs @@ -488,6 +488,36 @@ render = do drawMap --draw map -> put to another function for readability liftIO $ do + ---- RENDER MAPOBJECTS -------------------------------------------- + currentProgram $= Just (state ^. gl.glMap.objectProgram) + checkError "setting up shadowmap-program" + + --set up projection (= copy from state) + --TODO: Fix width/depth + with (distribute frust) $ \ptr -> + glUniformMatrix4fv projmo 1 0 (castPtr (ptr :: Ptr (L.M44 CFloat))) + checkError "copy projection" + + --set up camera + --TODO: Fix magic constants... and camPos + let ! cam = getCam camPos zDist' xa ya + with (distribute cam) $ \ptr -> + glUniformMatrix4fv vmatmo 1 0 (castPtr (ptr :: Ptr (L.M44 CFloat))) + checkError "copy shadowmap-cam" + + --set up normal--Mat transpose((model*camera)^-1) + --needed? + let normal' = (case L.inv33 (fmap (^. L._xyz) cam ^. L._xyz) of + (Just a) -> a + Nothing -> L.eye3) :: L.M33 CFloat + nmap = collect id normal' :: L.M33 CFloat --transpose... + + with (distribute nmap) $ \ptr -> + glUniformMatrix3fv nmatmo 1 0 (castPtr (ptr :: Ptr (L.M33 CFloat))) + + checkError "nmat" + mapM_ renderObject (state ^. gl.glMap.mapObjects) + checkError "draw mapobjects" ---- COMPOSE RENDERING -------------------------------------------- -- Render to BackBuffer (=Screen)