add TScene
This commit is contained in:
26
thermion_dart/native/include/c_api/TScene.h
Normal file
26
thermion_dart/native/include/c_api/TScene.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _T_SCENE_H
|
||||
#define _T_SCENE_H
|
||||
|
||||
#include "APIExport.h"
|
||||
#include "APIBoundaryTypes.h"
|
||||
#include "TMaterialInstance.h"
|
||||
#include "TTexture.h"
|
||||
#include "ResourceBuffer.hpp"
|
||||
#include "MathUtils.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_addEntity(TScene* tScene, EntityId entityId);
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_setSkybox(TScene* tScene, TSkybox *skybox);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
38
thermion_dart/native/src/c_api/TScene.cpp
Normal file
38
thermion_dart/native/src/c_api/TScene.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "c_api/TScene.h"
|
||||
|
||||
#include <filament/Engine.h>
|
||||
#include <filament/Fence.h>
|
||||
#include <filament/Material.h>
|
||||
#include <filament/Scene.h>
|
||||
#include <filament/Skybox.h>
|
||||
#include <filament/Texture.h>
|
||||
#include <filament/TextureSampler.h>
|
||||
#include <filament/TransformManager.h>
|
||||
#include <filament/View.h>
|
||||
|
||||
#include "Log.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace thermion
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
using namespace filament;
|
||||
#endif
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_addEntity(TScene *tScene, EntityId entityId)
|
||||
{
|
||||
auto *scene = reinterpret_cast<Scene *>(tScene);
|
||||
scene->addEntity(utils::Entity::import(entityId));
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_setSkybox(TScene* tScene, TSkybox *tSkybox) {
|
||||
auto *scene = reinterpret_cast<Scene *>(tScene);
|
||||
auto *skybox = reinterpret_cast<Skybox *>(tSkybox);
|
||||
scene->setSkybox(skybox);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user