Reduce number of wall points sent for shadows
This commit is contained in:
+15
-3
@@ -559,11 +559,11 @@ displayHP n w = translate (halfWidth w-70) (halfHeight w-40) $
|
|||||||
|
|
||||||
testPic w = blank
|
testPic w = blank
|
||||||
|
|
||||||
wallsForGloom' :: World -> [(Point2,Point2,Point2,Point2)]
|
wallsForGloom' :: World -> [(Point2,Point2)]
|
||||||
wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThrough)
|
wallsForGloom' w = map (wallPairBack . _wlLine) $ filter (not . _wlIsSeeThrough)
|
||||||
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
||||||
|
|
||||||
where wallPairToFour (x:y:_) = (ss x,ss y,ss $ x +.+ n,ss $ y+.+ n)
|
where wallPairBack (x:y:_) = (ss $ x +.+ n,ss $ y+.+ n)
|
||||||
where n = 15 *.* (normalizeV $ vNormal $ y -.- x)
|
where n = 15 *.* (normalizeV $ vNormal $ y -.- x)
|
||||||
ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
|
ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
|
||||||
ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
|
ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
|
||||||
@@ -571,6 +571,18 @@ wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThroug
|
|||||||
-- the ss transformation would possibly be better done using a matrix in the
|
-- the ss transformation would possibly be better done using a matrix in the
|
||||||
-- shader
|
-- shader
|
||||||
zoom = _cameraZoom w
|
zoom = _cameraZoom w
|
||||||
|
--wallsForGloom' :: World -> [(Point2,Point2,Point2,Point2)]
|
||||||
|
--wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThrough)
|
||||||
|
-- $ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
||||||
|
--
|
||||||
|
-- where wallPairToFour (x:y:_) = (ss x,ss y,ss $ x +.+ n,ss $ y+.+ n)
|
||||||
|
-- where n = 15 *.* (normalizeV $ vNormal $ y -.- x)
|
||||||
|
-- ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
|
||||||
|
-- ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
|
||||||
|
-- ss = ss'' . ss'
|
||||||
|
---- the ss transformation would possibly be better done using a matrix in the
|
||||||
|
---- shader
|
||||||
|
-- zoom = _cameraZoom w
|
||||||
|
|
||||||
lightsForGloom' :: World -> [(Point4)]
|
lightsForGloom' :: World -> [(Point4)]
|
||||||
lightsForGloom' w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
lightsForGloom' w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
||||||
|
|||||||
@@ -297,8 +297,10 @@ threePtrsVAO vao = case (\(_,ps,_) -> ps) $ unzip3 $ _vaoBufferTargets vao of
|
|||||||
|
|
||||||
|
|
||||||
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
||||||
[(Point2,Point2,Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
|
[(Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
|
||||||
renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints pic = do
|
renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints pic = do
|
||||||
|
ticksAfterL <- SDL.ticks
|
||||||
|
startWallTicks <- SDL.ticks
|
||||||
depthFunc $= Just Lequal
|
depthFunc $= Just Lequal
|
||||||
|
|
||||||
aticks <- SDL.ticks
|
aticks <- SDL.ticks
|
||||||
@@ -343,7 +345,7 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
|||||||
bindVertexArrayObject $= Just (_vao $ _wallVAO pdata)
|
bindVertexArrayObject $= Just (_vao $ _wallVAO pdata)
|
||||||
let wallPtr = (\(_,x,_) -> x) $ head $ _vaoBufferTargets $ _wallVAO pdata
|
let wallPtr = (\(_,x,_) -> x) $ head $ _vaoBufferTargets $ _wallVAO pdata
|
||||||
-- wallPtr2 = (\(_,x,_) -> x) $ (_vaoBufferTargets $ _wallVAO pdata) !! 1
|
-- wallPtr2 = (\(_,x,_) -> x) $ (_vaoBufferTargets $ _wallVAO pdata) !! 1
|
||||||
foldWalls n ((x,y),(z,w),(a,b),(c,d)) = do
|
foldWalls n ((x,y),(z,w)) = do
|
||||||
pokeFourOff wallPtr n (x,y,z,w)
|
pokeFourOff wallPtr n (x,y,z,w)
|
||||||
-- pokeFourOff wallPtr2 n (a,b,c,d)
|
-- pokeFourOff wallPtr2 n (a,b,c,d)
|
||||||
return $ n+1
|
return $ n+1
|
||||||
@@ -366,7 +368,8 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
|||||||
bindArrayBuffers (1) $ _vaoBufferTargets $ _fadeCircVAO pdata
|
bindArrayBuffers (1) $ _vaoBufferTargets $ _fadeCircVAO pdata
|
||||||
blendFuncSeparate $= ((Zero,Zero),(Zero, OneMinusSrcAlpha))
|
blendFuncSeparate $= ((Zero,Zero),(Zero, OneMinusSrcAlpha))
|
||||||
drawArrays Points (fromIntegral 0) (fromIntegral 1)
|
drawArrays Points (fromIntegral 0) (fromIntegral 1)
|
||||||
ticksAfterL <- SDL.ticks
|
-- ticksAfterL <- SDL.ticks
|
||||||
|
endWallTicks <- SDL.ticks
|
||||||
-- draw picture
|
-- draw picture
|
||||||
-- set drawing for on top
|
-- set drawing for on top
|
||||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||||
@@ -400,7 +403,8 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
|||||||
uniform (snd shad !! 2) $= (0::Float)
|
uniform (snd shad !! 2) $= (0::Float)
|
||||||
uniform (snd shad !! 3) $= Vector2 (0::Float) 0
|
uniform (snd shad !! 3) $= Vector2 (0::Float) 0
|
||||||
uniform (snd shad !! 4) $= idmat
|
uniform (snd shad !! 4) $= idmat
|
||||||
return (ticksAfterL, ticks2+ticks3+ticks4)
|
--return (ticksAfterL, ticks2+ticks3+ticks4, endWallTicks - startWallTicks)
|
||||||
|
return (ticksAfterL, endWallTicks - startWallTicks)
|
||||||
|
|
||||||
bufferOffset :: Integral a => a -> Ptr b
|
bufferOffset :: Integral a => a -> Ptr b
|
||||||
bufferOffset = plusPtr nullPtr . fromIntegral
|
bufferOffset = plusPtr nullPtr . fromIntegral
|
||||||
|
|||||||
Reference in New Issue
Block a user