private void writeShaderNodes(TechniqueDef techniqueDef, Collection<MatParam> matParams, OutputStreamWriter out) throws IOException { out.write(" VertexShaderNodes {\n"); for (ShaderNode shaderNode : techniqueDef.getShaderNodes()) { if(shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex){ writeShaderNode(out, shaderNode, matParams); } } out.write(" }\n\n"); out.write(" FragmentShaderNodes {\n"); for (ShaderNode shaderNode : techniqueDef.getShaderNodes()) { if(shaderNode.getDefinition().getType() == Shader.ShaderType.Fragment){ writeShaderNode(out, shaderNode, matParams); } } out.write(" }\n\n"); }
continue; if (shaderNode.getDefinition().getType() == type) { int index = findShaderIndexFromVersion(shaderNode, type); String shaderPath = shaderNode.getDefinition().getShadersPath().get(index);
/** * Stores a global output. * * @param var the variable to store. * @param varStatement the statement being read. * @throws MatParseException if we have duplicates of a global vertex output variable. */ public void storeGlobal(ShaderNodeVariable var, Statement varStatement) throws MatParseException { var.setShaderOutput(true); final ShaderGenerationInfo generationInfo = techniqueDef.getShaderGenerationInfo(); final ShaderNodeDefinition definition = shaderNode.getDefinition(); if (definition.getType() == ShaderType.Vertex) { ShaderNodeVariable global = generationInfo.getVertexGlobal(); if (global != null) { if (!global.getName().equals(var.getName())) { throw new MatParseException("A global output is already defined for the vertex shader: " + global.getName() + ". vertex shader can only have one global output", varStatement); } } else { generationInfo.setVertexGlobal(var); } } else if (definition.getType() == ShaderType.Fragment) { storeVariable(var, generationInfo.getFragmentGlobals()); } }
storeGlobal(right, statement); } else if (right.getNameSpace().equals(ShaderGenerator.NAME_SPACE_VERTEX_ATTRIBUTE)) { if (definition.getType() == ShaderType.Fragment) { throw new MatParseException("Cannot have an attribute as input in a fragment shader" + right.getName(), statement); if (definition.getType() == ShaderType.Vertex) { if (updateRightFromUniforms(param, mapping, vertexDeclaredUniforms, statement)) { updateMaterialTextureType(statement, mapping, left, param); if (definition.getType() == ShaderType.Vertex) { if (updateRightFromUniforms(worldParam, mapping, vertexDeclaredUniforms)) { storeVertexUniform(mapping.getRightVariable());
private void writeShaderNodes(TechniqueDef techniqueDef, Collection<MatParam> matParams, OutputStreamWriter out) throws IOException { out.write(" VertexShaderNodes {\n"); for (ShaderNode shaderNode : techniqueDef.getShaderNodes()) { if(shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex){ writeShaderNode(out, shaderNode, matParams); } } out.write(" }\n\n"); out.write(" FragmentShaderNodes {\n"); for (ShaderNode shaderNode : techniqueDef.getShaderNodes()) { if(shaderNode.getDefinition().getType() == Shader.ShaderType.Fragment){ writeShaderNode(out, shaderNode, matParams); } } out.write(" }\n\n"); }
continue; if (shaderNode.getDefinition().getType() == type) { int index = findShaderIndexFromVersion(shaderNode, type); String shaderPath = shaderNode.getDefinition().getShadersPath().get(index);
/** * stores a global output * * @param var the variable to store * @param statement1 the statement being read * @throws IOException */ public void storeGlobal(ShaderNodeVariable var, Statement statement1) throws IOException { var.setShaderOutput(true); if (shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex) { ShaderNodeVariable global = techniqueDef.getShaderGenerationInfo().getVertexGlobal(); if (global != null) { if (!global.getName().equals(var.getName())) { throw new MatParseException("A global output is already defined for the vertex shader: " + global.getName() + ". vertex shader can only have one global output", statement1); } } else { techniqueDef.getShaderGenerationInfo().setVertexGlobal(var); } } else if (shaderNode.getDefinition().getType() == Shader.ShaderType.Fragment) { storeVariable(var, techniqueDef.getShaderGenerationInfo().getFragmentGlobals()); } }
if (shaderNode.getDefinition().getType() == Shader.ShaderType.Fragment) { throw new MatParseException("Cannot have an attribute as input in a fragment shader" + right.getName(), statement1); throw new MatParseException("Could not find a Material Parameter named " + right.getName(), statement1); if (shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex) { if (updateRightFromUniforms(param, mapping, vertexDeclaredUniforms, statement1)) { updateMaterialTextureType(statement1, mapping, left, param); throw new MatParseException("Could not find a World Parameter named " + right.getName(), statement1); if (shaderNode.getDefinition().getType() == Shader.ShaderType.Vertex) { if (updateRightFromUniforms(worldParam, mapping, vertexDeclaredUniforms)) { storeVertexUniform(mapping.getRightVariable());