-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Check two tasks:
- dotrix_pbr::EncodeTask -> it provides following output:
type Output = gpu::Commands; - dotrix_gpu::SubmitCommands -> it takes
gpu::Commandsfrom all tasks, sorts them according to priority and executes. As an output, there will betype Output = FrameOutputthat has already the ready frame texture.
The gpu::Commands are important. They cover different rendering parts:
- Clear up the frame
- Render skybox/skydome
- Render terrain
- Render all PBR objects
- Optional post-processing of the 3D scene
- Render overlay (UI)
- Optional post-processing that will affect UI too
Each task that provides gpu::Commands also defines their priority:
encoder.finish(self.priority)
Using the priority you can affect the order of commands.
In other words, post-processing could be just a new task, that will encode appropriate commands with selected effects.
- This brings us to a concept of a new
dotrix_postprocesscrate, that should be created as a result of this issue. - The crate will provide some data structure called
PostProcessthat will implement configuration for the effects. - A user can create a new task in his/her app, that will run under user-defined conditions (state, dependencies etc) with specific post-processing effect and then encode the commands with selected priority.
pub struct PlayerDrunkEffect {
post_processing: PostProcessing,
}
impl PlayerDrunkEffect {
pub fn new(render_priority: u32) -> Self {
Self {
post_processing: PostProcessing {
render_priority,
...configure the drunk effect
}
}
}
}
impl dotrix::Task for UiTask {
type Context = (dotrix::Any<dotrix::Gpu>, dotrix::Any<dotrix::Frame>);
type Output = gpu::Commands;
fn run(&mut self, (gpu, frame): Self::Context) -> Self::Output {
self.post_processing.encode(gpu, frame)
}
}
The only technical complication that is left to solve is double frame buffer. Current frame texture is stored in dotrix_gpu::Gpu::frame_texture. We will need to solve where we render what and when and which one we display in the end :)
Metadata
Metadata
Assignees
Labels
No labels