Beispiel #1
0
        public override void Draw(IDrawDevice device)
        {
            DrawDesignTimeVisuals(device);

            if (State != MediaState.Playing)
            {
                return;
            }

            if (_theoraVideo == null || _theoraVideo.ElapsedMilliseconds == 0)
            {
                return;
            }

            Texture.Bind(_textureOne);
            GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _theoraVideo.Width, _theoraVideo.Height, PixelFormat.Luminance, PixelType.UnsignedByte,
                             _theoraVideo.GetYColorPlane());

            Texture.Bind(_textureTwo);
            GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _theoraVideo.Width / 2, _theoraVideo.Height / 2, PixelFormat.Luminance, PixelType.UnsignedByte,
                             _theoraVideo.GetCbColorPlane());

            Texture.Bind(_textureThree);
            GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _theoraVideo.Width / 2, _theoraVideo.Height / 2, PixelFormat.Luminance, PixelType.UnsignedByte,
                             _theoraVideo.GetCrColorPlane());

            var drawTechnique = (OgvDrawTechnique)Material.Res.Technique.Res;

            drawTechnique.TextureOne   = _textureOne;
            drawTechnique.TextureTwo   = _textureTwo;
            drawTechnique.TextureThree = _textureThree;

            var rect = GetScreenRect();
            var z    = GameObj.Transform == null ? 0 : GameObj.Transform.Pos.Z;

            if (_canvas == null)
            {
                _canvas = new Canvas(device);
                _canvas.State.SetMaterial(Material);
            }

            _canvas.State.ColorTint = ColourTint;
            _canvas.FillRect(rect.X, rect.Y, z, rect.W, rect.H);
        }