| 1 |
/* |
| 2 |
Copyright 2020-2020 Michalis Kamburelis and glTF-Sample-Viewer authors. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
|
| 15 |
Calculate Physical (PBR) lighting model, in Gouraud shading. */ |
| 16 |
|
| 17 |
uniform vec4 castle_MaterialBaseAlpha; |
| 18 |
uniform vec3 castle_EmissiveColor; |
| 19 |
|
| 20 |
void calculate_lighting(out vec4 result, const in vec4 vertex_eye, const in vec3 normal_eye) |
| 21 |
{ |
| 22 |
vec4 material_base_alpha; |
| 23 |
|
| 24 |
material_base_alpha = castle_apply_color_per_vertex(castle_MaterialBaseAlpha); |
| 25 |
|
| 26 |
result = vec4(castle_EmissiveColor, material_base_alpha.a); |
| 27 |
|
| 28 |
"This GLSL code should never be used, since PhysicalMaterial requires Phong shading. |
| 29 |
Uncommented, to break compilation in case this is accidentally used." |
| 30 |
|
| 31 |
/* Clamp sum of lights colors to be <= 1. See template_phong.fs for comments. */ |
| 32 |
result.rgb = min(result.rgb, 1.0); |
| 33 |
} |