it works again!!

This commit is contained in:
2021-10-24 19:27:37 +02:00
parent 2834623ba7
commit c8d4da62b6
9 changed files with 14 additions and 22 deletions

View File

@@ -8,11 +8,7 @@ use crate::input::InputState;
use crate::vulkan::TextureHandle;
use crate::vulkan::{MeshHandle, VulkanRenderer};
use super::pipelines::{vs, vs_text};
pub trait PushConstant {}
impl PushConstant for vs::ty::PushConstants {}
impl PushConstant for vs_text::ty::PushConstants {}
use super::pipelines::vs;
#[derive(Clone)]
pub struct GameObject {
@@ -28,6 +24,10 @@ pub struct GameObject {
pub visible: bool,
}
pub enum PushConstantType {
MeshPC(vs::ty::PushConstants),
}
impl GameObject {
pub fn new(mesh: MeshHandle) -> GameObject {
GameObject { mesh_index: mesh.index, textures: mesh.textures, position: Vector3::new(0.0, 0.0, 0.0),
@@ -65,8 +65,8 @@ impl GameObject {
self.rotation = self.rotation * Quaternion::from(Euler::new(Deg(x), Deg(y), Deg(z)));
}
pub fn get_push_constants(&self) -> Box<dyn PushConstant> {
Box::new(vs::ty::PushConstants {
pub fn get_push_constants(&self) -> PushConstantType {
PushConstantType::MeshPC(vs::ty::PushConstants {
model: self.get_model_matrix().into(),
is_selected: if self.is_selected { 1 } else { 0 },
})