Skip to content
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

[example] Add shaders_rounded_rectangle example #4719

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

anstropleuton
Copy link
Contributor

@anstropleuton anstropleuton commented Jan 22, 2025

Add a new shader example: shaders_rounded_rectangle!

This example demonstrates how to use three shaders to create a rounded rectangle with shadow and border. Thanks to Iñigo Quilez for providing Signed Distance Functions for the rounded rectangle!

Screenshot:

shaders_rounded_rectangle

Regarding the edit on example template:

  • Added star template ()
  • Replaced [core] and basic window with [] and name

Missing/TODO:

  • Add and test for web
  • Check rating star, I did it 2-star but I am not sure about that.

@anstropleuton
Copy link
Contributor Author

I've added a commit to combine the three shaders into one shader as requested, and I have also gone ahead and defined two functions to make the code a bit more organized in an easy-to-digest manner

examples/shaders/shaders_rounded_rectangle.c Dismissed Show dismissed Hide dismissed
examples/Makefile Outdated Show resolved Hide resolved
examples/Makefile.Web Outdated Show resolved Hide resolved
// Thanks to Iñigo Quilez (https://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm)
// And thanks to inobelar (https://www.shadertoy.com/view/fsdyzB) for shader
// MIT License
float RoundedRectangleSDF(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, could you align parameters in a single line?

examples/shaders/shaders_rounded_rectangle.c Outdated Show resolved Hide resolved
@raysan5
Copy link
Owner

raysan5 commented Jan 23, 2025

@anstropleuton Hi! I added some points to review!

@raysan5 raysan5 merged commit 7bfc8e8 into raysan5:master Jan 23, 2025
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Jan 23, 2025

@anstropleuton thanks for this new example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants