Fixed an issue with the ShaderNodeGenerator that was missing some variable names in cases like that ',myVar,myVar.x'

experimental
Nehon 10 years ago
parent 2066c98dd0
commit 0ebb3acb16
  1. 2
      jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java
  2. 1
      jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java

@ -517,7 +517,7 @@ public class Glsl100ShaderGenerator extends ShaderGenerator {
* @return the modified source code
*/
protected String replace(String nodeSource, ShaderNodeVariable var, String newName) {
nodeSource = nodeSource.replaceAll("(\\W)" + var.getName() + "(\\W)", "$1" + newName + "$2");
nodeSource = nodeSource.replaceAll("(?<=\\W)" + var.getName() + "(?=\\W)", newName);
return nodeSource;
}

@ -71,7 +71,6 @@ public abstract class ShaderGenerator {
/**
* Generate vertex and fragment shaders for the given technique
*
* @param technique the technique to use to generate the shaders
* @return a Shader program
*/
public Shader generateShader() {

Loading…
Cancel
Save