Sync with latest Kha

This commit is contained in:
Lubos Lenco 2016-03-07 22:51:17 +01:00
parent 813966f4ea
commit 51adf1ef1c
5 changed files with 5 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View file

@ -5,7 +5,7 @@ bl_info = {
"category": "Game Engine",
"description": "3D Game Engine built for Cycles",
"author": "Lubos Lenco",
"version": (16, 1, 0, 0),
"version": (16, 3, 0, 0),
"wiki_url": "http://cyclesgame.org/"
}

View file

@ -60,13 +60,12 @@ float shadowTest(vec4 lPos, float dotNL) {
lPosH.y = 1.0 - ((-lPosH.y + 1.0) / (2.0));
vec4 packedZValue = texture(shadowMap, lPosH.st);
float distanceFromLight = packedZValue.z;
float bias = clamp(0.005 * tan(acos(dotNL)), 0.0, 0.01);
// 1.0 = not in shadow, 0.0 = in shadow
return float(distanceFromLight > lPosH.z - bias);
// return texture(shadowMap, vec3(lPosH.st, lPosH.z / lPosH.w));
}
@ -194,6 +193,7 @@ void main() {
#ifdef _NMTex
vec3 n = (texture(snormal, texCoord).rgb * 2.0 - 1.0);
n = normalize(TBN * normalize(n));
n = vec3(0.0, 0.0, 1.0);
#else
vec3 n = normalize(normal);
#endif
@ -205,7 +205,6 @@ void main() {
if (receiveShadow) {
if (lPos.w > 0.0) {
visibility = shadowTest(lPos, dotNL);
visibility = (visibility * 0.8) + 0.2;
visibility = 1.0;
}
}

View file

@ -119,7 +119,7 @@ def parse_shader(sres, c, con, defs, lines, parse_attributes):
ctype = s[1]
cid = s[2][:-1]
found = False # Unique check
if ctype == 'sampler2D': # Texture unit
if ctype == 'sampler2D' or ctype == 'sampler2DShadow': # Texture unit
for tu in con.texture_units:
if tu.id == cid:
found = True