mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
make wgpu renderer optional
This commit is contained in:
parent
64b897016c
commit
41e15a2d90
4 changed files with 17 additions and 10 deletions
|
@ -4,10 +4,13 @@ version = "0.1.0"
|
|||
authors = ["Carter Anderson <mcanders1@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
default = ["wgpu"]
|
||||
|
||||
[dependencies]
|
||||
# Modified to use std::any::type_name instead of std::any::TypeId
|
||||
legion = { path = "bevy_legion", features = ["serialize"] }
|
||||
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "a7b0d5ae5bc0934439ef559ed145e93f0117c39a"}
|
||||
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "a7b0d5ae5bc0934439ef559ed145e93f0117c39a", optional = true }
|
||||
bitflags = "1.0"
|
||||
glam = "0.8.6"
|
||||
winit = "0.22.0"
|
||||
|
|
|
@ -6,12 +6,8 @@ use crate::{
|
|||
plugin::load_plugin,
|
||||
prelude::StandardMaterial,
|
||||
render::{
|
||||
draw_target::draw_targets::*,
|
||||
pass::passes::*,
|
||||
pipeline::pipelines::*,
|
||||
render_resource::resource_providers::*,
|
||||
renderer::{renderers::wgpu_renderer::WgpuRenderer, Renderer},
|
||||
*,
|
||||
draw_target::draw_targets::*, pass::passes::*, pipeline::pipelines::*,
|
||||
render_resource::resource_providers::*, renderer::Renderer, *,
|
||||
},
|
||||
ui,
|
||||
};
|
||||
|
@ -188,8 +184,14 @@ impl AppBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub fn add_wgpu_renderer(mut self) -> Self {
|
||||
self.renderer = Some(Box::new(WgpuRenderer::new()));
|
||||
self.renderer = Some(Box::new(renderer::renderers::wgpu_renderer::WgpuRenderer::new()));
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "wgpu"))]
|
||||
fn add_wgpu_renderer(self) -> Self {
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -200,6 +202,8 @@ impl AppBuilder {
|
|||
.add_wgpu_renderer()
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn load_plugin(mut self, path: &str) -> Self {
|
||||
let (_lib, plugin) = load_plugin(path);
|
||||
self = plugin.build(self);
|
||||
|
|
|
@ -12,4 +12,3 @@ pub mod ui;
|
|||
pub use bevy_transform as transform;
|
||||
pub use glam as math;
|
||||
pub use legion;
|
||||
pub use wgpu;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#[cfg(feature = "wgpu")]
|
||||
pub mod wgpu_renderer;
|
||||
|
|
Loading…
Reference in a new issue