Skip to content

Commit dc3e547

Browse files
committed
Tests.
1 parent 9a2760b commit dc3e547

10 files changed

Lines changed: 22 additions & 21 deletions

File tree

examples/box.rs

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

4444
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
45-
graphics_record_command(graphics, DrawCommand::Rotate { angle })?;
45+
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
4646
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
4747
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
4848

examples/camera_controllers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ 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 })?;
73+
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
7474
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
7575
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
7676
} else {

examples/custom_material.rs

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

5252
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
53-
graphics_record_command(graphics, DrawCommand::Rotate { angle })?;
53+
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
5454
graphics_record_command(graphics, DrawCommand::Material(mat))?;
5555
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
5656
graphics_record_command(graphics, DrawCommand::PopMatrix)?;

examples/lights.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ 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 })?;
92+
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
9393
graphics_record_command(graphics, DrawCommand::Geometry(box_geo))?;
9494
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
9595

examples/materials.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn sketch() -> error::Result<()> {
8686
DrawCommand::Translate(Vec2::new(
8787
col as f32 * spacing - offset_x,
8888
row as f32 * spacing - offset_y,
89-
)),
89+
).extend(0.0)),
9090
)?;
9191
graphics_record_command(graphics, DrawCommand::Material(mat))?;
9292
graphics_record_command(graphics, DrawCommand::Geometry(sphere))?;

examples/pbr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn sketch() -> error::Result<()> {
7070
DrawCommand::Translate(Vec2::new(
7171
col as f32 * spacing - offset_x,
7272
row as f32 * spacing - offset_y,
73-
)),
73+
).extend(0.0)),
7474
)?;
7575
graphics_record_command(
7676
graphics,

examples/primitives_3d.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ 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)))?;
110-
graphics_record_command(graphics, DrawCommand::Rotate { angle: t })?;
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 })?;
111111
graphics_record_command(graphics, make_cmd(t))?;
112112
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
113113
}

examples/stroke_3d.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ 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)))?;
39-
graphics_record_command(graphics, DrawCommand::Rotate { angle })?;
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 })?;
4040

4141
graphics_record_command(
4242
graphics,
@@ -60,8 +60,8 @@ fn sketch() -> error::Result<()> {
6060

6161
// thick wireframe box
6262
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
63-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::ZERO))?;
64-
graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.7 })?;
63+
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 })?;
6565

6666
graphics_record_command(
6767
graphics,
@@ -85,8 +85,8 @@ fn sketch() -> error::Result<()> {
8585

8686
// thick wireframe sphere
8787
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
88-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(80.0, 0.0)))?;
89-
graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.5 })?;
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 })?;
9090

9191
graphics_record_command(
9292
graphics,
@@ -110,11 +110,12 @@ fn sketch() -> error::Result<()> {
110110

111111
// wireframe-only sphere (no fill)
112112
graphics_record_command(graphics, DrawCommand::PushMatrix)?;
113-
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(160.0, 0.0)))?;
113+
graphics_record_command(graphics, DrawCommand::Translate(Vec2::new(160.0, 0.0).extend(0.0)))?;
114114
graphics_record_command(
115115
graphics,
116116
DrawCommand::Rotate {
117117
angle: -angle * 0.3,
118+
axis: Vec3::Z,
118119
},
119120
)?;
120121

examples/text_3d.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ 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)))?;
65-
graphics_record_command(graphics, DrawCommand::Rotate { angle: t * 0.3 })?;
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 })?;
6666
graphics_record_command(graphics, DrawCommand::Geometry(geom))?;
6767
graphics_record_command(graphics, DrawCommand::PopMatrix)?;
6868

examples/transforms.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use processing_glfw::GlfwContext;
22

3-
use bevy::math::Vec2;
3+
use bevy::math::{Vec2, Vec3};
44
use processing::prelude::*;
55
use processing_render::render::command::DrawCommand;
66
use std::f32::consts::PI;
@@ -36,14 +36,14 @@ fn sketch() -> error::Result<()> {
3636
DrawCommand::Translate(Vec2::new(
3737
50.0 + j as f32 * 100.0,
3838
50.0 + i as f32 * 100.0,
39-
)),
39+
).extend(0.0)),
4040
)?;
4141

4242
let angle = t + (i + j) as f32 * PI / 8.0;
43-
graphics_record_command(graphics, DrawCommand::Rotate { angle })?;
43+
graphics_record_command(graphics, DrawCommand::Rotate { angle, axis: Vec3::Z })?;
4444

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

4848
let r = j as f32 / 3.0;
4949
let g = i as f32 / 3.0;

0 commit comments

Comments
 (0)