Skip to content

Commit 1a02b59

Browse files
committed
Clean imports.
1 parent f9631a0 commit 1a02b59

File tree

5 files changed

+40
-43
lines changed

5 files changed

+40
-43
lines changed

crates/processing_ffi/src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,7 @@ pub extern "C" fn processing_translate(graphics_id: u64, x: f32, y: f32) {
378378
error::clear_error();
379379
let graphics_entity = Entity::from_bits(graphics_id);
380380
error::check(|| {
381-
graphics_record_command(
382-
graphics_entity,
383-
DrawCommand::Translate(bevy::math::Vec2::new(x, y)),
384-
)
381+
graphics_record_command(graphics_entity, DrawCommand::Translate(Vec2::new(x, y)))
385382
});
386383
}
387384

@@ -406,12 +403,7 @@ pub extern "C" fn processing_rotate(graphics_id: u64, angle: f32) {
406403
pub extern "C" fn processing_scale(graphics_id: u64, x: f32, y: f32) {
407404
error::clear_error();
408405
let graphics_entity = Entity::from_bits(graphics_id);
409-
error::check(|| {
410-
graphics_record_command(
411-
graphics_entity,
412-
DrawCommand::Scale(bevy::math::Vec2::new(x, y)),
413-
)
414-
});
406+
error::check(|| graphics_record_command(graphics_entity, DrawCommand::Scale(Vec2::new(x, y))));
415407
}
416408

417409
/// Shear along the X axis.

crates/processing_pyo3/src/graphics.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use pyo3::{
1212
};
1313

1414
use crate::glfw::GlfwContext;
15+
use crate::math::{extract_vec2, extract_vec3, extract_vec4};
1516

1617
#[pyclass(unsendable)]
1718
pub struct Surface {
@@ -45,13 +46,13 @@ pub struct Light {
4546
impl Light {
4647
#[pyo3(signature = (*args))]
4748
pub fn position(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
48-
let v = crate::math::extract_vec3(args)?;
49+
let v = extract_vec3(args)?;
4950
transform_set_position(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
5051
}
5152

5253
#[pyo3(signature = (*args))]
5354
pub fn look_at(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
54-
let v = crate::math::extract_vec3(args)?;
55+
let v = extract_vec3(args)?;
5556
transform_look_at(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
5657
}
5758
}
@@ -131,19 +132,19 @@ impl Geometry {
131132

132133
#[pyo3(signature = (*args))]
133134
pub fn color(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
134-
let v = crate::math::extract_vec4(args)?;
135+
let v = extract_vec4(args)?;
135136
geometry_color(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
136137
}
137138

138139
#[pyo3(signature = (*args))]
139140
pub fn normal(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
140-
let v = crate::math::extract_vec3(args)?;
141+
let v = extract_vec3(args)?;
141142
geometry_normal(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
142143
}
143144

144145
#[pyo3(signature = (*args))]
145146
pub fn vertex(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
146-
let v = crate::math::extract_vec3(args)?;
147+
let v = extract_vec3(args)?;
147148
geometry_vertex(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
148149
}
149150

@@ -153,7 +154,7 @@ impl Geometry {
153154

154155
#[pyo3(signature = (i, *args))]
155156
pub fn set_vertex(&self, i: u32, args: &Bound<'_, PyTuple>) -> PyResult<()> {
156-
let v = crate::math::extract_vec3(args)?;
157+
let v = extract_vec3(args)?;
157158
geometry_set_vertex(self.entity, i, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
158159
}
159160
}
@@ -403,7 +404,7 @@ impl Graphics {
403404

404405
#[pyo3(signature = (*args))]
405406
pub fn translate(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
406-
let v = crate::math::extract_vec2(args)?;
407+
let v = extract_vec2(args)?;
407408
graphics_record_command(self.entity, DrawCommand::Translate(v))
408409
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))
409410
}
@@ -471,7 +472,7 @@ impl Graphics {
471472

472473
#[pyo3(signature = (*args))]
473474
pub fn scale(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
474-
let v = crate::math::extract_vec2(args)?;
475+
let v = extract_vec2(args)?;
475476
graphics_record_command(self.entity, DrawCommand::Scale(v))
476477
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))
477478
}
@@ -513,13 +514,13 @@ impl Graphics {
513514

514515
#[pyo3(signature = (*args))]
515516
pub fn camera_position(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
516-
let v = crate::math::extract_vec3(args)?;
517+
let v = extract_vec3(args)?;
517518
transform_set_position(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
518519
}
519520

520521
#[pyo3(signature = (*args))]
521522
pub fn camera_look_at(&self, args: &Bound<'_, PyTuple>) -> PyResult<()> {
522-
let v = crate::math::extract_vec3(args)?;
523+
let v = extract_vec3(args)?;
523524
transform_look_at(self.entity, v).map_err(|e| PyRuntimeError::new_err(format!("{e}")))
524525
}
525526

crates/processing_pyo3/src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,38 +145,38 @@ mod mewnala {
145145
use super::*;
146146

147147
#[pymodule_export]
148-
use super::super::math::PyQuat;
148+
use crate::math::PyQuat;
149149
#[pymodule_export]
150-
use super::super::math::PyVec2;
150+
use crate::math::PyVec2;
151151
#[pymodule_export]
152-
use super::super::math::PyVec3;
152+
use crate::math::PyVec3;
153153
#[pymodule_export]
154-
use super::super::math::PyVec4;
154+
use crate::math::PyVec4;
155155
#[pymodule_export]
156-
use super::super::math::PyVecIter;
156+
use crate::math::PyVecIter;
157157

158158
#[pyfunction]
159159
#[pyo3(signature = (*args))]
160-
fn vec2(args: &Bound<'_, PyTuple>) -> PyResult<super::super::math::PyVec2> {
161-
super::super::math::PyVec2::py_new(args)
160+
fn vec2(args: &Bound<'_, PyTuple>) -> PyResult<crate::math::PyVec2> {
161+
crate::math::PyVec2::py_new(args)
162162
}
163163

164164
#[pyfunction]
165165
#[pyo3(signature = (*args))]
166-
fn vec3(args: &Bound<'_, PyTuple>) -> PyResult<super::super::math::PyVec3> {
167-
super::super::math::PyVec3::py_new(args)
166+
fn vec3(args: &Bound<'_, PyTuple>) -> PyResult<crate::math::PyVec3> {
167+
crate::math::PyVec3::py_new(args)
168168
}
169169

170170
#[pyfunction]
171171
#[pyo3(signature = (*args))]
172-
fn vec4(args: &Bound<'_, PyTuple>) -> PyResult<super::super::math::PyVec4> {
173-
super::super::math::PyVec4::py_new(args)
172+
fn vec4(args: &Bound<'_, PyTuple>) -> PyResult<crate::math::PyVec4> {
173+
crate::math::PyVec4::py_new(args)
174174
}
175175

176176
#[pyfunction]
177177
#[pyo3(signature = (*args))]
178-
fn quat(args: &Bound<'_, PyTuple>) -> PyResult<super::super::math::PyQuat> {
179-
super::super::math::PyQuat::py_new(args)
178+
fn quat(args: &Bound<'_, PyTuple>) -> PyResult<crate::math::PyQuat> {
179+
crate::math::PyQuat::py_new(args)
180180
}
181181
}
182182

crates/processing_render/src/surface.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use raw_window_handle::{
3232
};
3333

3434
use processing_core::error::{self, ProcessingError, Result};
35+
#[cfg(not(target_os = "windows"))]
3536
use std::ptr::NonNull;
3637

3738
use crate::image::{Image, ImageTextures};

crates/processing_wasm/src/lib.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![cfg(target_arch = "wasm32")]
22

3-
use bevy::prelude::Entity;
3+
use bevy::{
4+
math::{Vec2, Vec3},
5+
prelude::Entity,
6+
};
47
use processing_render::{
58
config::Config, exit, geometry_box, geometry_sphere, graphics_begin_draw, graphics_end_draw,
69
graphics_flush, graphics_record_command, image_create, image_destroy, image_load,
@@ -191,7 +194,7 @@ pub fn js_reset_matrix(surface_id: u64) -> Result<(), JsValue> {
191194
pub fn js_translate(surface_id: u64, x: f32, y: f32) -> Result<(), JsValue> {
192195
check(graphics_record_command(
193196
Entity::from_bits(surface_id),
194-
DrawCommand::Translate(bevy::math::Vec2::new(x, y)),
197+
DrawCommand::Translate(Vec2::new(x, y)),
195198
))
196199
}
197200

@@ -207,7 +210,7 @@ pub fn js_rotate(surface_id: u64, angle: f32) -> Result<(), JsValue> {
207210
pub fn js_scale(surface_id: u64, x: f32, y: f32) -> Result<(), JsValue> {
208211
check(graphics_record_command(
209212
Entity::from_bits(surface_id),
210-
DrawCommand::Scale(bevy::math::Vec2::new(x, y)),
213+
DrawCommand::Scale(Vec2::new(x, y)),
211214
))
212215
}
213216

@@ -279,23 +282,23 @@ pub fn js_image_destroy(image_id: u64) -> Result<(), JsValue> {
279282
pub fn js_transform_set_position(entity_id: u64, x: f32, y: f32, z: f32) -> Result<(), JsValue> {
280283
check(transform_set_position(
281284
Entity::from_bits(entity_id),
282-
bevy::math::Vec3::new(x, y, z),
285+
Vec3::new(x, y, z),
283286
))
284287
}
285288

286289
#[wasm_bindgen(js_name = "transformTranslate")]
287290
pub fn js_transform_translate(entity_id: u64, x: f32, y: f32, z: f32) -> Result<(), JsValue> {
288291
check(transform_translate(
289292
Entity::from_bits(entity_id),
290-
bevy::math::Vec3::new(x, y, z),
293+
Vec3::new(x, y, z),
291294
))
292295
}
293296

294297
#[wasm_bindgen(js_name = "transformSetRotation")]
295298
pub fn js_transform_set_rotation(entity_id: u64, x: f32, y: f32, z: f32) -> Result<(), JsValue> {
296299
check(transform_set_rotation(
297300
Entity::from_bits(entity_id),
298-
bevy::math::Vec3::new(x, y, z),
301+
Vec3::new(x, y, z),
299302
))
300303
}
301304

@@ -325,23 +328,23 @@ pub fn js_transform_rotate_axis(
325328
check(transform_rotate_axis(
326329
Entity::from_bits(entity_id),
327330
angle,
328-
bevy::math::Vec3::new(axis_x, axis_y, axis_z),
331+
Vec3::new(axis_x, axis_y, axis_z),
329332
))
330333
}
331334

332335
#[wasm_bindgen(js_name = "transformSetScale")]
333336
pub fn js_transform_set_scale(entity_id: u64, x: f32, y: f32, z: f32) -> Result<(), JsValue> {
334337
check(transform_set_scale(
335338
Entity::from_bits(entity_id),
336-
bevy::math::Vec3::new(x, y, z),
339+
Vec3::new(x, y, z),
337340
))
338341
}
339342

340343
#[wasm_bindgen(js_name = "transformScale")]
341344
pub fn js_transform_scale(entity_id: u64, x: f32, y: f32, z: f32) -> Result<(), JsValue> {
342345
check(transform_scale(
343346
Entity::from_bits(entity_id),
344-
bevy::math::Vec3::new(x, y, z),
347+
Vec3::new(x, y, z),
345348
))
346349
}
347350

@@ -354,7 +357,7 @@ pub fn js_transform_look_at(
354357
) -> Result<(), JsValue> {
355358
check(transform_look_at(
356359
Entity::from_bits(entity_id),
357-
bevy::math::Vec3::new(target_x, target_y, target_z),
360+
Vec3::new(target_x, target_y, target_z),
358361
))
359362
}
360363

0 commit comments

Comments
 (0)