removed test directory, converted Shape's material handle to a refptr<Material> instead of a Material *, made refptr<T>::operator*() and operator->() const members

git-svn-id: svn://anubis/fart/trunk@96 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-02-10 01:09:07 +00:00
1 parent 2e82f9e2ea
commit 0fc1e468fe
10 files changed
+23 -79

No files matched your search

+5 -5
View File
@@ -4,19 +4,19 @@
#include <iostream>
using namespace std;
Color Lighting::computePhong(const Material & material,
Color Lighting::computePhong(const refptr<Material> material,
const std::vector<Light *> & lights,
const Ray & viewRay,
const Vector & surfacePoint,
const Vector & surfaceNormal,
const Color & ambientLight)
{
Color result = ambientLight * material.getAmbientColor();
Color result = ambientLight * material->getAmbientColor();
Vector viewDirection = -viewRay.getDirection();
double shininess = material.getShininess();
const Color & diffuseColor = material.getDiffuseColor();
const Color & specularColor = material.getSpecularColor();
double shininess = material->getShininess();
const Color & diffuseColor = material->getDiffuseColor();
const Color & specularColor = material->getSpecularColor();
for (std::vector<Light *>::const_iterator it = lights.begin();
it != lights.end();
+2 -1
View File
@@ -6,12 +6,13 @@
#include "Material.h"
#include "util/Ray.h"
#include "util/Color.h"
#include "util/refptr.h"
#include <vector>
class Lighting
{
public:
static Color computePhong(const Material & material,
static Color computePhong(const refptr<Material> material,
const std::vector<Light *> & lights,
const Ray & viewRay,
const Vector & surfacePoint,
+2 -4
View File
@@ -176,13 +176,11 @@ Color Scene::traceRay(const Ray & ray)
it++)
{
/* compute the Phong lighting for each hit */
const Material * material = it->first->getMaterial();
if (material == NULL)
material = &Material::white;
refptr<Material> material = it->first->getMaterial();
Vector surfacePoint = ray[it->second];
color = Lighting::computePhong(*material,
color = Lighting::computePhong(material,
m_lights,
ray,
surfacePoint,