Commit f161dc09 authored by Brian's avatar Brian

fix some typos

parent 910b7375
...@@ -12,7 +12,7 @@ float sphere_r = 1.0; ...@@ -12,7 +12,7 @@ float sphere_r = 1.0;
vec3 point_at_parameter(vec3 A, float t) vec3 point_at_parameter(vec3 A, float t)
{ return A + t * ray_d; } { return A + t * ray_d; }
bool hit_sphere(float max_x, float max_y) float hit_sphere(float max_x, float max_y)
vec3 ray_o = vec3(max_x, max_y, 0.0); vec3 ray_o = vec3(max_x, max_y, 0.0);
vec3 omc = ray_o - sphere_c; vec3 omc = ray_o - sphere_c;
float a = dot(ray_d, ray_d); float a = dot(ray_d, ray_d);
...@@ -32,16 +32,19 @@ bool hit_sphere(float max_x, float max_y) ...@@ -32,16 +32,19 @@ bool hit_sphere(float max_x, float max_y)
vec4 color(float max_x, float max_y) vec4 color(float max_x, float max_y)
{ {
float t = hit_sphere(max_x, max_y float t = hit_sphere(max_x, max_y);
if (t > 0)) { if (t > 0)) {
vec3 N = normalize(point_at_parameter(vec3(max_x, max_y, 0.0), t)); vec3 N = normalize(point_at_parameter(vec3(max_x, max_y, 0.0), t)-vec3(0,0,-1));
return 0.5*vec4(N.x + 1, N.y +1, N.z + 1, 2); return 0.5*vec4(N.x + 1, N.y +1, N.z + 1, 2);
} }
else else
{ // base pixel colour for image { // base pixel colour for image
vec4 pixel(0.0, 0.0, 0.0, 1.0);
/*
vec4 unit_direction = normalize(ray_d); vec4 unit_direction = normalize(ray_d);
float t = 0.5 * (unit_directioon.y + 1.0); float t = 0.5 * (unit_directioon.y + 1.0);
vec4 pixel = (1.0 - t) * vec4(1.0, 1.0, 1.0, 1.0) + t * vec4(0.5, 0.7, 1.0, 1.0); vec4 pixel = (1.0 - t) * vec4(1.0, 1.0, 1.0, 1.0) + t * vec4(0.5, 0.7, 1.0, 1.0);
*/
return pixel; return pixel;
} }
......
 glCalls.cpp  OpenGL_Raytracer.vcxproj -> C:\Users\brian\Desktop\Multimedia\mm_raytracer\OpenGL_Raytracer\x64\Debug\OpenGL_Raytracer.exe
OpenGL_Raytracer.vcxproj -> C:\Users\brian\Desktop\Multimedia\mm_raytracer\OpenGL_Raytracer\x64\Debug\OpenGL_Raytracer.exe
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