Upgrade to Blitz v0.2.0 (#4731)
* Bump Rust CI version to 1.88 Signed-off-by: Nico Burns <nico@nicoburns.com> * Upgrade to Blitz v0.2.0 Signed-off-by: Nico Burns <nico@nicoburns.com> * Native: enable clipboard and file_dialog support by default * Fix clippy errors Signed-off-by: Nico Burns <nico@nicoburns.com> * See if cargo update magically fixes build Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix compile err Signed-off-by: Nico Burns <nico@nicoburns.com> * Remove unused wasm-opt dep * Fix wgpu_child_window example Signed-off-by: Nico Burns <nico@nicoburns.com> * Update blitz-shell Signed-off-by: Nico Burns <nico@nicoburns.com> * cargo fmt Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow clippy lint Signed-off-by: Nico Burns <nico@nicoburns.com> * CI: Bump pinned nightly version Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow clippy lint in whole module Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix more clippy lints Signed-off-by: Nico Burns <nico@nicoburns.com> * Use Rust 1.90 for clippy Signed-off-by: Nico Burns <nico@nicoburns.com> * cargo update --ignore-rust-version * revert cargo updates Signed-off-by: Nico Burns <nico@nicoburns.com> * Revert another silly clippy lint --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
1 parent
0b1f2fc8c2
commit
9359446017
26 files changed
+1029
-807
No files matched your search
@@ -1,20 +1,20 @@
|
||||
use crate::bevy_scene_plugin::BevyScenePlugin;
|
||||
use bevy::{
|
||||
camera::{ManualTextureViewHandle, RenderTarget},
|
||||
prelude::*,
|
||||
render::{
|
||||
camera::{ManualTextureView, ManualTextureViewHandle, ManualTextureViews, RenderTarget},
|
||||
render_resource::TextureFormat,
|
||||
renderer::{
|
||||
RenderAdapter, RenderAdapterInfo, RenderDevice, RenderInstance, RenderQueue,
|
||||
WgpuWrapper,
|
||||
},
|
||||
settings::{RenderCreation, RenderResources},
|
||||
texture::ManualTextureView,
|
||||
RenderPlugin,
|
||||
},
|
||||
};
|
||||
use dioxus_native::{CustomPaintCtx, DeviceHandle, TextureHandle};
|
||||
use std::sync::Arc;
|
||||
use wgpu::Instance;
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
pub struct UIData {
|
||||
@@ -30,7 +30,7 @@ pub struct BevyRenderer {
|
||||
}
|
||||
|
||||
impl BevyRenderer {
|
||||
pub fn new(instance: &Instance, device_handle: &DeviceHandle) -> Self {
|
||||
pub fn new(device_handle: &DeviceHandle) -> Self {
|
||||
// Create a headless Bevy App.
|
||||
let mut app = App::new();
|
||||
app.add_plugins(
|
||||
@@ -42,7 +42,7 @@ impl BevyRenderer {
|
||||
RenderQueue(Arc::new(WgpuWrapper::new(device_handle.queue.clone()))),
|
||||
RenderAdapterInfo(WgpuWrapper::new(device_handle.adapter.get_info())),
|
||||
RenderAdapter(Arc::new(WgpuWrapper::new(device_handle.adapter.clone()))),
|
||||
RenderInstance(Arc::new(WgpuWrapper::new(instance.clone()))),
|
||||
RenderInstance(Arc::new(WgpuWrapper::new(device_handle.instance.clone()))),
|
||||
)),
|
||||
synchronous_pipeline_compilation: true,
|
||||
..default()
|
||||
@@ -51,6 +51,7 @@ impl BevyRenderer {
|
||||
primary_window: None,
|
||||
exit_condition: bevy::window::ExitCondition::DontExit,
|
||||
close_when_requested: false,
|
||||
..Default::default()
|
||||
})
|
||||
.disable::<bevy::winit::WinitPlugin>(),
|
||||
);
|
||||
@@ -95,7 +96,7 @@ impl BevyRenderer {
|
||||
// Run one frame of the Bevy app to render the 3D scene.
|
||||
self.app.update();
|
||||
|
||||
self.texture_handle
|
||||
self.texture_handle.clone()
|
||||
}
|
||||
|
||||
fn init_texture(&mut self, mut ctx: CustomPaintCtx<'_>, width: u32, height: u32) {
|
||||
@@ -114,9 +115,8 @@ impl BevyRenderer {
|
||||
|
||||
if let Some(mut manual_texture_views) = world.get_resource_mut::<ManualTextureViews>() {
|
||||
// Clean previous texture if any.
|
||||
if let Some(texture_handle) = self.texture_handle {
|
||||
ctx.unregister_texture(texture_handle);
|
||||
self.texture_handle = None;
|
||||
if self.texture_handle.is_some() {
|
||||
ctx.unregister_texture(self.texture_handle.take().unwrap());
|
||||
}
|
||||
if let Some(old_handle) = self.manual_texture_view_handle {
|
||||
manual_texture_views.remove(&old_handle);
|
||||
|
||||
@@ -2,7 +2,6 @@ use crate::bevy_renderer::BevyRenderer;
|
||||
use crate::Color;
|
||||
use dioxus_native::{CustomPaintCtx, CustomPaintSource, DeviceHandle, TextureHandle};
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use wgpu::Instance;
|
||||
|
||||
pub enum DemoMessage {
|
||||
// Color in RGB format
|
||||
@@ -71,8 +70,8 @@ impl DemoPaintSource {
|
||||
}
|
||||
|
||||
impl CustomPaintSource for DemoPaintSource {
|
||||
fn resume(&mut self, instance: &Instance, device_handle: &DeviceHandle) {
|
||||
let active_state = BevyRenderer::new(instance, device_handle);
|
||||
fn resume(&mut self, device_handle: &DeviceHandle) {
|
||||
let active_state = BevyRenderer::new(device_handle);
|
||||
self.state = DemoRendererState::Active(Box::new(active_state));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user