Use ssbo/vertex pulling for lighting cap shader
Not yet sure whether the colour vector is correctly input into the ssbo
This commit is contained in:
@@ -14,27 +14,18 @@ vec4 projNear (vec4 pos)
|
||||
vec2 xy = (pos.xyz + a * dir).xy ;
|
||||
return vec4 ( xy, 100 , 1) ;
|
||||
}
|
||||
vec4 tris[3] =
|
||||
{vec4(0,0,0,1)
|
||||
,vec4(1,1,0,1)
|
||||
,vec4(0,1,0,1)
|
||||
};
|
||||
bool ztest (vec4 p) {return p.z - lightPos.z > 0;}
|
||||
void main() {
|
||||
int j = gl_VertexID/3;
|
||||
int i1 = j * 3;
|
||||
uint t = indices[gl_VertexID];
|
||||
//uint t = gl_VertexID;
|
||||
gl_Position = tris[t];
|
||||
//uint t = gl_VertexID % 3;
|
||||
vec4 p = data[indices[gl_VertexID]].pos;
|
||||
// gl_Position = (p.w == 1
|
||||
// && ztest(data[indices[i1]].pos)
|
||||
// && ztest(data[indices[i1+1]].pos)
|
||||
// && ztest(data[indices[i1+2]].pos)
|
||||
// ? theMat * projNear(p)
|
||||
// : vec4(1,1,1,0)
|
||||
// );
|
||||
vec4 po = data[indices[gl_VertexID]].pos;
|
||||
gl_Position = (po.w == 1
|
||||
&& ztest(data[indices[i1]].pos)
|
||||
&& ztest(data[indices[i1+1]].pos)
|
||||
&& ztest(data[indices[i1+2]].pos)
|
||||
? theMat * projNear(po)
|
||||
: vec4(1,1,1,0)
|
||||
);
|
||||
}
|
||||
//layout (location = 0) in vec4 position;
|
||||
//layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
|
||||
Reference in New Issue
Block a user