Fixed warnings in Terrain shader.

Fixed the use of the first diffuse map
Fixed the camera positioning in the TestSpotLightTerrain
This commit is contained in:
Rémy Bouquet 2017-02-26 09:25:23 +01:00
parent 8214346e8b
commit 5470abb2b0
4 changed files with 11 additions and 29 deletions

View File

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

View File

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

View File

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

View File

@ -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 {