Clarify number of distortions, play with distorting bullets

This commit is contained in:
2025-11-19 21:49:20 +00:00
parent 610936a5fa
commit 10dbb238c8
7 changed files with 93 additions and 72 deletions
+4 -3
View File
@@ -359,7 +359,6 @@ doDrawing' win pdata u = do
glDepthFunc GL_ALWAYS
glBlendFunc GL_ONE GL_ZERO
-- perform distortions
-- this is hideous
case getDistortions cfig w of
[] -> do
glBindTextureUnit 0 $ pdata ^. fboBase . _2 . _1 . unTO
@@ -371,7 +370,7 @@ doDrawing' win pdata u = do
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fbo2 . _1 . unFBO)
withArray (concatMap rdToVec2s rs) $
glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0
(18 * fromIntegral (length rs * sizeOf (0 :: Float)))
(24 * fromIntegral (length rs * sizeOf (0 :: Float)))
glBindTextureUnit 1 $ pdata ^. fboBase . _2 . _1 . unTO
glUseProgram (pdata ^. barrelShader . _1)
glUniform1i 0 (fromIntegral (length rs))
@@ -399,7 +398,9 @@ doDrawing' win pdata u = do
SDL.glSwapWindow win
rdToVec2s :: Distortion -> [Point2]
rdToVec2s (RadialDistortion a b c d e f g h i j k l _) = [a,b,c,d,e,f,g,h,i,j,k,l]
rdToVec2s (RadialDistortion a b c d e f _) = [a,b,c] <> t d <> t e <> t f
where
t (V3 x y z) = [x,y,z]
bufferPerspectiveMatrixUBO :: Config -> Camera -> GLuint -> IO ()
bufferPerspectiveMatrixUBO cfig cam uboid =