mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
remove .system from pipelined code (#2538)
Now that we have main features, lets use them!
This commit is contained in:
parent
955c79f299
commit
2e99d84cdc
32 changed files with 92 additions and 153 deletions
5
.github/bors.toml
vendored
5
.github/bors.toml
vendored
|
@ -3,8 +3,9 @@ status = [
|
|||
"build (stable, ubuntu-latest)",
|
||||
"build (stable, macos-latest)",
|
||||
"build (nightly, ubuntu-latest)",
|
||||
"build-wasm (stable, ubuntu-latest)",
|
||||
"build-wasm (nightly, ubuntu-latest)",
|
||||
# TODO: re-enable after wasm works on pipelined-rendering
|
||||
# "build-wasm (stable, ubuntu-latest)",
|
||||
# "build-wasm (nightly, ubuntu-latest)",
|
||||
"markdownlint",
|
||||
"check-markdown-links",
|
||||
"run-examples",
|
||||
|
|
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
@ -45,27 +45,27 @@ jobs:
|
|||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUSTFLAGS: "-C debuginfo=0 -D warnings"
|
||||
# NOTE: temporarily disabled while we sort out pipelined-rendering support
|
||||
# build-wasm:
|
||||
# strategy:
|
||||
# matrix:
|
||||
# toolchain: [stable, nightly]
|
||||
# os: [ubuntu-latest]
|
||||
# runs-on: ${{ matrix.os }}
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
build-wasm:
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain: [stable, nightly]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# - uses: actions-rs/toolchain@v1
|
||||
# with:
|
||||
# toolchain: ${{ matrix.toolchain }}
|
||||
# target: wasm32-unknown-unknown
|
||||
# override: true
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
target: wasm32-unknown-unknown
|
||||
override: true
|
||||
|
||||
- name: Check wasm
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --target wasm32-unknown-unknown --no-default-features --features bevy_winit,x11,hdr,bevy_gltf
|
||||
# - name: Check wasm
|
||||
# uses: actions-rs/cargo@v1
|
||||
# with:
|
||||
# command: check
|
||||
# args: --target wasm32-unknown-unknown --no-default-features --features bevy_winit,x11,hdr,bevy_gltf
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -544,7 +544,7 @@ impl App {
|
|||
/// #
|
||||
/// # struct MyOwnPlugin;
|
||||
/// # impl Plugin for MyOwnPlugin {
|
||||
/// # fn build(&self, app: &mut AppBuilder){;}
|
||||
/// # fn build(&self, app: &mut App) { }
|
||||
/// # }
|
||||
/// #
|
||||
/// App::new()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
archetype::ArchetypeGeneration,
|
||||
system::{check_system_change_tick, BoxedSystem, IntoSystem, System, SystemId},
|
||||
system::{check_system_change_tick, BoxedSystem, IntoSystem, SystemId},
|
||||
world::World,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -27,11 +27,15 @@ use std::{
|
|||
///
|
||||
/// ```
|
||||
/// # use bevy_ecs::prelude::*;
|
||||
/// # use std::marker::PhantomData;
|
||||
/// use bevy_ecs::system::SystemParam;
|
||||
///
|
||||
/// #[derive(SystemParam)]
|
||||
/// struct MyParam<'a> {
|
||||
/// foo: Res<'a, usize>,
|
||||
/// struct MyParam<'s, 'w> {
|
||||
/// foo: Res<'w, usize>,
|
||||
/// // TODO: this isn't ideal ... maybe the SystemParam derive can be smarter about world and state lifetimes?
|
||||
/// #[system_param(ignore)]
|
||||
/// marker: PhantomData<&'s usize>,
|
||||
/// }
|
||||
///
|
||||
/// fn my_system(param: MyParam) {
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# Crevice Changelog
|
||||
|
||||
## Unreleased Changes
|
||||
|
||||
## [0.6.0][0.6.0] (2021-02-24)
|
||||
* Added `std430` support. Most APIs between `std140` and `std430` are the same!
|
||||
* Added the `WriteStd140` trait. This trait is more general than `AsStd140` and is automatically implemented for all existing `AsStd140` implementers.
|
||||
* Added `Writer::write_std140` to write a type that implements `Std140`.
|
||||
* Added `AsStd140::std140_size_static`. This is similar to the old size method, `std140_size`, but no longer requires a value to be passed. For size measurements that depend on a value, use `WriteStd140::std140_size` instead.
|
||||
* Deprecated `Writer::write_slice`, as `Writer::write` now accepts slices.
|
||||
* Changed bounds of some functions, like `Writer::write` to use `WriteStd140` instead of `AsStd140`. This should affect no existing consumers.
|
||||
* Moved `std140_size` from `AsStd140` to `WriteStd140`. Some existing consumers may need to import the other trait to access this m ethod.
|
||||
|
||||
[0.6.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.6.0
|
||||
|
||||
## 0.5.0 (2020-10-18)
|
||||
* Added f64-based std140 types: `DVec2`, `DVec3`, `DVec4`, `DMat2`, `DMat3`, and `DMat4`.
|
||||
* Added support for std140 structs with alignment greater than 16.
|
||||
* Fixed padding for std140 matrices; they were previously missing trailing padding.
|
||||
|
||||
## 0.4.0 (2020-10-01)
|
||||
* Added `AsStd140::std140_size` for easily pre-sizing buffers.
|
||||
* `Writer::write` and `Sizer::add` now return the offset the value is or would be written to.
|
||||
* Added `std140::DynamicUniform` for aligning dynamic uniform members.
|
||||
* Added `Writer::write_slice` for writing multiple values in a row.
|
||||
|
||||
## 0.3.0 (2020-09-22)
|
||||
* Added `Std140::as_bytes`, reducing the need to work with bytemuck directly.
|
||||
* Removed public re-export of bytemuck.
|
||||
|
||||
## 0.2.0 (2020-09-22)
|
||||
* Added documentation for everything in the crate.
|
||||
* Removed `type_layout` being exposed except for internal tests.
|
||||
* Fixed alignment offset not taking into account previously added alignment.
|
||||
* Added `std140::Writer`, for writing dynamically laid out types to buffers.
|
||||
* Added `std140::Sizer`, for pre-calculating buffer sizes.
|
||||
|
||||
## 0.1.0 (2020-09-18)
|
||||
* Initial MVP release
|
|
@ -25,7 +25,4 @@ mint = "0.5.5"
|
|||
glam = "0.15.1"
|
||||
|
||||
[dev-dependencies]
|
||||
cgmath = { version = "0.17.0", features = ["mint"] }
|
||||
insta = "0.16.1"
|
||||
type-layout = { version = "0.2.0", features = ["serde1"] }
|
||||
crevice-derive = { version = "0.6.0", path = "crevice-derive" }
|
||||
|
|
|
@ -18,9 +18,9 @@ Examples in this crate use cgmath, but any math crate that works with the mint
|
|||
crate will also work. Some other crates include nalgebra, ultraviolet, glam, and
|
||||
vek.
|
||||
|
||||
### Examples
|
||||
## Examples
|
||||
|
||||
#### Single Value
|
||||
### Single Value
|
||||
|
||||
Uploading many types can be done by deriving `AsStd140` and using
|
||||
[`as_std140`][std140::AsStd140::as_std140] and
|
||||
|
@ -126,10 +126,11 @@ Crevice supports Rust 1.46.0 and newer due to use of new `const fn` features.
|
|||
|
||||
Licensed under either of
|
||||
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|
||||
|
|
|
@ -9,11 +9,6 @@ homepage = "https://github.com/LPGhatguy/crevice"
|
|||
repository = "https://github.com/LPGhatguy/crevice"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[features]
|
||||
# Feature used for testing; enables type_layout derive on types.
|
||||
# Requires crate using derive to depend on type_layout as well.
|
||||
test_type_layout = []
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
|
|
|
@ -244,10 +244,6 @@ impl EmitOptions {
|
|||
},
|
||||
);
|
||||
|
||||
// For testing purposes, we can optionally generate type layout
|
||||
// information using the type-layout crate.
|
||||
let type_layout_derive = quote!();
|
||||
|
||||
quote! {
|
||||
#[allow(non_snake_case)]
|
||||
mod #alignment_mod_name {
|
||||
|
@ -257,7 +253,6 @@ impl EmitOptions {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#type_layout_derive
|
||||
#[repr(C)]
|
||||
#visibility struct #generated_name #ty_generics #where_clause {
|
||||
#( #generated_fields )*
|
||||
|
|
|
@ -35,7 +35,7 @@ uniform MAIN {
|
|||
} main;
|
||||
```
|
||||
|
||||
```rust
|
||||
```skip
|
||||
use crevice::std140::{AsStd140, Std140};
|
||||
use cgmath::prelude::*;
|
||||
use cgmath::{Matrix3, Vector3};
|
||||
|
@ -76,7 +76,7 @@ buffer POINT_LIGHTS {
|
|||
} point_lights;
|
||||
```
|
||||
|
||||
```rust
|
||||
```skip
|
||||
use crevice::std140::{self, AsStd140};
|
||||
|
||||
#[derive(AsStd140)]
|
||||
|
|
|
@ -87,7 +87,7 @@ uniform CAMERA {
|
|||
} camera;
|
||||
```
|
||||
|
||||
```
|
||||
```skip
|
||||
use cgmath::prelude::*;
|
||||
use cgmath::{Matrix4, Deg, perspective};
|
||||
use crevice::std140::{AsStd140, Std140};
|
||||
|
|
|
@ -22,9 +22,9 @@ fn main() {
|
|||
.add_plugins(PipelinedDefaultPlugins)
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_startup_system(setup.system())
|
||||
.add_system(movement.system())
|
||||
.add_system(animate_light_direction.system())
|
||||
.add_startup_system(setup)
|
||||
.add_system(movement)
|
||||
.add_system(animate_light_direction)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
.add_plugins(PipelinedDefaultPlugins)
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_startup_system(setup.system())
|
||||
.add_startup_system(setup)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ fn main() {
|
|||
);
|
||||
App::new()
|
||||
.add_plugins(PipelinedDefaultPlugins)
|
||||
.add_startup_system(setup.system())
|
||||
.add_system(adjust_point_light_biases.system())
|
||||
.add_system(toggle_light.system())
|
||||
.add_system(adjust_directional_light_biases.system())
|
||||
.add_system(camera_controller.system())
|
||||
.add_startup_system(setup)
|
||||
.add_system(adjust_point_light_biases)
|
||||
.add_system(toggle_light)
|
||||
.add_system(adjust_directional_light_biases)
|
||||
.add_system(camera_controller)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ fn setup(
|
|||
mesh: meshes.add(Mesh::from(shape::Plane {
|
||||
size: 2.0 * spawn_plane_depth,
|
||||
})),
|
||||
material: white_handle.clone(),
|
||||
material: white_handle,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use bevy::{
|
|||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(PipelinedDefaultPlugins)
|
||||
.add_startup_system(setup.system())
|
||||
.add_startup_system(setup)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,14 +96,19 @@ Example | File | Description
|
|||
Example | File | Description
|
||||
--- | --- | ---
|
||||
`3d_scene` | [`3d/3d_scene.rs`](./3d/3d_scene.rs) | Simple 3D scene with basic shapes and lighting
|
||||
`3d_scene_pipelined` | [`3d/3d_scene_pipelined.rs`](./3d/3d_scene_pipelined.rs) | Simple 3D scene with basic shapes and lighting
|
||||
`cornell_box_pipelined` | [`3d/cornell_box_pipelined.rs`](./3d/cornell_box_pipelined.rs) | Re-production of the cornell box
|
||||
`load_gltf` | [`3d/load_gltf.rs`](./3d/load_gltf.rs) | Loads and renders a gltf file as a scene
|
||||
`msaa` | [`3d/msaa.rs`](./3d/msaa.rs) | Configures MSAA (Multi-Sample Anti-Aliasing) for smoother edges
|
||||
`orthographic` | [`3d/orthographic.rs`](./3d/orthographic.rs) | Shows how to create a 3D orthographic view (for isometric-look games or CAD applications)
|
||||
`parenting` | [`3d/parenting.rs`](./3d/parenting.rs) | Demonstrates parent->child relationships and relative transformations
|
||||
`pbr` | [`3d/pbr.rs`](./3d/pbr.rs) | Demonstrates use of Physically Based Rendering (PBR) properties
|
||||
`pbr_pipelined` | [`3d/pbr_pipelined.rs`](./3d/pbr_pipelined.rs) | Demonstrates use of Physically Based Rendering (PBR) properties
|
||||
`render_to_texture` | [`3d/render_to_texture.rs`](./3d/render_to_texture.rs) | Shows how to render to texture
|
||||
`shadow_biases_pipelined` | [`3d/shadow_biases_pipelined.rs`](./3d/shadow_biases_pipelined.rs) | Demonstrates how shadow biases affect shadows in a 3d scene
|
||||
`spawner` | [`3d/spawner.rs`](./3d/spawner.rs) | Renders a large number of cubes with changing position and material
|
||||
`texture` | [`3d/texture.rs`](./3d/texture.rs) | Shows configuration of texture materials
|
||||
`texture_pipelined` | [`3d/texture_pipelined.rs`](./3d/texture_pipelined.rs) | Shows configuration of texture materials
|
||||
`update_gltf_scene` | [`3d/update_gltf_scene.rs`](./3d/update_gltf_scene.rs) | Update a scene from a gltf file, either by spawning the scene as a child of another entity, or by accessing the entities of the scene
|
||||
`wireframe` | [`3d/wireframe.rs`](./3d/wireframe.rs) | Showcases wireframe rendering
|
||||
`z_sort_debug` | [`3d/z_sort_debug.rs`](./3d/z_sort_debug.rs) | Visualizes camera Z-ordering
|
||||
|
@ -230,6 +235,7 @@ Example | File | Description
|
|||
Example | File | Description
|
||||
--- | --- | ---
|
||||
`bevymark` | [`tools/bevymark.rs`](./tools/bevymark.rs) | A heavy workload to benchmark your system with Bevy
|
||||
`bevymark_pipelined` | [`tools/bevymark_pipelined.rs`](./tools/bevymark_pipelined.rs) | A heavy workload to benchmark your system with Bevy
|
||||
|
||||
## UI (User Interface)
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ fn main() {
|
|||
// .add_plugin(WgpuResourceDiagnosticsPlugin::default())
|
||||
.insert_resource(BevyCounter { count: 0 })
|
||||
// .init_resource::<BirdMaterial>()
|
||||
.add_startup_system(setup.system())
|
||||
.add_system(mouse_handler.system())
|
||||
.add_system(movement_system.system())
|
||||
.add_system(collision_system.system())
|
||||
.add_system(counter_system.system())
|
||||
.add_startup_system(setup)
|
||||
.add_system(mouse_handler)
|
||||
.add_system(movement_system)
|
||||
.add_system(collision_system)
|
||||
.add_system(counter_system)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,5 +28,5 @@ bevy_utils = { path = "../../crates/bevy_utils", version = "0.5.0" }
|
|||
bitflags = "1.2"
|
||||
# direct dependency required for derive macro
|
||||
bytemuck = { version = "1", features = ["derive"] }
|
||||
crevice = { path = "../../crates/crevice" }
|
||||
crevice = { path = "../../crates/crevice", version = "0.6.0" }
|
||||
wgpu = "0.9"
|
||||
|
|
|
@ -33,20 +33,17 @@ impl Plugin for PbrPlugin {
|
|||
|
||||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_meshes.system())
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_lights.system())
|
||||
.add_system_to_stage(RenderStage::Prepare, render::prepare_meshes.system())
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_meshes)
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_lights)
|
||||
.add_system_to_stage(RenderStage::Prepare, render::prepare_meshes)
|
||||
.add_system_to_stage(
|
||||
RenderStage::Prepare,
|
||||
// this is added as an exclusive system because it contributes new views. it must run (and have Commands applied)
|
||||
// _before_ the `prepare_views()` system is run. ideally this becomes a normal system when "stageless" features come out
|
||||
render::prepare_lights.exclusive_system(),
|
||||
)
|
||||
.add_system_to_stage(RenderStage::Queue, render::queue_meshes.system())
|
||||
.add_system_to_stage(
|
||||
RenderStage::PhaseSort,
|
||||
sort_phase_system::<ShadowPhase>.system(),
|
||||
)
|
||||
.add_system_to_stage(RenderStage::Queue, render::queue_meshes)
|
||||
.add_system_to_stage(RenderStage::PhaseSort, sort_phase_system::<ShadowPhase>)
|
||||
// FIXME: Hack to ensure RenderCommandQueue is initialized when PbrShaders is being initialized
|
||||
// .init_resource::<RenderCommandQueue>()
|
||||
.init_resource::<PbrShaders>()
|
||||
|
|
|
@ -30,7 +30,7 @@ image = { version = "0.23.12", default-features = false }
|
|||
|
||||
# misc
|
||||
wgpu = "0.9"
|
||||
naga = { git = "https://github.com/gfx-rs/naga", rev = "0cf5484bba530f1134badbd2a1c1a8e9daf2e9c3", features = ["glsl-in", "spv-in", "spv-out", "wgsl-in", "wgsl-out"] }
|
||||
naga = { version = "0.5", features = ["glsl-in", "spv-in", "spv-out", "wgsl-in", "wgsl-out"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
bitflags = "1.2.1"
|
||||
smallvec = { version = "1.6", features = ["union", "const_generics"] }
|
||||
|
@ -40,9 +40,9 @@ thiserror = "1.0"
|
|||
futures-lite = "1.4.0"
|
||||
anyhow = "1.0"
|
||||
hex = "0.4.2"
|
||||
hexasphere = "3.4"
|
||||
hexasphere = "4.0"
|
||||
parking_lot = "0.11.0"
|
||||
crevice = { path = "../../crates/crevice" }
|
||||
crevice = { path = "../../crates/crevice", version = "0.6.0" }
|
||||
|
||||
[features]
|
||||
png = ["image/png"]
|
||||
|
|
|
@ -31,22 +31,19 @@ impl Plugin for CameraPlugin {
|
|||
active_cameras.add(Self::CAMERA_3D);
|
||||
app.register_type::<Camera>()
|
||||
.insert_resource(active_cameras)
|
||||
.add_system_to_stage(CoreStage::PostUpdate, crate::camera::active_cameras_system)
|
||||
.add_system_to_stage(
|
||||
CoreStage::PostUpdate,
|
||||
crate::camera::active_cameras_system.system(),
|
||||
crate::camera::camera_system::<OrthographicProjection>,
|
||||
)
|
||||
.add_system_to_stage(
|
||||
CoreStage::PostUpdate,
|
||||
crate::camera::camera_system::<OrthographicProjection>.system(),
|
||||
)
|
||||
.add_system_to_stage(
|
||||
CoreStage::PostUpdate,
|
||||
crate::camera::camera_system::<PerspectiveProjection>.system(),
|
||||
crate::camera::camera_system::<PerspectiveProjection>,
|
||||
);
|
||||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.init_resource::<ExtractedCameraNames>()
|
||||
.add_system_to_stage(RenderStage::Extract, extract_cameras.system());
|
||||
.add_system_to_stage(RenderStage::Extract, extract_cameras);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,18 +61,15 @@ impl Plugin for CorePipelinePlugin {
|
|||
fn build(&self, app: &mut App) {
|
||||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.add_system_to_stage(
|
||||
RenderStage::Extract,
|
||||
extract_core_pipeline_camera_phases.system(),
|
||||
)
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_core_views_system.system())
|
||||
.add_system_to_stage(RenderStage::Extract, extract_core_pipeline_camera_phases)
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_core_views_system)
|
||||
.add_system_to_stage(
|
||||
RenderStage::PhaseSort,
|
||||
sort_phase_system::<Transparent2dPhase>.system(),
|
||||
sort_phase_system::<Transparent2dPhase>,
|
||||
)
|
||||
.add_system_to_stage(
|
||||
RenderStage::PhaseSort,
|
||||
sort_phase_system::<Transparent3dPhase>.system(),
|
||||
sort_phase_system::<Transparent3dPhase>,
|
||||
);
|
||||
|
||||
let pass_node_2d = MainPass2dNode::new(&mut render_app.world);
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
//! # Examples
|
||||
//!
|
||||
//! ```rust
|
||||
//! use bevy_render::mesh::VertexAttributeValues;
|
||||
//! use bevy_render2::mesh::VertexAttributeValues;
|
||||
//! use std::convert::{ TryInto, TryFrom };
|
||||
//!
|
||||
//! // creating std::vec::Vec
|
||||
//! let buffer = vec![[0_u32; 4]; 10];
|
||||
//!
|
||||
//! // converting std::vec::Vec to bevy_render::mesh::VertexAttributeValues
|
||||
//! // converting std::vec::Vec to bevy_render2::mesh::VertexAttributeValues
|
||||
//! let values = VertexAttributeValues::from(buffer.clone());
|
||||
//!
|
||||
//! // converting bevy_render::mesh::VertexAttributeValues to std::vec::Vec with two ways
|
||||
//! // converting bevy_render2::mesh::VertexAttributeValues to std::vec::Vec with two ways
|
||||
//! let result_into: Vec<[u32; 4]> = values.clone().try_into().unwrap();
|
||||
//! let result_from: Vec<[u32; 4]> = Vec::try_from(values.clone()).unwrap();
|
||||
//!
|
||||
|
|
|
@ -36,8 +36,8 @@ pub struct Mesh {
|
|||
///
|
||||
/// Example of constructing a mesh:
|
||||
/// ```
|
||||
/// # use bevy_render::mesh::{Mesh, Indices};
|
||||
/// # use bevy_render::pipeline::PrimitiveTopology;
|
||||
/// # use bevy_render2::mesh::{Mesh, Indices};
|
||||
/// # use bevy_render2::render_resource::PrimitiveTopology;
|
||||
/// fn create_triangle() -> Mesh {
|
||||
/// let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
|
||||
/// mesh.set_attribute(Mesh::ATTRIBUTE_POSITION, vec![[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 1.0, 0.0]]);
|
||||
|
|
|
@ -35,8 +35,8 @@ impl<A: RenderAsset> Plugin for RenderAssetPlugin<A> {
|
|||
render_app
|
||||
.init_resource::<ExtractedAssets<A>>()
|
||||
.init_resource::<RenderAssets<A>>()
|
||||
.add_system_to_stage(RenderStage::Extract, extract_render_asset::<A>.system())
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_render_asset::<A>.system());
|
||||
.add_system_to_stage(RenderStage::Extract, extract_render_asset::<A>)
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_render_asset::<A>);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Shader {
|
|||
&source,
|
||||
&naga::front::glsl::Options {
|
||||
entry_points,
|
||||
..Default::default()
|
||||
defines: Default::default(),
|
||||
},
|
||||
)?
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ pub use texture_cache::*;
|
|||
use crate::{render_asset::RenderAssetPlugin, RenderStage};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::prelude::*;
|
||||
|
||||
// TODO: replace Texture names with Image names?
|
||||
pub struct ImagePlugin;
|
||||
|
@ -34,7 +33,7 @@ impl Plugin for ImagePlugin {
|
|||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.init_resource::<TextureCache>()
|
||||
.add_system_to_stage(RenderStage::Cleanup, update_texture_cache_system.system());
|
||||
.add_system_to_stage(RenderStage::Cleanup, update_texture_cache_system);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ impl Plugin for ViewPlugin {
|
|||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.init_resource::<ViewMeta>()
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_views.system());
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_views);
|
||||
|
||||
let mut graph = render_app.world.get_resource_mut::<RenderGraph>().unwrap();
|
||||
graph.add_node(ViewPlugin::VIEW_NODE, ViewNode);
|
||||
|
|
|
@ -23,8 +23,8 @@ impl Plugin for WindowRenderPlugin {
|
|||
render_app
|
||||
.init_resource::<WindowSurfaces>()
|
||||
.init_resource::<NonSendMarker>()
|
||||
.add_system_to_stage(RenderStage::Extract, extract_windows.system())
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_windows.system());
|
||||
.add_system_to_stage(RenderStage::Extract, extract_windows)
|
||||
.add_system_to_stage(RenderStage::Prepare, prepare_windows);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ pub use render::*;
|
|||
pub use sprite::*;
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::prelude::IntoSystem;
|
||||
use bevy_render2::{
|
||||
core_pipeline, render_graph::RenderGraph, render_phase::DrawFunctions, RenderStage,
|
||||
};
|
||||
|
@ -22,9 +21,9 @@ impl Plugin for SpritePlugin {
|
|||
app.register_type::<Sprite>();
|
||||
let render_app = app.sub_app_mut(0);
|
||||
render_app
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_sprites.system())
|
||||
.add_system_to_stage(RenderStage::Prepare, render::prepare_sprites.system())
|
||||
.add_system_to_stage(RenderStage::Queue, queue_sprites.system())
|
||||
.add_system_to_stage(RenderStage::Extract, render::extract_sprites)
|
||||
.add_system_to_stage(RenderStage::Prepare, render::prepare_sprites)
|
||||
.add_system_to_stage(RenderStage::Queue, queue_sprites)
|
||||
.init_resource::<SpriteShaders>()
|
||||
.init_resource::<SpriteMeta>();
|
||||
let draw_sprite = DrawSprite::new(&mut render_app.world);
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
* Remove AppBuilder
|
||||
* Add SubApps
|
||||
* `Res<Box<dyn RenderResourceContext>>` -> `Res<RenderResources>`
|
||||
* Removed RenderResourceBindings
|
||||
* Made shaders and pipelines proper render resources (removes dependency on bevy_asset and is generally a cleaner api)
|
||||
* Removed RenderResources / RenderResource traits
|
||||
* Decoupled swap chain from Window in Renderer api
|
||||
* Removed RenderResourceBindings
|
||||
* Removed asset tracking from render resources
|
||||
* Removed cruft from RenderResource api
|
Loading…
Reference in a new issue