Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Feb 4, 2024
1 parent 04fe53e commit ffefe9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 7 additions & 1 deletion bevy_nannou/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bevy_nannou_draw::color::{RED, SALMON, SEAGREEN, SEASHELL, SKYBLUE};
pub fn main() {
App::new()
.add_plugins((DefaultPlugins, NannouPlugin))
.insert_resource(Msaa::default())
.add_systems(Startup, startup)
.add_systems(Update, (update_draw, update_mesh))
.run();
Expand All @@ -31,6 +32,10 @@ fn startup(mut commands: Commands, assets: Res<AssetServer>, mut meshes: ResMut<

commands.spawn(
(Camera3dBundle {
camera: Camera {
hdr: false,
..Default::default()
},
camera_3d: Camera3d {
// TODO: we should manage this in the nannou plugin as function of backgrond color
clear_color: ClearColorConfig::None,
Expand Down Expand Up @@ -72,7 +77,8 @@ fn update_draw(
Some(texture) => texture,
};

draw.texture(texture_handle.clone(), texture.clone());
// TODO: why is the texture rotated?
// draw.texture(texture_handle.clone(), texture.clone());
draw.ellipse().w_h(100.0, 100.0).color(SALMON);
draw.ellipse()
.x(100.0 + time.elapsed().as_millis() as f32 / 100.0)
Expand Down
3 changes: 0 additions & 3 deletions bevy_nannou_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ fn texture_event_handler(
// TODO hack to only handle 2D textures for now
// We should maybe require users to spawn a NannouTextureHandle themselves
if image.texture_descriptor.dimension == wgpu::TextureDimension::D2 {
println!("Spawning NannouTextureHandle");
commands.spawn(NannouTextureHandle(handle));
}
}
Expand Down Expand Up @@ -158,9 +157,7 @@ fn prepare_texture_bind_groups(
// need to run this on every frame, just when the textures change
for texture in nannou_textures.iter() {
if !texture_bind_group_cache.contains_key(&**texture) {
println!("Found texture {:?}", &**texture);
if let Some(gpu_image) = gpu_images.get(&**texture) {
println!("Creating bind group for texture {:?}", &**texture);
let bind_group_layout = NannouPipeline::create_texture_bind_group_layout(
&render_device,
true,
Expand Down
2 changes: 1 addition & 1 deletion result

0 comments on commit ffefe9f

Please sign in to comment.