added jitter parameter to lights, currently uses random vectors, which i'm not happy with; added Vector::getPerpendicularVector() which will be used to replace random jitter for lights
git-svn-id: svn://anubis/fart/trunk@256 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
1af787b9ab
commit
eb14077ab7
8 files changed
+71
-35
No files matched your search
@@ -83,6 +83,18 @@ Vector Vector::reflect(const Vector & target) const
|
||||
return (*this) + me_to_proj * 2.0;
|
||||
}
|
||||
|
||||
Vector Vector::getPerpendicularVector() const
|
||||
{
|
||||
Vector t = *this;
|
||||
t.normalize();
|
||||
Vector p = t * Vector(0, 0, 1);
|
||||
if (p.mag() <= 0.1)
|
||||
{
|
||||
p = t * Vector(1, 0, 0);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, const Vector & v)
|
||||
{
|
||||
out << "[" << v[0] << ", " << v[1] << ", " << v[2] << "]";
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ class Vector
|
||||
double dist_to(const Vector & other) const;
|
||||
Vector proj(const Vector & target) const;
|
||||
Vector reflect(const Vector & target) const;
|
||||
operator double() { return mag(); }
|
||||
operator double() const { return mag(); }
|
||||
Vector getPerpendicularVector() const;
|
||||
|
||||
protected:
|
||||
double m_array[3];
|
||||
|
||||
Reference in new issue
Block a user