add option to record to PNGs (inc background threadpool for encoding)

This commit is contained in:
Nick Fisher
2023-11-20 15:28:55 +08:00
parent a96309bd77
commit 5c1be3d047
9 changed files with 112 additions and 27 deletions

View File

@@ -33,6 +33,7 @@
#include <chrono>
#include "AssetManager.hpp"
#include "ThreadPool.hpp"
using namespace std;
using namespace filament;
@@ -122,6 +123,8 @@ namespace polyvox
void clearLights();
void setPostProcessing(bool enabled);
void setRecording(bool recording);
AssetManager *const getAssetManager()
{
@@ -134,7 +137,7 @@ namespace polyvox
Scene *_scene = nullptr;
View *_view = nullptr;
Engine *_engine = nullptr;
flutter_filament::ThreadPool* _tp = nullptr;
Renderer *_renderer = nullptr;
RenderTarget *_rt = nullptr;
Texture *_rtColor = nullptr;
@@ -189,9 +192,13 @@ 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;
uint32_t _lastFrameTimeInNanos;
bool _recording = false;
};
}

View File

@@ -169,6 +169,7 @@ extern "C"
FLUTTER_PLUGIN_EXPORT void pick(void *const viewer, int x, int y, EntityId *entityId);
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 ios_dummy();
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void *ptr);
#ifdef __cplusplus