add FilamentAsset methods
This commit is contained in:
24
thermion_dart/native/include/c_api/TFilamentAsset.h
Normal file
24
thermion_dart/native/include/c_api/TFilamentAsset.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/Entity.h>
|
||||||
|
|
||||||
|
#include "APIExport.h"
|
||||||
|
#include "APIBoundaryTypes.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
EMSCRIPTEN_KEEPALIVE uint32_t FilamentAsset_getEntityCount(
|
||||||
|
TFilamentAsset *filamentAsset
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void FilamentAsset_getEntities(
|
||||||
|
TFilamentAsset *filamentAsset,
|
||||||
|
EntityId* out
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
34
thermion_dart/native/src/c_api/TFilamentAsset.cpp
Normal file
34
thermion_dart/native/src/c_api/TFilamentAsset.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include <gltfio/FilamentAsset.h>
|
||||||
|
|
||||||
|
#include "c_api/TSceneAsset.h"
|
||||||
|
#include "scene/SceneAsset.hpp"
|
||||||
|
#include "scene/GltfSceneAsset.hpp"
|
||||||
|
#include "scene/GeometrySceneAssetBuilder.hpp"
|
||||||
|
|
||||||
|
using namespace thermion;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE uint32_t FilamentAsset_getEntityCount(
|
||||||
|
TFilamentAsset *tFilamentAsset
|
||||||
|
) {
|
||||||
|
auto *filamentAsset = reinterpret_cast<gltfio::FilamentAsset*>(tFilamentAsset);
|
||||||
|
return filamentAsset->getEntityCount();
|
||||||
|
}
|
||||||
|
EMSCRIPTEN_KEEPALIVE void FilamentAsset_getEntities(
|
||||||
|
TFilamentAsset *tFilamentAsset,
|
||||||
|
EntityId* out
|
||||||
|
) {
|
||||||
|
auto *filamentAsset = reinterpret_cast<gltfio::FilamentAsset*>(tFilamentAsset);
|
||||||
|
for(int i=0; i < filamentAsset->getEntityCount(); i++) {
|
||||||
|
out[i] = utils::Entity::smuggle(filamentAsset->getEntities()[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user