Add files

This commit is contained in:
2023-03-14 20:24:33 +00:00
parent ed0da4bf1d
commit b7d7bc2346
3 changed files with 32 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
float closestPointOnLineParam (vec2 a, vec2 b, vec2 p) {
return dot(p - a,b-a) / dot(b-a,b-a);
}
vec2 closestPointOnSeg (vec2 a,vec2 b, vec2 p) {
float x = closestPointOnLineParam(a,b,p);
if (x < 0) {
return a;
} else{ if (x > 1) { return b; }
{ return a + (x * (b- a));}
}
}
+10
View File
@@ -0,0 +1,10 @@
#version 450 core
in vec4 vCol;
in vec4 vPos;
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
void main()
{
fCol = vCol;
fPos = vec4(vPos.xyz,1);
}
+11
View File
@@ -0,0 +1,11 @@
#version 450 core
layout (location = 0) in vec4 pos;
layout (location = 1) in vec4 col;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
out vec4 vPos;
void main() {
gl_Position = theMat * vec4(pos.xyz,1);
vCol = col;
vPos = pos;
}