default texture, y is up

This commit is contained in:
2019-08-03 00:01:44 +02:00
parent 4f261fa708
commit 35bb18ace9
3 changed files with 10 additions and 8 deletions

BIN
models/missing-texture.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -66,7 +66,7 @@ impl TestGame {
self.cubes = self.test_meshes.iter().map(|(mesh, tex_id)| renderer.add_game_object(GameObject::new(*mesh, *tex_id, renderer))).collect(); self.cubes = self.test_meshes.iter().map(|(mesh, tex_id)| renderer.add_game_object(GameObject::new(*mesh, *tex_id, renderer))).collect();
} }
self.cam_rotation = self.cam_rotation * Quaternion::from_angle_z(Deg(self.input.get_axis("look_horizontal") * 0.05)); self.cam_rotation = self.cam_rotation * Quaternion::from_angle_y(Deg(self.input.get_axis("look_horizontal") * 0.05));
self.cam_rotation = Quaternion::from_angle_x(Deg(self.input.get_axis("look_vertical") * 0.05)) * self.cam_rotation; self.cam_rotation = Quaternion::from_angle_x(Deg(self.input.get_axis("look_vertical") * 0.05)) * self.cam_rotation;
self.cam_position += self.cam_rotation.invert().rotate_vector(Vector3::new( self.cam_position += self.cam_rotation.invert().rotate_vector(Vector3::new(
self.input.get_axis("move_sideways") * -0.05, self.input.get_axis("move_sideways") * -0.05,
@@ -110,10 +110,10 @@ fn main() {
let mut renderer = VulkanRenderer::init( let mut renderer = VulkanRenderer::init(
(-line_count..=line_count) (-line_count..=line_count)
.flat_map(|it| vec![ .flat_map(|it| vec![
LinePoint { position: [it as f32, -line_count as f32, 0.] }, LinePoint { position: [it as f32, 0., -line_count as f32] },
LinePoint { position: [it as f32, line_count as f32, 0.] }, LinePoint { position: [it as f32, 0., line_count as f32] },
LinePoint { position: [-line_count as f32, it as f32, 0.] }, LinePoint { position: [-line_count as f32, 0., it as f32] },
LinePoint { position: [line_count as f32, it as f32, 0.] }, LinePoint { position: [line_count as f32, 0., it as f32] },
]).collect(), ]).collect(),
log_config.vulkan_validation_layers, log_config.vulkan_validation_layers,
); );

View File

@@ -289,18 +289,20 @@ impl VulkanRenderer {
let (default_tex, default_tex_future) = { let (default_tex, default_tex_future) = {
let image = image::load_from_memory_with_format(include_bytes!("../models/Eye.png"), let image = image::load_from_memory_with_format(include_bytes!("../models/missing-texture.jpg"),
ImageFormat::PNG).unwrap().to_rgba(); ImageFormat::JPEG).unwrap().to_rgba();
let image_data = image.into_raw().clone(); let image_data = image.into_raw().clone();
ImmutableImage::from_iter( ImmutableImage::from_iter(
image_data.iter().cloned(), image_data.iter().cloned(),
Dimensions::Dim2d { width: 4096, height: 4096 }, Dimensions::Dim2d { width: 128, height: 128 },
Format::R8G8B8A8Unorm, Format::R8G8B8A8Unorm,
queue.clone(), queue.clone(),
).unwrap() ).unwrap()
}; };
default_tex_future.flush().unwrap();
let default_descriptor_set = Arc::new(PersistentDescriptorSet::start(pipeline.clone(), 0) let default_descriptor_set = Arc::new(PersistentDescriptorSet::start(pipeline.clone(), 0)
.add_sampled_image(default_tex.clone(), sampler.clone()).unwrap() .add_sampled_image(default_tex.clone(), sampler.clone()).unwrap()
.build().unwrap() .build().unwrap()