Exemple #1
0
        public static ShaderProgram LoadShader(ShaderProgramData shader_data)
        {
            var shader_program =
                GraphicsContext.CreateShaderProgram(
                    shader_data.VertexShader,
                    shader_data.FragmentShader,
                    shader_data.Samplers,
                    shader_data.Params);

            shader_program.Id = shader_data.Id;

            return(shader_program);
        }
Exemple #2
0
        public static ShaderProgramData Build(string id, string relativeVsPath, string relativeFsPath)
        {
            Console.WriteLine($"Compiling Shader: {id}");

            var result = ShaderCompiler.Compile(ResourceLoader.GetFullResourcePath(relativeVsPath), ResourceLoader.GetFullResourcePath(relativeFsPath));

            var shader_program_data = new ShaderProgramData()
            {
                Id             = id,
                VertexShader   = result.VsBytes,
                FragmentShader = result.FsBytes,
                Samplers       = result.Samplers,
                Params         = result.Params
            };

            return(shader_program_data);
        }