Exemple #1
0
        public Background(Vector3DF color, Vector3DF light)
        {
            byte[] shader_code =
                Engine.Graphics.GraphicsDeviceType == GraphicsDeviceType.OpenGL
                ? Engine.File.CreateStaticFile("Shaders/BackEffect.glsl").Buffer
                : Engine.Graphics.GraphicsDeviceType == GraphicsDeviceType.DirectX11
                ? Engine.File.CreateStaticFile("Shaders/BackEffect.hlsl").Buffer
                : new byte[0];

            // マテリアルを作成する
            material = Engine.Graphics.CreateMaterial2D(
                Engine.Graphics.CreateShader2D(
                    new UTF8Encoding().GetString(shader_code)
                    )
                );

            // ストップウォッチを作成する
            stopwatch = new Stopwatch();

            // マテリアル内の変数を設定する
            material.SetVector2DF("resolution", Engine.WindowSize.To2DF());
            material.SetVector3DF("color", color);
            material.SetVector3DF("light", light);

            // ストップウォッチを起動させる
            stopwatch.Start();
        }
Exemple #2
0
            protected override void OnDraw(asd.RenderTexture2D dst, asd.RenderTexture2D src)
            {
                m_material2d.SetTexture2D("g_texture", src);
                m_material2d.SetVector3DF("g_values", new Vector3DF(640, 480, 200));

                DrawOnTexture2DWithMaterial(dst, m_material2d);
            }