2023-09-01 01:34:58 +00:00
|
|
|
use edict::EntityId;
|
2023-05-14 19:18:18 +00:00
|
|
|
|
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 {
|
2023-05-14 19:18:18 +00:00
|
|
|
mesh: Mesh,
|
|
|
|
material: Material,
|
2023-09-01 01:34:58 +00:00
|
|
|
entity: EntityId,
|
2023-05-15 03:18:41 +00:00
|
|
|
|
2023-05-19 03:44:07 +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,
|
2023-05-14 19:18:18 +00:00
|
|
|
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
|
|
|
|
}
|
2023-05-14 19:18:18 +00:00
|
|
|
|
|
|
|
pub fn material(&self)-> &Material {
|
|
|
|
&self.material
|
|
|
|
}
|
|
|
|
|
2023-09-01 01:34:58 +00:00
|
|
|
pub fn entity(&self)-> EntityId {
|
2023-05-14 19:18:18 +00:00
|
|
|
self.entity
|
|
|
|
}
|
2023-05-19 03:44:07 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|