/** * finds an UniformBinding representing a WorldParam from the techniqueDef * * @param varName the name of the WorldParam * @return the corresponding UniformBinding to the WorldParam */ protected UniformBinding findWorldParam(String varName) { for (UniformBinding worldParam : techniqueDef.getWorldBindings()) { if (varName.equals(worldParam.toString())) { return worldParam; } } return null; }
/** * updates the right variable of the given mapping from a UniformBinding (a WorldParam) it checks * if the unifrom hasn't already been loaded, add it to the maps if not. * * @param param the WorldParam UniformBinding * @param mapping the mapping * @param map the map of uniforms to search into * @return true if the param was added to the map */ protected boolean updateRightFromUniforms( UniformBinding param, VariableMapping mapping, Map<String, DeclaredVariable> map) { ShaderNodeVariable right = mapping.getRightVariable(); String name = "g_" + param.toString(); DeclaredVariable dv = map.get(name); if (dv == null) { right.setType(param.getGlslType()); right.setName(name); dv = new DeclaredVariable(right); map.put(right.getName(), dv); dv.addNode(shaderNode); mapping.setRightVariable(right); return true; } dv.addNode(shaderNode); mapping.setRightVariable(dv.var); return false; }