* 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
3.0
sha..rd 14 years ago
parent 8cbde935a4
commit 7314c5f613
  1. 3
      engine/src/core-data/Common/MatDefs/Light/Lighting.vert
  2. 6
      engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java
  3. 3
      engine/src/terrain/Common/MatDefs/Terrain/TerrainLighting.frag

@ -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);

@ -125,6 +125,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();

@ -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);

Loading…
Cancel
Save