* Fix lighting "early cull" issue for terrain lighting shader as well

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7794 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
sha..rd 2011-07-01 17:01:00 +00:00
parent 8cbde935a4
commit 7314c5f613
3 changed files with 12 additions and 0 deletions

View File

@ -99,6 +99,9 @@ void lightComputeDir(in vec3 worldPos, in vec4 color, in vec4 position, out vec4
} }
float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){ float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
if (shiny <= 1.0){
return 0.0;
}
#ifndef LOW_QUALITY #ifndef LOW_QUALITY
vec3 H = (viewdir + lightdir) * vec3(0.5); vec3 H = (viewdir + lightdir) * vec3(0.5);
return pow(max(dot(H, norm), 0.0), shiny); return pow(max(dot(H, norm), 0.0), shiny);

View File

@ -126,6 +126,12 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
Display.setVSyncEnabled(settings.isVSync()); Display.setVSyncEnabled(settings.isVSync());
if (created.get()){
Display.releaseContext();
Display.makeCurrent();
Display.update();
}
if (!created.get() || pixelFormatChanged){ if (!created.get() || pixelFormatChanged){
ContextAttribs attr = createContextAttribs(); ContextAttribs attr = createContextAttribs();
if (attr != null){ if (attr != null){

View File

@ -161,6 +161,9 @@ float lightComputeDiffuse(in vec3 norm, in vec3 lightdir, in vec3 viewdir){
} }
float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){ float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
if (shiny <= 1.0){
return 0.0;
}
#ifdef WARDISO #ifdef WARDISO
// Isotropic Ward // Isotropic Ward
vec3 halfVec = normalize(viewdir + lightdir); vec3 halfVec = normalize(viewdir + lightdir);