Allow for multiple distortions at once

This commit is contained in:
2025-11-18 22:49:51 +00:00
parent 8428f08ebd
commit b633b9d55f
5 changed files with 41 additions and 31 deletions
+6 -4
View File
@@ -367,12 +367,11 @@ doDrawing' win pdata u = do
glUseProgram (pdata ^. fullscreenShader)
glDrawArrays GL_TRIANGLES 0 6
--(RadialDistortion (V2 a b) (V2 c d) (V2 e f) (V2 g h) _:_) -> do
(RadialDistortion a b c d e f _:_) -> do
rs -> do
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fbo2 . _1 . unFBO)
-- pokeArray (pdata ^. barrelShader . _2 . vboPtr) [a, b, c, d, e, f, g, h]
withArray [a, b, c, d, e, f] $
withArray (concatMap rdToVec2s rs) $
glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0
(12 * fromIntegral (sizeOf (0 :: Float)))
(12 * fromIntegral (length rs * sizeOf (0 :: Float)))
glBindTextureUnit 1 $ pdata ^. fboBase . _2 . _1 . unTO
glUseProgram (pdata ^. barrelShader . _1)
glDrawArrays GL_TRIANGLES 0 6
@@ -398,6 +397,9 @@ doDrawing' win pdata u = do
renderLayer FixedCoordLayer shadV pokeCounts
SDL.glSwapWindow win
rdToVec2s :: Distortion -> [Point2]
rdToVec2s (RadialDistortion a b c d e f _) = [a,b,c,d,e,f]
bufferPerspectiveMatrixUBO :: Config -> Camera -> GLuint -> IO ()
bufferPerspectiveMatrixUBO cfig cam uboid =
withArray