Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = [
]

[dependencies]
bevy = { version = "0.16.0", default-features = false, features = [
bevy = { version = "0.17", default-features = false, features = [
"bevy_asset",
"bevy_gizmos",
"bevy_pbr",
Expand All @@ -30,8 +30,7 @@ bytemuck = "1.21.0"
image = "0.25.5"

[dev-dependencies]
bevy_rts_camera = "0.10.0"
bevy = "0.16.0"
bevy = "0.17"

[features]
debug = []
19 changes: 9 additions & 10 deletions assets/shaders/instancing.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -82,33 +82,32 @@ fn vertex(in: VertexInput) -> VertexOutput {
return out;
}


////////////////////////////////////////////////////////////////////////////////
// TEXTURE BIND GROUP
////////////////////////////////////////////////////////////////////////////////

// DIGIT ATLAS
@group(2) @binding(0)
@group(3) @binding(0)
var digit_atlas_texture: texture_2d<f32>;
@group(2) @binding(1)
@group(3) @binding(1)
var digit_atlas_sampler: sampler;

// ARROW IMG
@group(2) @binding(2)
@group(3) @binding(2)
var arrow_texture: texture_2d<f32>;
@group(2) @binding(3)
@group(3) @binding(3)
var arrow_sampler: sampler;

// 'X' IMG
@group(2) @binding(4)
@group(3) @binding(4)
var x_texture: texture_2d<f32>;
@group(2) @binding(5)
@group(3) @binding(5)
var x_sampler: sampler;

// 'X' IMG
@group(2) @binding(6)
@group(3) @binding(6)
var destination_texture: texture_2d<f32>;
@group(2) @binding(7)
@group(3) @binding(7)
var destination_sampler: sampler;

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -171,4 +170,4 @@ fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {

// GRID LINES
return in.color;
}
}
2 changes: 1 addition & 1 deletion examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn spawn_units(
Mesh3d(meshes.add(Cuboid::new(5.0, 5.0, 5.0))),
MeshMaterial3d(materials.add(StandardMaterial::from_color(BLUE_500))),
Transform::from_translation(pos),
Speed(25.0),
Speed(50.0),
Boid::default(), // ADD THIS! - Can also be set with custom parameters `Boid::new(50.0, 0.0, 0.0, 5.0)`
Name::new("Unit"),
)
Expand Down
21 changes: 0 additions & 21 deletions examples/stress_test2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use bevy_pathfinding::{
grid::Grid,
utils, BevyPathfindingPlugin,
};
use bevy_rts_camera::{Ground, RtsCamera, RtsCameraControls, RtsCameraPlugin};

const CELL_SIZE: f32 = 10.0; // size of each cell in the grid
const BUCKETS: f32 = 150.0; // size of each bucket (spatial partitioning) in the grid
Expand All @@ -31,7 +30,6 @@ fn main() {
.add_plugins((
DefaultPlugins,
BevyPathfindingPlugin, // ADD THIS!
RtsCameraPlugin,
))
.add_systems(Startup, (camera, setup, spawn_units))
.add_systems(Update, (set_unit_destination, move_unit))
Expand All @@ -46,24 +44,6 @@ fn camera(mut cmds: Commands) {
Camera3d::default(),
GameCamera, // ADD THIS!
Transform::from_translation(Vec3::new(0.0, 2000.0, 1500.0)).looking_at(Vec3::ZERO, Vec3::Y),
RtsCamera {
bounds: Aabb2d::new(Vec2::ZERO, Vec2::new(MAP_WIDTH / 2.0, MAP_DEPTH / 2.0)),
min_angle: 60.0f32.to_radians(),
// height_max: 300.0,
height_max: 1000.0,
height_min: 30.0,
..default()
},
RtsCameraControls {
edge_pan_width: 0.01,
key_left: KeyCode::KeyA,
key_right: KeyCode::KeyD,
key_up: KeyCode::KeyW,
key_down: KeyCode::KeyS,
pan_speed: 165.0,
zoom_sensitivity: 0.2,
..default()
},
));
}

Expand All @@ -77,7 +57,6 @@ fn setup(
Mesh3d(meshes.add(Plane3d::default().mesh().size(MAP_WIDTH, MAP_DEPTH))),
MeshMaterial3d(materials.add(StandardMaterial::from_color(GREEN_600))),
MapBase, // ADD THIS!
Ground,
Name::new("Map Base"),
);

Expand Down
14 changes: 7 additions & 7 deletions src/debug/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn draw_on_startup(mut cmds: Commands) {
}

fn set_active_dbg_flowfield(
trigger: Trigger<SetActiveFlowfieldEv>,
trigger: On<SetActiveFlowfieldEv>,
mut cmds: Commands,
mut active_dbg_flowfield: ResMut<ActiveDbgFlowfield>,
) {
Expand All @@ -47,7 +47,7 @@ fn set_active_dbg_flowfield(
}
}

fn trigger_events(_trigger: Trigger<DrawAllEv>, mut cmds: Commands, dbg: Res<DbgOptions>) {
fn trigger_events(_trigger: On<DrawAllEv>, mut cmds: Commands, dbg: Res<DbgOptions>) {
dbg.print("\ntrigger_events() start");

cmds.trigger(DrawGridEv);
Expand All @@ -59,7 +59,7 @@ fn trigger_events(_trigger: Trigger<DrawAllEv>, mut cmds: Commands, dbg: Res<Dbg
}

fn draw_grid(
_trigger: Trigger<DrawGridEv>,
_trigger: On<DrawGridEv>,
mut cmds: Commands,
mut meshes: ResMut<Assets<Mesh>>,
q_grid_lines: Query<Entity, With<GridLine>>,
Expand Down Expand Up @@ -140,7 +140,7 @@ fn draw_grid(
}

pub fn draw_flowfield(
_trigger: Trigger<DrawFlowFieldEv>,
_trigger: On<DrawFlowFieldEv>,
dbg: Res<DbgOptions>,
grid: Res<Grid>,
active_dbg_flowfield: Res<ActiveDbgFlowfield>,
Expand Down Expand Up @@ -233,7 +233,7 @@ pub fn draw_flowfield(
}

fn draw_costfield(
_trigger: Trigger<DrawCostFieldEv>,
_trigger: On<DrawCostFieldEv>,
dbg: Res<DbgOptions>,
mut meshes: ResMut<Assets<Mesh>>,
grid: Res<Grid>,
Expand Down Expand Up @@ -310,7 +310,7 @@ fn draw_costfield(
}

fn draw_integration_field(
_trigger: Trigger<DrawIntegrationFieldEv>,
_trigger: On<DrawIntegrationFieldEv>,
dbg: Res<DbgOptions>,
active_dbg_flowfield: Res<ActiveDbgFlowfield>,
mut meshes: ResMut<Assets<Mesh>>,
Expand Down Expand Up @@ -392,7 +392,7 @@ fn draw_integration_field(
}

fn draw_index(
_trigger: Trigger<DrawAllEv>,
_trigger: On<DrawAllEv>,
dbg: Res<DbgOptions>,
mut meshes: ResMut<Assets<Mesh>>,
grid: Res<Grid>,
Expand Down
2 changes: 2 additions & 0 deletions src/debug/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ pub fn load_dbg_icon(mut images: ResMut<Assets<Image>>, mut dbg_icon: ResMut<Dbg
sampler: ImageSampler::Descriptor(ImageSamplerDescriptor::default()),
texture_view_descriptor: None,
asset_usage: Default::default(),
copy_on_resize: false,
data_order: Default::default(),
};

// Add the image to Bevy's asset storage
Expand Down
Loading