Some cleanup of rendering/poking, remove forcefield gun

This commit is contained in:
2024-10-01 13:19:34 +01:00
parent 6438da0037
commit d357d5a03c
11 changed files with 64 additions and 148 deletions
+1 -2
View File
@@ -122,8 +122,7 @@ inventoryX c = case c of
, makeTypeCraftNum 2 PIPE
]
'B' ->
[ forceFieldGun
, wristArmour
[ wristArmour
, wristArmour
, autoRifle
, tinMag
-1
View File
@@ -164,7 +164,6 @@ data HeldItemType
| POISONSPRAYER
| DRONELAUNCHER
| SHATTERGUN
| FORCEFIELDGUN
| HELDDETECTOR Detector
| TORCH
| FLATSHIELD
-20
View File
@@ -191,7 +191,6 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
MuzzleLauncher -> createProjectile magtree mz itmtree cr w
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
MuzzleShatter -> shootShatter itm cr w
MuzzleForceField -> useForceFieldGun itm cr w
MuzzleDetector -> itemDetectorEffect itm cr w
where
mid = magtree ^? ldtValue . itLocation . ilInvID
@@ -444,25 +443,6 @@ shootTeslaArc itm cr mz w =
pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
dir = _crDir cr + _mzRot mz
-- I believe because the targeting returns to nothing straight after you release
-- the rmb, it is possible for this to do nothing
-- TODO investigate more and fix
useForceFieldGun :: Item -> Creature -> World -> World
useForceFieldGun _ _ = id
--useForceFieldGun itm cr w = fromMaybe w $ do
-- a <- cr ^? crTargeting . ctPos . _Just
-- let mwp = mouseWorldPos (w ^. input) (w ^. wCam)
-- b = if dist a mwp < 100 then mwp else a +.+ 100 *.* normalizeV (mwp -.- a)
-- wlline = (a, b)
-- return $
-- w
-- & cWorld . lWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
-- & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID (_itLocation itm)) . itParams . paramMID ?~ i
-- & moveWallIDUnsafe i wlline
-- where
-- i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just
determineProjectileTracking ::
LabelDoubleTree ComposeLinkType Item ->
LabelDoubleTree ComposeLinkType Item ->
-1
View File
@@ -64,6 +64,5 @@ itemFromHeldType ht = case ht of
-- REMOTELAUNCHER -> remoteLauncher
POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> undefined
FORCEFIELDGUN -> forceFieldGun
HELDDETECTOR d -> clickDetector d
FLATSHIELD -> flatShield
-16
View File
@@ -31,22 +31,6 @@ torch =
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
forceFieldGun :: Item
forceFieldGun =
defaultHeldItem
-- & itUse . useTargeting ?~ TargetRBLine
-- & itType . iyModules . at ModTarget ?~ TARGET TargetRBLine
& itParams .~ ParamMID Nothing
-- & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
-- & itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
-- & itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType .~ HELD FORCEFIELDGUN
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleForceField
{- |
Sends out pulses that display walls.
-}
-7
View File
@@ -90,13 +90,6 @@ itemRooms =
[ rc [sniperRifle]
]
)
,
( HELD FORCEFIELDGUN
, join $
takeOne
[ rc [forceFieldGun]
]
)
,
( HELD $ KEYCARD 0
, join $
+9 -9
View File
@@ -59,8 +59,8 @@ doDrawing' win pdata u = do
shadV = _pictureShaders pdata
nFls = w ^. cWorld . numberFloorVerxs
-- bind as much data into vbos as feasible at this point
-- count mutable vectors setup (what is the 6 here?)
layerCounts <- UMV.replicate (numLayers * 6) 0
-- count mutable vectors setup
pokeCounts <- UMV.replicate (numLayers * numShads) 0
-- attempt to poke in parallel
let wswp = wallSPics <> worldSPic cfig u
ws = wswp ^. _1
@@ -70,7 +70,7 @@ doDrawing' win pdata u = do
(\_ a b -> return (a, b))
( pokeLayVerxs
shadV
layerCounts
pokeCounts
wp
)
( pokeWallsWindows
@@ -94,7 +94,7 @@ doDrawing' win pdata u = do
(V.fromList $ w ^. cWorld . lWorld . clouds)
--(sortOn (^. clPos . _3) $ w ^. cWorld . lWorld . clouds)
-- bind wall points, silhouette data, surface geometry
bufferShaderLayers shadV layerCounts
bufferShaderLayers shadV pokeCounts
mapM_
(uncurry bufferPokedVBO)
[ (pdata ^. vboWindows, nWins)
@@ -219,9 +219,9 @@ doDrawing' win pdata u = do
glDepthFunc GL_LESS
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
glDepthMask GL_FALSE
renderLayer BloomNoZWrite shadV layerCounts
renderLayer BloomNoZWrite shadV pokeCounts
glDepthMask GL_TRUE
renderLayer BloomLayer shadV layerCounts
renderLayer BloomLayer shadV pokeCounts
--setup downscale viewport for blurring bloom
--setViewportSize (round winx `div` (2 * resFact)) (round winy `div` (2 * resFact))
setViewport _graphics_downsize_resolution cfig
@@ -253,7 +253,7 @@ doDrawing' win pdata u = do
GL_COLOR
0
ptr
-- renderLayer MidLayer shadV layerCounts
-- renderLayer MidLayer shadV pokeCounts
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
@@ -372,11 +372,11 @@ doDrawing' win pdata u = do
--glDepthMask GL_TRUE
glEnable GL_BLEND
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
renderLayer DebugLayer shadV layerCounts
renderLayer DebugLayer shadV pokeCounts
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig))
$ \ptr -> glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
renderLayer FixedCoordLayer shadV layerCounts
renderLayer FixedCoordLayer shadV pokeCounts
SDL.glSwapWindow win
getDistortions :: Configuration -> World -> [Distortion]
+2 -49
View File
@@ -5,13 +5,9 @@ module Shader.Compile (
makeShaderVBO,
makeShaderUsingVBO,
makeByteStringShaderUsingVAO,
makeStaticShader,
makeShaderUsingVAO,
setupVAOUsingVBO,
setupVAOvbo,
setupEBO,
setupVertexAttribPointer,
makeSourcedShader,
toFloatVAs,
setupStaticVBOVAO
) where
@@ -29,8 +25,6 @@ import Graphics.GL.Core45
import Shader.Data
import Shader.Parameters
--import Graphics.GL.Core45
{- |
Compiles a full shader found within the shader directory.
The shader is made up of files begining with the inputted string with extensions .vert, .geom etc.
@@ -70,10 +64,7 @@ makeShaderEBO s shaderlist sizes pm vbo = do
shad <- makeShaderUsingVBO s shaderlist sizes pm vbo
ebo <- setupEBO (shad ^. shaderVAO)
glVertexArrayElementBuffer (shad ^. shaderVAO . vaoName) (ebo ^. eboName)
return
( shad
, ebo
)
return (shad, ebo)
makeShaderUsingVBO ::
-- | First part of the name of the shader
@@ -92,6 +83,7 @@ makeShaderUsingVBO s shaderlist sizes pm vbo = do
setupVBO :: Int -> IO VBO
setupVBO vertexsize = do
vboname <- mglCreate glCreateBuffers
-- unclear whether this should also be multiplied by floatSize
thePtr <- mallocBytes (vertexsize * numDrawableVertices)
-- Allocate space
glNamedBufferData
@@ -120,8 +112,6 @@ setupStaticVBOVAO vas vdata = withArrayLen vdata $ \i ptr -> do
}
vao <- setupVAOUsingVBO vas vbo
return (vbo,vao)
setupVBOStatic :: Int -> IO VBO
setupVBOStatic vertexsize = do
@@ -170,33 +160,6 @@ makeShaderUsingVAO s shaderlist pm theVAO = do
, _shaderPrimitive = pm
}
-- this should be changed to some FIXED STORAGE SHADER
-- I cannot think of any other reason to have it
{- |
Compiles a full shader found within the shader directory.
The shader is made up of files begining with the inputted string with extensions .vert, .geom etc.
-}
makeStaticShader ::
Storable a =>
-- | First part of the name of the shader
String ->
-- | shader types
[GLenum] ->
[VertexAttribute] ->
[a] ->
PrimitiveMode ->
IO Shader
makeStaticShader s shaderlist vas vdata pm = do
prog <- makeSourcedShader s shaderlist
(_, vao) <- setupStaticVBOVAO vas vdata
return
( Shader
{ _shaderUINT = prog
, _shaderVAO = vao
, _shaderPrimitive = pm
}
)
{- | Compile shader and get its uniform locations.
supposes the shader code is in the shader folder, with the string names
followed by .vert/.geom/.frag.
@@ -213,16 +176,6 @@ shaderTypeExt GL_FRAGMENT_SHADER = ".frag"
shaderTypeExt GL_COMPUTE_SHADER = ".comp"
shaderTypeExt _ = undefined
setupVAOvbo :: [VertexAttribute] -> Int -> GLuint -> IO VAO
setupVAOvbo sizes strd vbo = do
vaoname <- mglCreate glCreateVertexArrays
glBindVertexArray vaoname
setupVertexAttribs vbo vaoname sizes (fromIntegral strd * fromIntegral floatSize)
return $
VAO
{ _vaoName = vaoname
}
setupVAOUsingVBO :: [VertexAttribute] -> VBO -> IO VAO
setupVAOUsingVBO vas vbo = do
let strd = vbo ^. vboVertexBytes
+3 -1
View File
@@ -6,7 +6,7 @@ module Shader.Parameters
, glushortSize
, numGLushort
) where
import Picture.Data
--import Picture.Data
import Graphics.GL.Core45
import Foreign
@@ -30,10 +30,12 @@ numGLushort :: Int
numGLushort = fromIntegral (maxBound :: GLushort) + 1
{-# INLINE numGLushort #-}
-- why 6?
numDrawableVertices :: Int
{-# INLINE numDrawableVertices #-}
numDrawableVertices = 6 * numSubElements
-- why this number?
numSubElements :: Int
{-# INLINE numSubElements #-}
numSubElements = 65536