Debug bezier quad, doesn't draw straighter lines well

This commit is contained in:
jgk
2021-03-12 22:17:48 +01:00
parent 95c9610b74
commit 9aa6fec418
6 changed files with 25 additions and 13 deletions
+2 -5
View File
@@ -23,10 +23,7 @@ void main()
//float d = x - y - 1 + 2* sqrt(y);
float d = sqrt(x) + sqrt(y) - 1;
float e = sqrt(f(x,w)) + sqrt(f(y,w2)) - 1.0;
if ( d < 0 || e > 0) { discard; }
// if ( d < 0 || e > 0) { discard; }
fColor = gColor;
// if ( d < 0) { fColor = vec4 (0,1,0,1); }
// if ( e > 0) { fColor = vec4 (0,0,1,1); }
// if ( d < z*z*0.0 || d > z*z*0.1+ 0.5) { fColor = vec4 (0,1,0,1); }
// if ( d < -0.1 || d > 0.1) { fColor = vec4 (0,0,1,1); }
if ( d < 0 || e > 0) { fColor = vec4(0,0,1,1); }
}
+8 -3
View File
@@ -1,6 +1,6 @@
#version 430 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vColor[];
in float vRad[];
out vec4 gColor;
@@ -8,6 +8,10 @@ out float gRadStart;
out float gRadEnd;
out vec3 gBoundingBox;
vec3 normV (vec3 v)
{ return vec3(v.y,-v.x,v.z) ;
}
void main()
{
vec3 pa = gl_in[0].gl_Position.xyz;
@@ -16,11 +20,12 @@ void main()
gRadStart = vRad[0];
gRadEnd = vRad[2];
// vec3 pa = vec3(paa.xy + 0.1 * (paa.xy - pca.xy), paa.z);
// vec3 pc = vec3(pca.xy + 0.1 * (pca.xy - paa.xy), pca.z);
gBoundingBox = vec3 (1,0,1);
gColor = vColor[0];
gl_Position = vec4 (pa + normV (pa-pb) , 1);
EmitVertex();
gl_Position = vec4 (pa, 1);
EmitVertex();
gBoundingBox = vec3 (0,0,0);
+1
View File
@@ -367,6 +367,7 @@ startCr = basicCreature
,frontArmour
,miniGun
,medkit 50
,bezierGun
]
++ repeat NoItem))
-- startInv
+1
View File
@@ -32,6 +32,7 @@ lev1 = do
(
[return $ return $ Right deadEndRoom
]
++ [slowDoorRoom]
++ [return $ connectRoom corridor
,return $ connectRoom door]
++ firstWeapon
+11 -3
View File
@@ -1415,16 +1415,24 @@ bezierTarget cid w = setTarget w
p = mouseWorldPos w
bezierControl :: Point2 -> Int -> World -> World
bezierControl targetp cid w = shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
bezierControl targetp cid w = resetGun $ shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
where
j = _crInvSel $ _creatures w IM.! cid
controlp = mouseWorldPos w
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
resetGun = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierTarget
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = w
mkBezierBul startp controlp targetp cid w = over particles' (bbul 30 :) w
where
bbul i = Particle'
{_ptPict' = onLayerL [levLayer PtLayer ] $ bezierQuad white white 5 5 startp controlp targetp
,_ptUpdate' = \w p -> case i of 0 -> (w, Nothing)
n -> (w, Just $ bbul (i-1))
}
fireRemoteLauncher :: Int -> World -> World
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
$ soundOnce (fromIntegral launcherSound)
+2 -2
View File
@@ -121,8 +121,8 @@ worldPictures w
where tst x y sc t = translate x y $ scale sc sc $ color white $ text t
testPic :: World -> [Picture]
testPic w = [blank]
-- [setLayer 1 $ onLayerL [99] $ bezierQuad white red 5 50 (-200,200) (-200,-200) (00,00) ]
testPic w = --[blank]
[setLayer 1 $ onLayerL [99] $ bezierQuad white red 20 50 (-200,0) (0,0) (200,50) ]
-- $ uncurry translate (mouseWorldPos w)