diff options
Diffstat (limited to 'shaders/main')
-rw-r--r-- | shaders/main/frag.glsl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/shaders/main/frag.glsl b/shaders/main/frag.glsl index 6d7a53e..8aa9a6a 100644 --- a/shaders/main/frag.glsl +++ b/shaders/main/frag.glsl @@ -9,20 +9,21 @@ in vec3 lipos; void main() { - vec3 objco = vec3(texture(tex, fuv)); + vec3 fdiff = vec3(texture(tdiff, fuv)); + vec3 fspec = vec3(texture(tspec, fuv)); vec3 lico = vec3(1.0, 1.0, 1.0); vec3 amb = vec3(0.1, 0.1, 0.1); vec3 norm = normalize(fnorm); vec3 lidir = normalize(lipos - fpos); - vec3 dif = max(dot(norm, lidir), 0.0) * objco; + vec3 diff = max(dot(norm, lidir), 0.0) * fdiff; - float speen = max(sign(dot(lidir, norm)), 0.0); + float specen = max(sign(dot(lidir, norm)), 0.0); vec3 vwdir = normalize(-fpos); vec3 mid = normalize(lidir + vwdir); - float spe = pow(max(dot(norm, mid), 0.0), 256) * speen; + vec3 spec = pow(max(dot(norm, mid), 0.0), 256) * specen * fspec; - color = vec4((amb + dif + spe) * lico, 1.0); + color = vec4((amb + diff + spec) * lico, 1.0); } |