fancy text
This commit is contained in:
@@ -65,9 +65,12 @@ vulkano::impl_vertex!(LinePoint, position);
|
||||
pub struct TextVertex {
|
||||
pub position: [f32; 3],
|
||||
pub uv: [f32; 2],
|
||||
pub normal: [f32; 3],
|
||||
}
|
||||
vulkano::impl_vertex!(TextVertex, position, uv, normal);
|
||||
vulkano::impl_vertex!(TextVertex, position, uv);
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct TextInstanceData {}
|
||||
vulkano::impl_vertex!(TextInstanceData);
|
||||
|
||||
pub trait Game {
|
||||
/// Returns true if event should be ignored by the vulkan handler
|
||||
@@ -271,6 +274,7 @@ impl VulkanRenderer {
|
||||
let uniform_buffer = vs::ty::ObjectUniformData {
|
||||
view: Matrix4::identity().into(),
|
||||
projection: Matrix4::identity().into(),
|
||||
ortho_projection: Matrix4::identity().into(),
|
||||
time: 0.0,
|
||||
light_position: [0.0, 0.0, 0.0],
|
||||
light_directional_rotation: [0.0, 0.0, 0.0],
|
||||
@@ -448,6 +452,7 @@ impl VulkanRenderer {
|
||||
CPUVertex::Vertex3D(_) => None,
|
||||
CPUVertex::VertexText(vert) => Some(vert)
|
||||
}).collect();
|
||||
|
||||
let vertex_buffer = CpuAccessibleBuffer::from_iter(self.device.clone(), BufferUsage::vertex_buffer(), false, verts.into_iter()).unwrap();
|
||||
self.game_data.meshes_text.push(Mesh { vertex_buffer, index_buffer, original_path });
|
||||
self.game_data.meshes_text.len() - 1
|
||||
@@ -455,7 +460,7 @@ impl VulkanRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, filter: Filter, device: Arc<Device>) {
|
||||
pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, filter: Filter, wrap: SamplerAddressMode, device: Arc<Device>) {
|
||||
let dimensions = Dimensions::Dim2d { width, height };
|
||||
|
||||
let usage = ImageUsage {
|
||||
@@ -540,8 +545,8 @@ impl VulkanRenderer {
|
||||
future.flush().unwrap();
|
||||
|
||||
let sampler = Sampler::new(device.clone(), filter, filter,
|
||||
MipmapMode::Linear, SamplerAddressMode::Repeat, SamplerAddressMode::Repeat,
|
||||
SamplerAddressMode::Repeat, 0.0, 1.0, 0.0, (image_view.mipmap_levels() - 1) as f32).unwrap();
|
||||
MipmapMode::Linear, wrap, wrap, wrap,
|
||||
0.0, 1.0, 0.0, (image_view.mipmap_levels() - 1) as f32).unwrap();
|
||||
|
||||
self.game_data.textures.push(Texture { image: image_view, sampler });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user