private static void AppendFragmentMainFunction(List <TextureRenderInfo> textures, StringBuilder shaderSource, string uv0, string normal) { GlslUtils.AppendBeginMain(shaderSource); AppendMainFunctionBody(textures, shaderSource, uv0, normal); GlslUtils.AppendEndMain(shaderSource); }
private static void AppendVertexMainFunction(List <VertexAttributeRenderInfo> attributes, StringBuilder shaderSource) { GlslUtils.AppendBeginMain(shaderSource); GlslUtils.AppendVertexOutputAssignments(attributes, shaderSource); GlslUtils.AppendPositionAssignment(shaderSource, attributes); GlslUtils.AppendEndMain(shaderSource); }
private static void AppendVertexShader(List <VertexAttributeRenderInfo> attributes, StringBuilder shaderSource) { GlslUtils.AppendShadingLanguageVersion(shaderSource); GlslUtils.AppendVertexInputs(attributes, shaderSource); GlslUtils.AppendVertexOutputs(attributes, shaderSource); GlslUtils.AppendMatrixUniform(shaderSource); AppendVertexMainFunction(attributes, shaderSource); }
private static void AppendFragmentShader(List <VertexAttributeRenderInfo> attributes, StringBuilder shaderSource) { GlslUtils.AppendShadingLanguageVersion(shaderSource); GlslUtils.AppendFragmentInputs(attributes, shaderSource); GlslUtils.AppendFragmentOutput(shaderSource); shaderSource.AppendLine($"uniform int {attribIndexName};"); AppendFragmentMainFunction(attributes, shaderSource); }
/// <summary> /// Generates a shader for rendering each of the vertex attributes individually. /// </summary> /// <param name="attributes">Attributes used to generate render modes</param> /// <param name="vertexSource">The generated GLSL vertex shader source</param> /// <param name="fragmentSource">The generated GLSL fragment shader source</param> public void CreateShader(IEnumerable <ShaderAttribute> attributes, out string vertexSource, out string fragmentSource) { // TODO: Use an enum for the uniform type. var uniforms = new List <ShaderUniform> { new ShaderUniform(MvpMatrixName, UniformType.Mat4) }; vertexSource = GlslUtils.CreateVertexShaderSource(attributes, uniforms, GlslVersionMajor, GlslVersionMinor, MvpMatrixName); fragmentSource = GlslUtils.CreateFragmentShaderSource(attributes, uniforms, GlslVersionMajor, GlslVersionMinor, AttribIndexName); }
private static void AppendFragmentShader(List <TextureRenderInfo> textures, List <VertexAttributeRenderInfo> attributes, StringBuilder shaderSource, string uv0, string normal) { GlslUtils.AppendShadingLanguageVersion(shaderSource); GlslUtils.AppendFragmentInputs(attributes, shaderSource); AppendViewNormalInput(shaderSource); GlslUtils.AppendFragmentOutput(shaderSource); AppendTextureUniforms(textures, shaderSource); GlslUtils.AppendMatrixUniform(shaderSource); shaderSource.AppendLine($"uniform int {attribIndexName};"); AppendFragmentMainFunction(textures, shaderSource, uv0, normal); }
private static void AppendFragmentMainFunction(List <VertexAttributeRenderInfo> attributes, StringBuilder shaderSource) { GlslUtils.AppendBeginMain(shaderSource); AppendMainFunctionBody(attributes, shaderSource); GlslUtils.AppendEndMain(shaderSource); }