lyra-engine/src/render/render_job.rs

54 lines
1.1 KiB
Rust
Raw Normal View History

use hecs::Entity;
2023-05-15 03:21:47 +00:00
use crate::math::Transform;
use super::{mesh::Mesh, material::Material};
2023-04-20 06:07:11 +00:00
pub struct RenderJob {
mesh: Mesh,
material: Material,
entity: Entity,
2023-05-15 03:18:41 +00:00
transform: Transform,
last_transform: Option<Transform>, // TODO: render interpolation
2023-04-20 06:07:11 +00:00
}
impl RenderJob {
pub fn new(mesh: Mesh, material: Material, entity: Entity, transform: Transform, last_transform: Option<Transform>) -> Self {
2023-04-20 06:07:11 +00:00
Self {
mesh,
material,
entity,
2023-05-15 03:18:41 +00:00
transform,
last_transform,
2023-04-20 06:07:11 +00:00
}
}
pub fn mesh(&self)-> &Mesh {
&self.mesh
}
pub fn material(&self)-> &Material {
&self.material
}
pub fn entity(&self)-> Entity {
self.entity
}
pub fn transform(&self)-> &Transform {
&self.transform
}
pub fn set_transform(&mut self, transform: Transform){
self.transform = transform;
}
pub fn last_transform(&self)-> Option<&Transform> {
self.last_transform.as_ref()
}
pub fn set_last_transform(&mut self, last_transform: Transform){
self.last_transform = Some(last_transform);
}
2023-04-20 06:07:11 +00:00
}