Skip to content

Commit 5e2a819

Browse files
committed
Remove useless pub.
1 parent 8474e51 commit 5e2a819

30 files changed

+205
-206
lines changed

shaders/src/shader_prelude.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
pub use core::f32::consts::{FRAC_1_PI, FRAC_PI_2, PI};
1+
pub use core::f32::consts::{FRAC_1_PI, FRAC_PI_2, PI, TAU};
22
use core::ops::{Add, Mul, Sub};
3-
pub const TWO_PI: f32 = 2.0 * PI;
43
/// We can't use the `f32::consts::SQRT_3` constant here because it is an unstable library feature
54
pub const SQRT_3: f32 = 1.732_050_807_568_877_2;
65

shaders/src/shaders/a_lot_of_spheres.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
2828
Inputs { resolution, time }.main_image(color, frag_coord);
2929
}
3030

31-
pub struct Inputs {
32-
pub resolution: Vec3,
33-
pub time: f32,
31+
struct Inputs {
32+
resolution: Vec3,
33+
time: f32,
3434
}
3535

3636
const SHADOW: bool = true;
@@ -255,7 +255,7 @@ impl Inputs {
255255
color
256256
}
257257

258-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
258+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
259259
let q: Vec2 = frag_coord / self.resolution.xy();
260260
let mut p: Vec2 = Vec2::splat(-1.0) + 2.0 * q;
261261
p.x *= self.resolution.x / self.resolution.y;

shaders/src/shaders/a_question_of_time.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
4949
.main_image(color, frag_coord);
5050
}
5151

52-
pub struct Inputs {
53-
pub resolution: Vec3,
54-
pub time: f32,
55-
pub mouse: Vec4,
52+
struct Inputs {
53+
resolution: Vec3,
54+
time: f32,
55+
mouse: Vec4,
5656
}
5757

5858
// a few utility functions
@@ -75,7 +75,7 @@ fn stroke(d: f32, w: f32, s: f32, i: f32) -> f32 {
7575
}
7676
// a simple palette
7777
fn pal(d: f32) -> Vec3 {
78-
0.5 * ((TWO_PI * d * vec3(2.0, 2.0, 1.0) + vec3(0.0, 1.4, 0.0)).cos() + Vec3::ONE)
78+
0.5 * ((TAU * d * vec3(2.0, 2.0, 1.0) + vec3(0.0, 1.4, 0.0)).cos() + Vec3::ONE)
7979
}
8080
// 2d rotation matrix
8181
fn uvr_rotate(a: f32) -> Mat2 {
@@ -100,7 +100,7 @@ fn apollonian(uv: Vec2) -> Vec3 {
100100
// a DEC is a configuration of 4 circles tangent to each other
101101
// the easiest way to build the initial one it to construct a symetric Steiner Chain.
102102
// http://mathworld.wolfram.com/SteinerChain.html
103-
let a: f32 = TWO_PI / 3.;
103+
let a: f32 = TAU / 3.;
104104
let ra: f32 = 1.0 + (a * 0.5).sin();
105105
let rb: f32 = 1.0 - (a * 0.5).sin();
106106
dec[0] = vec3(0.0, 0.0, -1.0 / ra);
@@ -321,7 +321,7 @@ impl Inputs {
321321
c
322322
}
323323

324-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
324+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
325325
let uv: Vec2 = (frag_coord - self.resolution.xy() * 0.5) / self.resolution.y;
326326
let ms: Vec4 = (self.mouse - self.resolution.xyxy() * 0.5) / self.resolution.y;
327327
*frag_color = self.scene(uv * 4., ms * 4.).extend(1.0);

shaders/src/shaders/apollonian.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
3333
.main_image(color, frag_coord);
3434
}
3535

36-
pub struct Inputs {
37-
pub resolution: Vec3,
38-
pub time: f32,
39-
pub mouse: Vec4,
36+
struct Inputs {
37+
resolution: Vec3,
38+
time: f32,
39+
mouse: Vec4,
4040
}
4141

42-
pub struct State {
42+
struct State {
4343
inputs: Inputs,
4444
orb: Vec4,
4545
}
4646

4747
impl State {
4848
#[must_use]
49-
pub fn new(inputs: Inputs) -> Self {
49+
fn new(inputs: Inputs) -> Self {
5050
Self {
5151
inputs,
5252
orb: Vec4::ZERO,
@@ -148,7 +148,7 @@ impl State {
148148
col.sqrt()
149149
}
150150

151-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
151+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
152152
let time: f32 = self.inputs.time * 0.25 + 0.01 * self.inputs.mouse.x;
153153
let anim: f32 = 1.1 + 0.5 * smoothstep(-0.3, 0.3, (0.1 * self.inputs.time).cos());
154154
let mut tot: Vec3 = Vec3::ZERO;
@@ -185,7 +185,7 @@ impl State {
185185
*frag_color = tot.extend(1.0);
186186
}
187187

188-
pub fn main_vr(
188+
fn _main_vr(
189189
&mut self,
190190
frag_color: &mut Vec4,
191191
_frag_coord: Vec2,

shaders/src/shaders/atmosphere_system_test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
3333
.main_image(color, frag_coord);
3434
}
3535

36-
pub struct Inputs {
37-
pub resolution: Vec3,
38-
pub time: f32,
39-
pub mouse: Vec4,
36+
struct Inputs {
37+
resolution: Vec3,
38+
time: f32,
39+
mouse: Vec4,
4040
}
4141

42-
pub struct State {
42+
struct State {
4343
inputs: Inputs,
4444
sun_dir: Vec3,
4545
}
4646

4747
impl State {
4848
#[must_use]
49-
pub fn new(inputs: Inputs) -> Self {
49+
fn new(inputs: Inputs) -> Self {
5050
Self {
5151
inputs,
5252
sun_dir: vec3(0.0, 1.0, 0.0),
@@ -255,7 +255,7 @@ impl State {
255255
SUN_POWER * (sum_r * phase_r * BETA_R + sum_m * phase_m * BETA_M)
256256
}
257257

258-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
258+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
259259
let aspect_ratio: Vec2 = vec2(self.inputs.resolution.x / self.inputs.resolution.y, 1.0);
260260
let fov: f32 = 45.0_f32.to_radians().tan();
261261
let point_ndc: Vec2 = frag_coord / self.inputs.resolution.xy();

shaders/src/shaders/bubble_buckey_balls.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
3636
.main_image(color, frag_coord);
3737
}
3838

39-
pub struct Inputs<C0, C1> {
40-
pub resolution: Vec3,
41-
pub time: f32,
42-
pub mouse: Vec4,
43-
pub channel0: C0,
44-
pub channel1: C1,
39+
struct Inputs<C0, C1> {
40+
resolution: Vec3,
41+
time: f32,
42+
mouse: Vec4,
43+
channel0: C0,
44+
channel1: C1,
4545
}
4646

47-
pub struct State<C0, C1> {
47+
struct State<C0, C1> {
4848
inputs: Inputs<C0, C1>,
4949

5050
cam_point_at: Vec3,
@@ -55,7 +55,7 @@ pub struct State<C0, C1> {
5555

5656
impl<C0, C1> State<C0, C1> {
5757
#[must_use]
58-
pub fn new(inputs: Inputs<C0, C1>) -> Self {
58+
fn new(inputs: Inputs<C0, C1>) -> Self {
5959
Self {
6060
inputs,
6161
cam_point_at: Vec3::ZERO,
@@ -337,7 +337,7 @@ impl<C0, C1> State<C0, C1> {
337337
let cosrotx: f32 = rotx.cos();
338338
let sinrotx: f32 = rotx.sin();
339339

340-
let roty: f32 = TWO_PI * click.x + 0.05 * self.time;
340+
let roty: f32 = TAU * click.x + 0.05 * self.time;
341341
let cosroty: f32 = roty.cos();
342342
let sinroty: f32 = roty.sin();
343343

@@ -580,7 +580,7 @@ impl<C0: SampleCube, C1: SampleCube> State<C0, C1> {
580580
// **************************************************************************
581581
// MAIN
582582

583-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
583+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
584584
// ----------------------------------------------------------------------
585585
// Animate globals
586586

shaders/src/shaders/clouds.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
1515
Inputs { resolution, time }.main_image(color, frag_coord);
1616
}
1717

18-
pub struct Inputs {
19-
pub resolution: Vec3,
20-
pub time: f32,
18+
struct Inputs {
19+
resolution: Vec3,
20+
time: f32,
2121
}
2222

2323
const CLOUD_SCALE: f32 = 1.1;
@@ -74,7 +74,7 @@ fn fbm(mut n: Vec2) -> f32 {
7474
// -----------------------------------------------
7575

7676
impl Inputs {
77-
pub fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
77+
fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
7878
let p: Vec2 = frag_coord / self.resolution.xy();
7979
let mut uv: Vec2 = p * vec2(self.resolution.x / self.resolution.y, 1.0);
8080
let mut time: f32 = self.time * SPEED;

shaders/src/shaders/filtering_procedurals.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
4242
.main_image(color, frag_coord);
4343
}
4444

45-
pub struct Inputs {
46-
pub resolution: Vec3,
47-
pub time: f32,
48-
pub mouse: Vec4,
45+
struct Inputs {
46+
resolution: Vec3,
47+
time: f32,
48+
mouse: Vec4,
4949
}
5050

5151
//===============================================================================================
@@ -351,7 +351,7 @@ fn sample_texture(uvw: Vec3, nor: Vec3, mid: f32) -> Vec3 {
351351
}
352352

353353
impl Inputs {
354-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
354+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
355355
let p: Vec2 = (-self.resolution.xy() + 2.0 * frag_coord) / self.resolution.y;
356356
let mut th: f32 = (-self.resolution.x + 2.0 * self.mouse.x) / self.resolution.y;
357357

shaders/src/shaders/flappy_bird.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
2525
State::new(Inputs { resolution, time }).main_image(color, frag_coord);
2626
}
2727

28-
pub struct Inputs {
29-
pub resolution: Vec3,
30-
pub time: f32,
28+
struct Inputs {
29+
resolution: Vec3,
30+
time: f32,
3131
}
3232

33-
pub struct State {
33+
struct State {
3434
inputs: Inputs,
3535

3636
frag_color: Vec4,
3737
}
3838

3939
impl State {
4040
#[must_use]
41-
pub fn new(inputs: Inputs) -> Self {
41+
fn new(inputs: Inputs) -> Self {
4242
Self {
4343
inputs,
4444

@@ -1237,7 +1237,7 @@ impl State {
12371237
}
12381238
}
12391239

1240-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
1240+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
12411241
let level_pixel: Vec2 = self.get_level_pixel(frag_coord);
12421242

12431243
self.frag_color = rgb(113, 197, 207); // draw the blue sky background

shaders/src/shaders/galaxy_of_universes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
2626
Inputs { resolution, time }.main_image(color, frag_coord);
2727
}
2828

29-
pub struct Inputs {
30-
pub resolution: Vec3,
31-
pub time: f32,
29+
struct Inputs {
30+
resolution: Vec3,
31+
time: f32,
3232
}
3333

3434
impl Inputs {
35-
pub fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
35+
fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
3636
let uv: Vec2 = (frag_coord / self.resolution.xy()) - Vec2::splat(0.5);
3737
let t: f32 = self.time * 0.1
3838
+ ((0.25 + 0.05 * (self.time * 0.1).sin()) / (uv.length() + 0.07)) * 2.2;

shaders/src/shaders/geodesic_tiling.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
2323
.main_image(color, frag_coord);
2424
}
2525

26-
pub struct Inputs {
27-
pub resolution: Vec3,
28-
pub time: f32,
29-
pub mouse: Vec4,
26+
struct Inputs {
27+
resolution: Vec3,
28+
time: f32,
29+
mouse: Vec4,
3030
}
3131

32-
pub struct State {
32+
struct State {
3333
inputs: Inputs,
3434

3535
face_plane: Vec3,
@@ -46,7 +46,7 @@ pub struct State {
4646

4747
impl State {
4848
#[must_use]
49-
pub fn new(inputs: Inputs) -> Self {
49+
fn new(inputs: Inputs) -> Self {
5050
Self {
5151
inputs,
5252
face_plane: Vec3::ZERO,
@@ -272,7 +272,7 @@ impl State {
272272
// --------------------------------------------------------
273273

274274
fn pal(t: f32, a: Vec3, b: Vec3, c: Vec3, d: Vec3) -> Vec3 {
275-
a + b * (TWO_PI * (c * t + d)).cos()
275+
a + b * (TAU * (c * t + d)).cos()
276276
}
277277

278278
fn spectrum(n: f32) -> Vec3 {
@@ -761,7 +761,7 @@ fn linear_to_screen(linear_rgb: Vec3) -> Vec3 {
761761
}
762762

763763
impl State {
764-
pub fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
764+
fn main_image(&mut self, frag_color: &mut Vec4, frag_coord: Vec2) {
765765
self.time = self.inputs.time;
766766

767767
if LOOP != 0 {

shaders/src/shaders/heart.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ pub fn shader_fn(render_instruction: &ShaderInput, render_result: &mut ShaderRes
2121
Inputs { resolution, time }.main_image(color, frag_coord);
2222
}
2323

24-
pub struct Inputs {
25-
pub resolution: Vec3,
26-
pub time: f32,
24+
struct Inputs {
25+
resolution: Vec3,
26+
time: f32,
2727
}
2828

2929
impl Inputs {
30-
pub fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
30+
fn main_image(&self, frag_color: &mut Vec4, frag_coord: Vec2) {
3131
let mut p: Vec2 =
3232
(2.0 * frag_coord - self.resolution.xy()) / (self.resolution.xy().min_element());
3333

@@ -37,7 +37,7 @@ impl Inputs {
3737
// animate
3838
let tt: f32 = self.time.rem_euclid(1.5) / 1.5;
3939
let mut ss: f32 = tt.powf(0.2) * 0.5 + 0.5;
40-
ss = 1.0 + ss * 0.5 * (tt * TWO_PI * 3.0 + p.y * 0.5).sin() * (-tt * 4.0).exp();
40+
ss = 1.0 + ss * 0.5 * (tt * TAU * 3.0 + p.y * 0.5).sin() * (-tt * 4.0).exp();
4141
p *= vec2(0.5, 1.5) + ss * vec2(0.5, -0.5);
4242

4343
// shape

0 commit comments

Comments
 (0)