documentation & further renaming

This commit is contained in:
Nick Fisher
2024-06-15 21:26:08 +08:00
parent 3f88598498
commit dc0c855135
221 changed files with 5923 additions and 691 deletions

View File

@@ -36,7 +36,7 @@
#include "SceneManager.hpp"
#include "ThreadPool.hpp"
namespace thermion_flutter
namespace thermion_filament
{
typedef std::chrono::time_point<std::chrono::high_resolution_clock> time_point_t;
@@ -167,7 +167,7 @@ namespace thermion_flutter
Scene *_scene = nullptr;
View *_view = nullptr;
Engine *_engine = nullptr;
thermion_flutter::ThreadPool *_tp = nullptr;
thermion_filament::ThreadPool *_tp = nullptr;
Renderer *_renderer = nullptr;
RenderTarget *_rt = nullptr;
Texture *_rtColor = nullptr;

View File

@@ -9,7 +9,7 @@
using namespace std::chrono_literals;
#endif
namespace thermion_flutter
namespace thermion_filament
{
struct ResourceLoaderWrapperImpl : public ResourceLoaderWrapper

View File

@@ -23,7 +23,7 @@
#include "tsl/robin_map.h"
namespace thermion_flutter
namespace thermion_filament
{
typedef int32_t EntityId;

View File

@@ -5,7 +5,7 @@
#include <cassert>
#include <cstring>
namespace thermion_flutter {
namespace thermion_filament {
//

View File

@@ -15,7 +15,7 @@
#ifndef _THREADPOOL_HPP
#define _THREADPOOL_HPP
namespace thermion_flutter {
namespace thermion_filament {
class ThreadPool {
std::vector<std::thread> pool;

View File

@@ -24,7 +24,7 @@
#include <utils/NameComponentManager.h>
template class std::vector<float>;
namespace thermion_flutter
namespace thermion_filament
{
using namespace filament;
using namespace filament::gltfio;

View File

@@ -8,7 +8,7 @@
#include "gltfio/FilamentInstance.h"
#include "Log.hpp"
namespace thermion_flutter
namespace thermion_filament
{
typedef void(*CollisionCallback)(int32_t entityId1, int32_t entityId2) ;

View File

@@ -11,7 +11,7 @@
#include <math/norm.h>
#include "Log.hpp"
namespace thermion_flutter {
namespace thermion_filament {
class FileMaterialProvider : public filament::gltfio::MaterialProvider {

View File

@@ -103,7 +103,7 @@ namespace filament
class LightManager;
} // namespace filament
namespace thermion_flutter
namespace thermion_filament
{
using namespace filament;
@@ -469,7 +469,7 @@ namespace thermion_flutter
void FilamentViewer::loadPngTexture(string path, ResourceBuffer rb)
{
thermion_flutter::StreamBufferAdapter sb((char *)rb.data, (char *)rb.data + rb.size);
thermion_filament::StreamBufferAdapter sb((char *)rb.data, (char *)rb.data + rb.size);
std::istream inputStream(&sb);
@@ -1204,7 +1204,7 @@ namespace thermion_flutter
// std::lock_guard lock(_recordingMutex);
if (recording)
{
_tp = new thermion_flutter::ThreadPool(16);
_tp = new thermion_filament::ThreadPool(16);
_recordingStartTime = std::chrono::high_resolution_clock::now();
}
else
@@ -1559,4 +1559,4 @@ namespace thermion_flutter
return Entity::smuggle(renderable);
}
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -33,7 +33,7 @@ extern "C"
#include "material/image.h"
}
namespace thermion_flutter
namespace thermion_filament
{
using namespace std::chrono;
@@ -2113,4 +2113,4 @@ namespace thermion_flutter
out[2] = Entity::smuggle(_gizmoZ);
}
} // namespace thermion_flutter
} // namespace thermion_filament

View File

@@ -3,7 +3,7 @@
#include <cassert>
#include <cstring>
namespace thermion_flutter {
namespace thermion_filament {
class StreamBufferAdapter : public std::streambuf
{

View File

@@ -13,7 +13,7 @@
#include <thread>
#include <functional>
using namespace thermion_flutter;
using namespace thermion_filament;
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
@@ -753,7 +753,7 @@ extern "C"
Log("Dummy called");
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_free(void *ptr)
EMSCRIPTEN_KEEPALIVE void thermion_filament_free(void *ptr)
{
free(ptr);
}

View File

@@ -19,7 +19,6 @@ extern "C"
#endif
#include "ThermionDartFFIApi.h"
#include "FilamentViewer.hpp"
#include "Log.hpp"
#include "ThreadPool.hpp"
@@ -30,7 +29,7 @@ extern "C"
#include <thread>
#include <stdlib.h>
using namespace thermion_flutter;
using namespace thermion_filament;
using namespace std::chrono_literals;
#include <time.h>

View File

@@ -49,7 +49,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build/out)
add_executable(${MODULE_NAME}
"${CMAKE_CURRENT_SOURCE_DIR}/../src/SceneManager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/FilamentViewer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/ThermionViewerFFI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/ThermionDartApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/ThermionDartFFIApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../src/StreamBufferAdapter.cpp"

View File

@@ -60,56 +60,56 @@ extern "C"
// return 0;
// }
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_load_resource_callback(void* data, int32_t length, void* context) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_load_resource_callback(void* data, int32_t length, void* context) {
((PendingCall*)context)->HandleResponse(data, length);
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_set(char* ptr, int32_t offset, int32_t val) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_set(char* ptr, int32_t offset, int32_t val) {
memset(ptr+offset, val, 1);
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_set_float(float* ptr, int32_t offset, float val) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_set_float(float* ptr, int32_t offset, float val) {
ptr[offset] = val;
}
EMSCRIPTEN_KEEPALIVE float thermion_flutter_web_get_float(float* ptr, int32_t offset) {
EMSCRIPTEN_KEEPALIVE float thermion_filament_web_get_float(float* ptr, int32_t offset) {
return ptr[offset];
}
EMSCRIPTEN_KEEPALIVE double thermion_flutter_web_get_double(double* ptr, int32_t offset) {
EMSCRIPTEN_KEEPALIVE double thermion_filament_web_get_double(double* ptr, int32_t offset) {
return ptr[offset];
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_set_double(double* ptr, int32_t offset, double value) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_set_double(double* ptr, int32_t offset, double value) {
ptr[offset] = value;
}
EMSCRIPTEN_KEEPALIVE int32_t thermion_flutter_web_get_int32(int32_t* ptr, int32_t offset) {
EMSCRIPTEN_KEEPALIVE int32_t thermion_filament_web_get_int32(int32_t* ptr, int32_t offset) {
return ptr[offset];
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_set_int32(int32_t* ptr, int32_t offset, int32_t value) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_set_int32(int32_t* ptr, int32_t offset, int32_t value) {
ptr[offset] = value;
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_set_pointer(void** ptr, int32_t offset, void* val) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_set_pointer(void** ptr, int32_t offset, void* val) {
ptr[offset] = val;
}
EMSCRIPTEN_KEEPALIVE void* thermion_flutter_web_get_pointer(void** ptr, int32_t offset) {
EMSCRIPTEN_KEEPALIVE void* thermion_filament_web_get_pointer(void** ptr, int32_t offset) {
return ptr[offset];
}
EMSCRIPTEN_KEEPALIVE char thermion_flutter_web_get(char* ptr, int32_t offset) {
EMSCRIPTEN_KEEPALIVE char thermion_filament_web_get(char* ptr, int32_t offset) {
return ptr[offset];
}
EMSCRIPTEN_KEEPALIVE void* thermion_flutter_web_allocate(int32_t size) {
EMSCRIPTEN_KEEPALIVE void* thermion_filament_web_allocate(int32_t size) {
void* allocated = (void*)calloc(size, 1);
return allocated;
}
EMSCRIPTEN_KEEPALIVE long thermion_flutter_web_get_address(void** out) {
EMSCRIPTEN_KEEPALIVE long thermion_filament_web_get_address(void** out) {
return (long)*out;
}
@@ -149,7 +149,7 @@ extern "C"
int _lastResourceId = 0;
ResourceBuffer thermion_flutter_web_load_resource(const char* path)
ResourceBuffer thermion_filament_web_load_resource(const char* path)
{
// ideally we should bounce the call to Flutter then wait for callback
// this isn't working for large assets though - seems like it's deadlocked
@@ -212,19 +212,19 @@ extern "C"
return ResourceBuffer { data, numBytes, _lastResourceId } ;
}
void thermion_flutter_web_free_resource(ResourceBuffer rb) {
void thermion_filament_web_free_resource(ResourceBuffer rb) {
free((void*)rb.data);
}
EMSCRIPTEN_KEEPALIVE void thermion_flutter_web_free(void* ptr) {
EMSCRIPTEN_KEEPALIVE void thermion_filament_web_free(void* ptr) {
free(ptr);
}
EMSCRIPTEN_KEEPALIVE void* thermion_dart_web_get_resource_loader_wrapper() {
ResourceLoaderWrapper *rlw = (ResourceLoaderWrapper *)malloc(sizeof(ResourceLoaderWrapper));
rlw->loadResource = thermion_flutter_web_load_resource;
rlw->loadResource = thermion_filament_web_load_resource;
rlw->loadFromOwner = nullptr;
rlw->freeResource = thermion_flutter_web_free_resource;
rlw->freeResource = thermion_filament_web_free_resource;
rlw->freeFromOwner = nullptr;
rlw->loadToOut = nullptr;
rlw->owner = nullptr;