gpuray_glsl
diff src/cone.cc @ 4:2ed3da7dc0bc
broken
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 10 Nov 2014 01:26:00 +0200 |
parents | 297dbc5080c4 |
children | 000017955721 |
line diff
1.1 --- a/src/cone.cc Sun Nov 09 20:13:33 2014 +0200 1.2 +++ b/src/cone.cc Mon Nov 10 01:26:00 2014 +0200 1.3 @@ -65,10 +65,20 @@ 1.4 pt->dist = t; 1.5 pt->pos = ray.origin + ray.dir * t; 1.6 1.7 - pt->normal.z = sin(angle); 1.8 + if(pt->pos.y < ymin || pt->pos.y >= ymax) { 1.9 + return false; 1.10 + } 1.11 1.12 - //pt->normal = (pt->pos - pos) / radius; TODO continue here 1.13 + float radius = pt->pos.y * slope; 1.14 + pt->normal = Vector3(pt->pos.x, 0.0, pt->pos.z) / radius; 1.15 + 1.16 + float ny = sin(angle); 1.17 + float xzlen = sqrt(1.0 - ny * ny); 1.18 + pt->normal.x *= xzlen; 1.19 + pt->normal.y = ny; 1.20 + pt->normal.z *= xzlen; 1.21 1.22 pt->pos.transform(xform); 1.23 pt->normal.transform(dir_xform); 1.24 + return true; 1.25 }