コード例 #1
0
ファイル: MagicBackground.cs プロジェクト: mokujin/DN
        public MagicBackground()
        {
            shader = new Shader();

            float v = Shader.Version;

            shader.LoadVertexFile(Path.Combine("Effects", v < 3.3f ? "v12" : "v33", "magic_background.vert"));
            shader.LoadFragmentFile(Path.Combine("Effects", v < 3.3f ? "v12" : "v33", "magic_background.frag"));

            shader.Link();

            buffer = new VertexBuffer(4);
            buffer.DeclareNextAttribute("vposition", 2);
            buffer.DeclareNextAttribute("vtexcoord", 2);
            buffer.DeclareNextAttribute("vcolor", 4);

            buffer.Attach(shader);

            buffer.AddVertex(-1, -1, 0, 0, 1f, 1f, 1f, 1f);
            buffer.AddVertex(1, -1, 1, 0, 1f, 1f, 1f, 1f);
            buffer.AddVertex(1, 1, 1, 1, 1, 1, 1, 1);
            buffer.AddVertex(-1, 1, 0, 1, 1, 1, 1, 1);
            buffer.AddIndices(0, 1, 2, 0, 2, 3);
            buffer.UpdateBuffer();
        }
コード例 #2
0
ファイル: BloodSystem.cs プロジェクト: mokujin/DN
        public void Init()
        {
            blood_blend_shader = new Shader();

            float v = Shader.Version;

            blood_blend_shader.LoadVertexFile(Path.Combine("Effects", v < 3.3f ? "v12" : "v33", "blood_blend.vert"));
            blood_blend_shader.LoadFragmentFile(Path.Combine("Effects", v < 3.3f ? "v12" : "v33", "blood_blend.frag"));

            blood_blend_shader.Link();

            blend_buffer = new VertexBuffer(4);
            blend_buffer.DeclareNextAttribute("vposition", 2);
            blend_buffer.DeclareNextAttribute("vtexcoord", 2);
            blend_buffer.DeclareNextAttribute("vcolor", 4);

            blend_buffer.Attach(blood_blend_shader);
            blend_buffer.AddVertex(-1, -1, 0, 0, 1f, 1f, 1f, 1f);
            blend_buffer.AddVertex(1, -1, 1, 0, 1f, 1f, 1f, 1f);
            blend_buffer.AddVertex(1, 1, 1, 1, 1, 1, 1, 1);
            blend_buffer.AddVertex(-1, 1, 0, 1, 1, 1, 1, 1);
            blend_buffer.AddIndices(0, 1, 2, 0, 2, 3);
            blend_buffer.UpdateBuffer();
        }