add create_geometry_with_normals_ffi method, switch load_glb_from_buffer type to uint8_t for Dart leaf compat and add keepData param
This commit is contained in:
@@ -432,7 +432,7 @@ extern "C"
|
|||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void load_glb_from_buffer_ffi(void *const sceneManager,
|
EMSCRIPTEN_KEEPALIVE void load_glb_from_buffer_ffi(void *const sceneManager,
|
||||||
const void *const data,
|
const uint8_t *const data,
|
||||||
size_t length,
|
size_t length,
|
||||||
int numInstances,
|
int numInstances,
|
||||||
bool keepData,
|
bool keepData,
|
||||||
@@ -866,6 +866,7 @@ extern "C"
|
|||||||
int numIndices,
|
int numIndices,
|
||||||
int primitiveType,
|
int primitiveType,
|
||||||
const char *materialPath,
|
const char *materialPath,
|
||||||
|
bool keepData,
|
||||||
void (*callback)(EntityId))
|
void (*callback)(EntityId))
|
||||||
{
|
{
|
||||||
std::packaged_task<EntityId()> lambda(
|
std::packaged_task<EntityId()> lambda(
|
||||||
@@ -884,4 +885,33 @@ extern "C"
|
|||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void create_geometry_with_normals_ffi(
|
||||||
|
void *const sceneManager,
|
||||||
|
float *vertices,
|
||||||
|
int numVertices,
|
||||||
|
float *normals,
|
||||||
|
int numNormals,
|
||||||
|
uint16_t *indices,
|
||||||
|
int numIndices,
|
||||||
|
int primitiveType,
|
||||||
|
const char *materialPath,
|
||||||
|
bool keepData,
|
||||||
|
void (*callback)(EntityId))
|
||||||
|
{
|
||||||
|
std::packaged_task<EntityId()> lambda(
|
||||||
|
[=]
|
||||||
|
{
|
||||||
|
auto entity = create_geometry_with_normals(sceneManager, vertices, numVertices, normals, numNormals, indices, numIndices, primitiveType, materialPath);
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
MAIN_THREAD_EM_ASM({
|
||||||
|
moduleArg.dartFilamentResolveCallback($0,$1);
|
||||||
|
}, callback, entity);
|
||||||
|
#else
|
||||||
|
callback(entity);
|
||||||
|
#endif
|
||||||
|
return entity;
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user