added main/Lighting module, added operator-() to util/Vector, added m_shininess to main/Light
git-svn-id: svn://anubis/fart/trunk@71 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
434064c03c
commit
8677680577
5 files changed
+58
No files matched your search
@@ -23,10 +23,14 @@ class Light
|
||||
}
|
||||
const Color & getSpecularColor() const { return m_specular_color; }
|
||||
|
||||
void setShininess(double shininess) { m_shininess = shininess; }
|
||||
double getShininess() const { return m_shininess; }
|
||||
|
||||
protected:
|
||||
Vector m_position;
|
||||
Color m_diffuse_color;
|
||||
Color m_specular_color;
|
||||
double m_shininess;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
#include "Lighting.h"
|
||||
|
||||
Color Lighting::computePhong(const Material & material,
|
||||
const std::vector<Light *> & lights,
|
||||
const Ray & viewRay,
|
||||
const Vector & surfacePoint,
|
||||
const Vector & surfaceNormal,
|
||||
const Color & ambientLight)
|
||||
{
|
||||
Color result = ambientLight;
|
||||
Vector V = -viewRay.getDirection();
|
||||
for (std::vector<Light *>::const_iterator it = lights.begin();
|
||||
it != lights.end();
|
||||
it++)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef LIGHTING_H
|
||||
#define LIGHTING_H LIGHTING_H
|
||||
|
||||
#include "Light.h"
|
||||
#include "Material.h"
|
||||
#include "util/Ray.h"
|
||||
#include "util/Color.h"
|
||||
#include <vector>
|
||||
|
||||
class Lighting
|
||||
{
|
||||
public:
|
||||
static Color computePhong(const Material & material,
|
||||
const std::vector<Light *> & lights,
|
||||
const Ray & viewRay,
|
||||
const Vector & surfacePoint,
|
||||
const Vector & surfaceNormal,
|
||||
const Color & ambientLight);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user