A game framework written with osu! in mind.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix black square around triangles due to front-to-back

+45 -11
+32
osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackTriangle.cs
··· 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 + 4 + using osu.Framework.Graphics; 5 + using osu.Framework.Graphics.Shapes; 6 + using osuTK; 7 + using osuTK.Graphics; 8 + 9 + namespace osu.Framework.Tests.Visual.Containers 10 + { 11 + public class TestSceneFrontToBackTriangle : FrameworkTestScene 12 + { 13 + public TestSceneFrontToBackTriangle() 14 + { 15 + Children = new Drawable[] 16 + { 17 + new Box 18 + { 19 + RelativeSizeAxes = Axes.Both, 20 + Colour = Color4.LightPink 21 + }, 22 + new Triangle 23 + { 24 + Anchor = Anchor.Centre, 25 + Origin = Anchor.Centre, 26 + Size = new Vector2(200), 27 + Colour = Color4.Red 28 + } 29 + }; 30 + } 31 + } 32 + }
+1 -7
osu.Framework/Graphics/Shapes/Triangle.cs
··· 48 48 new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height), TextureCoords); 49 49 } 50 50 51 - protected override void DrawOpaqueInterior(Action<TexturedVertex2D> vertexAction) 51 + protected override void BlitOpaqueInterior(Action<TexturedVertex2D> vertexAction) 52 52 { 53 - base.DrawOpaqueInterior(vertexAction); 54 - 55 - TextureShader.Bind(); 56 - 57 53 var triangle = toTriangle(ConservativeScreenSpaceDrawQuad); 58 54 59 55 if (GLWrapper.IsMaskingActive) 60 56 DrawClipped(ref triangle, Texture, DrawColourInfo.Colour, vertexAction: vertexAction); 61 57 else 62 58 DrawTriangle(Texture, triangle, DrawColourInfo.Colour, vertexAction: vertexAction); 63 - 64 - TextureShader.Unbind(); 65 59 } 66 60 } 67 61 }
+12 -4
osu.Framework/Graphics/Sprites/SpriteDrawNode.cs
··· 63 63 null, TextureCoords); 64 64 } 65 65 66 + protected virtual void BlitOpaqueInterior(Action<TexturedVertex2D> vertexAction) 67 + { 68 + if (GLWrapper.IsMaskingActive) 69 + DrawClipped(ref ConservativeScreenSpaceDrawQuad, Texture, DrawColourInfo.Colour, vertexAction: vertexAction); 70 + else 71 + DrawQuad(Texture, ConservativeScreenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction, textureCoords: TextureCoords); 72 + } 73 + 66 74 public override void Draw(Action<TexturedVertex2D> vertexAction) 67 75 { 68 76 base.Draw(vertexAction); ··· 83 91 { 84 92 base.DrawOpaqueInterior(vertexAction); 85 93 94 + if (Texture?.Available != true) 95 + return; 96 + 86 97 TextureShader.Bind(); 87 98 88 - if (GLWrapper.IsMaskingActive) 89 - DrawClipped(ref ConservativeScreenSpaceDrawQuad, Texture, DrawColourInfo.Colour, vertexAction: vertexAction); 90 - else 91 - DrawQuad(Texture, ConservativeScreenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction, textureCoords: TextureCoords); 99 + BlitOpaqueInterior(vertexAction); 92 100 93 101 TextureShader.Unbind(); 94 102 }