From 4a4326826ece68528a91ae576a793bdc30c62840 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 16 May 2025 01:57:29 +0800 Subject: [PATCH] preparing LoadMaterialFromJson(....) --- CMAssetsManage | 2 +- CMSceneGraph | 2 +- example/Basic/CMakeLists.txt | 5 +-- .../Basic/MaterialLoader/MaterialLoader.cpp | 34 +++++++++++++++++++ example/Basic/rf_test.cpp | 2 -- 5 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 example/Basic/MaterialLoader/MaterialLoader.cpp diff --git a/CMAssetsManage b/CMAssetsManage index 0fae4623..0244bff1 160000 --- a/CMAssetsManage +++ b/CMAssetsManage @@ -1 +1 @@ -Subproject commit 0fae462338cd01c5a26d0a8f0175fe3729a65c94 +Subproject commit 0244bff1b60119806f683b54a137cda2cacc17ac diff --git a/CMSceneGraph b/CMSceneGraph index be7f43d6..6da4b997 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit be7f43d6a9077288e5ef883a56f54310dce5f735 +Subproject commit 6da4b9973812162a966de0db505572f25f1caaca diff --git a/example/Basic/CMakeLists.txt b/example/Basic/CMakeLists.txt index 7413c4a4..68f6fe6a 100644 --- a/example/Basic/CMakeLists.txt +++ b/example/Basic/CMakeLists.txt @@ -1,5 +1,6 @@ macro(CreateProject name) - add_executable(${name} ${ARGN} ${VULKAN_APP_FRAMEWORK}) + + add_executable(${name} ${ARGN} ${VULKAN_APP_FRAMEWORK} MaterialLoader/MaterialLoader.cpp) target_link_libraries(${name} ${ULRE}) IF(MSVC) @@ -10,7 +11,7 @@ set_property(TARGET ${name} PROPERTY FOLDER "ULRE/Example/Basic") endmacro() -CreateProject(00_RenderFrameworkTest rf_test.cpp AssetData.h) +CreateProject(00_RenderFrameworkTest rf_test.cpp) CreateProject(01_draw_triangle_in_NDC draw_triangle_in_NDC.cpp) CreateProject(02_draw_triangle_use_UBO draw_triangle_use_UBO.cpp) CreateProject(03_auto_instance auto_instance.cpp) diff --git a/example/Basic/MaterialLoader/MaterialLoader.cpp b/example/Basic/MaterialLoader/MaterialLoader.cpp new file mode 100644 index 00000000..15414903 --- /dev/null +++ b/example/Basic/MaterialLoader/MaterialLoader.cpp @@ -0,0 +1,34 @@ +#include +#include + +/* + + material json example: + + { + "name":"material_name", + "type":"2d", + "parent":"parent_material_name", + + "std2d": + { + "coordinate_system":"NDC", + "local_to_world:"false", + "position_format":"vec2" + } + } +*/ + +STD_MTL_NAMESPACE_BEGIN + +MaterialCreateInfo *Load2DMaterialFromJson(const Json::Value& json_root) +{ + +} + +MaterialCreateInfo *LoadMaterialFromJson(const Json::Value &json_root) +{ + +} + +STD_MTL_NAMESPACE_END diff --git a/example/Basic/rf_test.cpp b/example/Basic/rf_test.cpp index 37d9999e..f60e1416 100644 --- a/example/Basic/rf_test.cpp +++ b/example/Basic/rf_test.cpp @@ -4,7 +4,6 @@ #include #include #include -#include"AssetData.h" using namespace hgl; using namespace hgl::graph; @@ -56,7 +55,6 @@ private: //material_instance=CreateMaterialInstance(mci); - //下面这个方式更直接,在WorkObject中封装了CreateMaterialCreateInfo(name,...)这个方法一步到位 material_instance=CreateMaterialInstance("VertexColor2D",&cfg); //这个是使用名称创建