A game framework written with osu! in mind.
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 osu.Framework.Graphics.OpenGL;
5using osu.Framework.Graphics.Shaders;
6
7namespace osu.Framework.Graphics
8{
9 public abstract class TexturedShaderDrawNode : DrawNode
10 {
11 protected IShader Shader => RequiresRoundedShader ? RoundedTextureShader : TextureShader;
12
13 protected IShader TextureShader { get; private set; }
14 protected IShader RoundedTextureShader { get; private set; }
15
16 protected new ITexturedShaderDrawable Source => (ITexturedShaderDrawable)base.Source;
17
18 protected TexturedShaderDrawNode(ITexturedShaderDrawable source)
19 : base(source)
20 {
21 }
22
23 public override void ApplyState()
24 {
25 base.ApplyState();
26
27 TextureShader = Source.TextureShader;
28 RoundedTextureShader = Source.RoundedTextureShader;
29 }
30
31 protected virtual bool RequiresRoundedShader => GLWrapper.IsMaskingActive;
32 }
33}