Skip to content

Commit

Permalink
removing mouse translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-george committed Mar 11, 2018
1 parent 8edd9fb commit eaa34ec
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions raw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ struct Intersection
float mag(vec3 v){
return dot(v,v);
}
float epsilon = 1e-2;
float epsilon = 1e-3;
Expand Down Expand Up @@ -458,12 +458,18 @@ float rnd()
return float(seed)/509.0;
}
vec3 translate(vec3 v, float last){
return (mvMatrixScene*vec4(v,last)).xyz;
}
vec3 computeShadow(in Intersection intersect)
{
// ray from intersect to the light source
Ray shadowRay;
shadowRay.dir = normalize(-(intersect.point - lightSource));
shadowRay.origin = intersect.point + shadowRay.dir*epsilon;
//shadowRay.dir = translate(normalize(-(intersect.point - lightSource)),0);
//shadowRay.origin = translate(intersect.point + shadowRay.dir*epsilon,1);
shadowRay.depth = 1;
Intersection i2;
i2.t = FLT_MAX;
Expand All @@ -478,6 +484,8 @@ vec3 computeShadow(in Intersection intersect)
}
}
void main()
{
//please leave the scene config unaltered for marking
Expand Down Expand Up @@ -521,9 +529,12 @@ void main()
vec4 colour = vec4(0,0,0,1);
Ray ray;
ray.origin = vec3(0,0,0);//(mvMatrixScene*vec4(0,0,0,1)).xyz;
ray.dir = normalize((mvMatrixScene)*vec4(dir,0)).xyz;
lightSource = (vec4(6,4,3,1)).xyz;
ray.origin = vec3(0,0,0);
ray.dir = normalize(dir);
// ray.origin = translate(ray.origin, 1);
// ray.dir = translate(ray.dir,0);
lightSource = vec3(6,4,3);
float closest = 1.0/0.0;
Intersection i;
Expand All @@ -537,8 +548,10 @@ void main()
closest = i.t;
colour += vec4(computeShadow(i)/(d+1),1);//pow(decay,pow(d,2))*vec4(blinn_phong(i.colour,i.point,i.normal,true),1);
}
ray.origin = (i.point +epsilon*i.normal);
ray.origin = i.point +epsilon*i.normal;
ray.dir = normalize(reflect(ray.dir,i.normal));
//ray.origin = translate(i.point +epsilon*i.normal,1);
//ray.dir = translate(normalize(reflect(ray.dir,i.normal)),0);
} else {
break;
}
Expand Down

0 comments on commit eaa34ec

Please sign in to comment.