Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ common_api = [
"bevy_core_pipeline",
"bevy_post_process",
"bevy_sprite_render",
"bevy_gizmos_render",
]

# COLLECTION: Features used to build 3D Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer.
Expand All @@ -249,6 +250,7 @@ common_api = [
"3d_api",
"bevy_render",
"bevy_core_pipeline",
"bevy_gizmos_render",
"bevy_anti_alias",
"bevy_gltf",
"bevy_pbr",
Expand Down Expand Up @@ -369,9 +371,12 @@ bevy_light = ["bevy_internal/bevy_light"]
# Provides shaders usable through asset handles.
bevy_shader = ["bevy_internal/bevy_shader"]

# Adds support for rendering gizmos
# Adds support for gizmos
bevy_gizmos = ["bevy_internal/bevy_gizmos"]

# Adds support for rendering gizmos
bevy_gizmos_render = ["bevy_internal/bevy_gizmos_render"]

# Provides a collection of developer tools
bevy_dev_tools = ["bevy_internal/bevy_dev_tools"]

Expand Down
18 changes: 1 addition & 17 deletions crates/bevy_gizmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,21 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
webgl = []
webgpu = []
bevy_render = ["dep:bevy_render", "bevy_core_pipeline"]

[dependencies]
# Bevy
bevy_pbr = { path = "../bevy_pbr", version = "0.18.0-dev", optional = true }
bevy_sprite_render = { path = "../bevy_sprite_render", version = "0.18.0-dev", optional = true }
bevy_app = { path = "../bevy_app", version = "0.18.0-dev" }
bevy_camera = { path = "../bevy_camera", version = "0.18.0-dev" }
bevy_light = { path = "../bevy_light", version = "0.18.0-dev" }
bevy_light = { path = "../bevy_light", version = "0.18.0-dev", optional = true }
bevy_color = { path = "../bevy_color", version = "0.18.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.18.0-dev" }
bevy_image = { path = "../bevy_image", version = "0.18.0-dev" }
bevy_mesh = { path = "../bevy_mesh", version = "0.18.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.18.0-dev" }
bevy_asset = { path = "../bevy_asset", version = "0.18.0-dev" }
bevy_shader = { path = "../bevy_shader", version = "0.18.0-dev" }
bevy_render = { path = "../bevy_render", version = "0.18.0-dev", optional = true }
bevy_utils = { path = "../bevy_utils", version = "0.18.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.18.0-dev" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.18.0-dev", optional = true }
bevy_transform = { path = "../bevy_transform", version = "0.18.0-dev" }
bevy_gizmos_macros = { path = "macros", version = "0.18.0-dev" }
bevy_time = { path = "../bevy_time", version = "0.18.0-dev" }

# other
bytemuck = "1.0"
tracing = { version = "0.1", default-features = false, features = ["std"] }

[lints]
workspace = true

Expand Down
29 changes: 16 additions & 13 deletions crates/bevy_gizmos/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
//! A module for the [`GizmoConfig<T>`] [`Resource`].
use bevy_camera::visibility::RenderLayers;
pub use bevy_gizmos_macros::GizmoConfigGroup;

#[cfg(all(
feature = "bevy_render",
any(feature = "bevy_pbr", feature = "bevy_sprite_render")
))]
use {crate::GizmoAsset, bevy_asset::Handle, bevy_ecs::component::Component};

use bevy_ecs::{reflect::ReflectResource, resource::Resource};
Expand Down Expand Up @@ -195,8 +192,7 @@ pub struct GizmoConfig {
/// Describes which rendering layers gizmos will be rendered to.
///
/// Gizmos will only be rendered to cameras with intersecting layers.
#[cfg(feature = "bevy_render")]
pub render_layers: bevy_camera::visibility::RenderLayers,
pub render_layers: RenderLayers,
}

impl Default for GizmoConfig {
Expand All @@ -205,7 +201,6 @@ impl Default for GizmoConfig {
enabled: true,
line: Default::default(),
depth_bias: 0.,
#[cfg(feature = "bevy_render")]
render_layers: Default::default(),
}
}
Expand Down Expand Up @@ -244,15 +239,23 @@ impl Default for GizmoLineConfig {
}
}

#[cfg(all(
feature = "bevy_render",
any(feature = "bevy_pbr", feature = "bevy_sprite_render")
))]
/// Configuration for gizmo meshes.
#[derive(Component)]
pub(crate) struct GizmoMeshConfig {
pub struct GizmoMeshConfig {
/// Apply perspective to gizmo lines.
///
/// This setting only affects 3D, non-orthographic cameras.
///
/// Defaults to `false`.
pub line_perspective: bool,
/// Determine the style of gizmo lines.
pub line_style: GizmoLineStyle,
/// Describe how lines should join.
pub line_joints: GizmoLineJoint,
pub render_layers: bevy_camera::visibility::RenderLayers,
/// Describes which rendering layers gizmos will be rendered to.
///
/// Gizmos will only be rendered to cameras with intersecting layers.
pub render_layers: RenderLayers,
/// Handle of the gizmo asset.
pub handle: Handle<GizmoAsset>,
}
12 changes: 8 additions & 4 deletions crates/bevy_gizmos/src/gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,14 @@ where
Clear: 'static + Send + Sync,
{
pub(crate) enabled: bool,
pub(crate) list_positions: Vec<Vec3>,
pub(crate) list_colors: Vec<LinearRgba>,
pub(crate) strip_positions: Vec<Vec3>,
pub(crate) strip_colors: Vec<LinearRgba>,
/// The positions of line segment endpoints.
pub list_positions: Vec<Vec3>,
/// The colors of line segment endpoints.
pub list_colors: Vec<LinearRgba>,
/// The positions of line strip vertices.
pub strip_positions: Vec<Vec3>,
/// The colors of line strip vertices.
pub strip_colors: Vec<LinearRgba>,
#[reflect(ignore, clone)]
pub(crate) marker: PhantomData<(Config, Clear)>,
}
Expand Down
Loading
Loading