private String resolveDependencies(ShaderDependencyNode node, Set<ShaderDependencyNode> alreadyInjectedSet, StringBuilder extensions, boolean injectDependencies) {
        if (alreadyInjectedSet.contains(node)) {
            return "// " + node.getName() + " was already injected at the top.\n";
        } else {
            alreadyInjectedSet.add(node);
        }
        if (!node.getExtensions().isEmpty()) {
            extensions.append(node.getExtensions());
        }
        if (node.getDependencies().isEmpty()) {
            return node.getSource();
        } else {
            if (injectDependencies) {
                StringBuilder sb = new StringBuilder(node.getSource());
                List<String> resolvedShaderNodes = new ArrayList<>();

                for (ShaderDependencyNode dependencyNode : node.getDependencies()) {
                    resolvedShaderNodes.add(resolveDependencies(dependencyNode, alreadyInjectedSet, extensions, injectDependencies));
                }

                List<Integer> injectIndices = node.getDependencyInjectIndices();
                for (int i = resolvedShaderNodes.size() - 1; i >= 0; i--) {
                    // Must insert them backward
                    sb.insert(injectIndices.get(i), resolvedShaderNodes.get(i));
                }
                return sb.toString();
            } else {
                for (ShaderDependencyNode dependencyNode : node.getDependencies()) {
                    resolveDependencies(dependencyNode, alreadyInjectedSet, extensions, injectDependencies);
                }
                return null;
            }

        }
    }
Creates a {@link ShaderDependencyNode} from a stream representing shader code.

@param reader   the reader with shader code
@param nodeName the node name.
@return the shader dependency node
@throws AssetLoadException if we failed to load the shader code.
jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java