add toggle for postprocessing and minor cleanup work

This commit is contained in:
Nick Fisher
2023-10-03 22:04:37 +08:00
parent d49b43c191
commit c1f8eae85e
189 changed files with 568 additions and 146 deletions

View File

@@ -53,7 +53,7 @@ class _ExampleWidgetState extends State<ExampleWidget> {
bool _vertical = false;
bool _rendering = false;
int _framerate = 60;
bool _postProcessing = true;
bool _initialized = false;
bool _coneHidden = false;
@@ -111,6 +111,12 @@ class _ExampleWidgetState extends State<ExampleWidget> {
_item(() {
_filamentController.loadIbl('assets/default_env/default_env_ibl.ktx');
}, 'load IBL'),
_item(() {
setState(() {
_postProcessing = !_postProcessing;
});
_filamentController.setPostProcessing(_postProcessing);
}, "${_postProcessing ? "Disable" : "Enable"} postprocessing"),
_item(
() {
_filamentController.removeSkybox();

View File

@@ -106,6 +106,7 @@ namespace polyvox {
int32_t addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
void removeLight(EntityId entityId);
void clearLights();
void setPostProcessing(bool enabled);
AssetManager* const getAssetManager() {
return (AssetManager* const) _assetManager;

View File

@@ -150,6 +150,7 @@ FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, flo
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName);
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled);
FLUTTER_PLUGIN_EXPORT void ios_dummy();
#ifdef __cplusplus
}

View File

@@ -83,6 +83,7 @@ FLUTTER_PLUGIN_EXPORT int get_animation_count_ffi(void* const assetManager, Enti
FLUTTER_PLUGIN_EXPORT void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index);
FLUTTER_PLUGIN_EXPORT void get_morph_target_name_ffi(void* const assetManager, EntityId asset, const char *meshName, char *const outPtr, int index);
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count_ffi(void* const assetManager, EntityId asset, const char *meshName);
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void* const viewer, bool enabled);
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();

View File

@@ -143,7 +143,6 @@ FilamentViewer::FilamentViewer(const void* sharedContext, const ResourceLoaderWr
Log("Main camera created");
_view = _engine->createView();
_view->setPostProcessingEnabled(false);
Log("View created");
setToneMapping(ToneMapping::ACES);
@@ -247,6 +246,10 @@ FilamentViewer::FilamentViewer(const void* sharedContext, const ResourceLoaderWr
_scene->addEntity(imageEntity);
}
void FilamentViewer::setPostProcessing(bool enabled) {
_view->setPostProcessingEnabled(enabled);
}
void FilamentViewer::setBloom(float strength) {
decltype(_view->getBloomOptions()) opts;
opts.enabled = true;
@@ -259,14 +262,20 @@ void FilamentViewer::setToneMapping(ToneMapping toneMapping) {
ToneMapper* tm;
switch(toneMapping) {
case ToneMapping::ACES:
Log("Setting tone mapping to ACES");
tm = new ACESToneMapper();
break;
case ToneMapping::LINEAR:
Log("Setting tone mapping to Linear");
tm = new LinearToneMapper();
break;
case ToneMapping::FILMIC:
Log("Setting tone mapping to Filmic");
tm = new FilmicToneMapper();
break;
default:
Log("ERROR: Unsupported tone mapping");
return;
}
@@ -305,7 +314,7 @@ void FilamentViewer::removeLight(EntityId entityId) {
if(entity.isNull()) {
Log("Error: light entity not found under ID %d", entityId);
} else {
auto removed = remove(_lights.begin(), _lights.end(), entity);
remove(_lights.begin(), _lights.end(), entity);
_scene->remove(entity);
EntityManager::get().destroy(1, &entity);
}
@@ -437,7 +446,6 @@ void FilamentViewer::loadTextureFromPath(string path) {
void FilamentViewer::setBackgroundColor(const float r, const float g, const float b, const float a) {
_imageMaterial->setDefaultParameter("showImage", 0);
_imageMaterial->setDefaultParameter("backgroundColor", RgbaType::sRGB, float4(r, g, b, a));
const Viewport& vp = _view->getViewport();
_imageMaterial->setDefaultParameter("transform", _imageScale);
}

View File

@@ -232,7 +232,7 @@ extern "C" {
);
}
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
void* assetManager,
EntityId asset,
const float* const frameData,
@@ -254,6 +254,10 @@ extern "C" {
);
}
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled) {
((FilamentViewer*)viewer)->setPostProcessing(enabled);
}
// void set_bone_transform(

View File

@@ -369,28 +369,31 @@ extern "C"
// TODO
}
void play_animation_ffi(void* const assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade)
FLUTTER_PLUGIN_EXPORT void play_animation_ffi(void* const assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade)
{
std::packaged_task<void()> lambda([&]
{ play_animation(assetManager, asset, index, loop, reverse, replaceActive, crossfade); });
auto fut = _rl->add_task(lambda);
fut.wait();
}
void set_animation_frame_ffi(void* const assetManager, EntityId asset, int animationIndex, int animationFrame)
FLUTTER_PLUGIN_EXPORT void set_animation_frame_ffi(void* const assetManager, EntityId asset, int animationIndex, int animationFrame)
{
std::packaged_task<void()> lambda([&]
{ set_animation_frame(assetManager, asset, animationIndex, animationFrame); });
auto fut = _rl->add_task(lambda);
fut.wait();
}
void stop_animation_ffi(void* const assetManager, EntityId asset, int index)
FLUTTER_PLUGIN_EXPORT void stop_animation_ffi(void* const assetManager, EntityId asset, int index)
{
std::packaged_task<void()> lambda([&]
{ stop_animation(assetManager, asset, index); });
auto fut = _rl->add_task(lambda);
fut.wait();
}
int get_animation_count_ffi(void* const assetManager, EntityId asset)
FLUTTER_PLUGIN_EXPORT int get_animation_count_ffi(void* const assetManager, EntityId asset)
{
std::packaged_task<int()> lambda([&]
{ return get_animation_count(assetManager, asset); });
@@ -398,7 +401,7 @@ extern "C"
fut.wait();
return fut.get();
}
void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index)
FLUTTER_PLUGIN_EXPORT void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index)
{
std::packaged_task<void()> lambda([&] {
get_animation_name(assetManager, asset, outPtr, index);
@@ -407,6 +410,14 @@ extern "C"
fut.wait();
}
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void* const viewer, bool enabled) {
std::packaged_task<void()> lambda([&] {
set_post_processing(viewer, enabled);
});
auto fut = _rl->add_task(lambda);
fut.wait();
}
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi() {
Log("Dummy called");
}

View File

@@ -642,7 +642,7 @@ class FilamentControllerFFI extends FilamentController {
}
///
/// Sets the tone mapping.
/// Sets the tone mapping (requires postprocessing).
///
@override
Future setToneMapping(ToneMapper mapper) async {
@@ -653,6 +653,18 @@ class FilamentControllerFFI extends FilamentController {
_lib.set_tone_mapping_ffi(_viewer!, mapper.index);
}
///
/// Enable/disable postprocessing.
///
@override
Future setPostProcessing(bool enabled) async {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.set_post_processing_ffi(_viewer!, enabled);
}
///
/// Sets the strength of the bloom.
///

View File

@@ -108,8 +108,8 @@ class NativeLibrary {
late final _create_render_targetPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
ffi.Int)>>('create_render_target');
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32,
ffi.Uint32)>>('create_render_target');
late final _create_render_target = _create_render_targetPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
@@ -320,7 +320,7 @@ class NativeLibrary {
ffi.NativeFunction<
EntityId Function(
ffi.Pointer<ffi.Void>,
ffi.Int,
ffi.Uint8,
ffi.Float,
ffi.Float,
ffi.Float,
@@ -464,7 +464,7 @@ class NativeLibrary {
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<ffi.Void>,
ffi.Int,
ffi.Uint64,
ffi.Pointer<ffi.Void>,
ffi.Pointer<
ffi.NativeFunction<
@@ -499,7 +499,7 @@ class NativeLibrary {
late final _create_swap_chainPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
ffi.Int, ffi.Int)>>('create_swap_chain');
ffi.Uint32, ffi.Uint32)>>('create_swap_chain');
late final _create_swap_chain = _create_swap_chainPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
@@ -550,7 +550,7 @@ class NativeLibrary {
late final _update_viewport_and_camera_projectionPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
ffi.Float)>>('update_viewport_and_camera_projection');
late final _update_viewport_and_camera_projection =
_update_viewport_and_camera_projectionPtr
@@ -1298,6 +1298,23 @@ class NativeLibrary {
late final _reveal_mesh = _reveal_meshPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
void set_post_processing(
ffi.Pointer<ffi.Void> viewer,
bool enabled,
) {
return _set_post_processing(
viewer,
enabled,
);
}
late final _set_post_processingPtr = _lookup<
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
'set_post_processing');
late final _set_post_processing = _set_post_processingPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
void ios_dummy() {
return _ios_dummy();
}
@@ -1365,7 +1382,7 @@ class NativeLibrary {
late final _create_swap_chain_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
ffi.Int, ffi.Int)>>('create_swap_chain_ffi');
ffi.Uint32, ffi.Uint32)>>('create_swap_chain_ffi');
late final _create_swap_chain_ffi = _create_swap_chain_ffiPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
@@ -1385,8 +1402,8 @@ class NativeLibrary {
late final _create_render_target_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
ffi.Int)>>('create_render_target_ffi');
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
ffi.Uint32)>>('create_render_target_ffi');
late final _create_render_target_ffi = _create_render_target_ffiPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
@@ -1481,7 +1498,7 @@ class NativeLibrary {
late final _update_viewport_and_camera_projection_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
ffi.Float)>>('update_viewport_and_camera_projection_ffi');
late final _update_viewport_and_camera_projection_ffi =
_update_viewport_and_camera_projection_ffiPtr
@@ -1698,7 +1715,7 @@ class NativeLibrary {
ffi.NativeFunction<
EntityId Function(
ffi.Pointer<ffi.Void>,
ffi.Int,
ffi.Uint8,
ffi.Float,
ffi.Float,
ffi.Float,
@@ -2080,25 +2097,6 @@ class NativeLibrary {
late final _get_animation_name_ffi = _get_animation_name_ffiPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>, int)>();
double get_animation_duration_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
int index,
) {
return _get_animation_duration_ffi(
assetManager,
asset,
index,
);
}
late final _get_animation_duration_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Float Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Int)>>('get_animation_duration_ffi');
late final _get_animation_duration_ffi = _get_animation_duration_ffiPtr
.asFunction<double Function(ffi.Pointer<ffi.Void>, int, int)>();
void get_morph_target_name_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
@@ -2148,6 +2146,23 @@ class NativeLibrary {
_get_morph_target_name_count_ffiPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
int set_post_processing_ffi(
ffi.Pointer<ffi.Void> viewer,
bool enabled,
) {
return _set_post_processing_ffi(
viewer,
enabled,
);
}
late final _set_post_processing_ffiPtr = _lookup<
ffi
.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
'set_post_processing_ffi');
late final _set_post_processing_ffi = _set_post_processing_ffiPtr
.asFunction<int Function(ffi.Pointer<ffi.Void>, bool)>();
void ios_dummy_ffi() {
return _ios_dummy_ffi();
}
@@ -2157,13 +2172,105 @@ class NativeLibrary {
late final _ios_dummy_ffi = _ios_dummy_ffiPtr.asFunction<void Function()>();
}
final class __mbstate_t extends ffi.Union {
@ffi.Array.multi([128])
external ffi.Array<ffi.Char> __mbstate8;
@ffi.LongLong()
external int _mbstateL;
}
final class __darwin_pthread_handler_rec extends ffi.Struct {
external ffi
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>
__routine;
external ffi.Pointer<ffi.Void> __arg;
external ffi.Pointer<__darwin_pthread_handler_rec> __next;
}
final class _opaque_pthread_attr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([56])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_cond_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([40])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_condattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_mutex_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([56])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_mutexattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_once_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_rwlock_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([192])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_rwlockattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([16])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_t extends ffi.Struct {
@ffi.Long()
external int __sig;
external ffi.Pointer<__darwin_pthread_handler_rec> __cleanup_stack;
@ffi.Array.multi([8176])
external ffi.Array<ffi.Char> __opaque;
}
final class ResourceBuffer extends ffi.Struct {
external ffi.Pointer<ffi.Void> data;
@ffi.Int()
@ffi.Int32()
external int size;
@ffi.Int()
@ffi.Int32()
external int id;
}
@@ -2189,7 +2296,7 @@ typedef LoadFilamentResourceFromOwner = ffi.Pointer<
typedef FreeFilamentResourceFromOwner = ffi.Pointer<
ffi
.NativeFunction<ffi.Void Function(ResourceBuffer, ffi.Pointer<ffi.Void>)>>;
typedef EntityId = ffi.Int;
typedef EntityId = ffi.Int32;
typedef FilamentRenderCallback = ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> owner)>>;
@@ -2198,3 +2305,179 @@ const int __bool_true_false_are_defined = 1;
const int true1 = 1;
const int false1 = 0;
const int __DARWIN_ONLY_64_BIT_INO_T = 1;
const int __DARWIN_ONLY_UNIX_CONFORMANCE = 1;
const int __DARWIN_ONLY_VERS_1050 = 1;
const int __DARWIN_UNIX03 = 1;
const int __DARWIN_64_BIT_INO_T = 1;
const int __DARWIN_VERS_1050 = 1;
const int __DARWIN_NON_CANCELABLE = 0;
const String __DARWIN_SUF_EXTSN = '\$DARWIN_EXTSN';
const int __DARWIN_C_ANSI = 4096;
const int __DARWIN_C_FULL = 900000;
const int __DARWIN_C_LEVEL = 900000;
const int __STDC_WANT_LIB_EXT1__ = 1;
const int __DARWIN_NO_LONG_LONG = 0;
const int _DARWIN_FEATURE_64_BIT_INODE = 1;
const int _DARWIN_FEATURE_ONLY_64_BIT_INODE = 1;
const int _DARWIN_FEATURE_ONLY_VERS_1050 = 1;
const int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1;
const int _DARWIN_FEATURE_UNIX_CONFORMANCE = 3;
const int __has_ptrcheck = 0;
const int __DARWIN_NULL = 0;
const int __PTHREAD_SIZE__ = 8176;
const int __PTHREAD_ATTR_SIZE__ = 56;
const int __PTHREAD_MUTEXATTR_SIZE__ = 8;
const int __PTHREAD_MUTEX_SIZE__ = 56;
const int __PTHREAD_CONDATTR_SIZE__ = 8;
const int __PTHREAD_COND_SIZE__ = 40;
const int __PTHREAD_ONCE_SIZE__ = 8;
const int __PTHREAD_RWLOCK_SIZE__ = 192;
const int __PTHREAD_RWLOCKATTR_SIZE__ = 16;
const int __DARWIN_WCHAR_MAX = 2147483647;
const int __DARWIN_WCHAR_MIN = -2147483648;
const int __DARWIN_WEOF = -1;
const int _FORTIFY_SOURCE = 2;
const int NULL = 0;
const int USER_ADDR_NULL = 0;
const int __WORDSIZE = 64;
const int INT8_MAX = 127;
const int INT16_MAX = 32767;
const int INT32_MAX = 2147483647;
const int INT64_MAX = 9223372036854775807;
const int INT8_MIN = -128;
const int INT16_MIN = -32768;
const int INT32_MIN = -2147483648;
const int INT64_MIN = -9223372036854775808;
const int UINT8_MAX = 255;
const int UINT16_MAX = 65535;
const int UINT32_MAX = 4294967295;
const int UINT64_MAX = -1;
const int INT_LEAST8_MIN = -128;
const int INT_LEAST16_MIN = -32768;
const int INT_LEAST32_MIN = -2147483648;
const int INT_LEAST64_MIN = -9223372036854775808;
const int INT_LEAST8_MAX = 127;
const int INT_LEAST16_MAX = 32767;
const int INT_LEAST32_MAX = 2147483647;
const int INT_LEAST64_MAX = 9223372036854775807;
const int UINT_LEAST8_MAX = 255;
const int UINT_LEAST16_MAX = 65535;
const int UINT_LEAST32_MAX = 4294967295;
const int UINT_LEAST64_MAX = -1;
const int INT_FAST8_MIN = -128;
const int INT_FAST16_MIN = -32768;
const int INT_FAST32_MIN = -2147483648;
const int INT_FAST64_MIN = -9223372036854775808;
const int INT_FAST8_MAX = 127;
const int INT_FAST16_MAX = 32767;
const int INT_FAST32_MAX = 2147483647;
const int INT_FAST64_MAX = 9223372036854775807;
const int UINT_FAST8_MAX = 255;
const int UINT_FAST16_MAX = 65535;
const int UINT_FAST32_MAX = 4294967295;
const int UINT_FAST64_MAX = -1;
const int INTPTR_MAX = 9223372036854775807;
const int INTPTR_MIN = -9223372036854775808;
const int UINTPTR_MAX = -1;
const int INTMAX_MAX = 9223372036854775807;
const int UINTMAX_MAX = -1;
const int INTMAX_MIN = -9223372036854775808;
const int PTRDIFF_MIN = -9223372036854775808;
const int PTRDIFF_MAX = 9223372036854775807;
const int SIZE_MAX = -1;
const int RSIZE_MAX = 9223372036854775807;
const int WCHAR_MAX = 2147483647;
const int WCHAR_MIN = -2147483648;
const int WINT_MIN = -2147483648;
const int WINT_MAX = 2147483647;
const int SIG_ATOMIC_MIN = -2147483648;
const int SIG_ATOMIC_MAX = 2147483647;

View File

@@ -106,6 +106,7 @@ namespace polyvox {
int32_t addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
void removeLight(EntityId entityId);
void clearLights();
void setPostProcessing(bool enabled);
AssetManager* const getAssetManager() {
return (AssetManager* const) _assetManager;

View File

@@ -150,6 +150,7 @@ FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, flo
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName);
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled);
FLUTTER_PLUGIN_EXPORT void ios_dummy();
#ifdef __cplusplus
}

View File

@@ -1,6 +1,10 @@
#ifndef _POLYVOX_FILAMENT_FFI_API_H
#define _POLYVOX_FILAMENT_FFI_API_H
#ifdef __cplusplus
extern "C" {
#endif
///
/// This header replicates most of the methods in PolyvoxFilamentApi.h, and is only intended to be used to generate client FFI bindings.
/// The intention is that calling one of these methods will call its respective method in PolyvoxFilamentApi.h, but wrapped in some kind of thread runner to ensure thread safety.
@@ -39,48 +43,52 @@ FLUTTER_PLUGIN_EXPORT void remove_asset_ffi(void* const viewer, EntityId asset);
FLUTTER_PLUGIN_EXPORT void clear_assets_ffi(void* const viewer);
FLUTTER_PLUGIN_EXPORT bool set_camera_ffi(void* const viewer, EntityId asset, const char *nodeName);
FLUTTER_PLUGIN_EXPORT void apply_weights_ffi(
void* const assetManager,
EntityId asset,
const char *const entityName,
float *const weights,
int count
);
void* const assetManager,
EntityId asset,
const char *const entityName,
float *const weights,
int count
);
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights_ffi(
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
int numWeights
);
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
int numWeights
);
FLUTTER_PLUGIN_EXPORT bool set_morph_animation_ffi(
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
const int* const morphIndices,
int numMorphTargets,
int numFrames,
float frameLengthInMs);
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
const int* const morphIndices,
int numMorphTargets,
int numFrames,
float frameLengthInMs);
FLUTTER_PLUGIN_EXPORT
FLUTTER_PLUGIN_EXPORT void set_bone_animation_ffi(
void* const assetManager,
EntityId asset,
const float* const frameData,
int numFrames,
int numBones,
const char** const boneNames,
const char** const meshName,
int numMeshTargets,
float frameLengthInMs);
void* const assetManager,
EntityId asset,
const float* const frameData,
int numFrames,
int numBones,
const char** const boneNames,
const char** const meshName,
int numMeshTargets,
float frameLengthInMs);
FLUTTER_PLUGIN_EXPORT void play_animation_ffi(void* const assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade);
FLUTTER_PLUGIN_EXPORT void set_animation_frame_ffi(void* const assetManager, EntityId asset, int animationIndex, int animationFrame);
FLUTTER_PLUGIN_EXPORT void stop_animation_ffi(void* const assetManager, EntityId asset, int index);
FLUTTER_PLUGIN_EXPORT int get_animation_count_ffi(void* const assetManager, EntityId asset);
FLUTTER_PLUGIN_EXPORT void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index);
FLUTTER_PLUGIN_EXPORT float get_animation_duration_ffi(void* const assetManager, EntityId asset, int index);
FLUTTER_PLUGIN_EXPORT void get_morph_target_name_ffi(void* const assetManager, EntityId asset, const char *meshName, char *const outPtr, int index);
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count_ffi(void* const assetManager, EntityId asset, const char *meshName);
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void* const viewer, bool enabled);
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();
#ifdef __cplusplus
}
#endif
#endif // _POLYVOX_FILAMENT_FFI_API_H

View File

@@ -2,6 +2,7 @@
#define RESOURCE_BUFFER_H
#include <stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
@@ -57,6 +58,8 @@ extern "C" {
mFreeFilamentResource(rb);
}
}
#endif
LoadFilamentResource mLoadFilamentResource;
FreeFilamentResource mFreeFilamentResource;
@@ -66,7 +69,6 @@ extern "C" {
};
typedef struct ResourceLoaderWrapper ResourceLoaderWrapper;
#if defined(__cplusplus)
}
#endif

Some files were not shown because too many files have changed in this diff Show More