Add simdjson parser dependency.
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled

Load and parse gltf json data.
This commit is contained in:
2026-04-01 23:04:12 -07:00
parent c31ca2d0be
commit ebb54fd441
4 changed files with 35 additions and 1 deletions

3
.gitmodules vendored
View File

@@ -29,3 +29,6 @@
path = siren path = siren
url = ../siren url = ../siren
branch = main branch = main
[submodule "3rdparty/simdjson"]
path = 3rdparty/simdjson
url = https://github.com/simdjson/simdjson.git

1
3rdparty/simdjson vendored Submodule

Submodule 3rdparty/simdjson added at 769364abb2

View File

@@ -147,6 +147,12 @@ add_subdirectory(3rdparty/compressonator/cmp_core)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/compressonator/cmp_core/source") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/compressonator/cmp_core/source")
list (APPEND EXTRA_LIBS CMP_Core) list (APPEND EXTRA_LIBS CMP_Core)
# ---- simdjson ----
add_subdirectory(3rdparty/simdjson)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/simdjson/include")
list (APPEND EXTRA_LIBS simdjson)
target_compile_definitions(simdjson PUBLIC SIMDJSON_EXCEPTIONS=OFF)
# ---- Vulkan ---- # ---- Vulkan ----
add_library(vulkan INTERFACE) add_library(vulkan INTERFACE)
set(VULKAN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vulkan/include) set(VULKAN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vulkan/include)

View File

@@ -40,8 +40,30 @@
using namespace mimir; using namespace mimir;
using namespace hydra; using namespace hydra;
KRBundle* LoadGltf(KRContext& context, const Block& jsonData, const Block& binData, const std::string& baseName) #include "simdjson.h"
using namespace simdjson;
KRBundle* LoadGltf(KRContext& context, Block& jsonData, Block& binData, const std::string& baseName)
{ {
simdjson::dom::parser parser;
simdjson::dom::element jsonRoot;
jsonData.lock();
auto error = parser.parse((const char*)jsonData.getStart(), jsonData.getSize()).get(jsonRoot);
jsonData.unlock();
if (error) {
// TODO - Report and handle error
return nullptr;
}
std::string_view version;
error = jsonRoot["asset"]["version"].get(version);
if (error) {
// TODO - Report and handle error
return nullptr;
}
KRScene* pScene = new KRScene(context, baseName + "_scene"); KRScene* pScene = new KRScene(context, baseName + "_scene");
KRBundle* bundle = new KRBundle(context, baseName); KRBundle* bundle = new KRBundle(context, baseName);
@@ -49,6 +71,8 @@ KRBundle* LoadGltf(KRContext& context, const Block& jsonData, const Block& binDa
KrResult result = pScene->moveToBundle(bundle); KrResult result = pScene->moveToBundle(bundle);
// TODO - Validate result // TODO - Validate result
bundle->append(*pScene); bundle->append(*pScene);
return bundle; return bundle;
} }