mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Compare commits
3 Commits
79886ecc89
...
c3381c348d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c3381c348d | ||
![]() |
f74527d23b | ||
![]() |
5b65abe7b9 |
@ -269,6 +269,8 @@ add_executable(
|
|||||||
|
|
||||||
src/WallpaperEngine/Assets/AssetLoadException.cpp
|
src/WallpaperEngine/Assets/AssetLoadException.cpp
|
||||||
src/WallpaperEngine/Assets/AssetLoadException.h
|
src/WallpaperEngine/Assets/AssetLoadException.h
|
||||||
|
src/WallpaperEngine/Assets/AssetLocator.cpp
|
||||||
|
src/WallpaperEngine/Assets/AssetLocator.h
|
||||||
|
|
||||||
src/WallpaperEngine/FileSystem/Container.h
|
src/WallpaperEngine/FileSystem/Container.h
|
||||||
src/WallpaperEngine/FileSystem/Container.cpp
|
src/WallpaperEngine/FileSystem/Container.cpp
|
||||||
|
@ -6,20 +6,18 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
const char* assets_default_paths [] = {
|
std::vector<std::string> appDirectoryPaths = {
|
||||||
".steam/steam/steamapps/common",
|
".steam/steam/steamapps/common",
|
||||||
".local/share/Steam/steamapps/common",
|
".local/share/Steam/steamapps/common",
|
||||||
".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common",
|
".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common",
|
||||||
"snap/steam/common/.local/share/Steam/steamapps/common",
|
"snap/steam/common/.local/share/Steam/steamapps/common",
|
||||||
nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* workshop_content_default_paths [] = {
|
std::vector<std::string> workshopDirectoryPaths = {
|
||||||
".local/share/Steam/steamapps/workshop/content",
|
".local/share/Steam/steamapps/workshop/content",
|
||||||
".steam/steam/steamapps/workshop/content",
|
".steam/steam/steamapps/workshop/content",
|
||||||
".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/workshop/content",
|
".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/workshop/content",
|
||||||
"snap/steam/common/.local/share/Steam/steamapps/workshop/content",
|
"snap/steam/common/.local/share/Steam/steamapps/workshop/content",
|
||||||
nullptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::filesystem::path detectHomepath () {
|
std::filesystem::path detectHomepath () {
|
||||||
@ -33,14 +31,14 @@ std::filesystem::path detectHomepath () {
|
|||||||
if (!std::filesystem::is_directory (path))
|
if (!std::filesystem::is_directory (path))
|
||||||
sLog.exception ("Cannot find home directory for current user, ", home, " is not a directory");
|
sLog.exception ("Cannot find home directory for current user, ", home, " is not a directory");
|
||||||
|
|
||||||
return home;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std::string& contentID) {
|
std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std::string& contentID) {
|
||||||
auto homepath = detectHomepath ();
|
auto homepath = detectHomepath ();
|
||||||
|
|
||||||
for (const char** current = workshop_content_default_paths; *current != nullptr; current++) {
|
for (const auto& current : workshopDirectoryPaths) {
|
||||||
auto currentpath = std::filesystem::path (homepath) / *current / std::to_string (appID) / contentID;
|
auto currentpath = std::filesystem::path (homepath) / current / std::to_string (appID) / contentID;
|
||||||
|
|
||||||
if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
|
if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
|
||||||
continue;
|
continue;
|
||||||
@ -54,8 +52,8 @@ std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std
|
|||||||
std::filesystem::path Steam::FileSystem::appDirectory (const std::string& appDirectory, const std::string& path) {
|
std::filesystem::path Steam::FileSystem::appDirectory (const std::string& appDirectory, const std::string& path) {
|
||||||
auto homepath = detectHomepath ();
|
auto homepath = detectHomepath ();
|
||||||
|
|
||||||
for (const char** current = assets_default_paths; *current != nullptr; current++) {
|
for (const auto& current : appDirectoryPaths) {
|
||||||
auto currentpath = std::filesystem::path (homepath) / *current / appDirectory / path;
|
auto currentpath = std::filesystem::path (homepath) / current / appDirectory / path;
|
||||||
|
|
||||||
if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
|
if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
|
||||||
continue;
|
continue;
|
||||||
|
@ -29,6 +29,7 @@ float g_Time;
|
|||||||
float g_TimeLast;
|
float g_TimeLast;
|
||||||
float g_Daytime;
|
float g_Daytime;
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
@ -40,10 +41,10 @@ WallpaperApplication::WallpaperApplication (ApplicationContext& context) :
|
|||||||
this->setupBrowser();
|
this->setupBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerUniquePtr WallpaperApplication::setupContainer (const std::string& bg) const {
|
AssetLocatorUniquePtr WallpaperApplication::setupAssetLocator (const std::string& bg) const {
|
||||||
auto container = std::make_unique <Container> ();
|
auto container = std::make_unique <Container> ();
|
||||||
|
|
||||||
std::filesystem::path path (bg);
|
const std::filesystem::path path = bg;
|
||||||
|
|
||||||
container->mount (path, "/");
|
container->mount (path, "/");
|
||||||
try {
|
try {
|
||||||
@ -193,7 +194,7 @@ ContainerUniquePtr WallpaperApplication::setupContainer (const std::string& bg)
|
|||||||
"}"
|
"}"
|
||||||
);
|
);
|
||||||
|
|
||||||
return container;
|
return std::make_unique <AssetLocator> (std::move (container));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WallpaperApplication::loadBackgrounds () {
|
void WallpaperApplication::loadBackgrounds () {
|
||||||
@ -214,7 +215,7 @@ void WallpaperApplication::loadBackgrounds () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProjectUniquePtr WallpaperApplication::loadBackground (const std::string& bg) {
|
ProjectUniquePtr WallpaperApplication::loadBackground (const std::string& bg) {
|
||||||
auto container = this->setupContainer (bg);
|
auto container = this->setupAssetLocator (bg);
|
||||||
auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readString ("project.json"));
|
auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readString ("project.json"));
|
||||||
|
|
||||||
return WallpaperEngine::Data::Parsers::ProjectParser::parse (json, std::move(container));
|
return WallpaperEngine::Data::Parsers::ProjectParser::parse (json, std::move(container));
|
||||||
@ -401,16 +402,13 @@ void WallpaperApplication::show () {
|
|||||||
static struct tm* timeinfo;
|
static struct tm* timeinfo;
|
||||||
|
|
||||||
if (this->m_context.settings.general.dumpStructure) {
|
if (this->m_context.settings.general.dumpStructure) {
|
||||||
// TODO: REWRITE TO USE THE NEW DUMPER
|
auto prettyPrinter = Data::Dumpers::StringPrinter ();
|
||||||
/*
|
|
||||||
auto prettyPrinter = PrettyPrinter::CPrettyPrinter ();
|
|
||||||
|
|
||||||
for (const auto& [background, info] : this->m_renderContext->getWallpapers ()) {
|
for (const auto& [background, info] : this->m_renderContext->getWallpapers ()) {
|
||||||
prettyPrinter.printWallpaper (*info);
|
prettyPrinter.printWallpaper (info->getWallpaperData ());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << prettyPrinter.str () << std::endl;
|
std::cout << prettyPrinter.str () << std::endl;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEMOMODE
|
#if DEMOMODE
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WallpaperEngine/Application/ApplicationContext.h"
|
#include "WallpaperEngine/Application/ApplicationContext.h"
|
||||||
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
|
|
||||||
#include "WallpaperEngine/Render/CWallpaper.h"
|
#include "WallpaperEngine/Render/CWallpaper.h"
|
||||||
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
#include "WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h"
|
||||||
@ -16,6 +17,7 @@
|
|||||||
#include "WallpaperEngine/Data/Model/Types.h"
|
#include "WallpaperEngine/Data/Model/Types.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Application {
|
namespace WallpaperEngine::Application {
|
||||||
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
/**
|
/**
|
||||||
* Small wrapper class over the actual wallpaper's main application skeleton
|
* Small wrapper class over the actual wallpaper's main application skeleton
|
||||||
@ -53,12 +55,11 @@ class WallpaperApplication {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Sets up a combined container for the given background, adding default files and directories to the list
|
* Sets up an asset locator for the given background
|
||||||
*
|
*
|
||||||
* @param container
|
|
||||||
* @param bg
|
* @param bg
|
||||||
*/
|
*/
|
||||||
ContainerUniquePtr setupContainer (const std::string& bg) const;
|
AssetLocatorUniquePtr setupAssetLocator (const std::string& bg) const;
|
||||||
/**
|
/**
|
||||||
* Loads projects based off the settings
|
* Loads projects based off the settings
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#include "AssetLoadException.h"
|
#include "AssetLoadException.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Assets;
|
||||||
|
|
||||||
AssetLoadException::AssetLoadException (const std::string& filename, const std::string& extrainfo) :
|
AssetLoadException::AssetLoadException (const std::filesystem::filesystem_error& filesystem_error) noexcept
|
||||||
m_message ("Cannot find file " + filename + ": " + extrainfo) {}
|
: std::filesystem::filesystem_error (filesystem_error) {}
|
||||||
|
|
||||||
const char* AssetLoadException::what () const noexcept {
|
|
||||||
return this->m_message.c_str ();
|
|
||||||
}
|
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <exception>
|
#include <filesystem>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// TODO: REWRITE THIS ONE TO MAKE MORE SENSE, IT REALLY MEANS "FILE-RELATED EXCEPTION"
|
namespace WallpaperEngine::Assets {
|
||||||
namespace WallpaperEngine::Render {
|
class AssetLoadException final : public std::filesystem::filesystem_error {
|
||||||
class AssetLoadException final : public std::exception {
|
|
||||||
public:
|
public:
|
||||||
explicit AssetLoadException (const std::string& filename, const std::string& extrainfo = "");
|
using std::filesystem::filesystem_error::filesystem_error;
|
||||||
[[nodiscard]] const char* what () const noexcept override;
|
explicit AssetLoadException (const std::filesystem::filesystem_error& filesystem_error) noexcept;
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_message {};
|
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Assets
|
} // namespace WallpaperEngine::Assets
|
99
src/WallpaperEngine/Assets/AssetLocator.cpp
Normal file
99
src/WallpaperEngine/Assets/AssetLocator.cpp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#include "AssetLocator.h"
|
||||||
|
|
||||||
|
#include "AssetLoadException.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Assets;
|
||||||
|
|
||||||
|
AssetLocator::AssetLocator (ContainerUniquePtr filesystem) : m_filesystem (std::move (filesystem)) {}
|
||||||
|
|
||||||
|
std::string AssetLocator::shader (const std::filesystem::path& filename) const {
|
||||||
|
try {
|
||||||
|
std::filesystem::path shader = filename;
|
||||||
|
|
||||||
|
// detect workshop shaders and check if there's a
|
||||||
|
if (auto it = shader.begin (); *it++ == "workshop") {
|
||||||
|
const std::filesystem::path workshopId = *it++;
|
||||||
|
|
||||||
|
if (++it != shader.end ()) {
|
||||||
|
const std::filesystem::path& shaderfile = *it;
|
||||||
|
|
||||||
|
try {
|
||||||
|
shader = std::filesystem::path ("zcompat") / "scene" / "shaders" / workshopId / shaderfile;
|
||||||
|
// replace the old path with the new one
|
||||||
|
std::string contents = this->m_filesystem->readString (shader);
|
||||||
|
|
||||||
|
sLog.out ("Replaced ", filename, " with compat ", shader);
|
||||||
|
|
||||||
|
return contents;
|
||||||
|
} catch (std::filesystem::filesystem_error&) {
|
||||||
|
// these exceptions can be ignored because the replacement file might not exist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->m_filesystem->readString ("shaders" / filename);
|
||||||
|
} catch (std::filesystem::filesystem_error& base) {
|
||||||
|
throw AssetLoadException (base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AssetLocator::fragmentShader (const std::filesystem::path& filename) const {
|
||||||
|
auto final = filename;
|
||||||
|
|
||||||
|
final.replace_extension ("frag");
|
||||||
|
|
||||||
|
return this->shader (final);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AssetLocator::vertexShader (const std::filesystem::path& filename) const {
|
||||||
|
auto final = filename;
|
||||||
|
|
||||||
|
final.replace_extension ("vert");
|
||||||
|
|
||||||
|
return this->shader (final);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AssetLocator::includeShader (const std::filesystem::path& filename) const {
|
||||||
|
auto final = filename;
|
||||||
|
|
||||||
|
final.replace_extension ("h");
|
||||||
|
|
||||||
|
return this->shader (final);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AssetLocator::readString (const std::filesystem::path& filename) const {
|
||||||
|
try {
|
||||||
|
return this->m_filesystem->readString (filename);
|
||||||
|
} catch (std::filesystem::filesystem_error& base) {
|
||||||
|
throw AssetLoadException (base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ReadStreamSharedPtr AssetLocator::texture (const std::filesystem::path& filename) const {
|
||||||
|
auto final = filename;
|
||||||
|
|
||||||
|
final.replace_extension ("tex");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return this->m_filesystem->read (final);
|
||||||
|
} catch (std::filesystem::filesystem_error& base) {
|
||||||
|
throw AssetLoadException (base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadStreamSharedPtr AssetLocator::read (const std::filesystem::path& path) const {
|
||||||
|
try {
|
||||||
|
return this->m_filesystem->read (path);
|
||||||
|
} catch (std::filesystem::filesystem_error& base) {
|
||||||
|
throw AssetLoadException (base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::path AssetLocator::physicalPath (const std::filesystem::path& path) const {
|
||||||
|
try {
|
||||||
|
return this->m_filesystem->physicalPath (path);
|
||||||
|
} catch (std::filesystem::filesystem_error& base) {
|
||||||
|
throw AssetLoadException (base);
|
||||||
|
}
|
||||||
|
}
|
27
src/WallpaperEngine/Assets/AssetLocator.h
Normal file
27
src/WallpaperEngine/Assets/AssetLocator.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "WallpaperEngine/FileSystem/Container.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Assets {
|
||||||
|
using namespace WallpaperEngine::FileSystem;
|
||||||
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
class AssetLocator {
|
||||||
|
public:
|
||||||
|
explicit AssetLocator (ContainerUniquePtr filesystem);
|
||||||
|
|
||||||
|
std::string vertexShader (const std::filesystem::path& filename) const;
|
||||||
|
std::string fragmentShader (const std::filesystem::path& filename) const;
|
||||||
|
std::string includeShader (const std::filesystem::path& filename) const;
|
||||||
|
ReadStreamSharedPtr texture (const std::filesystem::path& filename) const;
|
||||||
|
std::string readString (const std::filesystem::path& filename) const;
|
||||||
|
ReadStreamSharedPtr read (const std::filesystem::path& path) const;
|
||||||
|
std::filesystem::path physicalPath (const std::filesystem::path& path) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string shader (const std::filesystem::path& filename) const;
|
||||||
|
|
||||||
|
ContainerUniquePtr m_filesystem;
|
||||||
|
};
|
||||||
|
|
||||||
|
using AssetLocatorUniquePtr = std::unique_ptr<AssetLocator>;
|
||||||
|
}
|
@ -35,7 +35,6 @@ enum DepthwriteMode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct MaterialPass {
|
struct MaterialPass {
|
||||||
// TODO: WRITE ENUMS FOR THESE
|
|
||||||
/** Blending mode */
|
/** Blending mode */
|
||||||
BlendingMode blending;
|
BlendingMode blending;
|
||||||
/** Culling mode */
|
/** Culling mode */
|
||||||
|
@ -22,8 +22,6 @@ struct ObjectData {
|
|||||||
std::vector <int> dependencies;
|
std::vector <int> dependencies;
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: CHECK IF THE SEMANTICS FOR MEMORY ARE RIGHT HERE
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all objects, represents a single object in the scene
|
* Base class for all objects, represents a single object in the scene
|
||||||
*
|
*
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "WallpaperEngine/FileSystem/Container.h"
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Model {
|
namespace WallpaperEngine::Data::Model {
|
||||||
|
using namespace WallpaperEngine::Assets;
|
||||||
/**
|
/**
|
||||||
* Represents a wallpaper engine project
|
* Represents a wallpaper engine project
|
||||||
*/
|
*/
|
||||||
@ -30,7 +31,7 @@ struct Project {
|
|||||||
Properties properties;
|
Properties properties;
|
||||||
/** The wallpaper this project defines */
|
/** The wallpaper this project defines */
|
||||||
WallpaperUniquePtr wallpaper;
|
WallpaperUniquePtr wallpaper;
|
||||||
/** VFS to access the project's files */
|
/** Abstraction over asset loading to provide access to them */
|
||||||
ContainerUniquePtr container;
|
AssetLocatorUniquePtr assetLocator;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -33,9 +33,9 @@ class Property : public DynamicValue, public TypeCaster, public PropertyData {
|
|||||||
virtual void update(const std::string& value) = 0;
|
virtual void update(const std::string& value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertySlider : public Property, SliderData {
|
class PropertySlider final : public Property, SliderData {
|
||||||
public:
|
public:
|
||||||
PropertySlider (PropertyData data, SliderData sliderData, float value) : Property (std::move(data)), SliderData (sliderData) {
|
PropertySlider (PropertyData data, SliderData sliderData, const float value) : Property (std::move(data)), SliderData (std::move (sliderData)) {
|
||||||
this->update (value);
|
this->update (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ class PropertySlider : public Property, SliderData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertyBoolean : public Property {
|
class PropertyBoolean final : public Property {
|
||||||
public:
|
public:
|
||||||
explicit PropertyBoolean (PropertyData data, bool value) : Property (std::move(data)) {
|
explicit PropertyBoolean (PropertyData data, const bool value) : Property (std::move(data)) {
|
||||||
this->update (value);
|
this->update (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,9 +57,9 @@ class PropertyBoolean : public Property {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertyColor : public Property {
|
class PropertyColor final : public Property {
|
||||||
public:
|
public:
|
||||||
explicit PropertyColor (PropertyData data, std::string value) : Property (std::move(data)) {
|
explicit PropertyColor (PropertyData data, const std::string& value) : Property (std::move(data)) {
|
||||||
this->PropertyColor::update (value);
|
this->PropertyColor::update (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class PropertyColor : public Property {
|
|||||||
// TODO: ENSURE ALL THIS PARSING IS CORRECT
|
// TODO: ENSURE ALL THIS PARSING IS CORRECT
|
||||||
if (copy.find (',') != std::string::npos) {
|
if (copy.find (',') != std::string::npos) {
|
||||||
// replace comma separator with spaces so it's
|
// replace comma separator with spaces so it's
|
||||||
std::replace (copy.begin (), copy.end (), ',', ' ');
|
std::ranges::replace (copy, ',', ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// hex colors should be converted to int colors
|
// hex colors should be converted to int colors
|
||||||
@ -110,9 +110,9 @@ class PropertyColor : public Property {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertyCombo : public Property, ComboData {
|
class PropertyCombo final : public Property, ComboData {
|
||||||
public:
|
public:
|
||||||
PropertyCombo (PropertyData data, ComboData comboData, std::string value) : Property (std::move(data)), ComboData (std::move(comboData)) {
|
PropertyCombo (PropertyData data, ComboData comboData, const std::string& value) : Property (std::move(data)), ComboData (std::move(comboData)) {
|
||||||
this->PropertyCombo::update (value);
|
this->PropertyCombo::update (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class PropertyCombo : public Property, ComboData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertyText : public Property {
|
class PropertyText final : public Property {
|
||||||
public:
|
public:
|
||||||
explicit PropertyText (PropertyData data) : Property (std::move(data)) {}
|
explicit PropertyText (PropertyData data) : Property (std::move(data)) {}
|
||||||
|
|
||||||
@ -136,9 +136,9 @@ class PropertyText : public Property {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PropertySceneTexture : public Property {
|
class PropertySceneTexture final : public Property {
|
||||||
public:
|
public:
|
||||||
explicit PropertySceneTexture (PropertyData data, std::string value) : Property (std::move(data)) {
|
explicit PropertySceneTexture (PropertyData data, const std::string& value) : Property (std::move(data)) {
|
||||||
this->PropertySceneTexture::update (value);
|
this->PropertySceneTexture::update (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace WallpaperEngine::FileSystem {
|
|
||||||
class Container;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Model {
|
namespace WallpaperEngine::Data::Model {
|
||||||
struct Project;
|
struct Project;
|
||||||
class Wallpaper;
|
class Wallpaper;
|
||||||
@ -40,13 +36,11 @@ using PropertySharedPtr = std::shared_ptr <Property>;
|
|||||||
using Properties = std::map <std::string, PropertySharedPtr>;
|
using Properties = std::map <std::string, PropertySharedPtr>;
|
||||||
using DynamicValueUniquePtr = std::unique_ptr <DynamicValue>;
|
using DynamicValueUniquePtr = std::unique_ptr <DynamicValue>;
|
||||||
using UserSettingUniquePtr = std::unique_ptr <UserSetting>;
|
using UserSettingUniquePtr = std::unique_ptr <UserSetting>;
|
||||||
// TODO: UP TO THIS POINT
|
|
||||||
|
|
||||||
using ShaderConstantMap = std::map <std::string, UserSettingUniquePtr>;
|
using ShaderConstantMap = std::map <std::string, UserSettingUniquePtr>;
|
||||||
|
|
||||||
using ProjectUniquePtr = std::unique_ptr <Project>;
|
using ProjectUniquePtr = std::unique_ptr <Project>;
|
||||||
using WallpaperUniquePtr = std::unique_ptr <Wallpaper>;
|
using WallpaperUniquePtr = std::unique_ptr <Wallpaper>;
|
||||||
using ContainerUniquePtr = std::unique_ptr <FileSystem::Container>;
|
|
||||||
using SceneUniquePtr = std::unique_ptr <Scene>;
|
using SceneUniquePtr = std::unique_ptr <Scene>;
|
||||||
using WebUniquePtr = std::unique_ptr <Web>;
|
using WebUniquePtr = std::unique_ptr <Web>;
|
||||||
using VideoUniquePtr = std::unique_ptr <Video>;
|
using VideoUniquePtr = std::unique_ptr <Video>;
|
||||||
|
@ -10,7 +10,7 @@ using namespace WallpaperEngine::Data::Parsers;
|
|||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
EffectUniquePtr EffectParser::load (const Project& project, const std::string& filename) {
|
EffectUniquePtr EffectParser::load (const Project& project, const std::string& filename) {
|
||||||
const auto effectJson = JSON::parse (project.container->readString (filename));
|
const auto effectJson = JSON::parse (project.assetLocator->readString (filename));
|
||||||
|
|
||||||
return parse (effectJson, project);
|
return parse (effectJson, project);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ using namespace WallpaperEngine::Data::Parsers;
|
|||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
MaterialUniquePtr MaterialParser::load (const Project& project, const std::string& filename) {
|
MaterialUniquePtr MaterialParser::load (const Project& project, const std::string& filename) {
|
||||||
const auto materialJson = JSON::parse (project.container->readString (filename));
|
const auto materialJson = JSON::parse (project.assetLocator->readString (filename));
|
||||||
|
|
||||||
return parse (materialJson, filename);
|
return parse (materialJson, filename);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using namespace WallpaperEngine::Data::Parsers;
|
|||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
ModelUniquePtr ModelParser::load (const Project& project, const std::string& filename) {
|
ModelUniquePtr ModelParser::load (const Project& project, const std::string& filename) {
|
||||||
const auto model = JSON::parse (project.container->readString (filename));
|
const auto model = JSON::parse (project.assetLocator->readString (filename));
|
||||||
|
|
||||||
return parse (model, project, filename);
|
return parse (model, project, filename);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ using namespace WallpaperEngine::Data::Parsers;
|
|||||||
|
|
||||||
static int backgroundId = 0;
|
static int backgroundId = 0;
|
||||||
|
|
||||||
ProjectUniquePtr ProjectParser::parse (const JSON& data, ContainerUniquePtr container) {
|
ProjectUniquePtr ProjectParser::parse (const JSON& data, AssetLocatorUniquePtr container) {
|
||||||
const auto general = data.optional ("general");
|
const auto general = data.optional ("general");
|
||||||
const auto workshopId = data.optional ("workshopid");
|
const auto workshopId = data.optional ("workshopid");
|
||||||
auto actualWorkshopId = std::to_string (--backgroundId);
|
auto actualWorkshopId = std::to_string (--backgroundId);
|
||||||
@ -38,7 +38,7 @@ ProjectUniquePtr ProjectParser::parse (const JSON& data, ContainerUniquePtr cont
|
|||||||
.workshopId = actualWorkshopId,
|
.workshopId = actualWorkshopId,
|
||||||
.supportsAudioProcessing = general.has_value () && general.value ().optional ("supportsaudioprocessing", false),
|
.supportsAudioProcessing = general.has_value () && general.value ().optional ("supportsaudioprocessing", false),
|
||||||
.properties = parseProperties (general),
|
.properties = parseProperties (general),
|
||||||
.container = std::move(container),
|
.assetLocator = std::move(container),
|
||||||
});
|
});
|
||||||
|
|
||||||
result->wallpaper = WallpaperParser::parse (data.require ("file", "Project's main file missing"), *result);
|
result->wallpaper = WallpaperParser::parse (data.require ("file", "Project's main file missing"), *result);
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Data/JSON.h"
|
#include "WallpaperEngine/Data/JSON.h"
|
||||||
#include "WallpaperEngine/Data/Model/Project.h"
|
#include "WallpaperEngine/Data/Model/Project.h"
|
||||||
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Parsers {
|
namespace WallpaperEngine::Data::Parsers {
|
||||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +17,7 @@ using namespace WallpaperEngine::Data::Model;
|
|||||||
*/
|
*/
|
||||||
class ProjectParser {
|
class ProjectParser {
|
||||||
public:
|
public:
|
||||||
static ProjectUniquePtr parse (const JSON& data, ContainerUniquePtr container);
|
static ProjectUniquePtr parse (const JSON& data, AssetLocatorUniquePtr container);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Project::Type parseType (const std::string& type);
|
static Project::Type parseType (const std::string& type);
|
||||||
|
@ -7,7 +7,7 @@ using namespace WallpaperEngine::Data::Parsers;
|
|||||||
using namespace WallpaperEngine::Data::Builders;
|
using namespace WallpaperEngine::Data::Builders;
|
||||||
|
|
||||||
UserSettingUniquePtr UserSettingParser::parse (const json& data, const Properties& properties) {
|
UserSettingUniquePtr UserSettingParser::parse (const json& data, const Properties& properties) {
|
||||||
DynamicValueUniquePtr value = std::make_unique <DynamicValue> ();
|
auto value = std::make_unique <DynamicValue> ();
|
||||||
PropertySharedPtr property;
|
PropertySharedPtr property;
|
||||||
std::optional<ConditionInfo> condition;
|
std::optional<ConditionInfo> condition;
|
||||||
auto valueIt = data;
|
auto valueIt = data;
|
||||||
@ -25,9 +25,8 @@ UserSettingUniquePtr UserSettingParser::parse (const json& data, const Propertie
|
|||||||
|
|
||||||
if (user.has_value () && !user->is_null ()) {
|
if (user.has_value () && !user->is_null ()) {
|
||||||
std::string source;
|
std::string source;
|
||||||
const auto& it = *user;
|
|
||||||
|
|
||||||
if (it.is_string ()) {
|
if (const auto& it = *user; it.is_string ()) {
|
||||||
source = it;
|
source = it;
|
||||||
} else {
|
} else {
|
||||||
condition = ConditionInfo {
|
condition = ConditionInfo {
|
||||||
@ -38,9 +37,7 @@ UserSettingUniquePtr UserSettingParser::parse (const json& data, const Propertie
|
|||||||
source = condition.value ().name;
|
source = condition.value ().name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto propertyIt = properties.find (source);
|
if (const auto propertyIt = properties.find (source); propertyIt != properties.end ()) {
|
||||||
|
|
||||||
if (propertyIt != properties.end ()) {
|
|
||||||
property = propertyIt->second;
|
property = propertyIt->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ WallpaperUniquePtr WallpaperParser::parse (const JSON& file, Project& project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SceneUniquePtr WallpaperParser::parseScene (const JSON& file, Project& project) {
|
SceneUniquePtr WallpaperParser::parseScene (const JSON& file, Project& project) {
|
||||||
const auto scene = JSON::parse (project.container->readString (file));
|
const auto scene = JSON::parse (project.assetLocator->readString (file));
|
||||||
const auto camera = scene.require ("camera", "Scenes must have a camera section");
|
const auto camera = scene.require ("camera", "Scenes must have a camera section");
|
||||||
const auto general = scene.require ("general", "Scenes must have a general section");
|
const auto general = scene.require ("general", "Scenes must have a general section");
|
||||||
const auto projection = general.require ("orthogonalprojection", "General section must have orthogonal projection info");
|
const auto projection = general.require ("orthogonalprojection", "General section must have orthogonal projection info");
|
||||||
|
@ -57,7 +57,7 @@ std::filesystem::path DirectoryAdapter::physicalPath (const std::filesystem::pat
|
|||||||
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
auto finalpath = std::filesystem::canonical(this->basepath / path);
|
||||||
|
|
||||||
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
if (finalpath.string ().find (this->basepath.string ()) != 0) {
|
||||||
throw Render::AssetLoadException ("Cannot find file", path);
|
throw std::filesystem::filesystem_error ("Cannot find file", path, std::error_code ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalpath;
|
return finalpath;
|
||||||
|
@ -45,7 +45,7 @@ bool PackageAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path PackageAdapter::physicalPath (const std::filesystem::path& path) const {
|
std::filesystem::path PackageAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Render::AssetLoadException ("Package adapter does not support realpath", path);
|
throw std::filesystem::filesystem_error ("Package adapter does not support realpath", path, std::error_code ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PackageFactory::handlesMountpoint (const std::filesystem::path& path) const {
|
bool PackageFactory::handlesMountpoint (const std::filesystem::path& path) const {
|
||||||
|
@ -22,7 +22,7 @@ bool VirtualAdapter::exists (const std::filesystem::path& path) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path VirtualAdapter::physicalPath (const std::filesystem::path& path) const {
|
std::filesystem::path VirtualAdapter::physicalPath (const std::filesystem::path& path) const {
|
||||||
throw Render::AssetLoadException ("Virtual adapter does not support realpath", path);
|
throw std::filesystem::filesystem_error ("Virtual adapter does not support realpath", path, std::error_code ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct VirtualAdapter final : Adapter {
|
|||||||
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
[[nodiscard]] std::filesystem::path physicalPath (const std::filesystem::path& path) const override;
|
||||||
|
|
||||||
void add (const std::filesystem::path& path, const char* data);
|
void add (const std::filesystem::path& path, const char* data);
|
||||||
void add (const std::filesystem::path& path, const JSON& contents);
|
void add (const std::filesystem::path& path, const JSON& data);
|
||||||
void add (const std::filesystem::path& path, const std::string& data);
|
void add (const std::filesystem::path& path, const std::string& data);
|
||||||
void add (const std::filesystem::path& path, MemoryStreamSharedPtr stream);
|
void add (const std::filesystem::path& path, MemoryStreamSharedPtr stream);
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ std::filesystem::path Container::physicalPath (const std::filesystem::path& path
|
|||||||
return this->resolveAdapterForFile (path).physicalPath (normalized);
|
return this->resolveAdapterForFile (path).physicalPath (normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AdapterSharedPtr Container::mount (const std::filesystem::path& path, const std::filesystem::path& mountPoint) {
|
AdapterSharedPtr Container::mount (const std::filesystem::path& path, const std::filesystem::path& mountPoint) {
|
||||||
// check if any adapter can handle the path
|
// check if any adapter can handle the path
|
||||||
for (const auto& factory : this->m_factories) {
|
for (const auto& factory : this->m_factories) {
|
||||||
@ -92,7 +91,8 @@ AdapterSharedPtr Container::mount (const std::filesystem::path& path, const std:
|
|||||||
return this->m_mountpoints.emplace_back (mountPoint, factory->create (path)).second;
|
return this->m_mountpoints.emplace_back (mountPoint, factory->create (path)).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog.exception("The specified mount (", path, ") cannot be handled by any of the filesystem adapters");
|
throw std::filesystem::filesystem_error (
|
||||||
|
"The specified mount cannot be handled by any of the filesystem adapters", path, std::error_code ());
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualAdapter& Container::getVFS () const {
|
VirtualAdapter& Container::getVFS () const {
|
||||||
@ -120,5 +120,5 @@ Adapter& Container::resolveAdapterForFile (const std::filesystem::path& path) co
|
|||||||
return this->resolveAdapterForFile ("/" + normalized.string());
|
return this->resolveAdapterForFile ("/" + normalized.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Render::AssetLoadException ("Cannot find requested file ", path);
|
throw std::filesystem::filesystem_error ("Cannot find requested file in any of the mountpoints", path, std::error_code ());
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,6 @@ class Container {
|
|||||||
/** Virtual file system adapter */
|
/** Virtual file system adapter */
|
||||||
std::shared_ptr<VirtualAdapter> m_vfs;
|
std::shared_ptr<VirtualAdapter> m_vfs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ContainerUniquePtr = std::unique_ptr<Container>;
|
||||||
}
|
}
|
@ -13,8 +13,6 @@ class CFBO final : public TextureProvider {
|
|||||||
uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight);
|
uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight);
|
||||||
~CFBO () override;
|
~CFBO () override;
|
||||||
|
|
||||||
// TODO: ADD DESTRUCTOR TO FREE RESOURCES
|
|
||||||
|
|
||||||
[[nodiscard]] const std::string& getName () const;
|
[[nodiscard]] const std::string& getName () const;
|
||||||
[[nodiscard]] const float& getScale () const;
|
[[nodiscard]] const float& getScale () const;
|
||||||
[[nodiscard]] TextureFormat getFormat () const override;
|
[[nodiscard]] TextureFormat getFormat () const override;
|
||||||
|
@ -15,8 +15,8 @@ Wallpapers::CScene& CObject::getScene () const {
|
|||||||
return this->m_scene;
|
return this->m_scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Container& CObject::getContainer () const {
|
const AssetLocator& CObject::getAssetLocator () const {
|
||||||
return this->getScene ().getContainer ();
|
return this->getScene ().getAssetLocator ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CObject::getId () const {
|
int CObject::getId () const {
|
||||||
|
@ -36,7 +36,7 @@ class CObject : public Helpers::ContextAware {
|
|||||||
virtual void render () = 0;
|
virtual void render () = 0;
|
||||||
|
|
||||||
[[nodiscard]] Wallpapers::CScene& getScene () const;
|
[[nodiscard]] Wallpapers::CScene& getScene () const;
|
||||||
[[nodiscard]] const Container& getContainer () const;
|
[[nodiscard]] const AssetLocator& getAssetLocator () const;
|
||||||
[[nodiscard]] int getId () const;
|
[[nodiscard]] int getId () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -110,14 +110,8 @@ void CTexture::setupResolution () {
|
|||||||
GLint CTexture::setupInternalFormat () {
|
GLint CTexture::setupInternalFormat () {
|
||||||
if (this->m_header->freeImageFormat != FIF_UNKNOWN) {
|
if (this->m_header->freeImageFormat != FIF_UNKNOWN) {
|
||||||
return GL_RGBA8;
|
return GL_RGBA8;
|
||||||
// set some extra information too as it's used for image sizing
|
}
|
||||||
// this ensures that a_TexCoord uses the full image instead of just part of it
|
|
||||||
// TODO: MAYBE IT'S BETTER TO CREATE A TEXTURE OF THE GIVEN SIZE AND COPY OVER WHAT WE READ FROM THE FILE?
|
|
||||||
/*this->m_header->width = this->m_header->mipmaps [0]->width;
|
|
||||||
this->m_header->height = this->m_header->mipmaps [0]->height;
|
|
||||||
this->m_header->textureWidth = this->m_header->mipmaps [0]->width;
|
|
||||||
this->m_header->textureHeight = this->m_header->mipmaps [0]->height;*/
|
|
||||||
} else {
|
|
||||||
// detect the image format and hand it to openGL to be used
|
// detect the image format and hand it to openGL to be used
|
||||||
switch (this->m_header->format) {
|
switch (this->m_header->format) {
|
||||||
case TextureFormat_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
case TextureFormat_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||||
@ -129,7 +123,6 @@ GLint CTexture::setupInternalFormat () {
|
|||||||
default: sLog.exception ("Cannot determine texture format");
|
default: sLog.exception ("Cannot determine texture format");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void CTexture::setupOpenGLParameters (uint32_t textureID) {
|
void CTexture::setupOpenGLParameters (uint32_t textureID) {
|
||||||
// bind the texture to assign information to it
|
// bind the texture to assign information to it
|
||||||
|
@ -45,8 +45,8 @@ CWallpaper::CWallpaper (
|
|||||||
|
|
||||||
CWallpaper::~CWallpaper () = default;
|
CWallpaper::~CWallpaper () = default;
|
||||||
|
|
||||||
const Container& CWallpaper::getContainer () const {
|
const AssetLocator& CWallpaper::getAssetLocator () const {
|
||||||
return *this->m_wallpaperData.project.container;
|
return *this->m_wallpaperData.project.assetLocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wallpaper& CWallpaper::getWallpaperData () const {
|
const Wallpaper& CWallpaper::getWallpaperData () const {
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
#include "FBOProvider.h"
|
#include "FBOProvider.h"
|
||||||
#include "WallpaperState.h"
|
#include "WallpaperState.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Application {
|
||||||
|
class WallpaperApplication;
|
||||||
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::WebBrowser {
|
namespace WallpaperEngine::WebBrowser {
|
||||||
class WebBrowserContext;
|
class WebBrowserContext;
|
||||||
}
|
}
|
||||||
@ -29,6 +33,7 @@ using namespace WallpaperEngine::Data::Model;
|
|||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::FileSystem;
|
||||||
|
|
||||||
class CWallpaper : public Helpers::ContextAware, public FBOProvider {
|
class CWallpaper : public Helpers::ContextAware, public FBOProvider {
|
||||||
|
friend class WallpaperEngine::Application::WallpaperApplication;
|
||||||
public:
|
public:
|
||||||
template <class T> [[nodiscard]] const T* as () const {
|
template <class T> [[nodiscard]] const T* as () const {
|
||||||
if (is <T> ()) {
|
if (is <T> ()) {
|
||||||
@ -65,7 +70,7 @@ class CWallpaper : public Helpers::ContextAware, public FBOProvider {
|
|||||||
/**
|
/**
|
||||||
* @return The container to resolve files for this wallpaper
|
* @return The container to resolve files for this wallpaper
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] const Container& getContainer () const;
|
[[nodiscard]] const AssetLocator& getAssetLocator () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The current audio context for this wallpaper
|
* @return The current audio context for this wallpaper
|
||||||
|
@ -39,7 +39,7 @@ X11FullScreenDetector::X11FullScreenDetector (
|
|||||||
try {
|
try {
|
||||||
// attempt casting to CGLFWOpenGLDriver, this will throw if it's not possible
|
// attempt casting to CGLFWOpenGLDriver, this will throw if it's not possible
|
||||||
// so we can gracely handle the error
|
// so we can gracely handle the error
|
||||||
dynamic_cast <GLFWOpenGLDriver&> (this->m_driver);
|
std::ignore = dynamic_cast <GLFWOpenGLDriver&> (this->m_driver);
|
||||||
} catch (std::exception&) {
|
} catch (std::exception&) {
|
||||||
sLog.exception ("X11 FullScreen Detector initialized with the wrong video driver... This is a bug...");
|
sLog.exception ("X11 FullScreen Detector initialized with the wrong video driver... This is a bug...");
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ FBOProvider::FBOProvider (const FBOProvider* parent) :
|
|||||||
m_parent (parent) {}
|
m_parent (parent) {}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<CFBO> FBOProvider::create(const FBO& base, uint32_t flags, glm::vec2 size) {
|
std::shared_ptr<CFBO> FBOProvider::create(const FBO& base, uint32_t flags, const glm::vec2 size) {
|
||||||
return this->m_fbos[base.name] = std::make_shared <CFBO> (
|
return this->m_fbos[base.name] = std::make_shared <CFBO> (
|
||||||
base.name,
|
base.name,
|
||||||
// TODO: PROPERLY DETERMINE FBO FORMAT BASED ON THE STRING
|
// TODO: PROPERLY DETERMINE FBO FORMAT BASED ON THE STRING
|
||||||
@ -44,10 +44,9 @@ std::shared_ptr<CFBO> FBOProvider::alias (const std::string& newName, const std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CFBO> FBOProvider::find (const std::string& name) const {
|
std::shared_ptr<CFBO> FBOProvider::find (const std::string& name) const {
|
||||||
const auto it = this->m_fbos.find (name);
|
if (const auto it = this->m_fbos.find (name); it != this->m_fbos.end ()) {
|
||||||
|
|
||||||
if (it != this->m_fbos.end ())
|
|
||||||
return it->second;
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->m_parent == nullptr) {
|
if (this->m_parent == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -485,7 +485,6 @@ void CImage::render () {
|
|||||||
const auto end = this->m_passes.end ();
|
const auto end = this->m_passes.end ();
|
||||||
|
|
||||||
for (; cur != end; ++cur) {
|
for (; cur != end; ++cur) {
|
||||||
// TODO: PROPERLY CHECK EFFECT'S VISIBILITY AND TAKE IT INTO ACCOUNT
|
|
||||||
if (std::next (cur) == end)
|
if (std::next (cur) == end)
|
||||||
glColorMask (true, true, true, false);
|
glColorMask (true, true, true, false);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ CSound::~CSound() {
|
|||||||
void CSound::load () {
|
void CSound::load () {
|
||||||
for (const auto& cur : this->m_sound.sounds) {
|
for (const auto& cur : this->m_sound.sounds) {
|
||||||
uint32_t filesize = 0;
|
uint32_t filesize = 0;
|
||||||
auto filebuffer = this->getContainer ().read (cur);
|
auto filebuffer = this->getAssetLocator ().read (cur);
|
||||||
auto stream = new Audio::AudioStream (this->getScene ().getAudioContext (), filebuffer, filesize);
|
auto stream = new Audio::AudioStream (this->getScene ().getAudioContext (), filebuffer, filesize);
|
||||||
|
|
||||||
stream->setRepeat (this->m_sound.playbackmode.has_value() && this->m_sound.playbackmode == "loop");
|
stream->setRepeat (this->m_sound.playbackmode.has_value() && this->m_sound.playbackmode == "loop");
|
||||||
|
@ -427,16 +427,16 @@ void CPass::setupShaders () {
|
|||||||
// TODO: USED TO BUILD THE TEXTURES LATER
|
// TODO: USED TO BUILD THE TEXTURES LATER
|
||||||
// use the combos copied from the pass so it includes the texture format
|
// use the combos copied from the pass so it includes the texture format
|
||||||
this->m_shader = new Render::Shaders::Shader (
|
this->m_shader = new Render::Shaders::Shader (
|
||||||
this->m_image.getContainer (), this->m_pass.shader, this->m_combos, this->m_override.combos,
|
this->m_image.getAssetLocator (), this->m_pass.shader, this->m_combos, this->m_override.combos,
|
||||||
this->m_pass.textures, this->m_override.textures, this->m_override.constants
|
this->m_pass.textures, this->m_override.textures, this->m_override.constants
|
||||||
);
|
);
|
||||||
|
|
||||||
const auto shaders = Shaders::GLSLContext::get ().toGlsl (
|
const auto [vertex, fragment] = Shaders::GLSLContext::get ().toGlsl (
|
||||||
this->m_shader->vertex (), this->m_shader->fragment ());
|
this->m_shader->vertex (), this->m_shader->fragment ());
|
||||||
|
|
||||||
// compile the shaders
|
// compile the shaders
|
||||||
const GLuint vertexShaderID = compileShader (shaders.first.c_str (), GL_VERTEX_SHADER);
|
const GLuint vertexShaderID = compileShader (vertex.c_str (), GL_VERTEX_SHADER);
|
||||||
const GLuint fragmentShaderID = compileShader (shaders.second.c_str (), GL_FRAGMENT_SHADER);
|
const GLuint fragmentShaderID = compileShader (fragment.c_str (), GL_FRAGMENT_SHADER);
|
||||||
// create the final program
|
// create the final program
|
||||||
this->m_programID = glCreateProgram ();
|
this->m_programID = glCreateProgram ();
|
||||||
// link the shaders together
|
// link the shaders together
|
||||||
|
@ -23,10 +23,9 @@ void RenderContext::render (Drivers::Output::OutputViewport* viewport) {
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
// search the background in the viewport selection
|
// search the background in the viewport selection
|
||||||
const auto ref = this->m_wallpapers.find (viewport->name);
|
|
||||||
|
|
||||||
// render the background
|
// render the background
|
||||||
if (ref != this->m_wallpapers.end ())
|
if (const auto ref = this->m_wallpapers.find (viewport->name); ref != this->m_wallpapers.end ())
|
||||||
ref->second->render (viewport->viewport, this->getOutput ().renderVFlip ());
|
ref->second->render (viewport->viewport, this->getOutput ().renderVFlip ());
|
||||||
|
|
||||||
#if !NDEBUG
|
#if !NDEBUG
|
||||||
|
@ -105,15 +105,15 @@ TBuiltInResource BuiltInResource = {
|
|||||||
.maxTaskWorkGroupSizeZ_NV = 1,
|
.maxTaskWorkGroupSizeZ_NV = 1,
|
||||||
.maxMeshViewCountNV = 4,
|
.maxMeshViewCountNV = 4,
|
||||||
.limits = {
|
.limits = {
|
||||||
.nonInductiveForLoops = 1,
|
.nonInductiveForLoops = true,
|
||||||
.whileLoops = 1,
|
.whileLoops = true,
|
||||||
.doWhileLoops = 1,
|
.doWhileLoops = true,
|
||||||
.generalUniformIndexing = 1,
|
.generalUniformIndexing = true,
|
||||||
.generalAttributeMatrixVectorIndexing = 1,
|
.generalAttributeMatrixVectorIndexing = true,
|
||||||
.generalVaryingIndexing = 1,
|
.generalVaryingIndexing = true,
|
||||||
.generalSamplerIndexing = 1,
|
.generalSamplerIndexing = true,
|
||||||
.generalVariableIndexing = 1,
|
.generalVariableIndexing = true,
|
||||||
.generalConstantMatrixVectorIndexing = 1,
|
.generalConstantMatrixVectorIndexing = true,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,62 +10,24 @@
|
|||||||
|
|
||||||
#include "GLSLContext.h"
|
#include "GLSLContext.h"
|
||||||
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
#include "WallpaperEngine/Assets/AssetLoadException.h"
|
||||||
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
#include "WallpaperEngine/FileSystem/Container.h"
|
#include "WallpaperEngine/FileSystem/Container.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Assets;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render::Shaders {
|
namespace WallpaperEngine::Render::Shaders {
|
||||||
// TODO: MOVE THIS INTO AN ASSET RESOLVER OR SOMETHING SIMILAR AS IT DOESN'T REALLY BELONG HERE BUT GETS THE CHANGESET OUT
|
|
||||||
std::string readShader (const std::filesystem::path& filename, const Container& container) {
|
|
||||||
std::filesystem::path shader = filename;
|
|
||||||
auto it = shader.begin ();
|
|
||||||
|
|
||||||
// detect workshop shaders and check if there's a
|
|
||||||
if (*it++ == "workshop") {
|
|
||||||
const std::filesystem::path workshopId = *it++;
|
|
||||||
|
|
||||||
if (++it != shader.end ()) {
|
|
||||||
const std::filesystem::path& shaderfile = *it;
|
|
||||||
|
|
||||||
try {
|
|
||||||
shader = std::filesystem::path ("zcompat") / "scene" / "shaders" / workshopId / shaderfile;
|
|
||||||
// replace the old path with the new one
|
|
||||||
std::string contents = container.readString (shader);
|
|
||||||
|
|
||||||
sLog.out ("Replaced ", filename, " with compat ", shader);
|
|
||||||
|
|
||||||
return contents;
|
|
||||||
} catch (AssetLoadException&) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return container.readString ("shaders" / filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string readVertex (const std::filesystem::path& filename, const Container& container) {
|
|
||||||
std::filesystem::path shader = filename;
|
|
||||||
shader.replace_extension (".vert");
|
|
||||||
return readShader (shader, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string readFragment (const std::filesystem::path& filename, const Container& container) {
|
|
||||||
std::filesystem::path shader = filename;
|
|
||||||
shader.replace_extension (".frag");
|
|
||||||
return readShader (shader, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
Shader::Shader (
|
Shader::Shader (
|
||||||
const Container& container, std::string filename,
|
const AssetLocator& assetLocator, std::string filename,
|
||||||
const ComboMap& combos, const ComboMap& overrideCombos,
|
const ComboMap& combos, const ComboMap& overrideCombos,
|
||||||
const TextureMap& textures, const TextureMap& overrideTextures,
|
const TextureMap& textures, const TextureMap& overrideTextures,
|
||||||
const ShaderConstantMap& constants
|
const ShaderConstantMap& constants
|
||||||
) :
|
) :
|
||||||
m_vertex (
|
m_vertex (
|
||||||
GLSLContext::UnitType_Vertex, filename, readVertex (filename, container),
|
GLSLContext::UnitType_Vertex, filename, assetLocator.vertexShader (filename),
|
||||||
container, constants, textures, overrideTextures, combos, overrideCombos),
|
assetLocator, constants, textures, overrideTextures, combos, overrideCombos),
|
||||||
m_fragment (
|
m_fragment (
|
||||||
GLSLContext::UnitType_Fragment, filename, readFragment (filename, container),
|
GLSLContext::UnitType_Fragment, filename, assetLocator.fragmentShader (filename),
|
||||||
container, constants, textures, overrideTextures, combos, overrideCombos),
|
assetLocator, constants, textures, overrideTextures, combos, overrideCombos),
|
||||||
m_file (std::move (filename)),
|
m_file (std::move (filename)),
|
||||||
m_combos (combos),
|
m_combos (combos),
|
||||||
m_overrideCombos (overrideCombos),
|
m_overrideCombos (overrideCombos),
|
||||||
@ -76,7 +38,6 @@ Shader::Shader (
|
|||||||
this->m_fragment.linkToUnit (&this->m_vertex);
|
this->m_fragment.linkToUnit (&this->m_vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const std::string& Shader::vertex () {
|
const std::string& Shader::vertex () {
|
||||||
return this->m_vertex.compile ();
|
return this->m_vertex.compile ();
|
||||||
}
|
}
|
||||||
@ -97,7 +58,7 @@ const std::map<std::string, int>& Shader::getCombos () const {
|
|||||||
return this->m_combos;
|
return this->m_combos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::ParameterSearchResult Shader::findParameter (const std::string& name) {
|
Shader::ParameterSearchResult Shader::findParameter (const std::string& name) const {
|
||||||
Variables::ShaderVariable* vertex = nullptr;
|
Variables::ShaderVariable* vertex = nullptr;
|
||||||
Variables::ShaderVariable* fragment = nullptr;
|
Variables::ShaderVariable* fragment = nullptr;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class Shader {
|
|||||||
* the pre-processing and compilation of the shader, adding
|
* the pre-processing and compilation of the shader, adding
|
||||||
* required definitions if needed
|
* required definitions if needed
|
||||||
*
|
*
|
||||||
* @param container The container to use for file lookup
|
* @param assetLocator The asset locator where to ask for assets for
|
||||||
* @param filename The file to load
|
* @param filename The file to load
|
||||||
* @param combos Settings for the shader
|
* @param combos Settings for the shader
|
||||||
* @param overrideCombos List of override combos to use
|
* @param overrideCombos List of override combos to use
|
||||||
@ -40,7 +40,7 @@ class Shader {
|
|||||||
* @param constants Default values for shader variables
|
* @param constants Default values for shader variables
|
||||||
*/
|
*/
|
||||||
Shader (
|
Shader (
|
||||||
const Container& container, std::string filename,
|
const AssetLocator& assetLocator, std::string filename,
|
||||||
const ComboMap& combos, const ComboMap& overrideCombos,
|
const ComboMap& combos, const ComboMap& overrideCombos,
|
||||||
const TextureMap& textures, const TextureMap& overrideTextures,
|
const TextureMap& textures, const TextureMap& overrideTextures,
|
||||||
const ShaderConstantMap& constants);
|
const ShaderConstantMap& constants);
|
||||||
@ -70,7 +70,7 @@ class Shader {
|
|||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] ParameterSearchResult findParameter (const std::string& name);
|
[[nodiscard]] ParameterSearchResult findParameter (const std::string& name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ using namespace WallpaperEngine::Data::Builders;
|
|||||||
using namespace WallpaperEngine::Render::Shaders;
|
using namespace WallpaperEngine::Render::Shaders;
|
||||||
|
|
||||||
ShaderUnit::ShaderUnit (
|
ShaderUnit::ShaderUnit (
|
||||||
GLSLContext::UnitType type, std::string file, std::string content, const Container& container,
|
GLSLContext::UnitType type, std::string file, std::string content, const AssetLocator& assetLocator,
|
||||||
const ShaderConstantMap& constants, const TextureMap& passTextures, const TextureMap& overrideTextures,
|
const ShaderConstantMap& constants, const TextureMap& passTextures, const TextureMap& overrideTextures,
|
||||||
const ComboMap& combos, const ComboMap& overrideCombos
|
const ComboMap& combos, const ComboMap& overrideCombos
|
||||||
) :
|
) :
|
||||||
@ -66,7 +66,7 @@ ShaderUnit::ShaderUnit (
|
|||||||
m_passTextures (passTextures),
|
m_passTextures (passTextures),
|
||||||
m_overrideTextures (overrideTextures),
|
m_overrideTextures (overrideTextures),
|
||||||
m_link (nullptr),
|
m_link (nullptr),
|
||||||
m_container (container) {
|
m_assetLocator (assetLocator) {
|
||||||
// pre-process the shader so the units are clear
|
// pre-process the shader so the units are clear
|
||||||
this->preprocess ();
|
this->preprocess ();
|
||||||
}
|
}
|
||||||
@ -152,8 +152,7 @@ void ShaderUnit::preprocessIncludes () {
|
|||||||
content += "// begin of include from file ";
|
content += "// begin of include from file ";
|
||||||
content += filename;
|
content += filename;
|
||||||
content += "\n";
|
content += "\n";
|
||||||
// TODO: MOVE SHADER PATH FROM HERE TO SOMEWHERE LIKE AN ASSET RESOLVER OR SOMETHING LIKE THAT
|
content += this->m_assetLocator.includeShader (filename);
|
||||||
content += this->m_container.readString (std::filesystem::path("shaders") / filename);
|
|
||||||
content += "\n// end of included from file ";
|
content += "\n// end of included from file ";
|
||||||
content += filename;
|
content += filename;
|
||||||
content += "\n";
|
content += "\n";
|
||||||
@ -192,8 +191,7 @@ void ShaderUnit::preprocessIncludes () {
|
|||||||
content = "// begin of include from file ";
|
content = "// begin of include from file ";
|
||||||
content += filename;
|
content += filename;
|
||||||
content += "\n";
|
content += "\n";
|
||||||
// TODO: MOVE SHADER PATH FROM HERE TO SOMEWHERE LIKE AN ASSET RESOLVER OR SOMETHING LIKE THAT
|
content += this->m_assetLocator.includeShader (filename);
|
||||||
content += this->m_container.readString (std::filesystem::path("shaders") / filename);
|
|
||||||
content += "\n// end of included from file ";
|
content += "\n// end of included from file ";
|
||||||
content += filename;
|
content += filename;
|
||||||
content += "\n";
|
content += "\n";
|
||||||
@ -313,7 +311,7 @@ void ShaderUnit::preprocessRequires () {
|
|||||||
// comment out requires
|
// comment out requires
|
||||||
while((start = this->m_preprocessed.find("#require", end)) != std::string::npos) {
|
while((start = this->m_preprocessed.find("#require", end)) != std::string::npos) {
|
||||||
// TODO: CHECK FOR ERRORS HERE
|
// TODO: CHECK FOR ERRORS HERE
|
||||||
size_t lineEnd = this->m_preprocessed.find_first_of('\n', start);
|
const size_t lineEnd = this->m_preprocessed.find_first_of('\n', start);
|
||||||
sLog.out("Shader has a require block ", this->m_preprocessed.substr (start, lineEnd - start));
|
sLog.out("Shader has a require block ", this->m_preprocessed.substr (start, lineEnd - start));
|
||||||
// replace the first two letters with a comment so the filelength doesn't change
|
// replace the first two letters with a comment so the filelength doesn't change
|
||||||
this->m_preprocessed = this->m_preprocessed.replace(start, 2, "//");
|
this->m_preprocessed = this->m_preprocessed.replace(start, 2, "//");
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "GLSLContext.h"
|
#include "GLSLContext.h"
|
||||||
#include "WallpaperEngine/Data/JSON.h"
|
#include "WallpaperEngine/Data/JSON.h"
|
||||||
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
#include "WallpaperEngine/Render/Shaders/Variables/ShaderVariable.h"
|
#include "WallpaperEngine/Render/Shaders/Variables/ShaderVariable.h"
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
|
|
||||||
@ -13,7 +14,7 @@
|
|||||||
|
|
||||||
namespace WallpaperEngine::Render::Shaders {
|
namespace WallpaperEngine::Render::Shaders {
|
||||||
using JSON = WallpaperEngine::Data::JSON::JSON;
|
using JSON = WallpaperEngine::Data::JSON::JSON;
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,7 +23,7 @@ using namespace WallpaperEngine::Data::Model;
|
|||||||
class ShaderUnit {
|
class ShaderUnit {
|
||||||
public:
|
public:
|
||||||
ShaderUnit (
|
ShaderUnit (
|
||||||
GLSLContext::UnitType type, std::string file, std::string content, const Container& container,
|
GLSLContext::UnitType type, std::string file, std::string content, const AssetLocator& assetLocator,
|
||||||
const ShaderConstantMap& constants, const TextureMap& passTextures,
|
const ShaderConstantMap& constants, const TextureMap& passTextures,
|
||||||
const TextureMap& overrideTextures, const ComboMap& combos, const ComboMap& overrideCombos);
|
const TextureMap& overrideTextures, const ComboMap& combos, const ComboMap& overrideCombos);
|
||||||
~ShaderUnit () = default;
|
~ShaderUnit () = default;
|
||||||
@ -158,6 +159,6 @@ class ShaderUnit {
|
|||||||
/**
|
/**
|
||||||
* The container to source files from
|
* The container to source files from
|
||||||
*/
|
*/
|
||||||
const Container& m_container;
|
const AssetLocator& m_assetLocator;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ std::shared_ptr<const TextureProvider> TextureCache::resolve (const std::string&
|
|||||||
// search for the texture in all the different containers just in case
|
// search for the texture in all the different containers just in case
|
||||||
for (const auto& [name, project] : this->getContext ().getApp ().getBackgrounds ()) {
|
for (const auto& [name, project] : this->getContext ().getApp ().getBackgrounds ()) {
|
||||||
try {
|
try {
|
||||||
auto contents = project->container->read (finalFilename);
|
auto contents = project->assetLocator->read (finalFilename);
|
||||||
auto stream = BinaryReader (contents);
|
auto stream = BinaryReader (contents);
|
||||||
|
|
||||||
auto parsedTexture = TextureParser::parse (stream);
|
auto parsedTexture = TextureParser::parse (stream);
|
||||||
@ -39,7 +39,7 @@ std::shared_ptr<const TextureProvider> TextureCache::resolve (const std::string&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw AssetLoadException (filename, "Cannot find file");
|
throw AssetLoadException ("Cannot find file", filename, std::error_code ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache::store (const std::string& name, std::shared_ptr<const TextureProvider> texture) {
|
void TextureCache::store (const std::string& name, std::shared_ptr<const TextureProvider> texture) {
|
||||||
|
@ -57,7 +57,7 @@ CVideo::CVideo (
|
|||||||
sLog.exception ("Failed to initialize MPV's GL context");
|
sLog.exception ("Failed to initialize MPV's GL context");
|
||||||
|
|
||||||
const std::filesystem::path videopath =
|
const std::filesystem::path videopath =
|
||||||
this->getVideo ().project.container->physicalPath (this->getVideo ().filename);
|
this->getVideo ().project.assetLocator->physicalPath (this->getVideo ().filename);
|
||||||
|
|
||||||
// build the path to the video file
|
// build the path to the video file
|
||||||
const char* command [] = {"loadfile", videopath.c_str (), nullptr};
|
const char* command [] = {"loadfile", videopath.c_str (), nullptr};
|
||||||
|
@ -9,7 +9,7 @@ namespace WallpaperEngine::Render::Wallpapers {
|
|||||||
class CVideo final : public CWallpaper {
|
class CVideo final : public CWallpaper {
|
||||||
public:
|
public:
|
||||||
CVideo (
|
CVideo (
|
||||||
const Wallpaper& video, RenderContext& context, AudioContext& audioContext,
|
const Wallpaper& wallpaper, RenderContext& context, AudioContext& audioContext,
|
||||||
const WallpaperState::TextureUVsScaling& scalingMode,
|
const WallpaperState::TextureUVsScaling& scalingMode,
|
||||||
const uint32_t& clampMode);
|
const uint32_t& clampMode);
|
||||||
|
|
||||||
|
@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Data/Model/Project.h"
|
#include "WallpaperEngine/Data/Model/Project.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
|
||||||
using namespace WallpaperEngine::WebBrowser::CEF;
|
using namespace WallpaperEngine::WebBrowser::CEF;
|
||||||
|
|
||||||
WPSchemeHandler::WPSchemeHandler(const Project& project) :
|
WPSchemeHandler::WPSchemeHandler(const Project& project) :
|
||||||
m_project (project),
|
m_project (project),
|
||||||
m_container (*this->m_project.container) {
|
m_assetLoader (*this->m_project.assetLocator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WPSchemeHandler::Open(CefRefPtr<CefRequest> request,
|
bool WPSchemeHandler::Open(CefRefPtr<CefRequest> request,
|
||||||
@ -48,7 +47,7 @@ bool WPSchemeHandler::Open(CefRefPtr<CefRequest> request,
|
|||||||
this->m_mimeType = mime;
|
this->m_mimeType = mime;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_contents = this->m_container.read (file);
|
this->m_contents = this->m_assetLoader.read (file);
|
||||||
callback->Continue ();
|
callback->Continue ();
|
||||||
} catch (AssetLoadException&) {
|
} catch (AssetLoadException&) {
|
||||||
#if !NDEBUG
|
#if !NDEBUG
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "WallpaperEngine/FileSystem/Container.h"
|
#include "WallpaperEngine/Assets/AssetLocator.h"
|
||||||
|
|
||||||
#include "include/cef_resource_handler.h"
|
#include "include/cef_resource_handler.h"
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
@ -13,7 +13,7 @@ struct Project;
|
|||||||
|
|
||||||
namespace WallpaperEngine::WebBrowser::CEF {
|
namespace WallpaperEngine::WebBrowser::CEF {
|
||||||
|
|
||||||
using namespace WallpaperEngine::FileSystem;
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Data::Model;
|
using namespace WallpaperEngine::Data::Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +39,7 @@ class WPSchemeHandler : public CefResourceHandler {
|
|||||||
private:
|
private:
|
||||||
const Project& m_project;
|
const Project& m_project;
|
||||||
|
|
||||||
const Container& m_container;
|
const AssetLocator& m_assetLoader;
|
||||||
ReadStreamSharedPtr m_contents = nullptr;
|
ReadStreamSharedPtr m_contents = nullptr;
|
||||||
std::string m_mimeType;
|
std::string m_mimeType;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "include/cef_scheme.h"
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
namespace WallpaperEngine::Data::Model {
|
namespace WallpaperEngine::Data::Model {
|
||||||
class Project;
|
struct Project;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace WallpaperEngine::WebBrowser::CEF {
|
namespace WallpaperEngine::WebBrowser::CEF {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
clang-tidy --format-style file src/**/*.cpp -p cmake-build-debug
|
clang-tidy --format-style file src/WallpaperEngine/**/*.cpp src/*.cpp src/Steam/**/*.cpp -p cmake-build-debug
|
Loading…
Reference in New Issue
Block a user