c0efce7c |
1 | // This file has been automatically generated from resource file src/Shaders/PBRPointLight.glsl |
2 | |
3 | static const char Shaders_PBRPointLight_glsl[] = |
4 | "//! Function computes contribution of isotropic point light source\n" |
5 | "//! into global variable DirectLighting (PBR shading).\n" |
6 | "//! @param theId light source index\n" |
7 | "//! @param theNormal surface normal\n" |
8 | "//! @param theView view direction\n" |
9 | "//! @param thePoint 3D position (world space)\n" |
10 | "//! @param theIsFront front/back face flag\n" |
11 | "void occPointLight (in int theId,\n" |
12 | " in vec3 theNormal,\n" |
13 | " in vec3 theView,\n" |
14 | " in vec3 thePoint,\n" |
15 | " in bool theIsFront)\n" |
16 | "{\n" |
17 | " vec3 aLight = occLight_Position (theId) - thePoint;\n" |
18 | "\n" |
19 | " float aDist = length (aLight);\n" |
20 | " float aRange = occLight_Range (theId);\n" |
21 | " float anAtten = occPointLightAttenuation (aDist, aRange);\n" |
22 | " if (anAtten <= 0.0) return;\n" |
23 | " aLight /= aDist;\n" |
24 | "\n" |
25 | " theNormal = theIsFront ? theNormal : -theNormal;\n" |
26 | " DirectLighting += occPBRIllumination (theView, aLight, theNormal,\n" |
27 | " BaseColor, Metallic, Roughness, IOR,\n" |
28 | " occLight_Specular (theId),\n" |
29 | " occLight_Intensity(theId) * anAtten);\n" |
30 | "}\n"; |