lyra-engine/src/render/render_job.rs

54 lines
1.1 KiB
Rust
Raw Normal View History

2023-09-01 01:34:58 +00:00
use edict::EntityId;
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,
2023-09-01 01:34:58 +00:00
entity: EntityId,
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 {
2023-09-01 01:34:58 +00:00
pub fn new(mesh: Mesh, material: Material, entity: EntityId, 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
}
2023-09-01 01:34:58 +00:00
pub fn entity(&self)-> EntityId {
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
}