added jitter and radius parameters to light objects; not using them yet

git-svn-id: svn://anubis/fart/trunk@255 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2010-06-25 16:37:17 +00:00
1 parent bc27be0f85
commit 1af787b9ab
10 files changed
+53 -11

No files matched your search

+1 -8
View File
@@ -18,14 +18,7 @@ Ray::Ray(const Vector & origin, const Vector & direction)
Ray Ray::randomRay()
{
double x, y, z;
do
{
x = 2.0 * rand() / RAND_MAX - 1.0;
y = 2.0 * rand() / RAND_MAX - 1.0;
z = 2.0 * rand() / RAND_MAX - 1.0;
} while (x*x + y*y + z*z <= 1.0);
return Ray(Vector(0, 0, 0), Vector(x, y, z));
return Ray(Vector(0, 0, 0), Vector::randomVector());
}
/*
+17 -2
View File
@@ -1,7 +1,10 @@
#include <stdlib.h> /* rand() */
#include <math.h>
#include <iostream>
#include "Vector.h"
#include <iostream>
#include <math.h>
Vector::Vector()
{
@@ -17,6 +20,18 @@ Vector::Vector(double x, double y, double z)
m_array[2] = z;
}
Vector Vector::randomVector()
{
double x, y, z;
do
{
x = 2.0 * rand() / RAND_MAX - 1.0;
y = 2.0 * rand() / RAND_MAX - 1.0;
z = 2.0 * rand() / RAND_MAX - 1.0;
} while (x*x + y*y + z*z > 1.0);
return Vector(x, y, z).normalize();
}
Vector & Vector::normalize()
{
double length = mag();
+1
View File
@@ -9,6 +9,7 @@ class Vector
public:
Vector();
Vector(double x, double y, double z);
static Vector randomVector();
double & operator[](int idx) { return m_array[idx]; }
double operator[](int idx) const { return m_array[idx]; }
Vector operator-() const;