Open
Conversation
…nstead of drawing segments with cap types that might overlap.
Refactor: New DrawCircleLinesInternal function added for drawing circle outlines. (calculates triangles and draws them directly instead of using DrawSegment) Refactor: DrawCircleSectorLinesInternal started.
Refactor: DrawSectorLines unified into 2 variations with only 1 concrete implementation each
…ge are now the same function just with different parameters (f or start/endangle)
…stomizable points
…sitve/negative angle directions correctly.
…or improved flexibility
…Drawing for correct outline drawing.
…fill the triangles inside.
Refactor: Reformat and clean up.
…t and DrawLinesTransparent xml summaries added. Feat: DrawLinesTransparent works correctly now. (about 2x slower than the convex version but 2-4x faster than the old DrawLines version!)
…cs to PolygonMath.cs Refactor: Removed DrawLines from PolygonDrawing.cs and renamed DrawLinesTransparent to DrawLines.
…ercentageTransparent methods. Feat: Basic concept of DrawLinesPerimeterTransparent works now.
… squared and beveled corners. (end caps are still missing)
Refactor: Old commented-out code removed. Todo: Todos for xml summaries added.
…roperties to ColorRgba.cs Refactor: Some cleanup. Docs: missing xml summaries added.
Feat: DrawCircleSectorLinesClosedInternal works in the positive direction now.
…ection/angle as well.
Feat: Additional CalculateCircleDrawingParameters overload implemented. Refactor: DrawCircleSectorLinesOpenInternal without end cap parameters removed. Replaced by the same function with end cap parameters (that was already used for percentage drawing).
…egments/sideLength parameters removed. Refactor: CircleDrawing.cs all functions that do not use this Circle circle removed.
…orithms replaced with Raylib drawing algorithms (much faster than my own).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is about overhauling, cleaning, and improving Shape drawing in ShapeEngine. The main goal is to fix all outline drawing functions of closed shapes and Polyline drawing.
I am implementing custom algorithms to construct and draw triangles instead of just drawing lines with cap types. Currently, using colors with any transparency for outlines will look bad on almost all shapes (line, ray, segment are not affected). Every other shape will have overlaps in the corners that will become visible with alpha values below 255.
Current Problematic Version
New Version
Affected Functions
Below is a list of functions that are affected by this problem and need to be fixed (might be missing some functions):
At first, I did not realize how much work it would be to do this, and I just started working on this. Thankfully, I am close to the end now with most of the functions already working. Still needs complete testing to make sure all of this works!
Performance
This should (theoretically) come with performance improvements on a lot of drawing functions because they are now drawing much fewer triangles than before. The downside is that the function itself needs to do more work to calculate all the triangle points needed.
I have made some preliminary (quick) testing and so far the new functions are 50% to 400% faster than the old ones. The new functions basically always draw the minimal number of triangles needed to display the shape outline, whereas the old functions (depending on the corner points used) drew a lot of overlapping triangles in the corners. Drawing triangles and draw calls are the most expensive, so the much fewer draw calls outweigh the extra computations needed in the new functions.
In some cases I left the old functions intact because they provide a benefit/feature (end caps for instance) that the new functions do not have. The limitation I have added is that all old functions that are left set the alpha of the provided color to 255 (no transparency) now.
I will test it once I am finished. The new ones will stay no matter what because they can be used with transparent colors but I might have to add all (or a selection) of old draw functions for faster performance.