Draw circles without using a geometry shader, layer offset broken
This commit is contained in:
@@ -3,6 +3,7 @@ layout (location = 0) in vec4 pos;
|
|||||||
layout (location = 1) in vec4 col;
|
layout (location = 1) in vec4 col;
|
||||||
layout (location = 2) in vec3 boxXboxYwidth;
|
layout (location = 2) in vec3 boxXboxYwidth;
|
||||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||||
|
layout (location = 0) uniform int layoff;
|
||||||
out vec4 vCol;
|
out vec4 vCol;
|
||||||
out vec3 vPos;
|
out vec3 vPos;
|
||||||
out vec3 vparams;
|
out vec3 vparams;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#version 450 core
|
#version 450 core
|
||||||
layout (location = 0) in vec4 pos;
|
layout (location = 0) in vec4 pos;
|
||||||
layout (location = 1) in vec4 col;
|
layout (location = 1) in vec4 col;
|
||||||
|
layout (location = 0) uniform int layoff;
|
||||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||||
out vec4 vCol;
|
out vec4 vCol;
|
||||||
out vec3 vPos;
|
out vec3 vPos;
|
||||||
|
|||||||
@@ -1,15 +1,33 @@
|
|||||||
#version 450 core
|
#version 450 core
|
||||||
layout (location = 0) in vec4 pos;
|
struct PosCol { vec4 posx; vec4 colx; };
|
||||||
layout (location = 1) in vec4 col;
|
|
||||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||||
out vec4 vCol;
|
layout (std430, binding = 13) readonly buffer Data { PosCol data[]; };
|
||||||
//const int ks[6] = //
|
layout (location = 0) uniform int n;
|
||||||
// {0,1,2 // 2--3
|
out vec4 gColC; // center color
|
||||||
// ,2,1,3 // | |
|
out vec4 gColE; // edge color
|
||||||
// }; // 0--1
|
out vec2 gBoundingBox;
|
||||||
// //
|
out vec3 gPos;
|
||||||
|
const int ks[6] = //
|
||||||
|
{1,0,2 // 2--3
|
||||||
|
,2,0,3 // | |
|
||||||
|
}; // 1--0
|
||||||
|
//
|
||||||
|
const vec2 bs[4] =
|
||||||
|
{ vec2( 1, 1)
|
||||||
|
, vec2(-1, 1)
|
||||||
|
, vec2(-1,-1)
|
||||||
|
, vec2( 1,-1)
|
||||||
|
} ;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = pos;
|
int i0 = n + (3 * (gl_VertexID/6) );
|
||||||
vCol = col;
|
gColC = data[i0].colx;
|
||||||
|
gColE = data[i0+1].colx;
|
||||||
|
int k = ks[gl_VertexID % 6];
|
||||||
|
gBoundingBox = bs[k];
|
||||||
|
gPos = (k > 2.5
|
||||||
|
? data[i0].posx + data[i0+2].posx - data[i0+1].posx
|
||||||
|
: data[i0+k].posx
|
||||||
|
).xyz;
|
||||||
|
gl_Position = theMat * vec4(gPos,1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#version 450 core
|
#version 450 core
|
||||||
layout (location = 0) in vec4 pos;
|
layout (location = 0) in vec4 pos;
|
||||||
layout (location = 1) in vec4 inColor;
|
layout (location = 1) in vec4 inColor;
|
||||||
//layout (location = 2) in vec4 inTexCoord;
|
|
||||||
layout (location = 2) in vec3 inTexCoord;
|
layout (location = 2) in vec3 inTexCoord;
|
||||||
|
layout (location = 0) uniform int layoff;
|
||||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||||
out vec4 vColor;
|
out vec4 vColor;
|
||||||
out vec3 vTexCoord;
|
out vec3 vTexCoord;
|
||||||
|
|||||||
+11
-3
@@ -3,7 +3,7 @@
|
|||||||
module Preload.Render (preloadRender) where
|
module Preload.Render (preloadRender) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
--import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Preload.Render
|
import Data.Preload.Render
|
||||||
import qualified Data.Vector.Mutable as MV
|
import qualified Data.Vector.Mutable as MV
|
||||||
@@ -105,9 +105,9 @@ preloadRender = do
|
|||||||
|
|
||||||
putStrLn "Setup 2D shaders"
|
putStrLn "Setup 2D shaders"
|
||||||
bslist <- makeShaderVBO "dualTwoD/basic" [vert, frag] (toFloatVAs [4, 4])
|
bslist <- makeShaderVBO "dualTwoD/basic" [vert, frag] (toFloatVAs [4, 4])
|
||||||
aslist <- makeShaderVBO "dualTwoD/arc" [vert, frag] (toFloatVAs [4, 4, 4])
|
|
||||||
eslist <- makeShaderVBO "dualTwoD/ellipse" [vert, geom, frag] (toFloatVAs [4, 4])
|
|
||||||
cslist <- makeShaderVBO "picture/charArray" [vert, frag] (toFloatVAs [4, 4, 4])
|
cslist <- makeShaderVBO "picture/charArray" [vert, frag] (toFloatVAs [4, 4, 4])
|
||||||
|
aslist <- makeShaderVBO "dualTwoD/arc" [vert, frag] (toFloatVAs [4, 4, 4])
|
||||||
|
eslist <- makeShaderVBO "dualTwoD/ellipse" [vert, frag] (toFloatVAs [4, 4])
|
||||||
shadV <- MV.new 4
|
shadV <- MV.new 4
|
||||||
zipWithM_
|
zipWithM_
|
||||||
(MV.write shadV)
|
(MV.write shadV)
|
||||||
@@ -117,6 +117,14 @@ preloadRender = do
|
|||||||
, aslist
|
, aslist
|
||||||
, eslist
|
, eslist
|
||||||
]
|
]
|
||||||
|
zipWithM_
|
||||||
|
(\i vbo -> glBindBufferBase GL_SHADER_STORAGE_BUFFER i (vbo ^. _2 . vboName))
|
||||||
|
[10 .. 13]
|
||||||
|
[ bslist -- note the ordering is very important
|
||||||
|
, cslist
|
||||||
|
, aslist
|
||||||
|
, eslist
|
||||||
|
]
|
||||||
-- GL_NEAREST_MIPMAP_LINEAR GL_LINEAR ?
|
-- GL_NEAREST_MIPMAP_LINEAR GL_LINEAR ?
|
||||||
initTexture2DArray 50 "data/charMaps/cMap16x32.Custom.png" 2 16 32 256 GL_NEAREST GL_NEAREST
|
initTexture2DArray 50 "data/charMaps/cMap16x32.Custom.png" 2 16 32 256 GL_NEAREST GL_NEAREST
|
||||||
putStrLn "Setup full screen shaders"
|
putStrLn "Setup full screen shaders"
|
||||||
|
|||||||
+4
-1
@@ -13,13 +13,16 @@ drawShaderLay l countsVector shadIn fs = do
|
|||||||
i <- UMV.read countsVector shadIn
|
i <- UMV.read countsVector shadIn
|
||||||
glUseProgram (_shaderUINT $ fst fs)
|
glUseProgram (_shaderUINT $ fst fs)
|
||||||
glBindVertexArray $ fs ^. _1 . shaderVAO . unVAO
|
glBindVertexArray $ fs ^. _1 . shaderVAO . unVAO
|
||||||
|
glUniform1i 0 . fromIntegral $ (l * numSubElements)
|
||||||
glDrawArrays
|
glDrawArrays
|
||||||
GL_TRIANGLES
|
GL_TRIANGLES
|
||||||
(fromIntegral $ l * numSubElements)
|
(fromIntegral $ l * numSubElements)
|
||||||
|
--(drawCountMod shadIn i)
|
||||||
(drawCountMod shadIn i)
|
(drawCountMod shadIn i)
|
||||||
--(fromIntegral i)
|
--(fromIntegral i)
|
||||||
|
|
||||||
drawCountMod :: Int -> Int -> GLsizei
|
drawCountMod :: Int -> Int -> GLsizei
|
||||||
drawCountMod i n
|
drawCountMod i n
|
||||||
| i == 3 = fromIntegral n -- modifies ellipse draw count
|
-- | i == 3 = fromIntegral $ 2 * n -- modifies ellipse draw count
|
||||||
|
| i == 3 = fromIntegral $ 2 * n -- modifies ellipse draw count
|
||||||
| otherwise = fromIntegral n
|
| otherwise = fromIntegral n
|
||||||
|
|||||||
@@ -2599,7 +2599,7 @@ attachOnward src/Dodge/Tree/Compose.hs 95;" f
|
|||||||
attachOnward' src/Dodge/Tree/Compose.hs 98;" f
|
attachOnward' src/Dodge/Tree/Compose.hs 98;" f
|
||||||
attachTree src/Dodge/Tree/Compose.hs 38;" f
|
attachTree src/Dodge/Tree/Compose.hs 38;" f
|
||||||
attentionViewPoint src/Dodge/Creature/ReaderUpdate.hs 75;" f
|
attentionViewPoint src/Dodge/Creature/ReaderUpdate.hs 75;" f
|
||||||
attribSize src/Shader/Compile.hs 195;" f
|
attribSize src/Shader/Compile.hs 193;" f
|
||||||
autoAmr src/Dodge/Item/Held/Rod.hs 39;" f
|
autoAmr src/Dodge/Item/Held/Rod.hs 39;" f
|
||||||
autoBS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 488;" f
|
autoBS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 488;" f
|
||||||
autoCrit src/Dodge/Creature/AutoCrit.hs 10;" f
|
autoCrit src/Dodge/Creature/AutoCrit.hs 10;" f
|
||||||
@@ -2766,7 +2766,7 @@ checkConnection src/Dodge/Inventory/Swap.hs 66;" f
|
|||||||
checkDeath src/Dodge/Creature/Update.hs 70;" f
|
checkDeath src/Dodge/Creature/Update.hs 70;" f
|
||||||
checkDeath' src/Dodge/Creature/Update.hs 73;" f
|
checkDeath' src/Dodge/Creature/Update.hs 73;" f
|
||||||
checkEndGame src/Dodge/Update.hs 766;" f
|
checkEndGame src/Dodge/Update.hs 766;" f
|
||||||
checkErrorGL src/Shader/Compile.hs 142;" f
|
checkErrorGL src/Shader/Compile.hs 140;" f
|
||||||
checkFBO src/Framebuffer/Check.hs 6;" f
|
checkFBO src/Framebuffer/Check.hs 6;" f
|
||||||
checkGLError src/GLHelp.hs 14;" f
|
checkGLError src/GLHelp.hs 14;" f
|
||||||
checkInvSlotsYou src/Dodge/Inventory/CheckSlots.hs 18;" f
|
checkInvSlotsYou src/Dodge/Inventory/CheckSlots.hs 18;" f
|
||||||
@@ -2867,7 +2867,7 @@ compP2A src/Dodge/ShiftPoint.hs 11;" f
|
|||||||
compactDraw src/Dodge/LevelGen.hs 94;" f
|
compactDraw src/Dodge/LevelGen.hs 94;" f
|
||||||
compactDraw' src/Dodge/LevelGen.hs 105;" f
|
compactDraw' src/Dodge/LevelGen.hs 105;" f
|
||||||
compactDrawTree src/Dodge/LevelGen.hs 88;" f
|
compactDrawTree src/Dodge/LevelGen.hs 88;" f
|
||||||
compileAndCheckShader src/Shader/Compile.hs 164;" f
|
compileAndCheckShader src/Shader/Compile.hs 162;" f
|
||||||
composeNode src/Dodge/Tree/Compose.hs 76;" f
|
composeNode src/Dodge/Tree/Compose.hs 76;" f
|
||||||
composeTree src/Dodge/Tree/Compose.hs 47;" f
|
composeTree src/Dodge/Tree/Compose.hs 47;" f
|
||||||
computerBeepingS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 640;" f
|
computerBeepingS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 640;" f
|
||||||
@@ -2888,7 +2888,7 @@ copier src/Dodge/Item/Scope.hs 88;" f
|
|||||||
copierItemUpdate src/Dodge/Creature/State.hs 131;" f
|
copierItemUpdate src/Dodge/Creature/State.hs 131;" f
|
||||||
copyItemToFloor src/Dodge/FloorItem.hs 14;" f
|
copyItemToFloor src/Dodge/FloorItem.hs 14;" f
|
||||||
corDoor src/Dodge/Room/Room.hs 385;" f
|
corDoor src/Dodge/Room/Room.hs 385;" f
|
||||||
cornerList src/Preload/Render.hs 219;" f
|
cornerList src/Preload/Render.hs 225;" f
|
||||||
corpseOrGib src/Dodge/Creature/Update.hs 111;" f
|
corpseOrGib src/Dodge/Creature/Update.hs 111;" f
|
||||||
corridor src/Dodge/Room/Corridor.hs 17;" f
|
corridor src/Dodge/Room/Corridor.hs 17;" f
|
||||||
corridorBoss src/Dodge/LockAndKey.hs 133;" f
|
corridorBoss src/Dodge/LockAndKey.hs 133;" f
|
||||||
@@ -3252,7 +3252,7 @@ drawCombFilter src/Dodge/Render/Picture.hs 269;" f
|
|||||||
drawCombineInventory src/Dodge/Render/HUD.hs 183;" f
|
drawCombineInventory src/Dodge/Render/HUD.hs 183;" f
|
||||||
drawConcurrentMessage src/Dodge/Render/Picture.hs 74;" f
|
drawConcurrentMessage src/Dodge/Render/Picture.hs 74;" f
|
||||||
drawCoord src/Dodge/Debug/Picture.hs 386;" f
|
drawCoord src/Dodge/Debug/Picture.hs 386;" f
|
||||||
drawCountMod src/Shader.hs 22;" f
|
drawCountMod src/Shader.hs 24;" f
|
||||||
drawCrInfo src/Dodge/Debug.hs 169;" f
|
drawCrInfo src/Dodge/Debug.hs 169;" f
|
||||||
drawCrInfo' src/Dodge/Debug.hs 164;" f
|
drawCrInfo' src/Dodge/Debug.hs 164;" f
|
||||||
drawCreature src/Dodge/Render/ShapePicture.hs 71;" f
|
drawCreature src/Dodge/Render/ShapePicture.hs 71;" f
|
||||||
@@ -3715,7 +3715,7 @@ initWallZoning src/Dodge/Wall/Zone.hs 12;" f
|
|||||||
initialRoomTree src/Dodge/Floor.hs 24;" f
|
initialRoomTree src/Dodge/Floor.hs 24;" f
|
||||||
initialWorld src/Dodge/Initialisation.hs 15;" f
|
initialWorld src/Dodge/Initialisation.hs 15;" f
|
||||||
initialisePlaying src/Sound.hs 77;" f
|
initialisePlaying src/Sound.hs 77;" f
|
||||||
initializeGLState src/Preload/Render.hs 240;" f
|
initializeGLState src/Preload/Render.hs 246;" f
|
||||||
initializeOptionMenu src/Dodge/Menu/Option.hs 17;" f
|
initializeOptionMenu src/Dodge/Menu/Option.hs 17;" f
|
||||||
initializeOptionMenuBO src/Dodge/Menu/Option.hs 30;" f
|
initializeOptionMenuBO src/Dodge/Menu/Option.hs 30;" f
|
||||||
initializeTexture2D src/Framebuffer/Update.hs 214;" f
|
initializeTexture2D src/Framebuffer/Update.hs 214;" f
|
||||||
@@ -4804,7 +4804,7 @@ setRBCreatureTargeting src/Dodge/Creature/State.hs 290;" f
|
|||||||
setRoomInt src/Dodge/Room/Tutorial.hs 91;" f
|
setRoomInt src/Dodge/Room/Tutorial.hs 91;" f
|
||||||
setSelWhileDragging src/Dodge/Update/Input/InGame.hs 337;" f
|
setSelWhileDragging src/Dodge/Update/Input/InGame.hs 337;" f
|
||||||
setSelectionListRestriction src/Dodge/Update/Input/ScreenLayer.hs 87;" f
|
setSelectionListRestriction src/Dodge/Update/Input/ScreenLayer.hs 87;" f
|
||||||
setShaderSource src/Shader/Compile.hs 177;" f
|
setShaderSource src/Shader/Compile.hs 175;" f
|
||||||
setShadowLimits src/Dodge/Shadows.hs 11;" f
|
setShadowLimits src/Dodge/Shadows.hs 11;" f
|
||||||
setSoundVolume src/Sound.hs 157;" f
|
setSoundVolume src/Sound.hs 157;" f
|
||||||
setTargetMv src/Dodge/Creature/ReaderUpdate.hs 83;" f
|
setTargetMv src/Dodge/Creature/ReaderUpdate.hs 83;" f
|
||||||
@@ -5441,7 +5441,7 @@ vShape src/Dodge/Placement/Instance/LightSource.hs 93;" f
|
|||||||
vToL src/MatrixHelper.hs 56;" f
|
vToL src/MatrixHelper.hs 56;" f
|
||||||
vToQuat src/Quaternion.hs 42;" f
|
vToQuat src/Quaternion.hs 42;" f
|
||||||
validTerminalCommands src/Dodge/Debug/Terminal.hs 137;" f
|
validTerminalCommands src/Dodge/Debug/Terminal.hs 137;" f
|
||||||
vasTightStride src/Shader/Compile.hs 184;" f
|
vasTightStride src/Shader/Compile.hs 182;" f
|
||||||
vecBetweenSpeed src/Dodge/Base.hs 146;" f
|
vecBetweenSpeed src/Dodge/Base.hs 146;" f
|
||||||
vecTurnTo src/Dodge/Movement/Turn.hs 19;" f
|
vecTurnTo src/Dodge/Movement/Turn.hs 19;" f
|
||||||
vert src/Shader/Data.hs 110;" f
|
vert src/Shader/Data.hs 110;" f
|
||||||
@@ -5509,7 +5509,7 @@ windowLine src/Dodge/Placement/Instance/Wall.hs 59;" f
|
|||||||
windowXFloat src/Dodge/Data/Config.hs 72;" f
|
windowXFloat src/Dodge/Data/Config.hs 72;" f
|
||||||
windowYFloat src/Dodge/Data/Config.hs 74;" f
|
windowYFloat src/Dodge/Data/Config.hs 74;" f
|
||||||
withAlpha src/Color.hs 10;" f
|
withAlpha src/Color.hs 10;" f
|
||||||
withByteString src/Shader/Compile.hs 213;" f
|
withByteString src/Shader/Compile.hs 211;" f
|
||||||
wlIXsNearCirc src/Dodge/Zoning/Wall.hs 32;" f
|
wlIXsNearCirc src/Dodge/Zoning/Wall.hs 32;" f
|
||||||
wlIXsNearPoint src/Dodge/Zoning/Wall.hs 22;" f
|
wlIXsNearPoint src/Dodge/Zoning/Wall.hs 22;" f
|
||||||
wlIXsNearRect src/Dodge/Zoning/Wall.hs 29;" f
|
wlIXsNearRect src/Dodge/Zoning/Wall.hs 29;" f
|
||||||
|
|||||||
Reference in New Issue
Block a user