lyra-engine/src/render/render_job.rs

54 lines
1.1 KiB
Rust
Executable File

use edict::EntityId;
use crate::math::Transform;
use super::{mesh::Mesh, material::Material};
pub struct RenderJob {
mesh: Mesh,
material: Material,
entity: EntityId,
transform: Transform,
last_transform: Option<Transform>, // TODO: render interpolation
}
impl RenderJob {
pub fn new(mesh: Mesh, material: Material, entity: EntityId, transform: Transform, last_transform: Option<Transform>) -> Self {
Self {
mesh,
material,
entity,
transform,
last_transform,
}
}
pub fn mesh(&self)-> &Mesh {
&self.mesh
}
pub fn material(&self)-> &Material {
&self.material
}
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);
}
}