Lap warming commit---gpu needs optimisation
This commit is contained in:
+16
-35
@@ -7,45 +7,26 @@ uniform vec2 radLum;
|
||||
out vec3 dField;
|
||||
out float lum;
|
||||
float isLHS (vec2 startV, vec2 testV)
|
||||
{
|
||||
return sign( -startV.x * testV.y + startV.y * testV.x);
|
||||
}
|
||||
vec4 shiftCloser (vec4 v)
|
||||
{ return vec4 (v.xy , v.z , v.w) ; }
|
||||
//{ return vec4 (v.xy , v.z-0.0001 , v.w) ; }
|
||||
{ return sign( -startV.x * testV.y + startV.y * testV.x); }
|
||||
void main()
|
||||
{
|
||||
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
|
||||
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
|
||||
if (isLHS (p1.xy - lightPos.xy, p2.xy - lightPos.xy) < 0)
|
||||
{
|
||||
lum = radLum.y;
|
||||
float rad = radLum.x;
|
||||
|
||||
vec4 p3 = vec4 (p1.xy,100,1);
|
||||
vec4 p4 = vec4 (p2.xy,100,1);
|
||||
|
||||
vec2 d1 = p1.xy - lightPos.xy;
|
||||
vec2 d2 = p2.xy - lightPos.xy;
|
||||
|
||||
vec4 a1 = shiftCloser( theMat * p1 );
|
||||
vec4 a2 = shiftCloser( theMat * p2 );
|
||||
vec4 a3 = shiftCloser( theMat * p3 );
|
||||
vec4 a4 = shiftCloser( theMat * p4 );
|
||||
|
||||
dField = (p1.xyz - lightPos) / rad;
|
||||
gl_Position = a1;
|
||||
EmitVertex();
|
||||
dField = (p3.xyz - lightPos) / rad;
|
||||
gl_Position = a3;
|
||||
EmitVertex();
|
||||
dField = (p2.xyz - lightPos) / rad;
|
||||
gl_Position = a2;
|
||||
EmitVertex();
|
||||
dField = (p4.xyz - lightPos) / rad;
|
||||
gl_Position = a4;
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
{ lum = radLum.y;
|
||||
float rad = radLum.x;
|
||||
vec4 p3 = vec4 (p1.xy,100,1);
|
||||
vec4 p4 = vec4 (p2.xy,100,1);
|
||||
vec2 d1 = p1.xy - lightPos.xy;
|
||||
vec2 d2 = p2.xy - lightPos.xy;
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
dField = (p1.xyz - lightPos) / rad; gl_Position = a1; EmitVertex();
|
||||
dField = (p3.xyz - lightPos) / rad; gl_Position = a3; EmitVertex();
|
||||
dField = (p2.xyz - lightPos) / rad; gl_Position = a2; EmitVertex();
|
||||
dField = (p4.xyz - lightPos) / rad; gl_Position = a4; EmitVertex();
|
||||
EndPrimitive();
|
||||
} else {}
|
||||
}
|
||||
|
||||
+10
-17
@@ -7,24 +7,17 @@ out vec4 gColor;
|
||||
out vec2 tPos;
|
||||
// consider using isLHS to check if the wall is facing the center
|
||||
float isLHS (vec2 startV, vec2 testV)
|
||||
{
|
||||
return sign( -startV.x * testV.y + startV.y * testV.x);
|
||||
}
|
||||
|
||||
{ return sign( -startV.x * testV.y + startV.y * testV.x); }
|
||||
void main()
|
||||
{
|
||||
gColor = vColor[0];
|
||||
|
||||
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
|
||||
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
|
||||
vec4 p3 = vec4 (p1.xy,100,1);
|
||||
vec4 p4 = vec4 (p2.xy,100,1);
|
||||
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
|
||||
{ gColor = vColor[0];
|
||||
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
|
||||
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
|
||||
vec4 p3 = vec4 (p1.xy,100,1);
|
||||
vec4 p4 = vec4 (p2.xy,100,1);
|
||||
vec4 a1 = theMat * p1;
|
||||
vec4 a2 = theMat * p2;
|
||||
vec4 a3 = theMat * p3;
|
||||
vec4 a4 = theMat * p4;
|
||||
tPos = vec2 ( 1,-1) ; gl_Position = a1; EmitVertex();
|
||||
tPos = vec2 ( 1, 1) ; gl_Position = a3; EmitVertex();
|
||||
tPos = vec2 (-1,-1) ; gl_Position = a2; EmitVertex();
|
||||
|
||||
Reference in New Issue
Block a user