Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh overhaul with custom vertex attributes #592 #599

Merged
merged 35 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
35a9bf8
first draft
Sep 28, 2020
4c5d883
clean up + format
Oct 1, 2020
92bae44
Update mesh.rs
Oct 1, 2020
d47897c
Update mesh.rs
Oct 1, 2020
6253a95
clippy nightly
Oct 1, 2020
ccbc1bc
changed vertex buffer slots now taken from binding; shader naming con…
Oct 4, 2020
66640b7
simplified shader vertex attribute reflection, removed VertexBufferDe…
Oct 4, 2020
519b6b0
format
Oct 4, 2020
ae2e670
format nightly
Oct 4, 2020
049e5a9
Draw panics now when vertex buffer is missing; Name based hashmap for…
Oct 5, 2020
21bd324
added proper clean up for mesh resources (untested)
Oct 6, 2020
5a09a47
fixed bevy_text to work with new vertex system
Oct 6, 2020
f59bacd
using fnv hash for vertex attributes; refactor
Oct 7, 2020
80eafc8
restored old vertex naming convention
Oct 7, 2020
8d54839
reintroduced multiple attributes per buffer
Oct 9, 2020
ab37614
changed internal resource id to u64; using AHasher for vertex attribu…
Oct 9, 2020
9734db5
Reintroduced interleaved buffers, but flexible. :smile: Pipeline spec…
Oct 13, 2020
20d101b
made fallback buffer obtional. readded properties to rendering structs
Oct 14, 2020
8ff3bbb
HashMap for attributes for consisten order and uniqueness. Removed Ve…
Oct 16, 2020
5608eb2
fixed text. cleanup
Oct 19, 2020
0d61e81
Removed mesh.insert_attribute. removed VertexBufferDescriptor hack in…
Oct 21, 2020
39740c4
Merge remote-tracking branch 'upstream/master' into render_mesh_seper…
Oct 22, 2020
1417b2c
post merge fixes
Oct 22, 2020
8fb3874
fmt
Oct 22, 2020
01f79c7
Update CHANGELOG.md
Oct 22, 2020
63c4574
Merge branch 'master' into render_mesh_seperate_buffers
Oct 22, 2020
1b39ca9
Sort attributes before turning them into bytes. Removed indices from …
Oct 30, 2020
8ce53ee
Merge branch 'master' into render_mesh_seperate_buffers
Oct 30, 2020
789de51
Update sprite_sheet.vert
Oct 30, 2020
f759aa6
Update mesh.rs
Oct 30, 2020
b766c9a
fixed a bug related to more attributes defined by mesh than used by s…
Oct 31, 2020
223f5a2
format
Oct 31, 2020
5a4d6e2
Revert "format"
Oct 31, 2020
87fde6d
Update pipeline_compiler.rs
Oct 31, 2020
e665298
Update pipeline_compiler.rs
Oct 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions crates/bevy_derive/src/as_vertex_buffer_descriptor.rs

This file was deleted.

7 changes: 0 additions & 7 deletions crates/bevy_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extern crate proc_macro;

mod app_plugin;
mod as_vertex_buffer_descriptor;
mod bytes;
mod modules;
mod render_resource;
Expand Down Expand Up @@ -44,12 +43,6 @@ pub fn derive_shader_defs(input: TokenStream) -> TokenStream {
shader_defs::derive_shader_defs(input)
}

/// Derives the AsVertexBufferDescriptor trait.
#[proc_macro_derive(AsVertexBufferDescriptor, attributes(vertex, as_crate))]
pub fn derive_as_vertex_buffer_descriptor(input: TokenStream) -> TokenStream {
as_vertex_buffer_descriptor::derive_as_vertex_buffer_descriptor(input)
}

/// Generates a dynamic plugin entry point function for the given `Plugin` type.
#[proc_macro_derive(DynamicPlugin)]
pub fn derive_dynamic_plugin(input: TokenStream) -> TokenStream {
Expand Down
29 changes: 8 additions & 21 deletions crates/bevy_render/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,29 +342,16 @@ impl<'a> DrawContext<'a> {
draw: &mut Draw,
render_resource_bindings: &[&RenderResourceBindings],
) -> Result<(), DrawError> {
let pipeline = self.current_pipeline.ok_or(DrawError::NoPipelineSet)?;
let pipeline_descriptor = self
.pipelines
.get(&pipeline)
.ok_or(DrawError::NonExistentPipeline)?;
let layout = pipeline_descriptor
.get_layout()
.ok_or(DrawError::PipelineHasNoLayout)?;
for (slot, vertex_buffer_descriptor) in layout.vertex_buffer_descriptors.iter().enumerate()
{
for bindings in render_resource_bindings.iter() {
if let Some((vertex_buffer, index_buffer)) =
bindings.get_vertex_buffer(&vertex_buffer_descriptor.name)
{
draw.set_vertex_buffer(slot as u32, vertex_buffer, 0);
if let Some(index_buffer) = index_buffer {
draw.set_index_buffer(index_buffer, 0);
}

break;
}
for bindings in render_resource_bindings.iter() {
for vertex_buffer in &bindings.vertex_buffers {
// TODO: don't to the -1 thing, when VERTEX_BUFFER_ASSET_INDEX in mesh.rs is finally gone
draw.set_vertex_buffer(*vertex_buffer.0 as u32 - 1, *vertex_buffer.1, 0);
}
if let Some(index_buffer) = bindings.index_buffer {
draw.set_index_buffer(index_buffer, 0);
}
}

Ok(())
}
}
Expand Down
Loading