Commit 69b3ecab authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[FIX] - bounding box issue for depth cueing fixed.

[FIX] - Scaling problem, tubes now scale properly according to zoom factor.
parent 21c70af1
...@@ -24,7 +24,8 @@ void main() ...@@ -24,7 +24,8 @@ void main()
{ {
float thickness; float thickness;
vec4 pos; vec4 pos;
vec3 lightPosition = vec3(0., 0., 10.); vec3 lightPosition = vec3(0., 0., 1000.);
vec3 ez = vec3(0., 0., 10.0);
usePointSprite = 1.0; usePointSprite = 1.0;
tangentR3 = gl_Normal; tangentR3 = gl_Normal;
endPoint = 1.0; endPoint = 1.0;
...@@ -32,11 +33,27 @@ void main() ...@@ -32,11 +33,27 @@ void main()
pos = gl_ModelViewProjectionMatrix * gl_Vertex; pos = gl_ModelViewProjectionMatrix * gl_Vertex;
z = pos.z; z = pos.z;
zNear =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(nearPos,1.00)).z ); vec3 q1 = nearPos;
zFar =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(farPos,1.0)).z ); vec3 q2 = nearPos; q2.x = farPos.x;
float tmp2 = zNear; vec3 q4 = nearPos; q4.y = farPos.y;
zNear = min( zNear, zFar ); vec3 q5 = nearPos; q5.z = farPos.z;
zFar = max( zFar, tmp2 );
vec3 q7 = farPos;
vec3 q8 = farPos; q8.x = nearPos.x;
vec3 q6 = farPos; q6.y = nearPos.y;
vec3 q3 = farPos; q3.z = nearPos.z;
float z1 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q1,1.0)).z );
float z2 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q2,1.0)).z );
float z3 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q3,1.0)).z );
float z4 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q4,1.0)).z );
float z5 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q5,1.0)).z );
float z6 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q6,1.0)).z );
float z7 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q7,1.0)).z );
float z8 =0.5 + 0.5*( (gl_ModelViewProjectionMatrix * vec4(q8,1.0)).z );
zNear = max( z1, max( z2, max( z3, max( z4, max( z5, max( z6, max( z7,z8)))))));
zFar = min( z1, min( z2, min( z3, min( z4, min( z5, min( z6, min( z7,z8)))))));
view = - pos.xyz; view = - pos.xyz;
...@@ -61,8 +78,8 @@ void main() ...@@ -61,8 +78,8 @@ void main()
// color of tube // color of tube
tubeColor = gl_Color; tubeColor = gl_Color;
vec3 offsetNN = cross( normalize(tangent.xyz), lightPosition); vec3 offsetNN = cross( (tangent.xyz), ez);
vec3 offset = normalize(offsetNN); vec3 offset = (offsetNN);
tangent_dot_view = length(offsetNN); tangent_dot_view = length(offsetNN);
//scalar product between viewDir and tangent //scalar product between viewDir and tangent
......
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