enable setting output directory for recording

This commit is contained in:
Nick Fisher
2023-11-20 22:59:50 +08:00
parent 5c1be3d047
commit 660395a40e
8 changed files with 83 additions and 25 deletions

View File

@@ -46,6 +46,7 @@ typedef int32_t EntityId;
namespace polyvox
{
enum ToneMapping
{
ACES,
@@ -124,6 +125,7 @@ namespace polyvox
void setPostProcessing(bool enabled);
void setRecording(bool recording);
void setRecordingOutputDirectory(const char* path);
AssetManager *const getAssetManager()
@@ -156,11 +158,11 @@ namespace polyvox
Skybox *_skybox = nullptr;
Texture *_iblTexture = nullptr;
IndirectLight *_indirectLight = nullptr;
bool _recomputeAabb = false;
bool _actualSize = false;
float _frameInterval = 1000.0 / 60.0;
// Camera properties
Camera *_mainCamera = nullptr; // the default camera added to every scene. If you want the *active* camera, access via View.
float _cameraFocalLength = 28.0f;
@@ -192,13 +194,18 @@ namespace polyvox
void loadKtxTexture(string path, ResourceBuffer data);
void loadPngTexture(string path, ResourceBuffer data);
void loadTextureFromPath(string path);
void savePng(void* data, size_t size);
int _frameNumber = 0;
void savePng(void* data, size_t size, int frameNumber);
uint32_t _lastFrameTimeInNanos;
time_point_t _startTime = std::chrono::high_resolution_clock::now();
bool _recording = false;
std::string _recordingOutputDirectory = std::string("/tmp");
std::mutex _recordingMutex;
};
struct FrameCallbackData {
FilamentViewer* viewer;
uint32_t frameNumber;
};
}

View File

@@ -170,6 +170,7 @@ extern "C"
FLUTTER_PLUGIN_EXPORT const char *get_name_for_entity(void *const assetManager, const EntityId entityId);
FLUTTER_PLUGIN_EXPORT const EntityId find_child_entity_by_name(void *const assetManager, const EntityId parent, const char* name);
FLUTTER_PLUGIN_EXPORT void set_recording(void *const viewer, bool recording);
FLUTTER_PLUGIN_EXPORT void set_recording_output_directory(void *const viewer, const char* outputDirectory);
FLUTTER_PLUGIN_EXPORT void ios_dummy();
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void *ptr);
#ifdef __cplusplus

View File

@@ -54,7 +54,7 @@ public:
private:
void add_worker() {
std::thread t([this]() {
while(!stop) {
while(!stop || tasks.size() > 0) {
std::function<void()> task;
{
std::unique_lock<std::mutex> lock(access);