fixed bug in QuadraticSolver, cheap lighting working
git-svn-id: svn://anubis/fart/trunk@45 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
761925220b
commit
d88f1ab5fd
5 files changed
+29
-20
No files matched your search
+2
-4
@@ -1,6 +1,7 @@
|
||||
|
||||
#include "Sphere.h"
|
||||
#include "util/Solver.h"
|
||||
#include <math.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
@@ -22,14 +23,11 @@ Solver::Result Sphere::intersect(const Ray & ray)
|
||||
+ ray.getOrigin()[2] * ray.getOrigin()[2]
|
||||
- m_radius2);
|
||||
Solver::Result quadSolutions = solver.solve();
|
||||
int resIdx = 0;
|
||||
for (int i = 0; i < quadSolutions.numResults; i++)
|
||||
{
|
||||
if (quadSolutions.results[i] >= 0.0)
|
||||
{
|
||||
res.results[resIdx] = quadSolutions.results[i];
|
||||
resIdx++;
|
||||
res.numResults = resIdx;
|
||||
res.results[res.numResults++] = quadSolutions.results[i];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in new issue
Block a user