diff --git a/src/WallpaperEngine/Core/Core.cpp b/src/WallpaperEngine/Core/Core.cpp index 7191e74..5c6c3e0 100644 --- a/src/WallpaperEngine/Core/Core.cpp +++ b/src/WallpaperEngine/Core/Core.cpp @@ -104,6 +104,25 @@ template T Core::jsonFindDefault (nlohmann::json& data, const char if (value == data.end () || value->type () == nlohmann::detail::value_t::null) return defaultValue; + // type checks + if ((std::is_same ::value || std::is_same ::value) && value->type () != nlohmann::detail::value_t::number_float) + { + fprintf(stderr, "%s is not of type double, returning default value\n", key); + return defaultValue; + } + else if (std::is_same ::value && value->type () != nlohmann::detail::value_t::string) + { + fprintf (stderr, "%s is not of type string, returning default value\n", key); + return defaultValue; + } + else if (std::is_same ::value && value->type () != nlohmann::detail::value_t::boolean) + { + fprintf (stderr, "%s is not of type boolean, returning default value\n", key); + return defaultValue; + } + + // TODO: SUPPORT INTEGERS AND OTHER TYPES + return *value; } diff --git a/src/WallpaperEngine/Core/Objects/CEffect.cpp b/src/WallpaperEngine/Core/Objects/CEffect.cpp index b58797f..7225b8f 100644 --- a/src/WallpaperEngine/Core/Objects/CEffect.cpp +++ b/src/WallpaperEngine/Core/Objects/CEffect.cpp @@ -36,18 +36,18 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object, CContainer* contai json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*file_it).get (), container)); auto name_it = jsonFindRequired (content, "name", "Effect must have a name"); - auto description_it = jsonFindRequired (content, "description", "Effect must have a description"); + auto description = jsonFindDefault (content, "description", ""); auto group_it = jsonFindRequired (content, "group", "Effect must have a group"); - auto preview_it = jsonFindRequired (content, "preview", "Effect must have a preview"); + auto preview = jsonFindDefault (content, "preview", ""); auto passes_it = jsonFindRequired (content, "passes", "Effect must have a pass list"); auto dependencies_it = jsonFindRequired (content, "dependencies", ""); auto fbos_it = content.find ("fbos"); CEffect* effect = new CEffect ( *name_it, - *description_it, + description, *group_it, - *preview_it, + preview, object ); diff --git a/src/WallpaperEngine/Render/Shaders/Compiler.cpp b/src/WallpaperEngine/Render/Shaders/Compiler.cpp index dfe0fdd..b56192c 100644 --- a/src/WallpaperEngine/Render/Shaders/Compiler.cpp +++ b/src/WallpaperEngine/Render/Shaders/Compiler.cpp @@ -478,7 +478,7 @@ namespace WallpaperEngine::Render::Shaders if (this->m_recursive == false) { // add the opengl compatibility at the top - finalCode = "#version 130\n" + finalCode = "#version 150\n" "#define highp\n" "#define mediump\n" "#define lowp\n" @@ -503,6 +503,20 @@ namespace WallpaperEngine::Render::Shaders "#define float3 vec3\n" "#define float4 vec4\n"; + if (this->m_type == Type_Vertex) + { + finalCode += + "#define varying out\n" + "#define attribute in\n"; + } + else + { + finalCode += + "#define varying in\n" + "#define gl_FragColor glOutColor\n" + "out vec4 glOutColor;\n"; + } + // add combo values auto cur = this->m_combos->begin (); auto end = this->m_combos->end ();