From 6fbdf461224eea1f85891f4a536cf82e65672d86 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 31 Jan 2009 00:17:09 +0000 Subject: [PATCH] fixed bug in util/Vector::reflect(), Phong shading getting much closer git-svn-id: svn://anubis/fart/trunk@73 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- main/Scene.cc | 2 -- util/Vector.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/main/Scene.cc b/main/Scene.cc index 417cb10..330daca 100644 --- a/main/Scene.cc +++ b/main/Scene.cc @@ -151,8 +151,6 @@ void Scene::renderPixel(int x, int y, unsigned char * pixel) } /* take the average of all the samples as the final pixel value */ - if (finalColor.r > 1.0 || finalColor.g > 1.0 || finalColor.b > 1.0) - cerr << "Error: " << finalColor << endl; pixel[BMP_RED] = (unsigned char) (0xFF * finalColor.r / m_multisample_level_squared); pixel[BMP_GREEN] = (unsigned char) diff --git a/util/Vector.cc b/util/Vector.cc index bbdde16..d970dc0 100644 --- a/util/Vector.cc +++ b/util/Vector.cc @@ -60,7 +60,7 @@ Vector Vector::reflect(const Vector & target) const { Vector projected = proj(target); Vector me_to_proj = projected - (*this); - return projected + me_to_proj * 2.0; + return (*this) + me_to_proj * 2.0; } std::ostream & operator<<(std::ostream & out, const Vector & v)