/** * {@inheritDoc} * * Fragment shader outputs are declared before the "void main(){" with the * "out" keyword. * * after the "void main(){", the vertex output are declared and initialized * and the fragment outputs are declared */ @Override protected void generateStartOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) { source.append("\n"); if (type == Shader.ShaderType.Fragment) { for (ShaderNodeVariable global : info.getFragmentGlobals()) { declareVariable(source, global, null, true, "out"); } } source.append("\n"); appendIndent(source); source.append("void main(){\n"); indent(); if (type == Shader.ShaderType.Vertex) { declareGlobalPosition(info, source); } else if (type == Shader.ShaderType.Fragment) { for (ShaderNodeVariable global : info.getFragmentGlobals()) { initVariable(source, global, "vec4(1.0)"); } } }
/** * {@inheritDoc} * * Fragment shader outputs are declared before the "void main(){" with the * "out" keyword. * * after the "void main(){", the vertex output are declared and initialized * and the fragment outputs are declared */ @Override protected void generateStartOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) { source.append("\n"); if (type == Shader.ShaderType.Fragment) { for (ShaderNodeVariable global : info.getFragmentGlobals()) { declareVariable(source, global, null, true, "out"); } } source.append("\n"); appendIndent(source); source.append("void main(){\n"); indent(); if (type == Shader.ShaderType.Vertex) { declareGlobalPosition(info, source); } else if (type == Shader.ShaderType.Fragment) { for (ShaderNodeVariable global : info.getFragmentGlobals()) { initVariable(source, global, "vec4(1.0)"); } } }