BC1!!!
This commit is contained in:
@@ -166,9 +166,7 @@ impl TestGame {
|
|||||||
assert!(is_dxt1);
|
assert!(is_dxt1);
|
||||||
println!("Texture width: {}, height: {}, bytes: {}", tex_width, tex_height, tex_byte_count);
|
println!("Texture width: {}, height: {}, bytes: {}", tex_width, tex_height, tex_byte_count);
|
||||||
|
|
||||||
let data_start: usize = 124;
|
renderer.upload_texture(&tex_bytes, tex_width, tex_height, vulkano::format::Format::BC1_RGBUnormBlock, renderer.device.clone());
|
||||||
let data_end: usize = data_start + tex_byte_count as usize;
|
|
||||||
renderer.upload_texture(&tex_bytes[data_start..data_end], tex_width, tex_height, vulkano::format::Format::BC1_RGBASrgbBlock, renderer.device.clone());
|
|
||||||
self.texture_index_counter += 1;
|
self.texture_index_counter += 1;
|
||||||
|
|
||||||
if self.log_config.mesh_load_info {
|
if self.log_config.mesh_load_info {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ pub fn load_mesh(mesh_path: &str, print_status: bool) -> Result<(Vec<CPUMesh>, D
|
|||||||
start_time = Some(SystemTime::now());
|
start_time = Some(SystemTime::now());
|
||||||
println!("Loading mesh file {}", mesh_path);
|
println!("Loading mesh file {}", mesh_path);
|
||||||
}
|
}
|
||||||
let (document, buffers, textures) = gltf::import(mesh_path)?;
|
let (document, buffers, _textures) = gltf::import(mesh_path)?;
|
||||||
let mut meshes = vec![];
|
let mut meshes = vec![];
|
||||||
|
|
||||||
if print_status { println!("Mesh file loaded after {} seconds, processing...", start_time.unwrap().elapsed().unwrap().as_secs()); }
|
if print_status { println!("Mesh file loaded after {} seconds, processing...", start_time.unwrap().elapsed().unwrap().as_secs()); }
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ use std::sync::Arc;
|
|||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use cgmath::{Matrix4, SquareMatrix};
|
use cgmath::{Matrix4, SquareMatrix};
|
||||||
use image::{ImageBuffer, Rgb, Rgba};
|
|
||||||
use image::buffer::ConvertBuffer;
|
|
||||||
use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::SubpassContents, image::MipmapsCount};
|
use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::SubpassContents, image::MipmapsCount};
|
||||||
use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState};
|
use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState};
|
||||||
use vulkano::descriptor::DescriptorSet;
|
use vulkano::descriptor::DescriptorSet;
|
||||||
@@ -434,9 +432,7 @@ impl VulkanRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, device: Arc<Device>) {
|
pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, device: Arc<Device>) {
|
||||||
// Format buffer on cpu for upload
|
|
||||||
let dimensions = Dimensions::Dim2d { width, height };
|
let dimensions = Dimensions::Dim2d { width, height };
|
||||||
|
|
||||||
let (image_view, future) = ImmutableImage::from_iter(bytes.iter().cloned(), dimensions, MipmapsCount::One, format, self.queue.clone()).unwrap();
|
let (image_view, future) = ImmutableImage::from_iter(bytes.iter().cloned(), dimensions, MipmapsCount::One, format, self.queue.clone()).unwrap();
|
||||||
future.flush().unwrap();
|
future.flush().unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user