Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bevy = { git = "https://github.com/bevyengine/bevy", branch = "main" }
processing = { path = "." }
processing_pyo3 = { path = "crates/processing_pyo3" }
processing_render = { path = "crates/processing_render" }
processing_utils = { path = "crates/processing_utils" }

[dependencies]
bevy = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/processing_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ x11 = ["bevy/x11"]

[dependencies]
bevy = { workspace = true }
processing_utils = { workspace = true }
lyon = "1.0"
raw-window-handle = "0.6"
thiserror = "2"
Expand Down
11 changes: 5 additions & 6 deletions crates/processing_render/src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ use crate::{
Flush,
error::{ProcessingError, Result},
image::{Image, bytes_to_pixels, create_readback_buffer, pixel_size, pixels_to_bytes},
render::{
RenderState,
command::{CommandBuffer, DrawCommand},
},
render::{RenderState, command::DrawCommand},
surface::Surface,
};

use processing_utils::CommandBuffer;

pub struct GraphicsPlugin;

impl Plugin for GraphicsPlugin {
Expand Down Expand Up @@ -242,7 +241,7 @@ pub fn create(
}),
Transform::from_xyz(0.0, 0.0, 999.9),
render_layer,
CommandBuffer::new(),
CommandBuffer::<DrawCommand>::new(),
RenderState::default(),
SurfaceSize(width, height),
Graphics {
Expand Down Expand Up @@ -465,7 +464,7 @@ pub fn end_draw(app: &mut App, entity: Entity) -> Result<()> {

pub fn record_command(
In((graphics_entity, cmd)): In<(Entity, DrawCommand)>,
mut graphics_query: Query<&mut CommandBuffer>,
mut graphics_query: Query<&mut CommandBuffer<DrawCommand>>,
) -> Result<()> {
let mut command_buffer = graphics_query
.get_mut(graphics_entity)
Expand Down
21 changes: 0 additions & 21 deletions crates/processing_render/src/render/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,3 @@ pub enum DrawCommand {
},
Geometry(Entity),
}

#[derive(Debug, Default, Component)]
pub struct CommandBuffer {
pub commands: Vec<DrawCommand>,
}

impl CommandBuffer {
pub fn new() -> Self {
Self {
commands: Vec::new(),
}
}

pub fn push(&mut self, cmd: DrawCommand) {
self.commands.push(cmd);
}

pub fn clear(&mut self) {
self.commands.clear();
}
}
6 changes: 4 additions & 2 deletions crates/processing_render/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ use bevy::{
math::{Affine3A, Mat4, Vec4},
prelude::*,
};
use command::{CommandBuffer, DrawCommand};
use command::DrawCommand;
use material::MaterialKey;
use primitive::{TessellationMode, empty_mesh};
use transform::TransformStack;

use crate::render::material::UntypedMaterial;
use crate::{Flush, geometry::Geometry, image::Image, render::primitive::rect};

use processing_utils::CommandBuffer;

#[derive(Component)]
#[relationship(relationship_target = TransientMeshes)]
pub struct BelongsToGraphics(pub Entity);
Expand Down Expand Up @@ -93,7 +95,7 @@ pub fn flush_draw_commands(
mut graphics: Query<
(
Entity,
&mut CommandBuffer,
&mut CommandBuffer<DrawCommand>,
&mut RenderState,
&RenderLayers,
&Projection,
Expand Down
10 changes: 10 additions & 0 deletions crates/processing_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "processing_utils"
version = "0.1.0"
edition = "2024"

[dependencies]
bevy = { workspace = true }

[lints]
workspace = true
22 changes: 22 additions & 0 deletions crates/processing_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use bevy::prelude::*;

#[derive(Debug, Default, Component)]
pub struct CommandBuffer<T> {
pub commands: Vec<T>,
}

impl<T> CommandBuffer<T> {
pub fn new() -> Self {
Self {
commands: Vec::new(),
}
}

pub fn push(&mut self, cmd: T) {
self.commands.push(cmd);
}

pub fn clear(&mut self) {
self.commands.clear();
}
}