Skip to content

Commit e26ef86

Browse files
committed
Reapply "Fmt."
This reverts commit ba2a1af.
1 parent ba2a1af commit e26ef86

File tree

29 files changed

+366
-257
lines changed

29 files changed

+366
-257
lines changed

bevy_nannou_draw/src/draw/background.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use bevy::prelude::Color;
22

3-
use crate::draw::{Draw, DrawCommand};
4-
use crate::render::ShaderModel;
3+
use crate::{
4+
draw::{Draw, DrawCommand},
5+
render::ShaderModel,
6+
};
57

68
/// A type used to update the background colour.
79
pub struct Background<'a, SM>

bevy_nannou_draw/src/draw/drawing.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
use std::any::TypeId;
2-
use std::marker::PhantomData;
1+
use std::{any::TypeId, marker::PhantomData};
32

4-
use bevy::asset::UntypedAssetId;
5-
use bevy::prelude::*;
6-
use lyon::path::PathEvent;
7-
use lyon::tessellation::{FillOptions, LineCap, LineJoin, StrokeOptions};
3+
use bevy::{asset::UntypedAssetId, prelude::*};
4+
use lyon::{
5+
path::PathEvent,
6+
tessellation::{FillOptions, LineCap, LineJoin, StrokeOptions},
7+
};
88
use uuid::Uuid;
99

10-
use crate::draw::primitive::Primitive;
11-
use crate::draw::properties::{
12-
SetColor, SetDimensions, SetFill, SetOrientation, SetPosition, SetStroke,
10+
use crate::{
11+
draw::{
12+
primitive::Primitive,
13+
properties::{SetColor, SetDimensions, SetFill, SetOrientation, SetPosition, SetStroke},
14+
Draw, DrawCommand, DrawRef,
15+
},
16+
render::{DefaultNannouShaderModel, ShaderModel},
1317
};
14-
use crate::draw::{Draw, DrawCommand, DrawRef};
15-
use crate::render::{DefaultNannouShaderModel, ShaderModel};
1618

1719
/// A **Drawing** in progress.
1820
///

bevy_nannou_draw/src/draw/indirect.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
//! A shader that renders a mesh multiple times in one draw call.
22
3-
use crate::render::{ShaderModelHandle, ShaderStorageBufferHandle};
43
use crate::{
54
draw::{drawing::Drawing, primitive::Primitive, Draw, DrawCommand},
6-
render::{queue_shader_model, PreparedShaderModel, ShaderModel},
5+
render::{
6+
queue_shader_model, PreparedShaderModel, ShaderModel, ShaderModelHandle,
7+
ShaderStorageBufferHandle,
8+
},
79
};
8-
use bevy::render::extract_instances::ExtractedInstances;
910
use bevy::{
1011
core_pipeline::core_3d::Transparent3d,
1112
ecs::system::{lifetimeless::*, SystemParamItem},
1213
pbr::{RenderMeshInstances, SetMeshBindGroup, SetMeshViewBindGroup},
1314
prelude::*,
1415
render::{
1516
extract_component::ExtractComponent,
17+
extract_instances::ExtractedInstances,
1618
mesh::{allocator::MeshAllocator, RenderMesh, RenderMeshBufferInfo},
1719
render_asset::{prepare_assets, RenderAssets},
1820
render_phase::{

bevy_nannou_draw/src/draw/instanced.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! A shader that renders a mesh multiple times in one draw call.
22
3-
use crate::render::ShaderModelHandle;
43
use crate::{
54
draw::{drawing::Drawing, primitive::Primitive, Draw, DrawCommand},
6-
render::{queue_shader_model, PreparedShaderModel, ShaderModel},
5+
render::{queue_shader_model, PreparedShaderModel, ShaderModel, ShaderModelHandle},
76
};
87
use bevy::{
98
core_pipeline::core_3d::Transparent3d,

bevy_nannou_draw/src/draw/mesh/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
//! Items related to the custom mesh type used by the `Draw` API.
22
3-
use bevy::prelude::*;
4-
use bevy::render::mesh::{Indices, PrimitiveTopology, VertexAttributeValues};
5-
use bevy::render::render_asset::RenderAssetUsages;
3+
use bevy::{
4+
prelude::*,
5+
render::{
6+
mesh::{Indices, PrimitiveTopology, VertexAttributeValues},
7+
render_asset::RenderAssetUsages,
8+
},
9+
};
610

711
pub use self::builder::MeshBuilder;
812

bevy_nannou_draw/src/draw/mod.rs

+25-17
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,33 @@
22
//!
33
//! See the [Draw] for more details.
44
5-
use std::any::{Any, TypeId};
6-
use std::marker::PhantomData;
7-
use std::ops::{Deref, Range};
8-
use std::sync::{Arc, RwLock};
5+
use std::{
6+
any::{Any, TypeId},
7+
marker::PhantomData,
8+
ops::{Deref, Range},
9+
sync::{Arc, RwLock},
10+
};
911

10-
pub use self::background::Background;
11-
pub use self::drawing::{Drawing, DrawingContext};
1212
use self::primitive::Primitive;
13-
pub use self::theme::Theme;
14-
use crate::draw::indirect::Indirect;
15-
use crate::draw::instanced::Instanced;
16-
use crate::draw::mesh::MeshExt;
17-
use crate::render::{DefaultNannouShaderModel, ShaderModel};
18-
use bevy::asset::UntypedAssetId;
19-
use bevy::platform_support::collections::{HashMap, HashSet};
20-
use bevy::prelude::*;
21-
use bevy::render::render_resource as wgpu;
22-
use bevy::render::render_resource::{BlendComponent, BlendState};
23-
use bevy::render::storage::ShaderStorageBuffer;
13+
pub use self::{
14+
background::Background,
15+
drawing::{Drawing, DrawingContext},
16+
theme::Theme,
17+
};
18+
use crate::{
19+
draw::{indirect::Indirect, instanced::Instanced, mesh::MeshExt},
20+
render::{DefaultNannouShaderModel, ShaderModel},
21+
};
22+
use bevy::{
23+
asset::UntypedAssetId,
24+
platform_support::collections::{HashMap, HashSet},
25+
prelude::*,
26+
render::{
27+
render_resource as wgpu,
28+
render_resource::{BlendComponent, BlendState},
29+
storage::ShaderStorageBuffer,
30+
},
31+
};
2432
use lyon::path::PathEvent;
2533
use uuid::Uuid;
2634

bevy_nannou_draw/src/draw/primitive/arrow.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
use bevy::prelude::*;
22
use lyon::tessellation::StrokeOptions;
33

4-
use crate::draw::primitive::path;
5-
use crate::draw::primitive::Line;
6-
use crate::draw::primitive::Primitive;
7-
use crate::draw::properties::spatial::{orientation, position};
8-
use crate::draw::properties::{SetColor, SetOrientation, SetPosition, SetStroke};
9-
use crate::draw::{self, Drawing};
10-
use crate::render::ShaderModel;
4+
use crate::{
5+
draw::{
6+
self,
7+
primitive::{path, Line, Primitive},
8+
properties::{
9+
spatial::{orientation, position},
10+
SetColor, SetOrientation, SetPosition, SetStroke,
11+
},
12+
Drawing,
13+
},
14+
render::ShaderModel,
15+
};
1116

1217
/// A path containing only two points - a start and end.
1318
///

bevy_nannou_draw/src/draw/primitive/ellipse.rs

+15-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@ use lyon::tessellation::StrokeOptions;
33

44
use nannou_core::geom;
55

6-
use crate::draw;
7-
use crate::draw::primitive::polygon::{self, PolygonInit, PolygonOptions, SetPolygon};
8-
use crate::draw::primitive::Primitive;
9-
use crate::draw::properties::spatial::{dimension, orientation, position};
10-
use crate::draw::properties::{
11-
spatial, SetColor, SetDimensions, SetOrientation, SetPosition, SetStroke,
6+
use crate::{
7+
draw,
8+
draw::{
9+
primitive::{
10+
polygon::{self, PolygonInit, PolygonOptions, SetPolygon},
11+
Primitive,
12+
},
13+
properties::{
14+
spatial,
15+
spatial::{dimension, orientation, position},
16+
SetColor, SetDimensions, SetOrientation, SetPosition, SetStroke,
17+
},
18+
Drawing,
19+
},
20+
render::ShaderModel,
1221
};
13-
use crate::draw::Drawing;
14-
use crate::render::ShaderModel;
1522

1623
/// Properties related to drawing an **Ellipse**.
1724
#[derive(Clone, Debug, Default)]

bevy_nannou_draw/src/draw/primitive/line.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
use bevy::prelude::*;
22
use lyon::tessellation::StrokeOptions;
33

4-
use crate::draw::primitive::path;
5-
use crate::draw::primitive::{PathStroke, Primitive};
6-
use crate::draw::properties::spatial::{orientation, position};
7-
use crate::draw::properties::{SetColor, SetOrientation, SetPosition, SetStroke};
8-
use crate::draw::{self, Drawing};
9-
use crate::render::ShaderModel;
4+
use crate::{
5+
draw::{
6+
self,
7+
primitive::{path, PathStroke, Primitive},
8+
properties::{
9+
spatial::{orientation, position},
10+
SetColor, SetOrientation, SetPosition, SetStroke,
11+
},
12+
Drawing,
13+
},
14+
render::ShaderModel,
15+
};
1016

1117
/// A path containing only two points - a start and end.
1218
///

bevy_nannou_draw/src/draw/primitive/mesh.rs

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ use bevy::prelude::*;
44

55
use nannou_core::geom;
66

7-
use crate::draw::mesh::MeshExt;
8-
use crate::draw::primitive::{Primitive, Vertex};
9-
use crate::draw::properties::spatial::{orientation, position};
10-
use crate::draw::properties::{SetColor, SetOrientation, SetPosition};
11-
use crate::draw::{self, Drawing};
12-
use crate::render::ShaderModel;
7+
use crate::{
8+
draw::{
9+
self,
10+
mesh::MeshExt,
11+
primitive::{Primitive, Vertex},
12+
properties::{
13+
spatial::{orientation, position},
14+
SetColor, SetOrientation, SetPosition,
15+
},
16+
Drawing,
17+
},
18+
render::ShaderModel,
19+
};
1320

1421
/// The mesh type prior to being initialised with vertices or indices.
1522
#[derive(Clone, Debug, Default)]

bevy_nannou_draw/src/draw/primitive/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ use bevy::prelude::{Color, Component};
22

33
use nannou_core::geom::{Vec2, Vec3};
44

5-
pub use self::arrow::Arrow;
6-
pub use self::ellipse::Ellipse;
7-
pub use self::line::Line;
8-
pub use self::mesh::PrimitiveMesh;
9-
pub use self::path::{Path, PathFill, PathInit, PathStroke};
10-
pub use self::polygon::{Polygon, PolygonInit};
11-
pub use self::quad::Quad;
12-
pub use self::rect::Rect;
13-
pub use self::text::Text;
14-
pub use self::tri::Tri;
5+
pub use self::{
6+
arrow::Arrow,
7+
ellipse::Ellipse,
8+
line::Line,
9+
mesh::PrimitiveMesh,
10+
path::{Path, PathFill, PathInit, PathStroke},
11+
polygon::{Polygon, PolygonInit},
12+
quad::Quad,
13+
rect::Rect,
14+
text::Text,
15+
tri::Tri,
16+
};
1517

1618
pub mod arrow;
1719
pub mod ellipse;

bevy_nannou_draw/src/draw/primitive/path.rs

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
use bevy::prelude::*;
2-
use lyon::path::PathEvent;
3-
use lyon::tessellation::{FillOptions, FillTessellator, StrokeOptions, StrokeTessellator};
4-
5-
use crate::draw::primitive::Primitive;
6-
use crate::draw::properties::spatial::{orientation, position};
7-
use crate::draw::properties::{SetColor, SetFill, SetOrientation, SetPosition, SetStroke};
8-
use crate::draw::{self, Drawing, DrawingContext};
9-
use crate::render::ShaderModel;
2+
use lyon::{
3+
path::PathEvent,
4+
tessellation::{FillOptions, FillTessellator, StrokeOptions, StrokeTessellator},
5+
};
6+
7+
use crate::{
8+
draw::{
9+
self,
10+
primitive::Primitive,
11+
properties::{
12+
spatial::{orientation, position},
13+
SetColor, SetFill, SetOrientation, SetPosition, SetStroke,
14+
},
15+
Drawing, DrawingContext,
16+
},
17+
render::ShaderModel,
18+
};
1019

1120
/// A set of path tessellation options (FillOptions or StrokeOptions).
1221
pub trait TessellationOptions {

bevy_nannou_draw/src/draw/primitive/polygon.rs

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
use bevy::prelude::*;
2-
use lyon::path::PathEvent;
3-
use lyon::tessellation::StrokeOptions;
4-
5-
use crate::draw::drawing::DrawingContext;
6-
use crate::draw::primitive::path::{self, PathEventSource};
7-
use crate::draw::primitive::Primitive;
8-
use crate::draw::properties::spatial::{orientation, position};
9-
use crate::draw::properties::{SetColor, SetOrientation, SetPosition, SetStroke};
10-
use crate::draw::{self, Drawing};
11-
use crate::render::ShaderModel;
2+
use lyon::{path::PathEvent, tessellation::StrokeOptions};
3+
4+
use crate::{
5+
draw::{
6+
self,
7+
drawing::DrawingContext,
8+
primitive::{
9+
path::{self, PathEventSource},
10+
Primitive,
11+
},
12+
properties::{
13+
spatial::{orientation, position},
14+
SetColor, SetOrientation, SetPosition, SetStroke,
15+
},
16+
Drawing,
17+
},
18+
render::ShaderModel,
19+
};
1220

1321
/// A trait implemented for all polygon draw primitives.
1422
pub trait SetPolygon: Sized {

bevy_nannou_draw/src/draw/primitive/quad.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ use lyon::tessellation::StrokeOptions;
33

44
use nannou_core::geom;
55

6-
use crate::draw::primitive::polygon::{self, PolygonInit, PolygonOptions, SetPolygon};
7-
use crate::draw::primitive::Primitive;
8-
use crate::draw::properties::spatial::{dimension, orientation, position};
9-
use crate::draw::properties::{
10-
spatial, SetColor, SetDimensions, SetOrientation, SetPosition, SetStroke,
6+
use crate::{
7+
draw::{
8+
self,
9+
primitive::{
10+
polygon::{self, PolygonInit, PolygonOptions, SetPolygon},
11+
Primitive,
12+
},
13+
properties::{
14+
spatial,
15+
spatial::{dimension, orientation, position},
16+
SetColor, SetDimensions, SetOrientation, SetPosition, SetStroke,
17+
},
18+
Drawing,
19+
},
20+
render::ShaderModel,
1121
};
12-
use crate::draw::{self, Drawing};
13-
use crate::render::ShaderModel;
1422

1523
/// Properties related to drawing a **Quad**.
1624
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)