vulkano reeeeeeeeeeee

This commit is contained in:
2021-10-24 18:57:46 +02:00
parent 23e19bf9d0
commit 2834623ba7
12 changed files with 193 additions and 192 deletions

View File

@@ -1,13 +1,18 @@
use std::sync::Arc;
use cgmath::{Deg, Euler, Matrix4, Quaternion, Vector3};
use vulkano::descriptor_set::PersistentDescriptorSet;
use crate::game::GameState;
use crate::input::InputState;
use crate::vulkan::{RendererDescriptorSets, TextureHandle};
use crate::vulkan::TextureHandle;
use crate::vulkan::{MeshHandle, VulkanRenderer};
use super::pipelines::vs;
use super::pipelines::{vs, vs_text};
pub trait PushConstant {}
impl PushConstant for vs::ty::PushConstants {}
impl PushConstant for vs_text::ty::PushConstants {}
#[derive(Clone)]
pub struct GameObject {
@@ -17,7 +22,7 @@ pub struct GameObject {
pub rotation: Quaternion<f32>,
pub scale: Vector3<f32>,
pub children: Vec<GameObject>,
pub descriptor_sets: Vec<Vec<Arc<RendererDescriptorSets>>>,
pub descriptor_sets: Vec<Vec<Arc<PersistentDescriptorSet>>>,
pub is_selected: bool,
pub pipeline_index: usize,
pub visible: bool,
@@ -60,11 +65,11 @@ impl GameObject {
self.rotation = self.rotation * Quaternion::from(Euler::new(Deg(x), Deg(y), Deg(z)));
}
pub fn get_push_constants(&self) -> vs::ty::PushConstants {
vs::ty::PushConstants {
pub fn get_push_constants(&self) -> Box<dyn PushConstant> {
Box::new(vs::ty::PushConstants {
model: self.get_model_matrix().into(),
is_selected: if self.is_selected { 1 } else { 0 },
}
})
}
pub fn get_model_matrix(&self) -> Matrix4<f32> {