From a4516dd5d6dcb12449afc7cf9be6dc4aaf67cbf8 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Thu, 21 Nov 2024 15:39:52 -0500 Subject: [PATCH] virtual cam for recording frames in game --- src/VCam.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/VCam.cs diff --git a/src/VCam.cs b/src/VCam.cs new file mode 100644 index 0000000..8036181 --- /dev/null +++ b/src/VCam.cs @@ -0,0 +1,42 @@ +using StereoKit; + +namespace snake; + +static class VCam +{ + // [!] clear directory before recording + // or better yet just overwrite and then delete anything that wasn't overwritten at the end + // [!] write documentation for making a video + // for example a kdenlive project file that is preconfigured for 60fps VP9 transparent webm etc + + public static float t = 0.0f; // use this to stage loops *start by rotating 360 degrees + public static int frame_index = 0; + public static bool recording = false; + public static Pose pose = new(0, 0, 0); + + public static void Init() + { + + } + + public static void Frame() + { + if (Input.Key(Key.N).IsJustActive()) + { + recording = !recording; + } + + pose.position = Input.Head.position; + pose.orientation = Input.Head.orientation; + if (recording) + { + frame_index++; + Renderer.Screenshot( + $"_frames/test_{frame_index:D4}.png", + pose, + 1280, + 720 + ); + } + } +} \ No newline at end of file