This commit is contained in:
parent
1d333b633b
commit
b361965033
6 changed files with 25 additions and 70 deletions
7
src/core/render/material.rs
Normal file
7
src/core/render/material.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use bevy_ecs::component::Component;
|
||||
use vulkano::pipeline::GraphicsPipeline;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Material(pub Arc<GraphicsPipeline>);
|
|
@ -1,10 +0,0 @@
|
|||
pub mod triangle;
|
||||
|
||||
use vulkano::command_buffer::CommandBuffer;
|
||||
|
||||
use crate::vulkan::vulkan_context::VulkanContext;
|
||||
|
||||
pub trait Material {
|
||||
fn load(&self, vulkan_context: &VulkanContext);
|
||||
fn bind(&self, command_buffer: &mut CommandBuffer);
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
use glam::Vec4;
|
||||
use vulkano::command_buffer::CommandBuffer;
|
||||
|
||||
use super::Material;
|
||||
|
||||
pub mod shaders {
|
||||
pub mod vs {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "vertex",
|
||||
path: r"res/shaders/vertex.vert",
|
||||
}
|
||||
}
|
||||
|
||||
pub mod fs {
|
||||
vulkano_shaders::shader! {
|
||||
ty: "fragment",
|
||||
path: r"res/shaders/vertex.frag",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TriangleMaterial {
|
||||
pub colors: [Vec4; 3],
|
||||
}
|
||||
|
||||
impl Material for TriangleMaterial {
|
||||
fn bind(&self, command_buffer: &mut CommandBuffer) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn load(&self, vulkan_context: &crate::vulkan::vulkan_context::VulkanContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
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;
|
||||
use vulkano::Validated;
|
||||
|
||||
#[derive(BufferContents, Vertex)]
|
||||
#[repr(C)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue