/* * Ray++ - Object-oriented ray tracing library * Copyright (C) 1998-2001 Martin Reinecke and others. * See the AUTHORS file for more information. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * See the README file for more information. */ #include "volumes/fog.h" namespace RAYPP { FOG::FOG () : Colour (1,1,1), Distance (5), I_o_R (1) {} FOG::FOG (const COLOUR &Col, float4 dist) : Colour (Col), Distance (dist), I_o_R (1) {} //virtual COLOUR FOG::Calc_new_Importance (const RAY &Ray) const { return Ray.Importance * exp ((Ray.mindist - Ray.maxdist)/Distance); } //virtual COLOUR FOG::Calc_Modified_Colour (const RAY &Ray, const COLOUR &Ingoing) const { float4 Fog_Factor= exp ((Ray.mindist-Ray.maxdist)/Distance); return (Fog_Factor*Ingoing + (1.0-Fog_Factor)*Colour); } //virtual COLOUR FOG::Get_Attenuated_Light (const RAY &Ray, const COLOUR &Ingoing) const { return Ingoing * exp ((Ray.mindist - Ray.maxdist)/Distance); } void FOG::Set_Colour (const COLOUR &new_col) { Colour = new_col; } void FOG::Set_Distance (float4 new_dist) { Distance = new_dist; } void FOG::Set_Refractive_Index (float4 new_index) { I_o_R = new_index; } } // namespace RAYPP