Studio Headless Mode (#36)

This PR adds the capaibility to run Stroyteller studio from the command
line, rendering the result to images. This is the basic functionality,
and there are somethings that I am saving for later when we make this a
more fully fledged feature.

Limitations:
- Right now, you cannot do image output resolutions that aren't 2^n.
This is a bug I plan on tackling later.

If you have questions on how the command line works, use the --help
argument.

Let me know what you think!

---------

Co-authored-by: Danny McGee <dannymcgee@gmail.com>
This commit is contained in:
Brooks Palin
2024-02-19 16:00:30 -07:00
committed by GitHub
parent a1779fb1ec
commit f1c1b85a98
11 changed files with 1016 additions and 28 deletions
+15
View File
@@ -24,6 +24,7 @@ pub struct BvhPlugin;
impl Plugin for BvhPlugin {
fn build(&self, app: &mut App) {
app.init_asset::<Bvh>()
.add_event::<BvhAnimCompleteEvent>()
.register_asset_loader(BvhLoader)
// FIXME: Need to add a state for this module (similar to scene
// module's `SceneState`) to manage the order/frequency at
@@ -106,6 +107,7 @@ fn compute_inverse_bindposes(
pub fn animate_bvh(
mut q_bvh_anims: Query<(&mut BvhAnim, &Children)>,
mut q_bvh_joints: Query<JointQuery, Without<BvhAnim>>,
mut bvh_event_writer: EventWriter<BvhAnimCompleteEvent>,
r_bvh_assets: Res<Assets<Bvh>>,
r_time: Res<Time>,
) {
@@ -122,6 +124,9 @@ pub fn animate_bvh(
if anim.timer.just_finished() {
anim.frame = (anim.frame + 1) % bvh_len;
if anim.frame == 0 {
bvh_event_writer.send(BvhAnimCompleteEvent);
}
}
anim.timer.percent()
@@ -204,6 +209,16 @@ fn lerp_frames<T: ReadOnlyWorldQuery>(
}
}
//==============================================================================
// Bvh Anim Events
//==============================================================================
// This may seem weird, but this is for the Headless mode to
// know when to stop recording.
#[derive(Event)]
pub struct BvhAnimCompleteEvent;
//==============================================================================
// Bvh Anim Component
//==============================================================================