Fixed warnings in Terrain shader.

Fixed the use of the first diffuse map
Fixed the camera positioning in the TestSpotLightTerrain
fix-456
Rémy Bouquet 8 years ago
parent d1b125eac1
commit df765322dc
  1. 2
      jme3-examples/src/main/java/jme3test/light/TestSpotLightTerrain.java
  2. 8
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/SPTerrainLighting.frag
  3. 8
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/TerrainLighting.frag
  4. 22
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/TerrainLighting.j3md

@ -98,7 +98,7 @@ public class TestSpotLightTerrain extends SimpleApplication {
ambLight.setColor(ColorRGBA.Black);
rootNode.addLight(ambLight);
cam.setLocation(new Vector3f(-41.219646f, -84.8363f, -171.67267f));
cam.setLocation(new Vector3f(-41.219646f, 0.8363f, -171.67267f));
cam.setRotation(new Quaternion(-0.04562731f, 0.89917684f, -0.09668826f, -0.4243236f));
sl.setDirection(cam.getDirection());
sl.setPosition(cam.getLocation());

@ -150,6 +150,7 @@ varying vec2 texCoord;
vec4 calculateDiffuseBlend(in vec2 texCoord) {
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
vec4 diffuseColor = vec4(1.0);
#ifdef ALPHAMAP_1
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
@ -157,9 +158,10 @@ varying vec2 texCoord;
#ifdef ALPHAMAP_2
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
#endif
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#ifdef DIFFUSEMAP
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#endif
#ifdef DIFFUSEMAP_1
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );

@ -151,6 +151,7 @@ varying vec3 lightVec;
vec4 calculateDiffuseBlend(in vec2 texCoord) {
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
vec4 diffuseColor = vec4(1.0);
#ifdef ALPHAMAP_1
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
@ -158,9 +159,10 @@ varying vec3 lightVec;
#ifdef ALPHAMAP_2
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
#endif
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#ifdef DIFFUSEMAP
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#endif
#ifdef DIFFUSEMAP_1
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );

@ -272,29 +272,7 @@ MaterialDef Terrain Lighting {
}
Technique GBuf {
VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
}
Defines {
VERTEX_COLOR : UseVertexColor
MATERIAL_COLORS : UseMaterialColors
V_TANGENT : VTangent
MINNAERT : Minnaert
WARDISO : WardIso
DIFFUSEMAP : DiffuseMap
NORMALMAP : NormalMap
SPECULARMAP : SpecularMap
PARALLAXMAP : ParallaxMap
}
}
Technique Glow {

Loading…
Cancel
Save