virtual cam for recording frames in game
This commit is contained in:
parent
a234c5fd22
commit
a4516dd5d6
1 changed files with 42 additions and 0 deletions
42
src/VCam.cs
Normal file
42
src/VCam.cs
Normal file
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue