#include <string>
namespace luxrays { namespace ocl {
std::string KernelSource_utils_funcs = 
"#line 2 \"utils_funcs.cl\"\n"
"\n"
"/***************************************************************************\n"
" *   Copyright (C) 1998-2013 by authors (see AUTHORS.txt)                  *\n"
" *                                                                         *\n"
" *   This file is part of LuxRays.                                         *\n"
" *                                                                         *\n"
" *   LuxRays is free software; you can redistribute it and/or modify       *\n"
" *   it under the terms of the GNU General Public License as published by  *\n"
" *   the Free Software Foundation; either version 3 of the License, or     *\n"
" *   (at your option) any later version.                                   *\n"
" *                                                                         *\n"
" *   LuxRays is distributed in the hope that it will be useful,            *\n"
" *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *\n"
" *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *\n"
" *   GNU General Public License for more details.                          *\n"
" *                                                                         *\n"
" *   You should have received a copy of the GNU General Public License     *\n"
" *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *\n"
" *                                                                         *\n"
" *   LuxRays website: http://www.luxrender.net                             *\n"
" ***************************************************************************/\n"
"\n"
"int Mod(int a, int b) {\n"
"	if (b == 0)\n"
"		b = 1;\n"
"\n"
"	a %= b;\n"
"	if (a < 0)\n"
"		a += b;\n"
"\n"
"	return a;\n"
"}\n"
"\n"
"int Floor2Int(const float val) {\n"
"	return (int)floor(val);\n"
"}\n"
"\n"
"float Lerp(const float t, const float v1, const float v2) {\n"
"	return mix(v1, v2, t);\n"
"}\n"
"\n"
"float3 Lerp3(const float t, const float3 v1, const float3 v2) {\n"
"	return mix(v1, v2, t);\n"
"}\n"
"\n"
"float SmoothStep(const float min, const float max, const float value) {\n"
"	const float v = clamp((value - min) / (max - min), 0.f, 1.f);\n"
"	return v * v * (-2.f * v  + 3.f);\n"
"}\n"
"\n"
"float CosTheta(const float3 v) {\n"
"	return v.z;\n"
"}\n"
"\n"
"float SinTheta2(const float3 w) {\n"
"	return fmax(0.f, 1.f - CosTheta(w) * CosTheta(w));\n"
"}\n"
; } }
