public boolean updateRightFromUniforms(MatParam param, VariableMapping mapping, Map<String, DeclaredVariable> map,
                                           Statement statement) throws MatParseException {

        final ShaderNodeVariable left = mapping.getLeftVariable();
        final ShaderNodeVariable right = mapping.getRightVariable();

        DeclaredVariable dv = map.get(param.getName());

        if (dv == null) {

            right.setType(param.getVarType().getGlslType());
            right.setName(param.getName());
            right.setPrefix("m_");

            if (left.getMultiplicity() != null) {

                if (!param.getVarType().name().endsWith("Array")) {
                    throw new MatParseException(param.getName() + " is not of Array type", statement);
                }

                String multiplicity = left.getMultiplicity();
                try {
                    Integer.parseInt(multiplicity);
                } catch (final NumberFormatException nfe) {
                    // multiplicity is not an int attempting to find for a material parameter.
                    MatParam mp = findMatParam(multiplicity);
                    if (mp != null) {
                        // It's tied to a material param, let's create a define and use this as the multiplicity
                        addDefine(multiplicity, VarType.Int);
                        multiplicity = multiplicity.toUpperCase();
                        left.setMultiplicity(multiplicity);
                        // only declare the variable if the define is defined.
                        left.setCondition(mergeConditions(left.getCondition(), "defined(" + multiplicity + ")", "||"));
                    } else {
                        throw new MatParseException("Wrong multiplicity for variable" + left.getName() + ". " +
                                multiplicity + " should be an int or a declared material parameter.", statement);
                    }
                }

                // the right variable must have the same multiplicity and the same condition.
                right.setMultiplicity(multiplicity);
                right.setCondition(left.getCondition());
            }

            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;
    }
Updates the right variable of the given mapping from a {@link MatParam} (a
WorldParam) it checks if the uniform hasn't already been loaded, add it
to the maps if not.

@param param   the mat param.
@param mapping the mapping.
@param map     the map of uniforms to search into.
@param statement the statement being read
@return true if the param was added to the map.
@throws MatParseException in case of a syntax error
jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java