Files
bullet3/btgui/OpenGLWindow/Shaders/useShadowMapInstancingPS.h
erwincoumans 906415429c added (and stripped) a simple C/C++ preprocessor (written in Lua), so the stringifier can handle the #include directive,
and embed the included files directly in the stringified files.
We need this, because we start sharing struct definitions and code between C/C++ and OpenCL (and potentially other languages)
preprocessor is from http://github.com/willsteel/lcpp
2013-08-01 21:05:19 -07:00

60 lines
1.3 KiB
C

//this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
static const char* useShadowMapInstancingFragmentShader= \
"#version 330 core\n"
"//precision highp float;\n"
"\n"
"in Fragment\n"
"{\n"
" vec4 color;\n"
"} fragment;\n"
"\n"
"in Vert\n"
"{\n"
" vec2 texcoord;\n"
"} vert;\n"
"\n"
"uniform sampler2D Diffuse;\n"
"uniform sampler2DShadow shadowMap;\n"
"\n"
"in vec3 lightDir,normal,ambient;\n"
"in vec4 ShadowCoord;\n"
"\n"
"out vec4 color;\n"
"\n"
"\n"
"\n"
"void main(void)\n"
"{\n"
" vec4 texel = fragment.color*texture(Diffuse,vert.texcoord);//fragment.color;\n"
" vec3 ct,cf;\n"
" float intensity,at,af;\n"
" \n"
" intensity = clamp( dot( normalize(normal),lightDir ), 0,1 );\n"
" \n"
" cf = ambient;\n"
" af = 1.0;\n"
" \n"
" ct = texel.rgb;\n"
" at = texel.a;\n"
" \n"
" //float bias = 0.005f;\n"
" \n"
" float bias = 0.005*tan(acos(intensity));\n"
" bias = clamp(bias, 0,0.01);\n"
"\n"
"\n"
" float visibility = texture(shadowMap, vec3(ShadowCoord.xy,(ShadowCoord.z-bias)/ShadowCoord.w));\n"
" \n"
" intensity*=2;\n"
" if (intensity>1)\n"
" intensity=1.f;\n"
" \n"
" visibility *= intensity;\n"
" \n"
" if (visibility<0.6)\n"
" visibility=0.6f;\n"
" \n"
" color = vec4(ct * visibility, 1.f);//at * af); \n"
"}\n"
;