diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8a8b7dd..39e5b9a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -13,14 +13,16 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -33,11 +35,11 @@
-
-
+
+
-
-
+
+
@@ -45,65 +47,79 @@
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
@@ -111,15 +127,6 @@
-
-
-
-
-
-
-
-
-
@@ -178,13 +185,19 @@
-
-
-
+
+
+
+
+
+
+
+
+
@@ -199,46 +212,37 @@
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -251,6 +255,7 @@
+
@@ -276,7 +281,12 @@
-
+
+
+
+
+
+
@@ -295,55 +305,37 @@
+
+
+
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -375,36 +367,22 @@
- file://$PROJECT_DIR$/BasicShaderLoader.cpp
- 336
-
+ file://$PROJECT_DIR$/nier_test.cpp
+ 133
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -426,7 +404,7 @@
-
+
@@ -434,21 +412,21 @@
-
+
-
+
-
+
@@ -456,7 +434,7 @@
-
+
@@ -466,110 +444,189 @@
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BasicShaderLoader.cpp b/BasicShaderLoader.cpp
index 6855a39..65b254f 100644
--- a/BasicShaderLoader.cpp
+++ b/BasicShaderLoader.cpp
@@ -6,14 +6,15 @@
#include "nier_test.h"
#include "common.h"
-BasicShaderLoader::BasicShaderLoader (irr::io::path file, Type type, bool recursive = false)
+BasicShaderLoader::BasicShaderLoader (irr::io::path file, Type type, bool recursive)
{
// begin with an space so it gets ignored properly on parse
if (recursive == false)
{
- this->m_content = "#version 120\n"
- "#define texSample2D texture2D\n"
- "#define frac fract\n";
+ this->m_content = "#version 120\n"
+ "#define texSample2D texture2D\n"
+ "#define frac fract\n"
+ "vec4 mul(vec4 x, mat4 y) { return x * y; }\n";
}
else
{
@@ -218,8 +219,6 @@ std::string* BasicShaderLoader::precompile ()
// search preprocessor macros and parse them
while (it != this->m_content.end () && this->m_error == false)
{
- // TODO: on precompilation steps search for attributes and replace them
- // TODO: with the correct opengl shader variable
if (*it == ' ' || *it == '\t' || *it == '\n' || *it == '\r' || *it == '\0' || *it == '{' || *it == '}' || *it == '[' || *it == ']' || *it == '.')
{
this->m_compiledContent += *it;
@@ -351,13 +350,17 @@ std::string* BasicShaderLoader::precompile ()
#undef BREAK_IF_ERROR
}
-static std::map BasicShaderLoader::sVariableReplacement =
+std::map BasicShaderLoader::sVariableReplacement =
{
- {"a_Position", "gl_Vertex"},
- {"a_TexCoord", "gl_MultiTexCoord0"},
+ // attribute vec3 a_position
+ {"a_Position", "gl_Vertex.xyz"},
+ // attribute vec2 a_TexCoord
+ {"a_TexCoord", "gl_MultiTexCoord0.xy"},
+ // attribute vec3 a_Normal
+ {"a_Normal", "gl_Normal.xyz"}
};
-static std::vector BasicShaderLoader::sTypes =
+std::vector BasicShaderLoader::sTypes =
{
"vec4", "vec3", "vec2", "float"
};
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9328f7..b37ab8c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,8 @@ find_package(GLUT REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Irrlicht REQUIRED)
-include_directories(${X11_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR})
+include_directories(${X11_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR} .)
-add_executable(wallengine main.cpp common.h nier_test.cpp BasicShaderLoader.h BasicShaderLoader.cpp nier_test.h)
+add_executable(wallengine main.cpp common.h nier_test.cpp BasicShaderLoader.h BasicShaderLoader.cpp nier_test.h wallpaperengine/Project.cpp wallpaperengine/Project.h wallpaperengine/Scene.cpp wallpaperengine/Scene.h wallpaperengine/Object.cpp wallpaperengine/Object.h)
target_link_libraries(wallengine ${X11_LIBRARIES} ${X11_Xxf86vm_LIB} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY})
\ No newline at end of file
diff --git a/nier_test.cpp b/nier_test.cpp
index 5dcef56..2341c89 100644
--- a/nier_test.cpp
+++ b/nier_test.cpp
@@ -4,6 +4,7 @@
#include "common.h"
#include "BasicShaderLoader.h"
+#include "wallpaperengine/Project.h"
irr::io::path _example_base_folder = "../res/";
irr::f32 g_AnimationSpeed = 0.1f;
@@ -126,6 +127,10 @@ public:
int nier_test ()
{
+ irr::io::path _wp_engine_folder = "/home/almamu/Development/tmp/nier__automata_-_become_as_gods_edition";
+
+ Project* wp_project = new Project (_wp_engine_folder);
+
irr::io::path _water_example = _example_base_folder; _water_example += "materials/water-intact.png";
irr::io::path _mud_example = _example_base_folder; _mud_example += "materials/plant-on-water.png";
irr::io::path _background_example = _example_base_folder; _background_example += "materials/top-part.png";
diff --git a/nlohmann/adl_serializer.hpp b/nlohmann/adl_serializer.hpp
new file mode 100644
index 0000000..53c9009
--- /dev/null
+++ b/nlohmann/adl_serializer.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include
+
+#include
+#include
+
+namespace nlohmann
+{
+template
+struct adl_serializer
+{
+ /*!
+ @brief convert a JSON value to any value type
+
+ This function is usually called by the `get()` function of the
+ @ref basic_json class (either explicit or via conversion operators).
+
+ @param[in] j JSON value to read from
+ @param[in,out] val value to write to
+ */
+ template
+ static void from_json(BasicJsonType&& j, ValueType& val) noexcept(
+ noexcept(::nlohmann::from_json(std::forward(j), val)))
+ {
+ ::nlohmann::from_json(std::forward(j), val);
+ }
+
+ /*!
+ @brief convert any value type to a JSON value
+
+ This function is usually called by the constructors of the @ref basic_json
+ class.
+
+ @param[in,out] j JSON value to write to
+ @param[in] val value to read from
+ */
+ template
+ static void to_json(BasicJsonType& j, ValueType&& val) noexcept(
+ noexcept(::nlohmann::to_json(j, std::forward(val))))
+ {
+ ::nlohmann::to_json(j, std::forward(val));
+ }
+};
+}
diff --git a/nlohmann/detail/conversions/from_json.hpp b/nlohmann/detail/conversions/from_json.hpp
new file mode 100644
index 0000000..cd6bfd1
--- /dev/null
+++ b/nlohmann/detail/conversions/from_json.hpp
@@ -0,0 +1,378 @@
+#pragma once
+
+#include // transform
+#include // array
+#include // and, not
+#include // forward_list
+#include // inserter, front_inserter, end
+#include