Add shaders that will just return positional information
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#version 430 core
|
||||
in vec4 vColor;
|
||||
in vec3 vparams;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float d = (dot(vec2(vparams.xy),vec2(vparams.xy)));
|
||||
if ( d > 1 || d < vparams.z ) {discard;}
|
||||
//if ( d > 1 ) {discard;}
|
||||
fColor = vColor;
|
||||
//fColor = (10,0,0,10);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec4 vColor [];
|
||||
in vec4 vparams [];
|
||||
out vec4 gColor;
|
||||
out float gRadIn;
|
||||
out vec2 angles;
|
||||
out vec2 dist;
|
||||
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
angles = vparams[0].xy;
|
||||
vec4 cenPos = gl_in[0].gl_Position;
|
||||
gColor = vColor[0];
|
||||
float width = vparams[0].w ;
|
||||
float rad = vparams[0].z + width;
|
||||
gRadIn = 1 - width * 2 / rad;
|
||||
// I am not currently sure why the multiplicand is 4 and not 2
|
||||
|
||||
gl_Position = worldMat * vec4 (cenPos.x + rad, cenPos.y + rad, cenPos.z , 1);
|
||||
dist = vec2 (1,1);
|
||||
EmitVertex();
|
||||
gl_Position = worldMat * vec4 (cenPos.x - rad, cenPos.y + rad, cenPos.z , 1);
|
||||
dist = vec2 (-1,1);
|
||||
EmitVertex();
|
||||
gl_Position = worldMat * vec4 (cenPos.x + rad, cenPos.y - rad, cenPos.z , 1);
|
||||
dist = vec2 (1,-1);
|
||||
EmitVertex();
|
||||
gl_Position = worldMat * vec4 (cenPos.x - rad, cenPos.y - rad, cenPos.z , 1);
|
||||
dist = vec2 (-1,-1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (location = 2) in vec3 boxXboxYwidth;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 vColor;
|
||||
out vec3 vparams;
|
||||
void main()
|
||||
{
|
||||
gl_Position = theMat * vec4(position.xyz,1);
|
||||
vColor = color;
|
||||
vparams = boxXboxYwidth;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#version 430 core
|
||||
in vec4 vColor;
|
||||
out vec4 fColor;
|
||||
void main()
|
||||
{
|
||||
fColor = vColor;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 vColor;
|
||||
void main()
|
||||
{
|
||||
gl_Position = theMat * vec4(position,1);
|
||||
vColor = vec4(position,1);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#version 430 core
|
||||
in vec4 vColor;
|
||||
out vec4 fColor;
|
||||
void main()
|
||||
{
|
||||
fColor = vColor;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 position;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 vColor;
|
||||
void main()
|
||||
{
|
||||
vec4 posxy = theMat * vec4(position.xyz,1);
|
||||
vec4 posz = theMat * vec4(position.xyw,1);
|
||||
gl_Position = vec4(posxy.xy,posz.z,1);
|
||||
vColor = color;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#version 430 core
|
||||
in vec4 vColor;
|
||||
in vec2 boxOut;
|
||||
in vec2 boxIn;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
//float d = x - y - 1 + 2* sqrt(y);
|
||||
float d = sqrt(boxOut.x) + sqrt(boxOut.y) - 1.0;
|
||||
// float e = sqrt(f(x,wStart)) + sqrt(f(y,wEnd)) - 1.0;
|
||||
float e = sqrt(boxIn.x) + sqrt(boxIn.y) - 1.0;
|
||||
if ( d < 0 || e > 0) { discard; }
|
||||
fColor = vColor;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#version 430 core
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 5) out;
|
||||
in vec4 vColor[];
|
||||
in vec2 vPosOff[];
|
||||
in float vRadMag[];
|
||||
out vec4 gColor;
|
||||
out float wStart;
|
||||
out float wEnd;
|
||||
out vec3 gBoundingBox;
|
||||
|
||||
out vec2 box2 ;
|
||||
|
||||
vec2 normV2 (vec2 v)
|
||||
{ return vec2(-v.y,v.x) ;
|
||||
}
|
||||
float lhs (vec2 da, vec2 db)
|
||||
{ return sign(dot(da, normV2(db))) ;
|
||||
}
|
||||
|
||||
float extrapolate (vec2 inOne, vec2 inZeroA, vec2 inZeroB, vec2 xy)
|
||||
{
|
||||
float det = inOne.x * (inZeroA.y - inZeroB.y)
|
||||
+ inZeroA.x * (inZeroB.y - inOne.y)
|
||||
+ inZeroB.x * (inOne.y - inZeroA.y)
|
||||
;
|
||||
float r = (inZeroA.y - inZeroB.y) ;
|
||||
float s = (inZeroB.x - inZeroA.x) ;
|
||||
float t = (inZeroA.x * inZeroB.y - inZeroB.x * inZeroA.y) ;
|
||||
return r * xy.x + s * xy.y + t
|
||||
/ det ;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 pa = gl_in[0].gl_Position.xyz;
|
||||
vec3 pb = gl_in[1].gl_Position.xyz;
|
||||
vec3 pc = gl_in[2].gl_Position.xyz;
|
||||
|
||||
wStart = vRadMag [0];
|
||||
wEnd = vRadMag [2];
|
||||
|
||||
box2 = vec2 (1,0);
|
||||
gBoundingBox = vec3 (0.9,0.1,0);
|
||||
gColor = vColor[0];
|
||||
gl_Position = vec4 (vPosOff[0] , pa.z , 1);
|
||||
EmitVertex();
|
||||
box2 = vec2 (0,1);
|
||||
gBoundingBox = vec3 (0.1,0.9,0);
|
||||
gColor = vColor[2];
|
||||
gl_Position = vec4 (vPosOff[2] , pc.z , 1);
|
||||
EmitVertex();
|
||||
box2 = vec2( extrapolate(vPosOff[0],vPosOff[2],pb.xy,pa.xy)
|
||||
, extrapolate(vPosOff[2],vPosOff[0],pb.xy,pa.xy)
|
||||
) ;
|
||||
box2 = vec2(0.2,0);
|
||||
gBoundingBox = vec3 (1,0,1);
|
||||
gColor = vColor[0];
|
||||
gl_Position = vec4 (pa, 1);
|
||||
EmitVertex();
|
||||
box2 = vec2( extrapolate(vPosOff[0],vPosOff[2],pb.xy,pc.xy)
|
||||
, extrapolate(vPosOff[2],vPosOff[0],pb.xy,pc.xy)
|
||||
) ;
|
||||
box2 = vec2(0,0.2);
|
||||
gBoundingBox = vec3 (0,1,1);
|
||||
gColor = vColor[2];
|
||||
gl_Position = vec4 (pc, 1);
|
||||
EmitVertex();
|
||||
box2 = vec2( 0,0 ) ;
|
||||
gBoundingBox = vec3 (0,0,0);
|
||||
gColor = vColor[1];
|
||||
gl_Position = vec4 (pb, 1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (location = 2) in vec4 boxes;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 vColor;
|
||||
out vec2 boxOut;
|
||||
out vec2 boxIn;
|
||||
void main()
|
||||
{
|
||||
gl_Position = theMat * vec4(position.xyz,1);
|
||||
vColor = color;
|
||||
boxOut = boxes.xy ;
|
||||
boxIn = boxes.zw ;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#version 430 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 gColor;
|
||||
in vec2 gTexCoord;
|
||||
|
||||
uniform sampler2D aTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(aTexture, vec2 (gTexCoord.x * 0.0078125, gTexCoord.y)) * gColor;
|
||||
// FragColor = texture(aTexture, vTexCoord);
|
||||
// FragColor = gColor;
|
||||
// FragColor = vec4 (1,1,1,1);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec4 vColor [];
|
||||
in vec3 vTexCoord [];
|
||||
out vec4 gColor;
|
||||
out vec2 gTex;
|
||||
void main()
|
||||
{
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
float sizex = vTexCoord[0].y;
|
||||
float sizey = vTexCoord[0].z;
|
||||
//float size = 0.05;
|
||||
gColor = vColor[0];
|
||||
float texPos = vTexCoord[0].x;
|
||||
|
||||
gl_Position = vec4 (cenPos.x - sizex*0.5, cenPos.y - sizey*0.5, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0, 0 , 5 , 1);
|
||||
gTex = vec2 (texPos*0.0078125, 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - sizex*0.5, cenPos.y + sizey*0.5, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0, 0.5 , 5 , 1);
|
||||
gTex = vec2 (texPos*0.0078125, 0);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + sizex*0.5, cenPos.y - sizey*0.5, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0.5, 0.5 , -5 , 1);
|
||||
gTex = vec2 ((texPos+1)*0.0078125, 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + sizex*0.5, cenPos.y + sizey*0.5, cenPos.z , 1);
|
||||
gTex = vec2 ((texPos+1)*0.0078125, 0);
|
||||
//gl_Position = vec4 (0.5, 0 , -5 , 1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec4 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 gColor;
|
||||
out vec2 gTexCoord;
|
||||
void main()
|
||||
{
|
||||
gl_Position = theMat * vec4(aPos, 1.0);
|
||||
gColor = aColor;
|
||||
gTexCoord = aTexCoord;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 430 core
|
||||
in vec4 gPos;
|
||||
in vec2 gBoundingBox;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float d = dot(gBoundingBox,gBoundingBox);
|
||||
if ( d > 1) { discard; }
|
||||
fColor = gPos;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#version 430 core
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 gPos;
|
||||
out vec2 gBoundingBox;
|
||||
void main()
|
||||
{
|
||||
vec4 pas = gl_in[0].gl_Position;
|
||||
vec4 pbs = gl_in[1].gl_Position;
|
||||
vec4 pcs = gl_in[2].gl_Position;
|
||||
vec4 pa = theMat * pas;
|
||||
vec4 pb = theMat * pbs;
|
||||
vec4 pc = theMat * pcs;
|
||||
gBoundingBox = vec2 (-1,1);
|
||||
gl_Position = pb;
|
||||
gPos = pbs;
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (1,1);
|
||||
gl_Position = pa;
|
||||
gPos = pas;
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (-1,-1);
|
||||
gl_Position = pc;
|
||||
gPos = pcs;
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (1,-1);
|
||||
gl_Position = pa + pc - pb;
|
||||
gPos = pas + pcs - pbs;
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position,1);
|
||||
}
|
||||
Reference in New Issue
Block a user