Remove ECS pattern: Split into new repo
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 6m2s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 6m2s
This commit is contained in:
parent
d232706f68
commit
f486486be3
32 changed files with 23 additions and 1823 deletions
|
@ -1,19 +0,0 @@
|
|||
use bevy_ecs::component::Component;
|
||||
use glam::{Mat4, Quat, Vec3};
|
||||
|
||||
pub trait Camera: Into<Mat4> + Component {}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Camera3D {
|
||||
pub projection: Mat4,
|
||||
pub position: Vec3,
|
||||
pub rotation: Quat,
|
||||
}
|
||||
|
||||
impl Into<Mat4> for Camera3D {
|
||||
fn into(self) -> Mat4 {
|
||||
Mat4::from_rotation_translation(self.rotation, self.position) * self.projection
|
||||
}
|
||||
}
|
||||
|
||||
impl Camera for Camera3D {}
|
|
@ -1,2 +0,0 @@
|
|||
pub mod camera;
|
||||
pub mod render;
|
|
@ -1,7 +0,0 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use bevy_ecs::component::Component;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Material(pub Arc<GraphicsPipeline>);
|
|
@ -1,14 +0,0 @@
|
|||
use bevy_ecs::component::Component;
|
||||
|
||||
use super::vertex::Vertex2D;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Mesh2D {
|
||||
pub vertices: Vec<Vertex2D>,
|
||||
}
|
||||
|
||||
impl Mesh2D {
|
||||
pub fn new(vertices: Vec<Vertex2D>) -> Self {
|
||||
Self { vertices }
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
pub mod material;
|
||||
pub mod mesh;
|
||||
pub mod vertex;
|
|
@ -1,38 +0,0 @@
|
|||
use std::sync::Arc;
|
||||
use vulkano::Validated;
|
||||
use vulkano::buffer::{
|
||||
AllocateBufferError, Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer,
|
||||
};
|
||||
use vulkano::memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator};
|
||||
use vulkano::pipeline::graphics::vertex_input::Vertex;
|
||||
|
||||
#[derive(BufferContents, Vertex)]
|
||||
#[repr(C)]
|
||||
pub struct Vertex2D {
|
||||
#[format(R32G32_SFLOAT)]
|
||||
pub position: [f32; 2],
|
||||
|
||||
#[format(R32G32B32_SFLOAT)]
|
||||
pub color: [f32; 3],
|
||||
}
|
||||
|
||||
impl Vertex2D {
|
||||
pub fn create_buffer(
|
||||
vertices: Vec<Vertex2D>,
|
||||
memory_allocator: &Arc<StandardMemoryAllocator>,
|
||||
) -> Result<Subbuffer<[Vertex2D]>, Validated<AllocateBufferError>> {
|
||||
Buffer::from_iter(
|
||||
memory_allocator.clone(),
|
||||
BufferCreateInfo {
|
||||
usage: BufferUsage::VERTEX_BUFFER,
|
||||
..Default::default()
|
||||
},
|
||||
AllocationCreateInfo {
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_DEVICE
|
||||
| MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
},
|
||||
vertices,
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue