Example #1
0
        public PostEffectBase(string pathdx, string pathgl)
        {
            asd.Shader2D shader;

            if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
            {
                if (pathdx == null)
                {
                    throw new NotSupportedException();
                }
                shader = Utils.LoadShader2D(pathdx);
            }
            else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
            {
                if (pathgl == null)
                {
                    throw new NotSupportedException();
                }
                shader = Utils.LoadShader2D(pathgl);
            }
            else
            {
                throw new NotSupportedException("Unsupported platform");
            }

            if (shader == null)
            {
                throw new ArgumentException("Compiled Error");
            }

            Material2d = asd.Engine.Graphics.CreateMaterial2D(shader);
        }
Example #2
0
    public CustomPostEffect_InvertPostEffect()
    {
        // シェーダーをHLSL/GLSLから生成する。
        if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_dx_ps);
        }
        else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_gl_ps);
        }

        // シェーダーからマテリアルを生成する。
        material2d = asd.Engine.Graphics.CreateMaterial2D(shader);
    }
Example #3
0
        protected void SetMaterial()
        {
            if (asd.Engine.File.Exists(filename))
            {
                {
                    var buf = asd.Engine.File.CreateStaticFile(filename).Buffer;
                    var s   = System.Text.Encoding.UTF8.GetString(buf);

                    // シェーダーをHLSL/GLSLから生成する。
                    shader = asd.Engine.Graphics.CreateShader2D(s);

                    // シェーダーからマテリアルを生成する。
                    material2d = asd.Engine.Graphics.CreateMaterial2D(shader);
                }
            }
            else
            {
                Console.WriteLine($"File '{filename}' does not exist");
            }
        }
Example #4
0
            public PostEffect(asd.Graphics g)
            {
                if (g.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
                {
                    m_shader = g.CreateShader2D(
                        shader2d_dx_ps
                        );
                }
                else if (g.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
                {
                    m_shader = g.CreateShader2D(
                        shader2d_gl_ps
                        );
                }
                else
                {
                    throw new Exception();
                }

                m_material2d = g.CreateMaterial2D(m_shader);
            }
Example #5
0
    public InvertedDrawnObject2D()
    {
        // シェーダーをHLSL/GLSLから生成する。
        if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_dx_ps);
        }
        else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_gl_ps);
        }

        // シェーダーからマテリアルを生成する。
        material2d = asd.Engine.Graphics.CreateMaterial2D(shader);

        // 画像を読み込む。
        texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Picture1.png");

        // 画像を設定する。
        material2d.SetTexture2D("g_texture", texture);
        material2d.SetTextureFilterType("g_texture", asd.TextureFilterType.Linear);
        material2d.SetTextureWrapType("g_texture", asd.TextureWrapType.Repeat);
    }
Example #6
0
        public ShaderObject2DBase(string pathdx, string pathgl)
        {
            asd.Shader2D shader;

            if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
            {
                if (pathdx == null)
                {
                    throw new NotSupportedException();
                }
                shader = Utils.LoadShader2D(pathdx);
            }
            else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
            {
                if (pathgl == null)
                {
                    throw new NotSupportedException();
                }
                shader = Utils.LoadShader2D(pathgl);
            }
            else
            {
                throw new NotSupportedException("Unsupported tform");
            }

            if (shader == null)
            {
                throw new ArgumentException("Compiled Error");
            }

            Material2d = asd.Engine.Graphics.CreateMaterial2D(shader);

            OnUpdateEvent += () => {
                Material2d.SetFloat("g_second", second);
                second += 1.0f / asd.Engine.CurrentFPS;
            };
        }
        public MosaicPostEffect()
        {
            // シェーダーをHLSL/GLSLから生成する。
            if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
            {
                shader = asd.Engine.Graphics.CreateShader2D(
                    shader2d_dx_ps
                    );
            }
            else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
            {
                shader = asd.Engine.Graphics.CreateShader2D(
                    shader2d_gl_ps
                    );
            }

            // シェーダーからマテリアルを生成する。
            material2d = asd.Engine.Graphics.CreateMaterial2D(shader);
        }
Example #8
0
 public NoisePropertyBase(asd.Material2D material2d)
 {
     Material2d = material2d;
 }
Example #9
0
            public PostEffect(asd.Graphics g)
            {
                if (g.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
                {
                    m_shader = g.CreateShader2D(
                        shader2d_dx_ps
                        );
                }
                else if (g.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
                {
                    m_shader = g.CreateShader2D(
                        shader2d_gl_ps
                        );
                }
                else
                {
                    throw new Exception();
                }

                m_material2d = g.CreateMaterial2D(m_shader);
            }