364 lines
17 KiB
Text
364 lines
17 KiB
Text
|
#version 410
|
||
|
|
||
|
layout(points) in;
|
||
|
layout(triangle_strip,max_vertices=24) out;
|
||
|
|
||
|
uniform mat4 projModelViewMatrix;
|
||
|
uniform mat3 normalMatrix;
|
||
|
uniform mat3 rotMatrix;
|
||
|
|
||
|
uniform mat4 lightProjModelViewMatrix[7];
|
||
|
uniform int numLights;
|
||
|
uniform float width;
|
||
|
uniform float height;
|
||
|
uniform float near;
|
||
|
uniform float far;
|
||
|
|
||
|
layout(location = 0) in vec3 colorgeo[1];
|
||
|
layout(location = 0) out vec3 colorout;
|
||
|
layout(location = 1) out vec3 normal;
|
||
|
layout(location = 2) out vec3 pos;
|
||
|
layout(location = 3) out vec4 lightviewpos[3];
|
||
|
|
||
|
/*
|
||
|
lightpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightpos[i] = lightpos[i] / lightpos[i].w;
|
||
|
lightpos[i].z = (2.0 * near) / (far + near - lightpos[i].z * (far - near));
|
||
|
lightpos[i] = vec4(lightpos[i].x/2.0 + 0.5,lightpos[i].y/2.0 + 0.5,lightpos[i].z,lightpos[i].w);
|
||
|
*/
|
||
|
|
||
|
void main(){
|
||
|
//hinten
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,-1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,-1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,-1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,-1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
//vorne
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,0,1));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
//oben
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
//unten
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,-1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,-1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,-1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(0,-1,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
//inks
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(-1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(-1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(-1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(-0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(-1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
//rechts*
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,-0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
gl_Position = (gl_in[0].gl_Position + vec4(rotMatrix * vec3(0.5,0.5,-0.5),0));
|
||
|
for(int i = 0;i < numLights; i++){
|
||
|
lightviewpos[i] = lightProjModelViewMatrix[i] * gl_Position;
|
||
|
lightviewpos[i] = lightviewpos[i] / lightviewpos[i].w;
|
||
|
lightviewpos[i] = vec4(lightviewpos[i].x/2.0 + 0.5,lightviewpos[i].y/2.0 + 0.5,lightviewpos[i].z/2.0 + 0.5,lightviewpos[i].w);
|
||
|
lightviewpos[i].z = (2.0 * near) / (far + near - lightviewpos[i].z * (far - near));
|
||
|
}
|
||
|
gl_Position = projModelViewMatrix * gl_Position;
|
||
|
colorout = colorgeo[0];
|
||
|
normal = normalize(rotMatrix * vec3(1,0,0));
|
||
|
pos = gl_Position.xyz;
|
||
|
EmitVertex();
|
||
|
|
||
|
EndPrimitive();
|
||
|
|
||
|
}
|
||
|
|