group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
FrameRecorder.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstdint>
7#include <glm/glm.hpp>
8#include <string>
9#include <vector>
10
20{
21 uint64_t frameNumber = 0;
22 double timestamp = 0.0;
23 int tickCount = 0;
24
25 // Raw physics state
26 glm::vec3 physPos{0.0f};
27 glm::vec3 physVel{0.0f};
28
29 // Raw input orientation
30 float yaw = 0.0f;
31 float pitch = 0.0f;
32
33 // What was sent to Renderer::drawFrame
34 glm::vec3 renderEye{0.0f};
35 float renderYaw = 0.0f;
36 float renderPitch = 0.0f;
37
38 // Screen-space (pixels) of world objects -- jitter is visible here
39 glm::vec2 cubeScreen{0.0f};
40 glm::vec2 modelScreen{0.0f};
41
42 std::string screenshotPath;
43};
44
56{
57public:
59 void startRecording(const std::string& baseDir);
60
62 void stopRecording();
63
65 void recordFrame(const FrameState& state);
66
67 bool isRecording() const { return recording_; }
68 const std::string& sessionDir() const { return sessionDir_; }
69 double startTimeSecs() const { return startTime_; }
70
71private:
72 bool recording_ = false;
73 std::string sessionDir_;
74 double startTime_ = 0.0;
75 std::vector<FrameState> frames_;
76
77 void writeCSV() const;
78};
Records per-frame state to a timestamped directory on disk.
Definition FrameRecorder.hpp:56
bool isRecording() const
Definition FrameRecorder.hpp:67
const std::string & sessionDir() const
Definition FrameRecorder.hpp:68
void startRecording(const std::string &baseDir)
Open a new session directory inside baseDir.
Definition FrameRecorder.cpp:46
double startTimeSecs() const
Definition FrameRecorder.hpp:69
void stopRecording()
Flush CSV to disk and close the session.
Definition FrameRecorder.cpp:65
void recordFrame(const FrameState &state)
Append one frame's state. No-op when not recording.
Definition FrameRecorder.cpp:75
Per-frame snapshot written to the recording CSV.
Definition FrameRecorder.hpp:20
glm::vec3 physVel
vel.value — current velocity.
Definition FrameRecorder.hpp:27
int tickCount
Physics-tick counter at this render frame.
Definition FrameRecorder.hpp:23
std::string screenshotPath
Absolute PNG path, or empty if unavailable.
Definition FrameRecorder.hpp:42
glm::vec3 renderEye
Definition FrameRecorder.hpp:34
glm::vec2 cubeScreen
Cube centre (0, 32, 400).
Definition FrameRecorder.hpp:39
glm::vec3 physPos
pos.value — what physics says.
Definition FrameRecorder.hpp:26
float pitch
input.pitch (accumulated mouse Y).
Definition FrameRecorder.hpp:31
double timestamp
Seconds since recording started.
Definition FrameRecorder.hpp:22
float yaw
input.yaw (accumulated mouse X).
Definition FrameRecorder.hpp:30
float renderYaw
Definition FrameRecorder.hpp:35
float renderPitch
Definition FrameRecorder.hpp:36
uint64_t frameNumber
Definition FrameRecorder.hpp:21
glm::vec2 modelScreen
Wraith model centre (200, 0, 400).
Definition FrameRecorder.hpp:40