out.write(formatCondition(shaderNode.getCondition(), matParams)); out.write("\n");
out.write(formatCondition(mapping.getCondition(), matParams));
private void writeShaderNode( OutputStreamWriter out, ShaderNode shaderNode, Collection<MatParam> matParams) throws IOException { out.write(" ShaderNode "); out.write(shaderNode.getName()); out.write(" {\n"); if (shaderNode.getCondition() != null){ out.write(" Condition: "); out.write(formatCondition(shaderNode.getCondition(), matParams)); out.write("\n"); } out.write(" Definition: "); out.write(shaderNode.getDefinition().getName()); out.write(": "); out.write(shaderNode.getDefinition().getPath()); out.write("\n"); out.write(" InputMappings {\n"); for (VariableMapping mapping : shaderNode.getInputMapping()) { writeVariableMapping(out, shaderNode, mapping, matParams); } out.write(" }\n"); out.write(" OutputMappings {\n"); for (VariableMapping mapping : shaderNode.getOutputMapping()) { writeVariableMapping(out, shaderNode, mapping, matParams); } out.write(" }\n"); out.write(" }\n"); }
private void writeVariableMapping(OutputStreamWriter out, ShaderNode shaderNode, VariableMapping mapping, Collection<MatParam> matParams) throws IOException { out.write(" "); if(!mapping.getLeftVariable().getNameSpace().equals(shaderNode.getName())) { out.write(mapping.getLeftVariable().getNameSpace()); out.write("."); } out.write(mapping.getLeftVariable().getName()); if(!mapping.getLeftSwizzling().equals("")){ out.write("."); out.write(mapping.getLeftSwizzling()); } out.write(" = "); if(!mapping.getRightVariable().getNameSpace().equals(shaderNode.getName())) { out.write(mapping.getRightVariable().getNameSpace()); out.write("."); } out.write(mapping.getRightVariable().getName().replaceFirst("g_","").replaceFirst("m_","")); if(!mapping.getRightSwizzling().equals("")){ out.write("."); out.write(mapping.getRightSwizzling()); } if (mapping.getCondition() != null){ out.write(" : "); out.write(formatCondition(mapping.getCondition(),matParams)); } out.write("\n"); }