Skip to content

Commit

Permalink
disable v-sync, add warning, appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-blackbird committed Nov 10, 2022
1 parent 2ef4b4f commit 78beb71
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_debug_draw/src/debug_draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl DebugDraw {
let br = (position + rotation * vec3(half_size.x, -half_size.y, 0.)).to_array();
self.positions.extend([tl, tr, tr, br, br, bl, bl, tl]);
self.colors
.extend(std::iter::repeat(color.as_linear_rgba_f32()).take(8))
.extend(std::iter::repeat(color.as_linear_rgba_f32()).take(8));
}

/// Draw a box.
Expand All @@ -115,7 +115,7 @@ impl DebugDraw {
tlf, tlb, trf, trb, brf, brb, blf, blb, // Front to back
]);
self.colors
.extend(std::iter::repeat(color.as_linear_rgba_f32()).take(24))
.extend(std::iter::repeat(color.as_linear_rgba_f32()).take(24));
}

/// Draw a line from `start` to `end`.
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_debug_draw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ fn update(
mut meshes: ResMut<Assets<Mesh>>,
mut commands: Commands,
) {
if let Some(mut mesh) = debug_draw
if let Some(mesh) = debug_draw
.mesh_handle
.as_ref()
.and_then(|handle| meshes.get_mut(handle))
{
if config.enabled {
debug_draw.update_mesh(&mut mesh);
debug_draw.update_mesh(mesh);
} else {
debug_draw.clear();
mesh.remove_attribute(Mesh::ATTRIBUTE_POSITION);
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_debug_draw/src/pipeline_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub(crate) type DrawDebugLines = (
DrawMesh2d,
);

#[allow(clippy::too_many_arguments)]
pub(crate) fn queue(
config: Res<DebugDrawConfig>,
draw2d_functions: Res<DrawFunctions<Transparent2d>>,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_debug_draw/src/pipeline_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub(crate) type DrawDebugLines = (
DrawMesh,
);

#[allow(clippy::too_many_arguments)]
pub(crate) fn queue(
opaque_3d_draw_functions: Res<DrawFunctions<Opaque3d>>,
debug_line_pipeline: Res<DebugLinePipeline>,
Expand Down
12 changes: 11 additions & 1 deletion examples/stress_tests/many_debug_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ use std::f32::consts::TAU;
use bevy::{
diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin},
prelude::*,
window::PresentMode,
};

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(DefaultPlugins.set(WindowPlugin {
window: WindowDescriptor {
title: "Many Debug Lines".to_string(),
present_mode: PresentMode::AutoNoVsync,
..default()
},
..default()
}))
.add_plugin(FrameTimeDiagnosticsPlugin::default())
.insert_resource(Config {
line_count: 50_000,
Expand Down Expand Up @@ -63,6 +71,8 @@ fn system(
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
warn!(include_str!("warning_string.txt"));

commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(3., 1., 5.).looking_at(Vec3::ZERO, Vec3::Y),
..default()
Expand Down

0 comments on commit 78beb71

Please sign in to comment.