Commit 04f00bf9 by Kai Westerkamp

box update

normal fix
parent 30ee4452
# Blender v2.57 (sub 0) OBJ File: ''
# www.blender.org
mtllib box.mtl
o Cube
v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000 v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000
...@@ -10,33 +6,24 @@ v 1.000000 1.000000 -1.000000 ...@@ -10,33 +6,24 @@ v 1.000000 1.000000 -1.000000
v 1.000000 1.000000 1.000000 v 1.000000 1.000000 1.000000
v -1.000000 1.000000 1.000000 v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000 v -1.000000 1.000000 -1.000000
vt 2.094305 1.396205
vt 1.396205 2.094305
vt 0.698100 1.396205 vn 1 0 0
vt 1.396205 0.698100 vn 0 1 0
vt 5.000000 5.000000 vn 0 0 1
vt 2.792410 5.000000 vn -1 0 0
vt 2.792410 2.792410 vn 0 -1 0
vt 5.000000 2.792410 vn 0 0 -1
vt 2.792410 2.094305
vt 2.094305 2.792410 f 1//5 2//5 3//5
vt 0.698100 2.792410 f 1//5 3//5 4//5
vt 0.000000 2.094305 f 5//2 8//2 7//2
vt 0.000000 0.698100 f 5//2 7//2 6//2
vt 0.698100 0.000000 f 1//1 5//1 6//1
vt 2.792410 0.698100 f 1//1 6//1 2//1
vt 2.094305 0.000000 f 2//3 6//3 7//3
usemtl Material f 2//3 7//3 3//3
s off f 3//4 7//4 8//4
f 1/1 2/2 3/3 f 3//4 8//4 4//4
f 1/1 3/3 4/4 f 5//6 1//6 4//6
f 5/5 8/6 7/7 f 5//6 4//6 8//6
f 5/5 7/7 6/8
f 1/1 5/9 6/10
f 1/1 6/10 2/2
f 2/2 6/11 7/12
f 2/2 7/12 3/3
f 3/3 7/13 8/14
f 3/3 8/14 4/4
f 5/15 1/1 4/4
f 5/15 4/4 8/16
...@@ -42,7 +42,7 @@ vec3 phong(vec3 lightPos){ ...@@ -42,7 +42,7 @@ vec3 phong(vec3 lightPos){
//return vec3(diffuse ); //return vec3(diffuse );
//return dcolor; //return dcolor;
//return (diffuse*dcolor); //return (diffuse*dcolor);
return (dcolor * diffuse + materialInfo.Specular * specular); return (dcolor * diffuse );//+ materialInfo.Specular * specular);
} }
......
...@@ -22,10 +22,14 @@ void main(void) ...@@ -22,10 +22,14 @@ void main(void)
// passthrough geometry shader for wireframe rendering // passthrough geometry shader for wireframe rendering
// just addind TriDistance; // just addind TriDistance;
vec3 normal = cross(teCamPosition[2]-teCamPosition[0],teCamPosition[1]-teCamPosition[0]);
//normal = cross(teCamPosition[1]-teCamPosition[0],teCamPosition[2]-teCamPosition[0]);
gTriDistance = vec3(1, 0, 0); gTriDistance = vec3(1, 0, 0);
gUV = teUV[0]; gUV = teUV[0];
gCamPosition = teCamPosition[0]; gCamPosition = teCamPosition[0];
gCamNormal = teCamNormal[0]; gCamNormal = teCamNormal[0];
//gCamNormal = normal;
gPatchDistance = tePatchDistance[0]; gPatchDistance = tePatchDistance[0];
gl_Position = gl_in[0].gl_Position; gl_Position = gl_in[0].gl_Position;
EmitVertex(); EmitVertex();
...@@ -34,6 +38,7 @@ void main(void) ...@@ -34,6 +38,7 @@ void main(void)
gUV = teUV[1]; gUV = teUV[1];
gCamPosition = teCamPosition[1]; gCamPosition = teCamPosition[1];
gCamNormal = teCamNormal[1]; gCamNormal = teCamNormal[1];
//gCamNormal = normal;
gPatchDistance = tePatchDistance[1]; gPatchDistance = tePatchDistance[1];
gl_Position = gl_in[1].gl_Position; gl_Position = gl_in[1].gl_Position;
EmitVertex(); EmitVertex();
...@@ -42,6 +47,7 @@ void main(void) ...@@ -42,6 +47,7 @@ void main(void)
gUV = teUV[2]; gUV = teUV[2];
gCamPosition = teCamPosition[2]; gCamPosition = teCamPosition[2];
gCamNormal = teCamNormal[2]; gCamNormal = teCamNormal[2];
// gCamNormal = normal;
gPatchDistance = tePatchDistance[2]; gPatchDistance = tePatchDistance[2];
gl_Position = gl_in[2].gl_Position; gl_Position = gl_in[2].gl_Position;
EmitVertex(); EmitVertex();
......
...@@ -31,5 +31,5 @@ void main(){ ...@@ -31,5 +31,5 @@ void main(){
vec3 pos; vec3 pos;
edges[gl_GlobalInvocationID.x].pos = 3.0f/8.0f * a.pos + 3.0f/8.0f * b.pos + 1.0f/8.0f * c.pos + 1.0f/8.0f * d.pos; edges[gl_GlobalInvocationID.x].pos = 3.0f/8.0f * a.pos + 3.0f/8.0f * b.pos + 1.0f/8.0f * c.pos + 1.0f/8.0f * d.pos;
edges[gl_GlobalInvocationID.x].norm = normalize(3.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][0]].norm + vertices[indices[gl_GlobalInvocationID.x][1]].norm) + 1.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][2]].norm + vertices[indices[gl_GlobalInvocationID.y][3]].norm)); edges[gl_GlobalInvocationID.x].norm = normalize(3.0f/8.0f * a.norm + 3.0f/8.0f * b.norm + 1.0f/8.0f * c.norm + 1.0f/8.0f * d.norm);
} }
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