-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from johanhelsing/bevy-0.11
Port to Bevy 0.11
- Loading branch information
Showing
44 changed files
with
333 additions
and
219 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
#define_import_path smud::outline | ||
|
||
#import smud | ||
|
||
fn fill(d: f32, color: vec4<f32>) -> vec4<f32> { | ||
let d_2 = abs(d - 1.) - 1.; | ||
let a = sd_fill_alpha_fwidth(d_2); | ||
let a = smud::sd_fill_alpha_fwidth(d_2); | ||
return vec4<f32>(color.rgb, a * color.a); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#define_import_path smud::simple_fill | ||
|
||
#import smud | ||
|
||
fn fill(d: f32, color: vec4<f32>) -> vec4<f32> { | ||
let a = sd_fill_alpha_fwidth(d); | ||
let a = smud::sd_fill_alpha_fwidth(d); | ||
return vec4<f32>(color.rgb, a * color.a); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#define_import_path smud::fragment | ||
|
||
#import smud::sdf as sdf | ||
#import smud::fill as fill | ||
|
||
struct FragmentInput { | ||
@location(0) color: vec4<f32>, | ||
@location(1) pos: vec2<f32>, | ||
}; | ||
|
||
@fragment | ||
fn fragment(in: FragmentInput) -> @location(0) vec4<f32> { | ||
let d = sdf(in.pos); | ||
return fill(d, in.color); | ||
let d = sdf::sdf(in.pos); | ||
return fill::fill(d, in.color); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::blobby_cross | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
let s = 20.; | ||
return (sd_blobby_cross(p / s, 0.7) * s) - 4.; | ||
return (smud::sd_blobby_cross(p / s, 0.7) * s) - 4.; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::box | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_box(p, vec2<f32>(30., 20.)); | ||
return smud::sd_box(p, vec2<f32>(30., 20.)); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::circle | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_circle(p, 25.); | ||
return smud::sd_circle(p, 25.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::donut | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return abs(sd_circle(p, 18.)) - 3.; | ||
return abs(smud::sd_circle(p, 18.)) - 3.; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::egg | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_egg(p, 25., 10.); | ||
return smud::sd_egg(p, 25., 10.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::ellipse | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_ellipse(p, 25., 15.); | ||
return smud::sd_ellipse(p, 25., 15.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::heart | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_heart((p / 40.) - vec2<f32>(0., -0.5)) * 40.; | ||
return smud::sd_heart((p / 40.) - vec2<f32>(0., -0.5)) * 40.; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::hexagon | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_hexagon(p, 20.); | ||
return smud::sd_hexagon(p, 20.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::horseshoe | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_horseshoe(p, sin_cos(0.4), 17., vec2<f32>(6., 4.)); | ||
return smud::sd_horseshoe(p, smud::sin_cos(0.4), 17., vec2<f32>(6., 4.)); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::moon | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_moon(p, 10., 25., 20.); | ||
return smud::sd_moon(p, 10., 25., 20.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::pie | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_pie(p, sin_cos(0.8), 25.); | ||
return smud::sd_pie(p, smud::sin_cos(0.8), 25.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::horseshoe | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_rounded_x(p, 30., 4.); | ||
return smud::sd_rounded_x(p, 30., 4.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::segment | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_segment(p, vec2<f32>(-13.), vec2<f32>(13.)) - 3.; | ||
return smud::sd_segment(p, vec2<f32>(-13.), vec2<f32>(13.)) - 3.; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::stairs | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
let s = 5.; | ||
let p = p - vec2<f32>(-20.); | ||
return sd_stairs(p / s, vec2<f32>(1.), 8.) * s; | ||
return smud::sd_stairs(p / s, vec2<f32>(1.), 8.) * s; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::star_4 | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_star(p * 0.5, 10., 4, 3.0); | ||
return smud::sd_star(p * 0.5, 10., 4, 3.0); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::star_5 | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_star_5(p, 10., 2.); | ||
return smud::sd_star_5_(p, 10., 2.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::triangle | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_equilateral_triangle(p, 20.); | ||
return smud::sd_equilateral_triangle(p, 20.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#import bevy_smud::shapes | ||
#define_import_path smud::gallery::vesica | ||
|
||
#import smud | ||
|
||
fn sdf(p: vec2<f32>) -> f32 { | ||
return sd_vesica(p, 30., 15.); | ||
return smud::sd_vesica(p, 30., 15.); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
type float4 = vec4<f32>; | ||
type float3 = vec3<f32>; | ||
type float = f32; | ||
#define_import_path smud::prelude | ||
|
||
alias float4 = vec4<f32>; | ||
alias float3 = vec3<f32>; | ||
alias float = f32; | ||
|
||
const PI: f32 = 3.141592653589793; |
Oops, something went wrong.