A game framework written with osu! in mind.
at master 34 lines 1.0 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using System; 5using osuTK; 6using osu.Framework.Graphics.Sprites; 7using osu.Framework.Graphics.OpenGL.Vertices; 8 9namespace osu.Framework.Graphics.Video 10{ 11 internal class VideoSpriteDrawNode : SpriteDrawNode 12 { 13 public VideoSpriteDrawNode(Video source) 14 : base(source.Sprite) 15 { 16 yuvCoeff = source.ConversionMatrix; 17 } 18 19 private Matrix3 yuvCoeff; 20 21 private int yLoc, uLoc = 1, vLoc = 2; 22 23 public override void Draw(Action<TexturedVertex2D> vertexAction) 24 { 25 Shader.GetUniform<int>("m_SamplerY").UpdateValue(ref yLoc); 26 Shader.GetUniform<int>("m_SamplerU").UpdateValue(ref uLoc); 27 Shader.GetUniform<int>("m_SamplerV").UpdateValue(ref vLoc); 28 29 Shader.GetUniform<Matrix3>("yuvCoeff").UpdateValue(ref yuvCoeff); 30 31 base.Draw(vertexAction); 32 } 33 } 34}