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
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:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -29,3 +29,6 @@
|
||||
path = siren
|
||||
url = ../siren
|
||||
branch = main
|
||||
[submodule "3rdparty/simdjson"]
|
||||
path = 3rdparty/simdjson
|
||||
url = https://github.com/simdjson/simdjson.git
|
||||
|
||||
1
3rdparty/simdjson
vendored
Submodule
1
3rdparty/simdjson
vendored
Submodule
Submodule 3rdparty/simdjson added at 769364abb2
@@ -147,6 +147,12 @@ add_subdirectory(3rdparty/compressonator/cmp_core)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/compressonator/cmp_core/source")
|
||||
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 ----
|
||||
add_library(vulkan INTERFACE)
|
||||
set(VULKAN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/vulkan/include)
|
||||
|
||||
@@ -40,8 +40,30 @@
|
||||
using namespace mimir;
|
||||
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");
|
||||
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);
|
||||
// TODO - Validate result
|
||||
bundle->append(*pScene);
|
||||
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user