예제 #1
0
파일: Material.java 프로젝트: pilsnils/LEGO
  /**
   * Pass a parameter to the material shader.
   *
   * @param name the name of the parameter defined in the material definition (j3md)
   * @param type the type of the parameter {@link VarType}
   * @param value the value of the parameter
   */
  public void setParam(String name, VarType type, Object value) {
    checkSetParam(type, name);

    if (type.isTextureType()) {
      setTextureParam(name, type, (Texture) value);
    } else {
      MatParam val = getParam(name);
      if (val == null) {
        MatParam paramDef = def.getMaterialParam(name);
        paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
      } else {
        val.setValue(value);
      }

      if (technique != null) {
        technique.notifyParamChanged(name, type, value);
      }
    }
  }