-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a 'Shape' class to the 'display' package #239
base: master
Are you sure you want to change the base?
Conversation
Added a Shape display class that is assembled by adding various primitives together and can be transformed like any Sprite object. Currently it only supports line segments (with rounded caps), but can be easily enhanced to do other shapes like rectangles and circles.
This looks awesome! Do you think there's a chance to add fill to this class too? Any kind of drawing api would really help us out here. |
I do want to add to this, and can probably whip up a quick rectangle or circle fill. If you're hoping for a line strip fill kinda like how Adobe Illustrator handles the pen tool, that would require some research on my end as I'm not sure how to triangulate polygonal shapes. I'm not sure of the direction Flambe wants to go with its drawing API. I just threw this together because I really needed line drawing with rounded caps, and hoped others could benefit as well. You can basically make filled circles now by using a line segment with zero length and rounded caps like: I'm not sure if people would consider that "hacky" though. |
@OvertureGames Very cool project, how far is this already? Beside addLineSegmentF with all those parameters, I would prefer to see such functions, to have understandable api.
|
@markknol I like your functions better and it conforms to most already existing drawing API's. I'll see about replacing the existing functions with the ones you listed there. Maybe I'll find some time to do so over this weekend. |
Really cool! I would love to see this merged into master 👍 |
👍 for implementing this "natively" by adding new Graphics methods. Rendering circles by drawing lots of thick lines seems like the wrong approach. I think the very first step here should be implementing something like |
@aduros I think the |
Would there be any downside to using this pull request until we have Graphics.drawTriangles implemented? I could really use this on a project coming up. |
I agree with @volkipp, is there any harm in allowing this starter version to be released and modify it over time? |
What is the state of this pull request? |
Unfortunately I don't think I will find time in the near future to further contribute to this pull request. |
Added a Shape display class that is assembled by adding various primitives together and can be transformed like any Sprite object. Currently it only supports line segments (with rounded caps), but can be easily enhanced to do other shapes like rectangles and circles.
The pull request includes a new file "Shape.hx" that resides in the 'display' package, and some modifications to the three 'Graphics' renderers (canvas, webGL, stage3D). Canvas implementation was straight forward. As for the other two, I've ensured to stay consistent with the current underlying architecture of drawing with quads, and the lines/caps are essentially just a series of fancy fillRect's that share the same vertex buffer attributes and shader.
(I've closed my last pull request #235 due to the sloppy form of not using branches, this should be easier to look at and discuss if interested)