projects
/
MicroTrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Phong does not work yet, but saving here
[MicroTrace.git]
/
Sphere.cxx
diff --git
a/Sphere.cxx
b/Sphere.cxx
index
3c19afa
..
6b8d943
100644
(file)
--- a/
Sphere.cxx
+++ b/
Sphere.cxx
@@
-26,18
+26,25
@@
Sphere::Intersect(Ray& ray)
if(t > ray.t())
return false;
if(t > ray.t())
return false;
- if( t <
1e-6
)
+ if( t <
Epsilon
)
{
t = (-B+root)/(2.0f*A);
{
t = (-B+root)/(2.0f*A);
- if( t <
1e-6
|| t > ray.t())
+ if( t <
Epsilon
|| t > ray.t())
return false;
}
return false;
}
+
ray.setT(t);
ray.setT(t);
+ ray.setHit(this);
+
return true;
}
Vec3f
Sphere::GetNormal(Ray& ray)
{
return true;
}
Vec3f
Sphere::GetNormal(Ray& ray)
{
- return Vec3f();
+ Vec3f p = ray.origin()+ray.direction()*ray.t();
+ Vec3f N = (p-m_center);
+ N.normalize();
+
+ return N;
}
}
This page took
0.021504 seconds
and
4
git commands to generate.