// // This file is part of Caelum. // See http://www.ogre3d.org/wiki/index.php/Caelum // // Copyright (c) 2008 Caelum team. See Contributors.txt for details. // // Caelum is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Caelum 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with Caelum. If not, see . // sampler scene: register(s0); sampler samplerPrec: register(s1); uniform float intensity; uniform float4 ambient_light_colour; // - - corner uniform float4 corner1; // + - corner uniform float4 corner2; // - + corner uniform float4 corner3; // + + corner uniform float4 corner4; // The x and y coordinal deviations for all 3 layers of precipitation uniform float4 deltaX; uniform float4 deltaY; uniform float4 precColor; // Cartesian to cylindrical coordinates float2 CylindricalCoordinates(float4 dir) { float R = 0.5; float2 res; //cubical root is used to counteract top/bottom circle effect dir *= R / pow(length(dir.xz), 0.33); res.y = -dir.y; res.x = -atan2(dir.z, dir.x); return res; } // Returns alpha value of a precipitation // view_direction is the direction vector resulting from the eye direction,wind direction and possibly other factors float Precipitation ( float2 cCoords, float intensity, float2 delta ) { cCoords -= delta; float4 raincol = tex2D(samplerPrec, cCoords); return (raincol.g