Commit 9d9e4300 by Philipp Adolf

Slight changes to shader

parent 143894a1
......@@ -11,7 +11,6 @@ void main()
{
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv+1;
gl_TessLevelOuter[0] = tesselation;
......
......@@ -8,12 +8,10 @@ out vec3 tePatchDistance;
uniform mat4x4 MV;
uniform mat4x4 MVP;
uniform int subdiv;
void main()
{
//v ist Punkt 7, u = 4, v= 8;
float u = gl_TessCoord.x;
float u2 = u*u;
float u3 = u2*u;
......@@ -29,19 +27,18 @@ void main()
float w3 = w2*w;
float w4= w2*w2;
//müsset alles / 12 sien , ist udnen beim entgültigen Punkte iengerechnet
float a0 = u4+2*u3*v;
float a1 = u4+2*u3*w;
float a2 = u4+2*u3*w+6*u3*v+6*u2*v*w+12*u2*v2+6*u*v2*w+6*u*v3+2*v3*w+v4;
float a3 = 6*u4+24*u3*w+24*u2*w2+8*u*w3+w4+24*u3*v+60*u2*v*w+36*u*v*w2+6*v*w3+24*u2*v2+36*u*v2*w+12*v2*w2+8*u*v3+6*v3*w+v4;
float a4 = u4+6*u3*w+12*u2*w2+6*u*w3+w4+2*u3*v+6*u2*v*w+6*u*v*w2+2*v*w3;
float a5 = 2*u*v3+v4;
float a6 = u4+6*u3*w+12*u2*w2+6*u*w3+w4+8*u3*v+36*u2*v*w+36*u*v*w2+8*v*w3+24*u2*v2+60*u*v2*w+24*v2*w2+24*u*v3+24*v3*w+6*v4;
float a7 = u4+8*u3*w+24*u2*w2+24*u*w3+6*w4+6*u3*v+36*u2*v*w+60*u*v*w2+24*v*w3+12*u2*v2+36*u*v2*w+24*v2*w2+6*u*v3+8*v3*w+v4;
float a8 = 2*u*w3+w4;
float a9 = 2*v3*w+v4;
float a10 = 2*u*w3+w4+6*u*v*w2+6*v*w3+6*u*v2*w+12*v2*w2+2*u*v3+6*v3*w+v4;
float a11 = w4+2*v*w3;
float a0 = (u4+2*u3*v) / 12.0f;
float a1 = (u4+2*u3*w) / 12.0f;
float a2 = (u4+2*u3*w+6*u3*v+6*u2*v*w+12*u2*v2+6*u*v2*w+6*u*v3+2*v3*w+v4) / 12.0f;
float a3 = (6*u4+24*u3*w+24*u2*w2+8*u*w3+w4+24*u3*v+60*u2*v*w+36*u*v*w2+6*v*w3+24*u2*v2+36*u*v2*w+12*v2*w2+8*u*v3+6*v3*w+v4) / 12.0f;
float a4 = (u4+6*u3*w+12*u2*w2+6*u*w3+w4+2*u3*v+6*u2*v*w+6*u*v*w2+2*v*w3) / 12.0f;
float a5 = (2*u*v3+v4) / 12.0f;
float a6 = (u4+6*u3*w+12*u2*w2+6*u*w3+w4+8*u3*v+36*u2*v*w+36*u*v*w2+8*v*w3+24*u2*v2+60*u*v2*w+24*v2*w2+24*u*v3+24*v3*w+6*v4) / 12.0f;
float a7 = (u4+8*u3*w+24*u2*w2+24*u*w3+6*w4+6*u3*v+36*u2*v*w+60*u*v*w2+24*v*w3+12*u2*v2+36*u*v2*w+24*v2*w2+6*u*v3+8*v3*w+v4) / 12.0f;
float a8 = (2*u*w3+w4) / 12.0f;
float a9 = (2*v3*w+v4) / 12.0f;
float a10 = (2*u*w3+w4+6*u*v*w2+6*v*w3+6*u*v2*w+12*v2*w2+2*u*v3+6*v3*w+v4) / 12.0f;
float a11 = (w4+2*v*w3) / 12.0f;
vec3 p0 = tcPosition[0];
vec3 p1 = tcPosition[1];
......@@ -57,18 +54,13 @@ void main()
vec3 p11 = tcPosition[11];
vec3 newPos= a0*p0+a1*p1+a2*p2+a3*p3+a4*p4+a5*p5+a6*p6+a7*p7+a8*p8+a9*p9+a10*p10+a11*p11;
vec4 pos = vec4(newPos/12,1);
/*
vec3 d0 = gl_TessCoord.x * p3;
vec3 d1 = gl_TessCoord.y * p6;
vec3 d2 = gl_TessCoord.z * p7;
pos = vec4((d0 + d1 + d2),1);
*/
if (subdiv == 0) {
newPos = u * p3 + v * p6 + w * p7;
}
vec4 pos = vec4(newPos, 1.0f);
tePatchDistance = gl_TessCoord.xyz;
teCamPosition = vec4(MV*pos).xyz;
gl_Position = MVP * pos;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment