Add blurring of lightmap (and refactoring)
This commit is contained in:
+25
-3
@@ -8,11 +8,13 @@ import Foreign
|
||||
import Picture.Preload
|
||||
|
||||
resizeSpareFBO
|
||||
:: Int -- ^ Width
|
||||
-> Int -- ^ Height
|
||||
:: Int -- ^ Lightmap width
|
||||
-> Int -- ^ Lightmap height
|
||||
-> Int -- ^ Full width
|
||||
-> Int -- ^ Full height
|
||||
-> PreloadData a
|
||||
-> IO (PreloadData a)
|
||||
resizeSpareFBO xsize ysize pdata = do
|
||||
resizeSpareFBO xsize ysize xfull yfull pdata = do
|
||||
-- I am unsure how much of this needs to be bound...
|
||||
let rdata = _renderData pdata
|
||||
fboName = _spareFBO rdata
|
||||
@@ -33,5 +35,25 @@ resizeSpareFBO xsize ysize pdata = do
|
||||
|
||||
fboStatus <- framebufferStatus Framebuffer
|
||||
putStrLn $ "after resize, framebuffer status:" ++ show fboStatus
|
||||
|
||||
resizeTextureFBO (_fbo2 rdata) xfull yfull
|
||||
resizeTextureFBO (_fbo3 rdata) xfull yfull
|
||||
|
||||
return pdata
|
||||
|
||||
resizeTextureFBO
|
||||
:: (FramebufferObject , TextureObject)
|
||||
-> Int
|
||||
-> Int
|
||||
-> IO ()
|
||||
resizeTextureFBO (fboName,fboTO) xsize ysize = do
|
||||
let xsize' = fromIntegral xsize
|
||||
ysize' = fromIntegral ysize
|
||||
bindFramebuffer Framebuffer $= fboName
|
||||
textureBinding Texture2D $= Just fboTO
|
||||
texImage2D Texture2D NoProxy 0 RGBA8 (TextureSize2D xsize' ysize') 0 (PixelData RGBA UnsignedByte nullPtr)
|
||||
textureFilter Texture2D $= ((Linear',Just Linear') , Nearest)
|
||||
generateMipmap' Texture2D
|
||||
framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D fboTO 0
|
||||
fboStatus <- framebufferStatus Framebuffer
|
||||
putStrLn $ "after resize, framebuffer status:" ++ show fboStatus
|
||||
|
||||
Reference in New Issue
Block a user