From 7bfc8e8ca75882de434c601c4294ca1774b69278 Mon Sep 17 00:00:00 2001 From: Anstro Pleuton <121956207+anstropleuton@users.noreply.github.com> Date: Thu, 23 Jan 2025 01:51:36 -0800 Subject: [PATCH] [example] Add shaders_rounded_rectangle example (#4719) * Add shaders_rounded_rectangle example * Minor tweaks to example template (add star, more) * Combine shaders * Fix changes after review --------- Co-authored-by: Anstro Pleuton --- examples/Makefile | 1 + examples/Makefile.Web | 1 + examples/README.md | 27 +- examples/examples_template.c | 6 +- .../shaders/glsl100/rounded_rectangle.fs | 76 ++++ .../shaders/glsl120/rounded_rectangle.fs | 74 ++++ .../shaders/glsl330/rounded_rectangle.fs | 77 ++++ examples/shaders/shaders_rounded_rectangle.c | 238 +++++++++++ .../shaders/shaders_rounded_rectangle.png | Bin 0 -> 13936 bytes .../shaders_rounded_rectangle.vcxproj | 387 ++++++++++++++++++ projects/VS2022/raylib.sln | 19 + 11 files changed, 891 insertions(+), 15 deletions(-) create mode 100644 examples/shaders/resources/shaders/glsl100/rounded_rectangle.fs create mode 100644 examples/shaders/resources/shaders/glsl120/rounded_rectangle.fs create mode 100644 examples/shaders/resources/shaders/glsl330/rounded_rectangle.fs create mode 100644 examples/shaders/shaders_rounded_rectangle.c create mode 100644 examples/shaders/shaders_rounded_rectangle.png create mode 100644 projects/VS2022/examples/shaders_rounded_rectangle.vcxproj diff --git a/examples/Makefile b/examples/Makefile index 407abd793..0a2c908a3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -634,6 +634,7 @@ SHADERS = \ shaders/shaders_palette_switch \ shaders/shaders_postprocessing \ shaders/shaders_raymarching \ + shaders/shaders_rounded_rectangle \ shaders/shaders_shadowmap \ shaders/shaders_shapes_textures \ shaders/shaders_simple_mask \ diff --git a/examples/Makefile.Web b/examples/Makefile.Web index 32d6daa57..6f060652f 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -514,6 +514,7 @@ SHADERS = \ shaders/shaders_palette_switch \ shaders/shaders_postprocessing \ shaders/shaders_raymarching \ + shaders/shaders_rounded_rectangle \ shaders/shaders_shadowmap \ shaders/shaders_shapes_textures \ shaders/shaders_simple_mask \ diff --git a/examples/README.md b/examples/README.md index ba14d82dd..c42a701a2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -199,6 +199,7 @@ Examples using raylib shaders functionality, including shaders loading, paramete | 138 | [shaders_write_depth](shaders/shaders_write_depth.c) | shaders_write_depth | ⭐️⭐️☆☆ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) | | 139 | [shaders_basic_pbr](shaders/shaders_basic_pbr.c) | shaders_basic_pbr | ⭐️⭐️⭐️⭐️ | 5.0 | 5.1-dev | [Afan OLOVCIC](https://github.com/_DevDad) | | 140 | [shaders_lightmap](shaders/shaders_lightmap.c) | shaders_lightmap | ⭐️⭐️⭐️☆ | 4.5 | 4.5 | [Jussi Viitala](https://github.com/nullstare) | +| 141 | [shaders_rounded_rectangle](shaders/shaders_rounded_rectangle.c) | shaders_rounded_rectangle | ⭐️⭐️⭐️☆ | 5.5 | 5.5 | [Anstro Pleuton](https://github.com/anstropleuton) | ### category: audio @@ -206,13 +207,13 @@ Examples using raylib audio functionality, including sound/music loading and pla | ## | example | image | difficulty
level | version
created | last version
updated | original
developer | |----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------| -| 141 | [audio_module_playing](audio/audio_module_playing.c) | audio_module_playing | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) | -| 142 | [audio_music_stream](audio/audio_music_stream.c) | audio_music_stream | ⭐️☆☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) | -| 143 | [audio_raw_stream](audio/audio_raw_stream.c) | audio_raw_stream | ⭐️⭐️⭐️☆ | 1.6 | 4.2 | [Ray](https://github.com/raysan5) | -| 144 | [audio_sound_loading](audio/audio_sound_loading.c) | audio_sound_loading | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) | -| 145 | [audio_mixed_processor](audio/audio_mixed_processor.c) | audio_mixed_processor | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) | -| 146 | [audio_stream_effects](audio/audio_stream_effects.c) | audio_stream_effects | ⭐️⭐️⭐️⭐️ | 4.2 | 5.0 | [Ray](https://github.com/raysan5) | -| 147 | [audio_sound_multi](audio/audio_sound_multi.c) | audio_sound_multi | ⭐️⭐️☆☆ | 4.6 | 4.6 | [Jeffery Myers](https://github.com/JeffM2501) | +| 142 | [audio_module_playing](audio/audio_module_playing.c) | audio_module_playing | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) | +| 143 | [audio_music_stream](audio/audio_music_stream.c) | audio_music_stream | ⭐️☆☆☆ | 1.3 | 4.2 | [Ray](https://github.com/raysan5) | +| 144 | [audio_raw_stream](audio/audio_raw_stream.c) | audio_raw_stream | ⭐️⭐️⭐️☆ | 1.6 | 4.2 | [Ray](https://github.com/raysan5) | +| 145 | [audio_sound_loading](audio/audio_sound_loading.c) | audio_sound_loading | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) | +| 146 | [audio_mixed_processor](audio/audio_mixed_processor.c) | audio_mixed_processor | ⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | [hkc](https://github.com/hatkidchan) | +| 147 | [audio_stream_effects](audio/audio_stream_effects.c) | audio_stream_effects | ⭐️⭐️⭐️⭐️ | 4.2 | 5.0 | [Ray](https://github.com/raysan5) | +| 148 | [audio_sound_multi](audio/audio_sound_multi.c) | audio_sound_multi | ⭐️⭐️☆☆ | 4.6 | 4.6 | [Jeffery Myers](https://github.com/JeffM2501) | ### category: others @@ -220,12 +221,12 @@ Examples showing raylib misc functionality that does not fit in other categories | ## | example | image | difficulty
level | version
created | last version
updated | original
developer | |----|----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------| -| 148 | [rlgl_standalone](others/rlgl_standalone.c) | rlgl_standalone | ⭐️⭐️⭐️⭐️ | 1.6 | 4.0 | [Ray](https://github.com/raysan5) | -| 149 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | rlgl_compute_shader | ⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) | -| 150 | [easings_testbed](others/easings_testbed.c) | easings_testbed | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) | -| 151 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | raylib_opengl_interop | ⭐️⭐️⭐️⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) | -| 152 | [embedded_files_loading](others/embedded_files_loading.c) | embedded_files_loading | ⭐️⭐️☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) | -| 153 | [raymath_vector_angle](others/raymath_vector_angle.c) | raymath_vector_angle | ⭐️⭐️☆☆ | 1.0 | 4.6 | [Ray](https://github.com/raysan5) | +| 149 | [rlgl_standalone](others/rlgl_standalone.c) | rlgl_standalone | ⭐️⭐️⭐️⭐️ | 1.6 | 4.0 | [Ray](https://github.com/raysan5) | +| 150 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | rlgl_compute_shader | ⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | [Teddy Astie](https://github.com/tsnake41) | +| 151 | [easings_testbed](others/easings_testbed.c) | easings_testbed | ⭐️⭐️⭐️☆ | 2.5 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) | +| 152 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | raylib_opengl_interop | ⭐️⭐️⭐️⭐️ | 3.8 | 4.0 | [Stephan Soller](https://github.com/arkanis) | +| 153 | [embedded_files_loading](others/embedded_files_loading.c) | embedded_files_loading | ⭐️⭐️☆☆ | 3.0 | 3.5 | [Kristian Holmgren](https://github.com/defutura) | +| 154 | [raymath_vector_angle](others/raymath_vector_angle.c) | raymath_vector_angle | ⭐️⭐️☆☆ | 1.0 | 4.6 | [Ray](https://github.com/raysan5) | As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with! diff --git a/examples/examples_template.c b/examples/examples_template.c index 0a44117b4..49136a4d4 100644 --- a/examples/examples_template.c +++ b/examples/examples_template.c @@ -56,7 +56,9 @@ /******************************************************************************************* * -* raylib [core] example - Basic window +* raylib [] example - +* +* Example complexity rating: [★☆??] ?/4 * * Example originally created with raylib 5.5, last time updated with raylib 5.5 * @@ -81,7 +83,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); + InitWindow(screenWidth, screenHeight, "raylib [] example - "); // TODO: Load resources / Initialize variables at this point diff --git a/examples/shaders/resources/shaders/glsl100/rounded_rectangle.fs b/examples/shaders/resources/shaders/glsl100/rounded_rectangle.fs new file mode 100644 index 000000000..3c8d07978 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/rounded_rectangle.fs @@ -0,0 +1,76 @@ +// Note: SDF by Iñigo Quilez is licensed under MIT License + +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +uniform vec4 rectangle; // Rectangle dimensions (x, y, width, height) +uniform vec4 radius; // Corner radius (top-left, top-right, bottom-left, bottom-right) +uniform vec4 color; + +// Shadow parameters +uniform float shadowRadius; +uniform vec2 shadowOffset; +uniform float shadowScale; +uniform vec4 shadowColor; + +// Border parameters +uniform float borderThickness; +uniform vec4 borderColor; + +// Create a rounded rectangle using signed distance field +// 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(vec2 fragCoord, vec2 center, vec2 halfSize, vec4 radius) +{ + vec2 fragFromCenter = fragCoord - center; + + // Determine which corner radius to use + radius.xy = (fragFromCenter.y > 0.0) ? radius.xy : radius.zw; + radius.x = (fragFromCenter.x < 0.0) ? radius.x : radius.y; + + // Calculate signed distance field + vec2 dist = abs(fragFromCenter) - halfSize + radius.x; + return min(max(dist.x, dist.y), 0.0) + length(max(dist, 0.0)) - radius.x; +} + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + + // Requires fragment coordinate varying pixels + vec2 fragCoord = gl_FragCoord.xy; + + // Calculate signed distance field for rounded rectangle + vec2 halfSize = rectangle.zw*0.5; + vec2 center = rectangle.xy + halfSize; + float recSDF = RoundedRectangleSDF(fragCoord, center, halfSize, radius); + + // Calculate signed distance field for rectangle shadow + vec2 shadowHalfSize = halfSize*shadowScale; + vec2 shadowCenter = center + shadowOffset; + float shadowSDF = RoundedRectangleSDF(fragCoord, shadowCenter, shadowHalfSize, radius); + + // Caculate alpha factors + float recFactor = smoothstep(1.0, 0.0, recSDF); + float shadowFactor = smoothstep(shadowRadius, 0.0, shadowSDF); + float borderFactor = smoothstep(0.0, 1.0, recSDF + borderThickness)*recFactor; + + // Multiply each color by its respective alpha factor + vec4 recColor = vec4(color.rgb, color.a*recFactor); + vec4 shadowCol = vec4(shadowColor.rgb, shadowColor.a*shadowFactor); + vec4 borderCol = vec4(borderColor.rgb, borderColor.a*borderFactor); + + // Combine the colors varying the order (shadow, rectangle, border) + gl_FragColor = mix(mix(shadowCol, recColor, recColor.a), borderCol, borderCol.a); +} \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/rounded_rectangle.fs b/examples/shaders/resources/shaders/glsl120/rounded_rectangle.fs new file mode 100644 index 000000000..eb96c28d3 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/rounded_rectangle.fs @@ -0,0 +1,74 @@ +// Note: SDF by Iñigo Quilez is licensed under MIT License + +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +uniform vec4 rectangle; // Rectangle dimensions (x, y, width, height) +uniform vec4 radius; // Corner radius (top-left, top-right, bottom-left, bottom-right) +uniform vec4 color; + +// Shadow parameters +uniform float shadowRadius; +uniform vec2 shadowOffset; +uniform float shadowScale; +uniform vec4 shadowColor; + +// Border parameters +uniform float borderThickness; +uniform vec4 borderColor; + +// Create a rounded rectangle using signed distance field +// 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(vec2 fragCoord, vec2 center, vec2 halfSize, vec4 radius) +{ + vec2 fragFromCenter = fragCoord - center; + + // Determine which corner radius to use + radius.xy = (fragFromCenter.y > 0.0) ? radius.xy : radius.zw; + radius.x = (fragFromCenter.x < 0.0) ? radius.x : radius.y; + + // Calculate signed distance field + vec2 dist = abs(fragFromCenter) - halfSize + radius.x; + return min(max(dist.x, dist.y), 0.0) + length(max(dist, 0.0)) - radius.x; +} + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + + // Requires fragment coordinate varying pixels + vec2 fragCoord = gl_FragCoord.xy; + + // Calculate signed distance field for rounded rectangle + vec2 halfSize = rectangle.zw*0.5; + vec2 center = rectangle.xy + halfSize; + float recSDF = RoundedRectangleSDF(fragCoord, center, halfSize, radius); + + // Calculate signed distance field for rectangle shadow + vec2 shadowHalfSize = halfSize*shadowScale; + vec2 shadowCenter = center + shadowOffset; + float shadowSDF = RoundedRectangleSDF(fragCoord, shadowCenter, shadowHalfSize, radius); + + // Caculate alpha factors + float recFactor = smoothstep(1.0, 0.0, recSDF); + float shadowFactor = smoothstep(shadowRadius, 0.0, shadowSDF); + float borderFactor = smoothstep(0.0, 1.0, recSDF + borderThickness)*recFactor; + + // Multiply each color by its respective alpha factor + vec4 recColor = vec4(color.rgb, color.a*recFactor); + vec4 shadowCol = vec4(shadowColor.rgb, shadowColor.a*shadowFactor); + vec4 borderCol = vec4(borderColor.rgb, borderColor.a*borderFactor); + + // Combine the colors varying the order (shadow, rectangle, border) + gl_FragColor = mix(mix(shadowCol, recColor, recColor.a), borderCol, borderCol.a); +} \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/rounded_rectangle.fs b/examples/shaders/resources/shaders/glsl330/rounded_rectangle.fs new file mode 100644 index 000000000..a96c31fab --- /dev/null +++ b/examples/shaders/resources/shaders/glsl330/rounded_rectangle.fs @@ -0,0 +1,77 @@ +// Note: SDF by Iñigo Quilez is licensed under MIT License + +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +uniform vec4 rectangle; // Rectangle dimensions (x, y, width, height) +uniform vec4 radius; // Corner radius (top-left, top-right, bottom-left, bottom-right) +uniform vec4 color; + +// Shadow parameters +uniform float shadowRadius; +uniform vec2 shadowOffset; +uniform float shadowScale; +uniform vec4 shadowColor; + +// Border parameters +uniform float borderThickness; +uniform vec4 borderColor; + +// Create a rounded rectangle using signed distance field +// 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(vec2 fragCoord, vec2 center, vec2 halfSize, vec4 radius) +{ + vec2 fragFromCenter = fragCoord - center; + + // Determine which corner radius to use + radius.xy = (fragFromCenter.y > 0.0) ? radius.xy : radius.zw; + radius.x = (fragFromCenter.x < 0.0) ? radius.x : radius.y; + + // Calculate signed distance field + vec2 dist = abs(fragFromCenter) - halfSize + radius.x; + return min(max(dist.x, dist.y), 0.0) + length(max(dist, 0.0)) - radius.x; +} + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord); + + // Requires fragment coordinate in pixels + vec2 fragCoord = gl_FragCoord.xy; + + // Calculate signed distance field for rounded rectangle + vec2 halfSize = rectangle.zw*0.5; + vec2 center = rectangle.xy + halfSize; + float recSDF = RoundedRectangleSDF(fragCoord, center, halfSize, radius); + + // Calculate signed distance field for rectangle shadow + vec2 shadowHalfSize = halfSize*shadowScale; + vec2 shadowCenter = center + shadowOffset; + float shadowSDF = RoundedRectangleSDF(fragCoord, shadowCenter, shadowHalfSize, radius); + + // Caculate alpha factors + float recFactor = smoothstep(1.0, 0.0, recSDF); + float shadowFactor = smoothstep(shadowRadius, 0.0, shadowSDF); + float borderFactor = smoothstep(0.0, 1.0, recSDF + borderThickness)*recFactor; + + // Multiply each color by its respective alpha factor + vec4 recColor = vec4(color.rgb, color.a*recFactor); + vec4 shadowCol = vec4(shadowColor.rgb, shadowColor.a*shadowFactor); + vec4 borderCol = vec4(borderColor.rgb, borderColor.a*borderFactor); + + // Combine the colors in the order (shadow, rectangle, border) + finalColor = mix(mix(shadowCol, recColor, recColor.a), borderCol, borderCol.a); +} \ No newline at end of file diff --git a/examples/shaders/shaders_rounded_rectangle.c b/examples/shaders/shaders_rounded_rectangle.c new file mode 100644 index 000000000..754110d92 --- /dev/null +++ b/examples/shaders/shaders_rounded_rectangle.c @@ -0,0 +1,238 @@ +/******************************************************************************************* +* +* raylib [shaders] example - Rounded Rectangle +* +* Example complexity rating: [★★★☆] 3/4 +* +* Example originally created with raylib 5.5, last time updated with raylib 5.5 +* +* Example contributed by Anstro Pleuton (@anstropleuton) and reviewed by Ramon Santamaria (@raysan5) +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2025-2025 Anstro Pleuton (@anstropleuton) +* +********************************************************************************************/ + +#include "raylib.h" + +#if defined(PLATFORM_DESKTOP) + #define GLSL_VERSION 330 +#else // PLATFORM_ANDROID, PLATFORM_WEB + #define GLSL_VERSION 100 +#endif + +//------------------------------------------------------------------------------------ +// Declare custom Structs +//------------------------------------------------------------------------------------ + +// Rounded rectangle data +typedef struct { + Vector4 cornerRadius; // Individual corner radius (top-left, top-right, bottom-left, bottom-right) + + // Shadow variables + float shadowRadius; + Vector2 shadowOffset; + float shadowScale; + + // Border variables + float borderThickness; // Inner-border thickness + + // Shader locations + int rectangleLoc; + int radiusLoc; + int colorLoc; + int shadowRadiusLoc; + int shadowOffsetLoc; + int shadowScaleLoc; + int shadowColorLoc; + int borderThicknessLoc; + int borderColorLoc; +} RoundedRectangle; + +//------------------------------------------------------------------------------------ +// Module Functions Declaration +//------------------------------------------------------------------------------------ + +// Create a rounded rectangle and set uniform locations +static RoundedRectangle CreateRoundedRectangle(Vector4 cornerRadius, float shadowRadius, Vector2 shadowOffset, float shadowScale, float borderThickness, Shader shader); + +// Update rounded rectangle uniforms +static void UpdateRoundedRectangle(RoundedRectangle rec, Shader shader); + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + const Color rectangleColor = BLUE; + const Color shadowColor = DARKBLUE; + const Color borderColor = SKYBLUE; + + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Rounded Rectangle"); + + // Load the shader + Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base.vs", GLSL_VERSION), + TextFormat("resources/shaders/glsl%i/rounded_rectangle.fs", GLSL_VERSION)); + + // Create a rounded rectangle + RoundedRectangle roundedRectangle = CreateRoundedRectangle( + (Vector4){ 5.0f, 10.0f, 15.0f, 20.0f }, // Corner radius + 20.0f, // Shadow radius + (Vector2){ 0.0f, -5.0f }, // Shadow offset + 0.95f, // Shadow scale + 5.0f, // Border thickness + shader // Shader + ); + + // Update shader uniforms + UpdateRoundedRectangle(roundedRectangle, shader); + + SetTargetFPS(60); + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + // Draw rectangle box with rounded corners using shader + Rectangle rec = { 50, 70, 110, 60 }; + DrawRectangleLines(rec.x - 20, rec.y - 20, rec.width + 40, rec.height + 40, DARKGRAY); + DrawText("Rounded rectangle", rec.x - 20, rec.y - 35, 10, DARKGRAY); + + // Flip Y axis to match shader coordinate system + rec.y = screenHeight - rec.y - rec.height; + SetShaderValue(shader, roundedRectangle.rectangleLoc, (float[]){ rec.x, rec.y, rec.width, rec.height }, SHADER_UNIFORM_VEC4); + + // Only rectangle color + SetShaderValue(shader, roundedRectangle.colorLoc, (float[]) { rectangleColor.r/255.0f, rectangleColor.g/255.0f, rectangleColor.b/255.0f, rectangleColor.a/255.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.shadowColorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.borderColorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + + BeginShaderMode(shader); + DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); + EndShaderMode(); + + + + // Draw rectangle shadow using shader + rec = (Rectangle){ 50, 200, 110, 60 }; + DrawRectangleLines(rec.x - 20, rec.y - 20, rec.width + 40, rec.height + 40, DARKGRAY); + DrawText("Rounded rectangle shadow", rec.x - 20, rec.y - 35, 10, DARKGRAY); + + rec.y = screenHeight - rec.y - rec.height; + SetShaderValue(shader, roundedRectangle.rectangleLoc, (float[]){ rec.x, rec.y, rec.width, rec.height }, SHADER_UNIFORM_VEC4); + + // Only shadow color + SetShaderValue(shader, roundedRectangle.colorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.shadowColorLoc, (float[]) { shadowColor.r/255.0f, shadowColor.g/255.0f, shadowColor.b/255.0f, shadowColor.a/255.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.borderColorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + + BeginShaderMode(shader); + DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); + EndShaderMode(); + + + + // Draw rectangle's border using shader + rec = (Rectangle){ 50, 330, 110, 60 }; + DrawRectangleLines(rec.x - 20, rec.y - 20, rec.width + 40, rec.height + 40, DARKGRAY); + DrawText("Rounded rectangle border", rec.x - 20, rec.y - 35, 10, DARKGRAY); + + rec.y = screenHeight - rec.y - rec.height; + SetShaderValue(shader, roundedRectangle.rectangleLoc, (float[]){ rec.x, rec.y, rec.width, rec.height }, SHADER_UNIFORM_VEC4); + + // Only border color + SetShaderValue(shader, roundedRectangle.colorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.shadowColorLoc, (float[]) { 0.0f, 0.0f, 0.0f, 0.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.borderColorLoc, (float[]) { borderColor.r/255.0f, borderColor.g/255.0f, borderColor.b/255.0f, borderColor.a/255.0f }, SHADER_UNIFORM_VEC4); + + BeginShaderMode(shader); + DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); + EndShaderMode(); + + + + // Draw one more rectangle with all three colors + rec = (Rectangle){ 240, 80, 500, 300 }; + DrawRectangleLines(rec.x - 30, rec.y - 30, rec.width + 60, rec.height + 60, DARKGRAY); + DrawText("Rectangle with all three combined", rec.x - 30, rec.y - 45, 10, DARKGRAY); + + rec.y = screenHeight - rec.y - rec.height; + SetShaderValue(shader, roundedRectangle.rectangleLoc, (float[]){ rec.x, rec.y, rec.width, rec.height }, SHADER_UNIFORM_VEC4); + + // All three colors + SetShaderValue(shader, roundedRectangle.colorLoc, (float[]) { rectangleColor.r/255.0f, rectangleColor.g/255.0f, rectangleColor.b/255.0f, rectangleColor.a/255.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.shadowColorLoc, (float[]) { shadowColor.r/255.0f, shadowColor.g/255.0f, shadowColor.b/255.0f, shadowColor.a/255.0f }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, roundedRectangle.borderColorLoc, (float[]) { borderColor.r/255.0f, borderColor.g/255.0f, borderColor.b/255.0f, borderColor.a/255.0f }, SHADER_UNIFORM_VEC4); + + BeginShaderMode(shader); + DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); + EndShaderMode(); + + DrawText("(c) Rounded rectangle SDF by Iñigo Quilez. MIT License.", screenWidth - 300, screenHeight - 20, 10, BLACK); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + UnloadShader(shader); // Unload shader + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} + +//------------------------------------------------------------------------------------ +// Module Functions Definitions +//------------------------------------------------------------------------------------ + +// Create a rounded rectangle and set uniform locations +RoundedRectangle CreateRoundedRectangle(Vector4 cornerRadius, float shadowRadius, Vector2 shadowOffset, float shadowScale, float borderThickness, Shader shader) +{ + RoundedRectangle rec; + rec.cornerRadius = cornerRadius; + rec.shadowRadius = shadowRadius; + rec.shadowOffset = shadowOffset; + rec.shadowScale = shadowScale; + rec.borderThickness = borderThickness; + + // Get shader uniform locations + rec.rectangleLoc = GetShaderLocation(shader, "rectangle"); + rec.radiusLoc = GetShaderLocation(shader, "radius"); + rec.colorLoc = GetShaderLocation(shader, "color"); + rec.shadowRadiusLoc = GetShaderLocation(shader, "shadowRadius"); + rec.shadowOffsetLoc = GetShaderLocation(shader, "shadowOffset"); + rec.shadowScaleLoc = GetShaderLocation(shader, "shadowScale"); + rec.shadowColorLoc = GetShaderLocation(shader, "shadowColor"); + rec.borderThicknessLoc = GetShaderLocation(shader, "borderThickness"); + rec.borderColorLoc = GetShaderLocation(shader, "borderColor"); + + UpdateRoundedRectangle(rec, shader); + + return rec; +} + +// Update rounded rectangle uniforms +void UpdateRoundedRectangle(RoundedRectangle rec, Shader shader) +{ + SetShaderValue(shader, rec.radiusLoc, (float[]){ rec.cornerRadius.x, rec.cornerRadius.y, rec.cornerRadius.z, rec.cornerRadius.w }, SHADER_UNIFORM_VEC4); + SetShaderValue(shader, rec.shadowRadiusLoc, &rec.shadowRadius, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, rec.shadowOffsetLoc, (float[]){ rec.shadowOffset.x, rec.shadowOffset.y }, SHADER_UNIFORM_VEC2); + SetShaderValue(shader, rec.shadowScaleLoc, &rec.shadowScale, SHADER_UNIFORM_FLOAT); + SetShaderValue(shader, rec.borderThicknessLoc, &rec.borderThickness, SHADER_UNIFORM_FLOAT); +} diff --git a/examples/shaders/shaders_rounded_rectangle.png b/examples/shaders/shaders_rounded_rectangle.png new file mode 100644 index 0000000000000000000000000000000000000000..0d8c2b5f41e887c4558c2c8c594912ca797e2036 GIT binary patch literal 13936 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYU_8XZ#=yWJp1k%10|Ns~v6E*A2L}g74M$1` z0|SF(iEBhjaDG}zd16s2Lwa6*ZmMo^a#3n(UU5c#$$RGgb_@&*x*$c)MX8A;nfZAN zA(^?U3?Zed3Py$sUWs`MMg~Tv3I^s@h9*`9W(onm3IV|(9ZxLpGcYJHc)B=-RLpsM zH@ipYWu^SL<@Z*-n`fC`8JVT|Drr_sr%~lJHBrkTl_S^AZq${Y#^UTQpCT{O!Q|o~ zQ18>iazUK==e!z@1ZNH*%LAvxCM2^6Fa!(~F?_2wP z^ICgxh8=xLbNT=MdcA&q%{%${Z8NWb{%7@fH#>vgwrdPU6F>XiiL3wnl{^1^{rQ*Y z*H`tN?)$r^Ft+s1^V+w&l6SrN(JyBkC3*hkdGo{?aocx#x1V1B96Gno?z!xDwe!zi z=O6C=ljnE;|F&cN47>BzGCtWmJShr+2^Gza#s$ksrg3Y-vN**Lz+%Z!cW> zM{k`@TxyKDbf2rDcZsWR7f6Z%kW4@|OX7;cDzGj!z{#74) z_NmJ9{;qSgugN*gG2qJ<{@+;txYs=IsfD|{`^O(2A8*~aY|lK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ELDT=+=o`ro^D=Rfy-U$p=A?V@{+?{0A_3=iJ3?$?d;yZ`Q5e|xpeb2YG^ zKL2ugcPVym!M+!T*Dcq*{_-m3X?5h+JrBz7&VRV<@0s<#Z|&9Ca_`yw1_maEIoYz| z#qVEj%zM0}yfC%yvR~Nti{1O&^ncyU&HZ5a*6RGjRa5tgt2Qtk=-YMf%k1tse2Uj! z-rsTVhTg8f+t%%i`?}-#-MY($G2dk7fBz9~dCoO{|J#-2;g$FPs+O<+^+W$x)T{gN zzkH8*nqGGE{eu5Be)sDp&wuY*XD2SZ*nZyXn!i@-`(OJo*G!!64oZ%{Zrx{P$eHu` z+4}oW?C$J~-8ri+{QP6r{@vR4_iGn2F)>&_(o#?GyVSN(+gm(8%l}+v-1Xb8te|0R rpQ!H)3=9o_6+z>d#LrB8{?DwFJ+Jve#pjO<3=9mOu6{1-oD!M + + + + Debug.DLL + Win32 + + + Debug.DLL + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release.DLL + Win32 + + + Release.DLL + x64 + + + Release + Win32 + + + Release + x64 + + + + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4} + Win32Proj + shaders_rounded_rectangle + 10.0 + shaders_rounded_rectangle + + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + Copy Debug DLL to output directory + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + Copy Debug DLL to output directory + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + + + Copy Release DLL to output directory + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + + + Copy Release DLL to output directory + + + + + + + + {e89d61ac-55de-4482-afd4-df7242ebc859} + + + + + + \ No newline at end of file diff --git a/projects/VS2022/raylib.sln b/projects/VS2022/raylib.sln index f4f0600e1..8f3323bc8 100644 --- a/projects/VS2022/raylib.sln +++ b/projects/VS2022/raylib.sln @@ -307,6 +307,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_bone_socket", "examp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_vertex_displacement", "examples\shaders_vertex_displacement.vcxproj", "{CCA63A76-D9FC-4130-9F67-4D97F9770D53}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_rounded_rectangle", "examples\shaders_rounded_rectangle.vcxproj", "{D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug.DLL|x64 = Debug.DLL|x64 @@ -2615,6 +2617,22 @@ Global {CCA63A76-D9FC-4130-9F67-4D97F9770D53}.Release|x64.Build.0 = Release|x64 {CCA63A76-D9FC-4130-9F67-4D97F9770D53}.Release|x86.ActiveCfg = Release|Win32 {CCA63A76-D9FC-4130-9F67-4D97F9770D53}.Release|x86.Build.0 = Release|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x64.ActiveCfg = Debug|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x64.Build.0 = Debug|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x86.ActiveCfg = Debug|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x86.Build.0 = Debug|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x64.ActiveCfg = Release|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x64.Build.0 = Release|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.ActiveCfg = Release|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2771,6 +2789,7 @@ Global {0981CA28-E4A5-4DF1-987F-A41D09131EFC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {3A7FE53D-35F7-49DC-9C9A-A5204A53523F} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {CCA63A76-D9FC-4130-9F67-4D97F9770D53} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}