Advertisement
rectalogic

uniform names

Jun 8th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.89 KB | None | 0 0
  1. Index: src/core/com/jme3/material/Material.java
  2. ===================================================================
  3. --- src/core/com/jme3/material/Material.java    (revision 9461)
  4. +++ src/core/com/jme3/material/Material.java    (working copy)
  5. @@ -467,15 +467,16 @@
  6.          name = checkSetParam(type, name);
  7.  
  8.          MatParam val = getParam(name);
  9. -        if (technique != null) {
  10. -            technique.notifySetParam(name, type, value);
  11. -        }
  12.          if (val == null) {
  13.              MatParam paramDef = def.getMaterialParam(name);
  14. -            paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
  15. +            val = new MatParam(type, name, value, paramDef.getFixedFuncBinding());
  16. +            paramValues.put(name, val);
  17.          } else {
  18.              val.setValue(value);
  19.          }
  20. +        if (technique != null) {
  21. +            technique.notifySetParam(val);
  22. +        }
  23.      }
  24.  
  25.      /**
  26. @@ -550,13 +551,14 @@
  27.          name = checkSetParam(type, name);
  28.          MatParamTexture val = getTextureParam(name);
  29.          if (val == null) {
  30. -            paramValues.put(name, new MatParamTexture(type, name, value, nextTexUnit++));
  31. +            val = new MatParamTexture(type, name, value, nextTexUnit++);
  32. +            paramValues.put(name, val);
  33.          } else {
  34.              val.setTextureValue(value);
  35.          }
  36.  
  37.          if (technique != null) {
  38. -            technique.notifySetParam(name, type, nextTexUnit - 1);
  39. +            technique.notifySetParam(val);
  40.          }
  41.  
  42.          // need to recompute sort ID
  43. @@ -996,7 +998,7 @@
  44.                      continue;
  45.                  }
  46.  
  47. -                technique.updateUniformParam(param.getName(),
  48. +                technique.updateUniformParam(param.getPrefixedName(),
  49.                          param.getVarType(),
  50.                          param.getValue(), true);
  51.              }
  52. Index: src/core/com/jme3/material/Technique.java
  53. ===================================================================
  54. --- src/core/com/jme3/material/Technique.java   (revision 9461)
  55. +++ src/core/com/jme3/material/Technique.java   (working copy)
  56. @@ -111,13 +111,13 @@
  57.      /**
  58.       * Called by the material to tell the technique a parameter was modified
  59.       */
  60. -    void notifySetParam(String paramName, VarType type, Object value) {
  61. -        String defineName = def.getShaderParamDefine(paramName);
  62. +    void notifySetParam(MatParam param) {
  63. +        String defineName = def.getShaderParamDefine(param.getName());
  64.          if (defineName != null) {
  65. -            needReload = defines.set(defineName, type, value);
  66. +            needReload = defines.set(defineName, param.getVarType(), param.getValue());
  67.          }
  68.          if (shader != null) {
  69. -            updateUniformParam(paramName, type, value);
  70. +            updateUniformParam(param.getPrefixedName(), param.getVarType(), param.getValue());
  71.          }
  72.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement