00001 /********************************************************************** 00002 * blaRAY -- photon mapper/raytracer 00003 * (C) 2008 by Tomasz bla Fortuna <bla@thera.be>, <bla@af.gliwice.pl> 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * any later version. 00009 * 00010 * See Docs/LICENSE 00011 *********************/ 00012 00013 #ifndef _RAY_H_ 00014 #define _RAY_H_ 00015 00016 #include <iostream> 00017 00018 #include "Math/Matrix.hh" 00019 #include "Math/Transform.hh" 00020 #include "Math/Vector.hh" 00021 00022 #include "World/Color.hh" 00023 00029 namespace Render { 00038 class Ray { 00039 private: 00041 Math::Vector S; 00042 00044 Math::Vector D; 00045 00047 /* World::Color C; */ 00048 00049 public: 00054 Ray(const Math::Vector &S, const Math::Vector &D) : S(S), D(D) 00055 { 00056 } 00057 00060 static Ray RayFromPoints(const Math::Vector &Start, 00061 const Math::Vector &Destination); 00062 00067 Ray Reflect(const Math::Vector &Normal, 00068 const Math::Vector &Point) const; 00069 00076 Ray Refract(const Math::Vector &Normal, 00077 const Math::Vector &Point, 00078 Double FromN, Double IntoN) const; 00079 00081 inline const Math::Vector &Start() const 00082 { 00083 return S; 00084 } 00085 00087 inline const Math::Vector &Direction() const 00088 { 00089 return D; 00090 } 00091 00094 Math::Vector GetPoint(Double Loc) const 00095 { 00096 return this->S + (this->D * Loc); 00097 } 00098 00100 friend std::ostream &operator<<(std::ostream &os, const Ray &R); 00101 }; 00102 00103 }; 00104 00105 #endif
1.5.5