Fix bloom resize bug, bloom itself could use improvement
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Preload.Update
|
||||
(pdataResizeUpdate
|
||||
) where
|
||||
import Data.Preload
|
||||
import Framebuffer.Update
|
||||
import Shader.Compile
|
||||
import Shader.Data
|
||||
import Data.Preload.Render
|
||||
|
||||
import qualified Data.ByteString as BS
|
||||
import qualified Data.ByteString.Char8 as BSC
|
||||
pdataResizeUpdate
|
||||
:: Int -- ^ Scaled width
|
||||
-> Int -- ^ Scaled height
|
||||
-> Int -- ^ Full width
|
||||
-> Int -- ^ Full height
|
||||
-> PreloadData a
|
||||
-> IO (PreloadData a)
|
||||
pdataResizeUpdate xsize ysize xfull yfull pdata = do
|
||||
rd <- renderDataResizeUpdate xsize ysize xfull yfull (_renderData pdata)
|
||||
return (pdata {_renderData = rd})
|
||||
|
||||
renderDataResizeUpdate
|
||||
:: Int -- ^ Scaled width
|
||||
-> Int -- ^ Scaled height
|
||||
-> Int -- ^ Full width
|
||||
-> Int -- ^ Full height
|
||||
-> RenderData
|
||||
-> IO RenderData
|
||||
renderDataResizeUpdate xsize ysize xfull yfull rdata = do
|
||||
rdata' <- sizeFBOs xsize ysize xfull yfull rdata
|
||||
bbVert <- BS.readFile "shader/texture/bloomBlur.vert"
|
||||
bbFrag <- BS.readFile "shader/texture/bloomBlur.frag"
|
||||
let (bh,bmid) = BS.breakSubstring "(" bbFrag
|
||||
(_,btt) = BS.breakSubstring ")" bmid
|
||||
bbFrag' = BS.append bh $ BS.append (BSC.pack $ '(' : show xfull ++ "," ++ show yfull) btt
|
||||
--BSC.putStrLn bbFrag'
|
||||
bbShad <- makeByteStringShaderUsingVAO "bloomBlur" [(vert,bbVert),(frag,bbFrag')] ETriangleStrip
|
||||
(_fullscreenShader rdata)
|
||||
return (rdata' {_bloomBlurShader = bbShad})
|
||||
|
||||
Reference in New Issue
Block a user