mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
light.inc.frag: Fix adsModel usage
adsModel is by used by phongFunction with worldView parameter, not worldEye. This fixed is copied from qt3d shader source code. The tests are updated to take into account this change.
This commit is contained in:
parent
6e374855c2
commit
e3499eb1bc
@ -102,7 +102,7 @@ void adsModelNormalMapped(const in vec3 worldPos,
|
||||
|
||||
void adsModel(const in vec3 worldPos,
|
||||
const in vec3 worldNormal,
|
||||
const in vec3 worldEye,
|
||||
const in vec3 worldView,
|
||||
const in float shininess,
|
||||
out vec3 diffuseColor,
|
||||
out vec3 specularColor)
|
||||
@ -112,7 +112,6 @@ void adsModel(const in vec3 worldPos,
|
||||
|
||||
// We perform all work in world space
|
||||
vec3 n = normalize(worldNormal);
|
||||
vec3 v = normalize(worldEye - worldPos);
|
||||
vec3 s = vec3(0.0);
|
||||
|
||||
for (int i = 0; i < lightCount; ++i) {
|
||||
@ -160,7 +159,7 @@ void adsModel(const in vec3 worldPos,
|
||||
if (diffuse > 0.0 && shininess > 0.0) {
|
||||
float normFactor = (shininess + 2.0) / 2.0;
|
||||
vec3 r = reflect(-s, n); // Reflection direction in world space
|
||||
specular = normFactor * pow(max(dot(r, v), 0.0), shininess);
|
||||
specular = normFactor * pow(max(dot(r, worldView), 0.0), shininess);
|
||||
}
|
||||
|
||||
// Accumulate the diffuse and specular contributions
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 461 KiB After Width: | Height: | Size: 456 KiB |
Binary file not shown.
Before Width: | Height: | Size: 461 KiB After Width: | Height: | Size: 456 KiB |
Loading…
x
Reference in New Issue
Block a user