Esempio n. 1
0
        public override ShaderSourceContent Import(FileStream stream, ContentManager manager)
        {
            ShaderSourceContent content = new ShaderSourceContent()
            {
                FileName = stream.Name
            };

            string ext = Path.GetExtension(stream.Name);

            if (ext == ".glsl")
            {
                content.ShaderType = ShaderType;
            }
            else
            {
                content.ShaderType = ext == ".vert" ? OpenTK.Graphics.OpenGL.ShaderType.VertexShader : OpenTK.Graphics.OpenGL.ShaderType.FragmentShader;
            }

            using (StreamReader reader = new StreamReader(stream))
            {
                content.Source = reader.ReadToEnd();
            }

            if (!ShaderHelper.BuildShaderProgram(content, manager.Log))
            {
                content = null;
            }

            return(content);
        }