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:
1 parent
bc27be0f85
commit
1af787b9ab
10 files changed
+53
-11
No files matched your search
@@ -1,11 +1,18 @@
|
||||
|
||||
#include "Light.h"
|
||||
#include "util/Vector.h"
|
||||
#include "util/Ray.h"
|
||||
|
||||
Light::Light()
|
||||
{
|
||||
m_position = Vector(0, 0, 0);
|
||||
m_diffuse_color = Color::white;
|
||||
m_specular_color = Color::white;
|
||||
m_jitter = 1;
|
||||
m_radius = 1.0;
|
||||
}
|
||||
|
||||
Vector Light::getJitterPosition() const
|
||||
{
|
||||
return m_position + Vector::randomVector() * m_radius;
|
||||
}
|
||||
@@ -14,6 +14,8 @@ class Light
|
||||
void setPosition(refptr<Vector> vec) { setPosition(*vec); }
|
||||
const Vector & getPosition() const { return m_position; }
|
||||
|
||||
Vector getJitterPosition() const;
|
||||
|
||||
void setDiffuseColor(const Color & diffuse)
|
||||
{
|
||||
m_diffuse_color = diffuse;
|
||||
@@ -25,11 +27,15 @@ class Light
|
||||
m_specular_color = specular;
|
||||
}
|
||||
const Color & getSpecularColor() const { return m_specular_color; }
|
||||
void setJitter(int j) { m_jitter = j; }
|
||||
int getJitter() const { return m_jitter; }
|
||||
|
||||
protected:
|
||||
Vector m_position;
|
||||
Color m_diffuse_color;
|
||||
Color m_specular_color;
|
||||
double m_radius;
|
||||
int m_jitter;
|
||||
};
|
||||
|
||||
#include "PointLight.h"
|
||||
|
||||
Reference in new issue
Block a user