added getNormalAt() to Shape & Sphere, trying to get basic lighting
git-svn-id: svn://anubis/fart/trunk@44 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
801f61f48c
commit
761925220b
6 files changed
+23
-7
No files matched your search
+2
-2
@@ -26,14 +26,14 @@ Vector & Vector::normalize()
|
||||
return *this;
|
||||
}
|
||||
|
||||
double Vector::mag()
|
||||
double Vector::mag() const
|
||||
{
|
||||
return sqrt(m_array[0] * m_array[0]
|
||||
+ m_array[1] * m_array[1]
|
||||
+ m_array[2] * m_array[2]);
|
||||
}
|
||||
|
||||
double Vector::mag2()
|
||||
double Vector::mag2() const
|
||||
{
|
||||
return m_array[0] * m_array[0]
|
||||
+ m_array[1] * m_array[1]
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ class Vector
|
||||
double & operator[](int idx) { return m_array[idx]; }
|
||||
double operator[](int idx) const { return m_array[idx]; }
|
||||
Vector & normalize();
|
||||
double mag();
|
||||
double mag2();
|
||||
double mag() const;
|
||||
double mag2() const;
|
||||
|
||||
private:
|
||||
double m_array[3];
|
||||
|
||||
Reference in new issue
Block a user