Skip to content

Commit 8a3e3d2

Browse files
committed
remove positional arguments in favor of using transform_set_position
1 parent 6eac1ec commit 8a3e3d2

File tree

3 files changed

+7
-46
lines changed

3 files changed

+7
-46
lines changed

crates/processing_render/src/lib.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -778,27 +778,21 @@ pub fn image_destroy(entity: Entity) -> error::Result<()> {
778778

779779
pub fn light_create_directional(
780780
graphics_entity: Entity,
781-
x: f32,
782-
y: f32,
783-
z: f32,
784781
color: Color,
785782
illuminance: f32,
786783
) -> error::Result<Entity> {
787784
app_mut(|app| {
788785
app.world_mut()
789786
.run_system_cached_with(
790787
light::create_directional,
791-
(graphics_entity, x, y, z, color, illuminance),
788+
(graphics_entity, color, illuminance),
792789
)
793790
.unwrap()
794791
})
795792
}
796793

797794
pub fn light_create_point(
798795
graphics_entity: Entity,
799-
x: f32,
800-
y: f32,
801-
z: f32,
802796
color: Color,
803797
intensity: f32,
804798
range: f32,
@@ -808,17 +802,14 @@ pub fn light_create_point(
808802
app.world_mut()
809803
.run_system_cached_with(
810804
light::create_point,
811-
(graphics_entity, x, y, z, color, intensity, range, radius),
805+
(graphics_entity, color, intensity, range, radius),
812806
)
813807
.unwrap()
814808
})
815809
}
816810

817811
pub fn light_create_spot(
818812
graphics_entity: Entity,
819-
x: f32,
820-
y: f32,
821-
z: f32,
822813
color: Color,
823814
intensity: f32,
824815
range: f32,
@@ -832,9 +823,6 @@ pub fn light_create_spot(
832823
light::create_spot,
833824
(
834825
graphics_entity,
835-
x,
836-
y,
837-
z,
838826
color,
839827
intensity,
840828
range,

crates/processing_render/src/light.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl Plugin for LightPlugin {
1212
}
1313

1414
pub fn create_directional(
15-
In((entity, px, py, pz, color, illuminance)): In<(Entity, f32, f32, f32, Color, f32)>,
15+
In((entity, color, illuminance)): In<(Entity, Color, f32)>,
1616
mut commands: Commands,
1717
graphics: Query<&RenderLayers, With<Graphics>>,
1818
) -> Result<Entity, ProcessingError> {
@@ -26,23 +26,13 @@ pub fn create_directional(
2626
color,
2727
..default()
2828
},
29-
Transform::from_xyz(px, py, pz),
3029
layer.clone(),
3130
))
3231
.id())
3332
}
3433

3534
pub fn create_point(
36-
In((entity, px, py, pz, color, intensity, range, radius)): In<(
37-
Entity,
38-
f32,
39-
f32,
40-
f32,
41-
Color,
42-
f32,
43-
f32,
44-
f32,
45-
)>,
35+
In((entity, color, intensity, range, radius)): In<(Entity, Color, f32, f32, f32)>,
4636
mut commands: Commands,
4737
graphics: Query<&RenderLayers, With<Graphics>>,
4838
) -> Result<Entity, ProcessingError> {
@@ -58,18 +48,14 @@ pub fn create_point(
5848
radius,
5949
..default()
6050
},
61-
Transform::from_xyz(px, py, pz),
6251
layer.clone(),
6352
))
6453
.id())
6554
}
6655

6756
pub fn create_spot(
68-
In((entity, px, py, pz, color, intensity, range, radius, inner_angle, outer_angle)): In<(
57+
In((entity, color, intensity, range, radius, inner_angle, outer_angle)): In<(
6958
Entity,
70-
f32,
71-
f32,
72-
f32,
7359
Color,
7460
f32,
7561
f32,
@@ -94,7 +80,6 @@ pub fn create_spot(
9480
outer_angle,
9581
..default()
9682
},
97-
Transform::from_xyz(px, py, pz),
9883
layer.clone(),
9984
))
10085
.id())

examples/lights.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,12 @@ fn sketch() -> error::Result<()> {
3131

3232
// We will only declare lights in `setup`
3333
// rather than calling some sort of `light()` method inside of `draw`
34-
let dir_light = light_create_directional(
35-
graphics,
36-
0.0,
37-
0.0,
38-
0.0,
39-
bevy::color::Color::srgb(0.35, 0.25, 0.5),
40-
1000.0,
41-
)?;
34+
let dir_light =
35+
light_create_directional(graphics, bevy::color::Color::srgb(0.35, 0.25, 0.5), 1000.0)?;
4236
transform_set_position(dir_light, 10.0, 10.0, 0.0)?;
4337

4438
let point_light = light_create_point(
4539
graphics,
46-
100.0,
47-
100.0,
48-
10.0,
4940
bevy::color::Color::srgb(1.0, 0.5, 0.25),
5041
1_000_000.0,
5142
20.0,
@@ -56,9 +47,6 @@ fn sketch() -> error::Result<()> {
5647

5748
let spot_light = light_create_spot(
5849
graphics,
59-
-15.0,
60-
-15.0,
61-
0.0,
6250
bevy::color::Color::srgb(0.25, 0.5, 0.88),
6351
1_000_000.0,
6452
25.0,

0 commit comments

Comments
 (0)