Fixed shader generation bug for array variables.

cleanup_build_scripts
Jan Ivenz 9 years ago
parent c6143ae640
commit 98a9f5c628
  1. 7
      jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java
  2. 1
      jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java

@ -258,7 +258,7 @@ public class Glsl100ShaderGenerator extends ShaderGenerator {
}
for (ShaderNodeVariable var : shaderNode.getDefinition().getOutputs()) {
ShaderNodeVariable v = new ShaderNodeVariable(var.getType(), shaderNode.getName(), var.getName());
ShaderNodeVariable v = new ShaderNodeVariable(var.getType(), shaderNode.getName(), var.getName(), var.getMultiplicity());
if (!declaredInputs.contains(shaderNode.getName() + "_" + var.getName())) {
if (!isVarying(info, v)) {
declareVariable(source, v);
@ -397,6 +397,11 @@ public class Glsl100ShaderGenerator extends ShaderGenerator {
source.append(mapping.getLeftVariable().getNameSpace());
source.append("_");
source.append(mapping.getLeftVariable().getName());
if (mapping.getLeftVariable().getMultiplicity() != null){
source.append("[");
source.append(mapping.getLeftVariable().getMultiplicity());
source.append("]");
}
//left swizzle, the variable can't be declared and assigned on the same line.
if (mapping.getLeftSwizzling().length() > 0) {

@ -752,6 +752,7 @@ public class ShaderNodeLoaderDelegate {
}
right.setNameSpace(node.getName());
right.setType(var.getType());
right.setMultiplicity(var.getMultiplicity());
mapping.setRightVariable(right);
storeVaryings(node, mapping.getRightVariable());

Loading…
Cancel
Save