Skip to content

Commit 5a76136

Browse files
committed
Fmt.
1 parent dc3e547 commit 5a76136

10 files changed

Lines changed: 107 additions & 27 deletions

File tree

examples/box.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ fn sketch() -> error::Result<()> {
4242
)?;
4343

4444
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
45-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
45+
graphics_record_command(
46+
graphics,
47+
DrawCommand::Rotate {
48+
angle,
49+
axis: Vec3::Z,
50+
},
51+
)?;
4652
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
4753
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
4854

examples/camera_controllers.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ fn sketch() -> error::Result<()> {
7070
graphics_record_command(graphics, DrawCommand::Roughness(0.3))?;
7171
graphics_record_command(graphics, DrawCommand::Metallic(0.8))?;
7272
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
73-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
73+
graphics_record_command(
74+
graphics,
75+
DrawCommand::Rotate {
76+
angle,
77+
axis: Vec3::Z,
78+
},
79+
)?;
7480
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
7581
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
7682
} else {

examples/custom_material.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ fn sketch() -> error::Result<()> {
5050
)?;
5151

5252
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
53-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
53+
graphics_record_command(
54+
graphics,
55+
DrawCommand::Rotate {
56+
angle,
57+
axis: Vec3::Z,
58+
},
59+
)?;
5460
graphics_record_command(graphics, DrawCommand::Material(mat))?;
5561
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
5662
graphics_record_command(graphics, DrawCommand::PopMatrix)?;

examples/lights.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ fn sketch() -> error::Result<()> {
8989
graphics_record_command(graphics, DrawCommand::Material(pbr_mat))?;
9090

9191
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
92-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
92+
graphics_record_command(
93+
graphics,
94+
DrawCommand::Rotate {
95+
angle,
96+
axis: Vec3::Z,
97+
},
98+
)?;
9399
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
94100
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
95101

examples/materials.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ fn sketch() -> error::Result<()> {
8383
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
8484
graphics_record_command(
8585
graphics,
86-
DrawCommand::Translate(Vec2::new(
87-
col as f32 * spacing - offset_x,
88-
row as f32 * spacing - offset_y,
89-
).extend(0.0)),
86+
DrawCommand::Translate(
87+
Vec2::new(
88+
col as f32 * spacing - offset_x,
89+
row as f32 * spacing - offset_y,
90+
)
91+
.extend(0.0),
92+
),
9093
)?;
9194
graphics_record_command(graphics, DrawCommand::Material(mat))?;
9295
graphics_record_command(graphics, DrawCommand::Geometry(sphere))?;

examples/pbr.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ fn sketch() -> error::Result<()> {
6767
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
6868
graphics_record_command(
6969
graphics,
70-
DrawCommand::Translate(Vec2::new(
71-
col as f32 * spacing - offset_x,
72-
row as f32 * spacing - offset_y,
73-
).extend(0.0)),
70+
DrawCommand::Translate(
71+
Vec2::new(
72+
col as f32 * spacing - offset_x,
73+
row as f32 * spacing - offset_y,
74+
)
75+
.extend(0.0),
76+
),
7477
)?;
7578
graphics_record_command(
7679
graphics,

examples/primitives_3d.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,17 @@ fn sketch() -> error::Result<()> {
106106

107107
for (x_offset, make_cmd) in &shapes {
108108
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
109-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(*x_offset, 0.0).extend(0.0)))?;
110-
graphics_record_command(graphics, DrawCommand::Rotate { angle: t, axis: Vec3::Z })?;
109+
graphics_record_command(
110+
graphics,
111+
DrawCommand::Translate(Vec2::new(*x_offset, 0.0).extend(0.0)),
112+
)?;
113+
graphics_record_command(
114+
graphics,
115+
DrawCommand::Rotate {
116+
angle: t,
117+
axis: Vec3::Z,
118+
},
119+
)?;
111120
graphics_record_command(graphics, make_cmd(t))?;
112121
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
113122
}

examples/stroke_3d.rs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,17 @@ fn sketch() -> error::Result<()> {
3535

3636
// thin wireframe box
3737
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
38-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(-80.0, 0.0).extend(0.0)))?;
39-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
38+
graphics_record_command(
39+
graphics,
40+
DrawCommand::Translate(Vec2::new(-80.0, 0.0).extend(0.0)),
41+
)?;
42+
graphics_record_command(
43+
graphics,
44+
DrawCommand::Rotate {
45+
angle,
46+
axis: Vec3::Z,
47+
},
48+
)?;
4049

4150
graphics_record_command(
4251
graphics,
@@ -61,7 +70,13 @@ fn sketch() -> error::Result<()> {
6170
// thick wireframe box
6271
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
6372
graphics_record_command(graphics, DrawCommand::Translate(Vec2::ZERO.extend(0.0)))?;
64-
graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.7, axis: Vec3::Z })?;
73+
graphics_record_command(
74+
graphics,
75+
DrawCommand::Rotate {
76+
angle: angle * 0.7,
77+
axis: Vec3::Z,
78+
},
79+
)?;
6580

6681
graphics_record_command(
6782
graphics,
@@ -85,8 +100,17 @@ fn sketch() -> error::Result<()> {
85100

86101
// thick wireframe sphere
87102
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
88-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(80.0, 0.0).extend(0.0)))?;
89-
graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.5, axis: Vec3::Z })?;
103+
graphics_record_command(
104+
graphics,
105+
DrawCommand::Translate(Vec2::new(80.0, 0.0).extend(0.0)),
106+
)?;
107+
graphics_record_command(
108+
graphics,
109+
DrawCommand::Rotate {
110+
angle: angle * 0.5,
111+
axis: Vec3::Z,
112+
},
113+
)?;
90114

91115
graphics_record_command(
92116
graphics,
@@ -110,7 +134,10 @@ fn sketch() -> error::Result<()> {
110134

111135
// wireframe-only sphere (no fill)
112136
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
113-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(160.0, 0.0).extend(0.0)))?;
137+
graphics_record_command(
138+
graphics,
139+
DrawCommand::Translate(Vec2::new(160.0, 0.0).extend(0.0)),
140+
)?;
114141
graphics_record_command(
115142
graphics,
116143
DrawCommand::Rotate {

examples/text_3d.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,17 @@ fn sketch() -> error::Result<()> {
6161
graphics_record_command(graphics, DrawCommand::Material(glow))?;
6262

6363
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
64-
graphics_record_command(graphics, DrawCommand::Scale(Vec2::new(15.0, 15.0).extend(1.0)))?;
65-
graphics_record_command(graphics, DrawCommand::Rotate { angle: t * 0.3, axis: Vec3::Z })?;
64+
graphics_record_command(
65+
graphics,
66+
DrawCommand::Scale(Vec2::new(15.0, 15.0).extend(1.0)),
67+
)?;
68+
graphics_record_command(
69+
graphics,
70+
DrawCommand::Rotate {
71+
angle: t * 0.3,
72+
axis: Vec3::Z,
73+
},
74+
)?;
6675
graphics_record_command(graphics, DrawCommand::Geometry(geom))?;
6776
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
6877

examples/transforms.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ fn sketch() -> error::Result<()> {
3333

3434
graphics_record_command(
3535
graphics,
36-
DrawCommand::Translate(Vec2::new(
37-
50.0 + j as f32 * 100.0,
38-
50.0 + i as f32 * 100.0,
39-
).extend(0.0)),
36+
DrawCommand::Translate(
37+
Vec2::new(50.0 + j as f32 * 100.0, 50.0 + i as f32 * 100.0).extend(0.0),
38+
),
4039
)?;
4140

4241
let angle = t + (i + j) as f32 * PI / 8.0;
43-
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
42+
graphics_record_command(
43+
graphics,
44+
DrawCommand::Rotate {
45+
angle,
46+
axis: Vec3::Z,
47+
},
48+
)?;
4449

4550
let s = 0.8 + (t * 2.0 + (i * j) as f32).sin() * 0.2;
4651
graphics_record_command(graphics, DrawCommand::Scale(Vec2::splat(s).extend(1.0)))?;

0 commit comments

Comments
 (0)