diff --git a/assets/games/liminal/scenes/scene-base.xml b/assets/games/liminal/scenes/scene-base.xml
index 53fb12b5..8f16ac6a 100644
--- a/assets/games/liminal/scenes/scene-base.xml
+++ b/assets/games/liminal/scenes/scene-base.xml
@@ -1,12 +1,14 @@
- -
-
-
+
-
+
-
+ -
+
+
+
-
+
\ No newline at end of file
diff --git a/assets/games/liminal/scenes/scene-extend.xml b/assets/games/liminal/scenes/scene-extend.xml
new file mode 100644
index 00000000..d335213c
--- /dev/null
+++ b/assets/games/liminal/scenes/scene-extend.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/dawnliminal/CMakeLists.txt b/src/dawnliminal/CMakeLists.txt
index 94ff8c34..4bd79eb1 100644
--- a/src/dawnliminal/CMakeLists.txt
+++ b/src/dawnliminal/CMakeLists.txt
@@ -19,6 +19,7 @@ add_subdirectory(save)
# Assets
set(LIMINAL_ASSETS_DIR ${DAWN_ASSETS_DIR}/games/liminal)
tool_scene(${LIMINAL_ASSETS_DIR}/scenes/scene-base.xml)
+tool_scene(${LIMINAL_ASSETS_DIR}/scenes/scene-extend.xml)
# tool_vnscene(${LIMINAL_ASSETS_DIR}/test.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/VNTextbox.xml)
diff --git a/src/dawntools/scenetool/SceneParser.cpp b/src/dawntools/scenetool/SceneParser.cpp
index 1b516ff7..db94a195 100644
--- a/src/dawntools/scenetool/SceneParser.cpp
+++ b/src/dawntools/scenetool/SceneParser.cpp
@@ -12,7 +12,9 @@ std::vector SceneParser::getRequiredAttributes() {
}
std::map SceneParser::getOptionalAttributes() {
- return {};
+ return {
+ { "extend", "" }
+ };
}
int32_t SceneParser::onParse(
@@ -25,6 +27,7 @@ int32_t SceneParser::onParse(
//Create the scene item
out->name = values["name"];
+ out->extend = values["extend"];
//Parse the children
auto itChildren = node->children.begin();
diff --git a/src/dawntools/scenetool/SceneParser.hpp b/src/dawntools/scenetool/SceneParser.hpp
index 093f74a8..141388dd 100644
--- a/src/dawntools/scenetool/SceneParser.hpp
+++ b/src/dawntools/scenetool/SceneParser.hpp
@@ -9,6 +9,7 @@
namespace Dawn {
struct Scene {
std::string name;
+ std::string extend;
std::vector items;
struct SceneItemComponentRegistry *registry;
};
diff --git a/src/dawntools/util/generator/SceneItemGenerator.cpp b/src/dawntools/util/generator/SceneItemGenerator.cpp
index 89554709..fee19857 100644
--- a/src/dawntools/util/generator/SceneItemGenerator.cpp
+++ b/src/dawntools/util/generator/SceneItemGenerator.cpp
@@ -64,6 +64,10 @@ void SceneItemGenerator::generate(
line(initBody, name + "->transform.setLocalScale(" + item->scale + ");", "");
}
+ if(item->lookAtPosition.size() > 0) {
+ line(initBody, name + "->transform.lookAt(" + item->lookAtPosition + ", " + item->lookAtTarget + ");", "");
+ }
+
// Add assets
auto itAssets = item->assets.begin();
while(itAssets != item->assets.end()) {
diff --git a/src/dawntools/util/parser/SceneItemParser.cpp b/src/dawntools/util/parser/SceneItemParser.cpp
index 5b0c8854..17342b4e 100644
--- a/src/dawntools/util/parser/SceneItemParser.cpp
+++ b/src/dawntools/util/parser/SceneItemParser.cpp
@@ -15,6 +15,7 @@ std::map SceneItemParser::getOptionalAttributes() {
return {
{ "ref", "" },
{ "position", "" },
+ { "lookAt", "" },
{ "scale", "" },
{ "prefab", "" }
};
@@ -38,6 +39,19 @@ int32_t SceneItemParser::onParse(
if(error->size() > 0) return 1;
}
+ if(values["lookAt"].size() > 0) {
+ auto lookAtSplit = stringSplit(values["lookAt"], ",");
+ if(lookAtSplit.size() != 6) {
+ *error = "Invalid lookAt value: " + values["lookAt"];
+ return 1;
+ }
+
+ out->lookAtPosition = vec3Parser(lookAtSplit[0] + "," + lookAtSplit[1] + "," + lookAtSplit[2], error);
+ if(error->size() > 0) return 1;
+ out->lookAtTarget = vec3Parser(lookAtSplit[3] + "," + lookAtSplit[4] + "," + lookAtSplit[5], error);
+ if(error->size() > 0) return 1;
+ }
+
out->prefab = values["prefab"];
auto itChildren = node->children.begin();
diff --git a/src/dawntools/util/parser/SceneItemParser.hpp b/src/dawntools/util/parser/SceneItemParser.hpp
index 313e5914..e029628f 100644
--- a/src/dawntools/util/parser/SceneItemParser.hpp
+++ b/src/dawntools/util/parser/SceneItemParser.hpp
@@ -12,6 +12,8 @@ namespace Dawn {
struct SceneItemComponentRegistry *registry;
std::string ref;
std::string position;
+ std::string lookAtPosition;
+ std::string lookAtTarget;
std::string scale;
std::string prefab;
std::vector components;
diff --git a/src/dawntools/util/parser/TypeParsers.hpp b/src/dawntools/util/parser/TypeParsers.hpp
index fc868400..8bdab236 100644
--- a/src/dawntools/util/parser/TypeParsers.hpp
+++ b/src/dawntools/util/parser/TypeParsers.hpp
@@ -79,6 +79,26 @@ namespace Dawn {
};
+ static inline std::string vec6Parser(std::string v, std::string *error) {
+ // Split string by comma into two strings that we pass into float
+ auto split = stringSplit(v, ",");
+ if(split.size() != 6) {
+ *error = "Invalid vec6 value: " + v;
+ return std::string("");
+ }
+ return std::string(
+ "glm::vec3(" +
+ floatParser(split[0], error) + ", " +
+ floatParser(split[1], error) + ", " +
+ floatParser(split[2], error) + ", " +
+ floatParser(split[3], error) + ", " +
+ floatParser(split[4], error) + ", " +
+ floatParser(split[5], error) +
+ ")"
+ );
+ };
+
+
static inline std::string vec4Parser(std::string v, std::string *error) {
// Split string by comma into two strings that we pass into float
auto split = stringSplit(v, ",");