diff --git a/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java b/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java index b00129005..ed53e89bc 100644 --- a/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java +++ b/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java @@ -396,7 +396,18 @@ public class Glsl100ShaderGenerator extends ShaderGenerator { source.append(mapping.getLeftVariable().getNameSpace()); source.append("_"); source.append(mapping.getLeftVariable().getName()); + + //left swizzle, the variable can't be declared and assigned on the same line. if (mapping.getLeftSwizzling().length() > 0) { + //initialize the declared variable to 0.0 + source.append(" = "); + source.append(mapping.getLeftVariable().getType()); + source.append("(0.0);\n"); + appendIndent(source); + //assign the value on a new line + source.append(mapping.getLeftVariable().getNameSpace()); + source.append("_"); + source.append(mapping.getLeftVariable().getName()); source.append("."); source.append(mapping.getLeftSwizzling()); } diff --git a/jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java b/jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java index b64e44814..13bde3c71 100644 --- a/jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java +++ b/jme3-core/src/main/java/com/jme3/shader/ShaderUtils.java @@ -120,11 +120,7 @@ public class ShaderUtils { card = Integer.parseInt(type.replaceAll(".*vec", "")); if (swizzling.length() > 0) { - //if (card >= swizzling.length()) { - card = swizzling.length(); -// } else { -// card = 0; -// } + card = swizzling.length(); } } }