default texture, y is up
This commit is contained in:
BIN
models/missing-texture.jpg
Normal file
BIN
models/missing-texture.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
10
src/main.rs
10
src/main.rs
@@ -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.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_position += self.cam_rotation.invert().rotate_vector(Vector3::new(
|
||||
self.input.get_axis("move_sideways") * -0.05,
|
||||
@@ -110,10 +110,10 @@ fn main() {
|
||||
let mut renderer = VulkanRenderer::init(
|
||||
(-line_count..=line_count)
|
||||
.flat_map(|it| vec![
|
||||
LinePoint { position: [it as f32, -line_count as f32, 0.] },
|
||||
LinePoint { position: [it as f32, line_count as f32, 0.] },
|
||||
LinePoint { position: [-line_count as f32, it as f32, 0.] },
|
||||
LinePoint { position: [line_count as f32, it as f32, 0.] },
|
||||
LinePoint { position: [it as f32, 0., -line_count as f32] },
|
||||
LinePoint { position: [it as f32, 0., line_count as f32] },
|
||||
LinePoint { position: [-line_count as f32, 0., it as f32] },
|
||||
LinePoint { position: [line_count as f32, 0., it as f32] },
|
||||
]).collect(),
|
||||
log_config.vulkan_validation_layers,
|
||||
);
|
||||
|
||||
@@ -289,18 +289,20 @@ impl VulkanRenderer {
|
||||
|
||||
|
||||
let (default_tex, default_tex_future) = {
|
||||
let image = image::load_from_memory_with_format(include_bytes!("../models/Eye.png"),
|
||||
ImageFormat::PNG).unwrap().to_rgba();
|
||||
let image = image::load_from_memory_with_format(include_bytes!("../models/missing-texture.jpg"),
|
||||
ImageFormat::JPEG).unwrap().to_rgba();
|
||||
let image_data = image.into_raw().clone();
|
||||
|
||||
ImmutableImage::from_iter(
|
||||
image_data.iter().cloned(),
|
||||
Dimensions::Dim2d { width: 4096, height: 4096 },
|
||||
Dimensions::Dim2d { width: 128, height: 128 },
|
||||
Format::R8G8B8A8Unorm,
|
||||
queue.clone(),
|
||||
).unwrap()
|
||||
};
|
||||
|
||||
default_tex_future.flush().unwrap();
|
||||
|
||||
let default_descriptor_set = Arc::new(PersistentDescriptorSet::start(pipeline.clone(), 0)
|
||||
.add_sampled_image(default_tex.clone(), sampler.clone()).unwrap()
|
||||
.build().unwrap()
|
||||
|
||||
Reference in New Issue
Block a user