mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
chore: cleanup typing issues and various other warnings here and there
This commit is contained in:
parent
8a8741dbff
commit
d652691088
@ -41,7 +41,7 @@ std::filesystem::path CCombinedContainer::resolveRealFile (const std::string& fi
|
|||||||
throw CAssetLoadException (filename, "Cannot resolve file in any of the containers");
|
throw CAssetLoadException (filename, "Cannot resolve file in any of the containers");
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* CCombinedContainer::readFile (const std::string& filename, uint32_t* length) const {
|
const uint8_t* CCombinedContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||||
for (const auto cur : this->m_containers) {
|
for (const auto cur : this->m_containers) {
|
||||||
try {
|
try {
|
||||||
// try to read the file on the current container, if the file doesn't exists
|
// try to read the file on the current container, if the file doesn't exists
|
||||||
|
@ -30,7 +30,7 @@ class CCombinedContainer final : public CContainer {
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The list of containers to search files off from */
|
/** The list of containers to search files off from */
|
||||||
|
@ -70,7 +70,7 @@ std::string CContainer::readFileAsString (const std::string& filename) const {
|
|||||||
uint32_t length = 0;
|
uint32_t length = 0;
|
||||||
|
|
||||||
// read file contents and allocate a buffer for a string
|
// read file contents and allocate a buffer for a string
|
||||||
const void* contents = this->readFile (std::move (filename), &length);
|
const uint8_t* contents = this->readFile (filename, &length);
|
||||||
char* buffer = new char [length + 1];
|
char* buffer = new char [length + 1];
|
||||||
|
|
||||||
// ensure there's a 0 at the end
|
// ensure there's a 0 at the end
|
||||||
|
@ -30,7 +30,7 @@ class CContainer {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual const void* readFile (const std::string& filename, uint32_t* length) const = 0;
|
[[nodiscard]] virtual const uint8_t* readFile (const std::string& filename, uint32_t* length) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for readFile, appends the texture extension at the end of the filename
|
* Wrapper for readFile, appends the texture extension at the end of the filename
|
||||||
|
@ -23,7 +23,7 @@ std::filesystem::path CDirectory::resolveRealFile (const std::string& filename)
|
|||||||
return std::filesystem::path (this->m_basepath) / filename;
|
return std::filesystem::path (this->m_basepath) / filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* CDirectory::readFile (const std::string& filename, uint32_t* length) const {
|
const uint8_t* CDirectory::readFile (const std::string& filename, uint32_t* length) const {
|
||||||
const std::filesystem::path final = std::filesystem::path (this->m_basepath) / filename;
|
const std::filesystem::path final = std::filesystem::path (this->m_basepath) / filename;
|
||||||
|
|
||||||
// first check the cache, if the file is there already just return the data in there
|
// first check the cache, if the file is there already just return the data in there
|
||||||
@ -47,7 +47,7 @@ const void* CDirectory::readFile (const std::string& filename, uint32_t* length)
|
|||||||
fseek (fp, 0, SEEK_SET);
|
fseek (fp, 0, SEEK_SET);
|
||||||
|
|
||||||
// now read the whole file
|
// now read the whole file
|
||||||
auto* contents = new char [size];
|
auto* contents = new uint8_t [size];
|
||||||
|
|
||||||
if (fread (contents, size, 1, fp) != 1) {
|
if (fread (contents, size, 1, fp) != 1) {
|
||||||
delete [] contents;
|
delete [] contents;
|
||||||
|
@ -19,7 +19,7 @@ class CDirectory final : public CContainer {
|
|||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The basepath for the directory */
|
/** The basepath for the directory */
|
||||||
|
@ -8,14 +8,14 @@ namespace WallpaperEngine::Assets {
|
|||||||
*/
|
*/
|
||||||
class CFileEntry {
|
class CFileEntry {
|
||||||
public:
|
public:
|
||||||
CFileEntry (const char* address, uint32_t length) : address (address), length (length) {}
|
CFileEntry (const uint8_t* address, uint32_t length) : address (address), length (length) {}
|
||||||
|
|
||||||
~CFileEntry () {
|
~CFileEntry () {
|
||||||
delete [] address;
|
delete [] address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** File contents */
|
/** File contents */
|
||||||
const char* address;
|
const uint8_t* address;
|
||||||
/** File length */
|
/** File length */
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@ CPackage::CPackage (std::filesystem::path path) : m_path (std::move (path)) {
|
|||||||
this->init ();
|
this->init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* CPackage::readFile (const std::string& filename, uint32_t* length) const {
|
const uint8_t* CPackage::readFile (const std::string& filename, uint32_t* length) const {
|
||||||
const auto it = this->m_contents.find (filename);
|
const auto it = this->m_contents.find (filename);
|
||||||
|
|
||||||
if (it == this->m_contents.end ())
|
if (it == this->m_contents.end ())
|
||||||
@ -35,7 +35,7 @@ const void* CPackage::readFile (const std::string& filename, uint32_t* length) c
|
|||||||
*length = it->second->length;
|
*length = it->second->length;
|
||||||
|
|
||||||
// clone original first
|
// clone original first
|
||||||
auto* result = new char [it->second->length];
|
auto* result = new uint8_t [it->second->length];
|
||||||
|
|
||||||
memcpy (result, it->second->address, it->second->length);
|
memcpy (result, it->second->address, it->second->length);
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ void CPackage::loadFiles (FILE* fp) {
|
|||||||
sLog.exception ("Cannot find file ", cur.filename, " from package ", this->m_path);
|
sLog.exception ("Cannot find file ", cur.filename, " from package ", this->m_path);
|
||||||
|
|
||||||
// allocate memory for the file's contents and read it from the file
|
// allocate memory for the file's contents and read it from the file
|
||||||
char* fileContents = new char [cur.length];
|
auto* fileContents = new uint8_t [cur.length];
|
||||||
|
|
||||||
if (fread (fileContents, cur.length, 1, fp) != 1) {
|
if (fread (fileContents, cur.length, 1, fp) != 1) {
|
||||||
delete [] fileContents;
|
delete [] fileContents;
|
||||||
|
@ -20,7 +20,7 @@ class CPackage final : public CContainer {
|
|||||||
public:
|
public:
|
||||||
explicit CPackage (std::filesystem::path path);
|
explicit CPackage (std::filesystem::path path);
|
||||||
|
|
||||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Assets;
|
||||||
|
|
||||||
void CVirtualContainer::add (const std::string& filename, const char* contents, uint32_t length) {
|
void CVirtualContainer::add (const std::string& filename, const uint8_t* contents, uint32_t length) {
|
||||||
this->m_virtualFiles.insert (std::make_pair (filename, new CFileEntry (contents, length)));
|
this->m_virtualFiles.insert (std::make_pair (filename, new CFileEntry (contents, length)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVirtualContainer::add (const std::string& filename, const std::string& contents) {
|
void CVirtualContainer::add (const std::string& filename, const std::string& contents) {
|
||||||
char* copy = new char [contents.length () + 1];
|
auto* copy = new uint8_t [contents.length () + 1];
|
||||||
|
|
||||||
// copy the text AND the \0
|
// copy the text AND the \0
|
||||||
memcpy (copy, contents.c_str (), contents.length () + 1);
|
memcpy (copy, contents.c_str (), contents.length () + 1);
|
||||||
@ -19,7 +19,7 @@ void CVirtualContainer::add (const std::string& filename, const std::string& con
|
|||||||
this->add (filename, copy, contents.length () + 1);
|
this->add (filename, copy, contents.length () + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* CVirtualContainer::readFile (const std::string& filename, uint32_t* length) const {
|
const uint8_t* CVirtualContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||||
const auto cur = this->m_virtualFiles.find (filename);
|
const auto cur = this->m_virtualFiles.find (filename);
|
||||||
|
|
||||||
if (cur == this->m_virtualFiles.end ())
|
if (cur == this->m_virtualFiles.end ())
|
||||||
@ -29,7 +29,7 @@ const void* CVirtualContainer::readFile (const std::string& filename, uint32_t*
|
|||||||
*length = cur->second->length;
|
*length = cur->second->length;
|
||||||
|
|
||||||
// clone original first
|
// clone original first
|
||||||
char* result = new char [cur->second->length];
|
auto* result = new uint8_t [cur->second->length];
|
||||||
|
|
||||||
memcpy (result, cur->second->address, cur->second->length);
|
memcpy (result, cur->second->address, cur->second->length);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class CVirtualContainer final : public CContainer {
|
|||||||
* @param contents
|
* @param contents
|
||||||
* @param length
|
* @param length
|
||||||
*/
|
*/
|
||||||
void add (const std::string& filename, const char* contents, uint32_t length);
|
void add (const std::string& filename, const uint8_t* contents, uint32_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new file to the virtual container
|
* Adds a new file to the virtual container
|
||||||
@ -29,7 +29,7 @@ class CVirtualContainer final : public CContainer {
|
|||||||
*/
|
*/
|
||||||
void add (const std::string& filename, const std::string& contents);
|
void add (const std::string& filename, const std::string& contents);
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
const void* readFile (const std::string& filename, uint32_t* length) const override;
|
const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The recorded files in this virtual container */
|
/** The recorded files in this virtual container */
|
||||||
|
@ -95,7 +95,7 @@ CAudioStream::CAudioStream (CAudioContext& context, const std::string& filename)
|
|||||||
this->loadCustomContent (filename.c_str ());
|
this->loadCustomContent (filename.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioStream::CAudioStream (CAudioContext& context, const void* buffer, int length) :
|
CAudioStream::CAudioStream (CAudioContext& context, const uint8_t* buffer, uint32_t length) :
|
||||||
m_audioContext (context),
|
m_audioContext (context),
|
||||||
m_swrctx (nullptr) {
|
m_swrctx (nullptr) {
|
||||||
// setup a custom context first
|
// setup a custom context first
|
||||||
@ -142,13 +142,17 @@ void CAudioStream::loadCustomContent (const char* filename) {
|
|||||||
if (avformat_find_stream_info (this->m_formatContext, nullptr) < 0)
|
if (avformat_find_stream_info (this->m_formatContext, nullptr) < 0)
|
||||||
sLog.exception ("Cannot determine file format: ", filename);
|
sLog.exception ("Cannot determine file format: ", filename);
|
||||||
|
|
||||||
|
bool hasAudioStream = false;
|
||||||
|
|
||||||
// find the audio stream
|
// find the audio stream
|
||||||
for (int i = 0; i < this->m_formatContext->nb_streams; i++) {
|
for (unsigned int i = 0; i < this->m_formatContext->nb_streams; i++) {
|
||||||
if (this->m_formatContext->streams [i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && this->m_audioStream < 0)
|
if (this->m_formatContext->streams [i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && hasAudioStream == false) {
|
||||||
|
hasAudioStream = true;
|
||||||
this->m_audioStream = i;
|
this->m_audioStream = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->m_audioStream == -1)
|
if (!hasAudioStream)
|
||||||
sLog.exception ("Cannot find an audio stream in file ", filename);
|
sLog.exception ("Cannot find an audio stream in file ", filename);
|
||||||
|
|
||||||
// get the decoder for it and alloc the required context
|
// get the decoder for it and alloc the required context
|
||||||
@ -308,11 +312,11 @@ AVFormatContext* CAudioStream::getFormatContext () {
|
|||||||
return this->m_formatContext;
|
return this->m_formatContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getAudioStream () {
|
unsigned int CAudioStream::getAudioStream () const {
|
||||||
return this->m_audioStream;
|
return this->m_audioStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::isInitialized () {
|
bool CAudioStream::isInitialized () const {
|
||||||
return this->m_initialized;
|
return this->m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,23 +324,23 @@ void CAudioStream::setRepeat (bool newRepeat) {
|
|||||||
this->m_repeat = newRepeat;
|
this->m_repeat = newRepeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioStream::isRepeat () {
|
bool CAudioStream::isRepeat () const {
|
||||||
return this->m_repeat;
|
return this->m_repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void* CAudioStream::getBuffer () {
|
const uint8_t* CAudioStream::getBuffer () {
|
||||||
return this->m_buffer;
|
return this->m_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getLength () {
|
uint32_t CAudioStream::getLength () const {
|
||||||
return this->m_length;
|
return this->m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAudioStream::getPosition () {
|
uint32_t CAudioStream::getPosition () const {
|
||||||
return this->m_position;
|
return this->m_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioStream::setPosition (int current) {
|
void CAudioStream::setPosition (uint32_t current) {
|
||||||
this->m_position = current;
|
this->m_position = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class CAudioContext;
|
|||||||
class CAudioStream {
|
class CAudioStream {
|
||||||
public:
|
public:
|
||||||
CAudioStream (CAudioContext& context, const std::string& filename);
|
CAudioStream (CAudioContext& context, const std::string& filename);
|
||||||
CAudioStream (CAudioContext& context, const void* buffer, int length);
|
CAudioStream (CAudioContext& context, const uint8_t* buffer, uint32_t length);
|
||||||
CAudioStream (CAudioContext& audioContext, AVCodecContext* context);
|
CAudioStream (CAudioContext& audioContext, AVCodecContext* context);
|
||||||
~CAudioStream ();
|
~CAudioStream ();
|
||||||
|
|
||||||
@ -56,11 +56,11 @@ class CAudioStream {
|
|||||||
/**
|
/**
|
||||||
* @return The audio stream index of the given file
|
* @return The audio stream index of the given file
|
||||||
*/
|
*/
|
||||||
int getAudioStream ();
|
[[nodiscard]] unsigned int getAudioStream () const;
|
||||||
/**
|
/**
|
||||||
* @return If the audio stream can be played or not
|
* @return If the audio stream can be played or not
|
||||||
*/
|
*/
|
||||||
bool isInitialized ();
|
[[nodiscard]] bool isInitialized () const;
|
||||||
/**
|
/**
|
||||||
* @param newRepeat true = repeat, false = no repeat
|
* @param newRepeat true = repeat, false = no repeat
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ class CAudioStream {
|
|||||||
/**
|
/**
|
||||||
* @return If the stream is to be repeated at the end or not
|
* @return If the stream is to be repeated at the end or not
|
||||||
*/
|
*/
|
||||||
bool isRepeat ();
|
[[nodiscard]] bool isRepeat () const;
|
||||||
/**
|
/**
|
||||||
* Stops decoding and playbak of the stream
|
* Stops decoding and playbak of the stream
|
||||||
*/
|
*/
|
||||||
@ -76,21 +76,21 @@ class CAudioStream {
|
|||||||
/**
|
/**
|
||||||
* @return The file data buffer
|
* @return The file data buffer
|
||||||
*/
|
*/
|
||||||
const void* getBuffer ();
|
[[nodiscard]] const uint8_t* getBuffer ();
|
||||||
/**
|
/**
|
||||||
* @return The length of the file data buffer
|
* @return The length of the file data buffer
|
||||||
*/
|
*/
|
||||||
int getLength ();
|
[[nodiscard]] uint32_t getLength () const;
|
||||||
/**
|
/**
|
||||||
* @return The read position of the data buffer
|
* @return The read position of the data buffer
|
||||||
*/
|
*/
|
||||||
int getPosition ();
|
[[nodiscard]] uint32_t getPosition () const;
|
||||||
/**
|
/**
|
||||||
* Updates the read position of the data buffer
|
* Updates the read position of the data buffer
|
||||||
*
|
*
|
||||||
* @param current
|
* @param current
|
||||||
*/
|
*/
|
||||||
void setPosition (int current);
|
void setPosition (uint32_t current);
|
||||||
/**
|
/**
|
||||||
* @return The SDL_cond used to signal waiting for data
|
* @return The SDL_cond used to signal waiting for data
|
||||||
*/
|
*/
|
||||||
@ -175,13 +175,13 @@ class CAudioStream {
|
|||||||
/** The format context that controls how data is read off the file */
|
/** The format context that controls how data is read off the file */
|
||||||
AVFormatContext* m_formatContext = nullptr;
|
AVFormatContext* m_formatContext = nullptr;
|
||||||
/** The stream index for the audio being played */
|
/** The stream index for the audio being played */
|
||||||
int m_audioStream = -1;
|
unsigned int m_audioStream;
|
||||||
/** File data pointer */
|
/** File data pointer */
|
||||||
const void* m_buffer {};
|
const uint8_t* m_buffer {};
|
||||||
/** The length of the file data pointer */
|
/** The length of the file data pointer */
|
||||||
int m_length {};
|
uint32_t m_length {};
|
||||||
/** The read position on the file data pointer */
|
/** The read position on the file data pointer */
|
||||||
int m_position = 0;
|
uint32_t m_position = 0;
|
||||||
|
|
||||||
struct MyAVPacketList {
|
struct MyAVPacketList {
|
||||||
AVPacket* packet;
|
AVPacket* packet;
|
||||||
|
@ -25,9 +25,9 @@ void pa_stream_read_cb (pa_stream* stream, const size_t /*nbytes*/, void* userda
|
|||||||
|
|
||||||
// Careful when to pa_stream_peek() and pa_stream_drop()!
|
// Careful when to pa_stream_peek() and pa_stream_drop()!
|
||||||
// c.f. https://www.freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#ac2838c449cde56e169224d7fe3d00824
|
// c.f. https://www.freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#ac2838c449cde56e169224d7fe3d00824
|
||||||
const void* data = nullptr;
|
const uint8_t* data = nullptr;
|
||||||
size_t currentSize;
|
size_t currentSize;
|
||||||
if (pa_stream_peek (stream, &data, ¤tSize) != 0) {
|
if (pa_stream_peek (stream, reinterpret_cast<const void**> (&data), ¤tSize) != 0) {
|
||||||
sLog.error ("Failed to peek at stream data...");
|
sLog.error ("Failed to peek at stream data...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ using namespace WallpaperEngine::Core;
|
|||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Assets;
|
||||||
using namespace WallpaperEngine::Core::UserSettings;
|
using namespace WallpaperEngine::Core::UserSettings;
|
||||||
|
|
||||||
CObject::CObject (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, std::string type,
|
CObject::CObject (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles) :
|
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles) :
|
||||||
m_scene (scene),
|
m_scene (scene),
|
||||||
m_visible (visible),
|
m_visible (visible),
|
||||||
@ -108,7 +108,7 @@ const std::vector<Objects::CEffect*>& CObject::getEffects () const {
|
|||||||
return this->m_effects;
|
return this->m_effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<uint32_t>& CObject::getDependencies () const {
|
const std::vector<int>& CObject::getDependencies () const {
|
||||||
return this->m_dependencies;
|
return this->m_dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +129,6 @@ void CObject::insertEffect (Objects::CEffect* effect) {
|
|||||||
this->m_effects.push_back (effect);
|
this->m_effects.push_back (effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObject::insertDependency (uint32_t dependency) {
|
void CObject::insertDependency (int dependency) {
|
||||||
this->m_dependencies.push_back (dependency);
|
this->m_dependencies.push_back (dependency);
|
||||||
}
|
}
|
@ -45,37 +45,37 @@ class CObject {
|
|||||||
return this->m_type == T::Type;
|
return this->m_type == T::Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Objects::CEffect*>& getEffects () const;
|
[[nodiscard]] const std::vector<Objects::CEffect*>& getEffects () const;
|
||||||
const std::vector<uint32_t>& getDependencies () const;
|
[[nodiscard]] const std::vector<int>& getDependencies () const;
|
||||||
int getId () const;
|
[[nodiscard]] int getId () const;
|
||||||
|
|
||||||
glm::vec3 getOrigin () const;
|
[[nodiscard]] glm::vec3 getOrigin () const;
|
||||||
glm::vec3 getScale () const;
|
[[nodiscard]] glm::vec3 getScale () const;
|
||||||
const glm::vec3& getAngles () const;
|
[[nodiscard]] const glm::vec3& getAngles () const;
|
||||||
const std::string& getName () const;
|
[[nodiscard]] const std::string& getName () const;
|
||||||
|
|
||||||
bool isVisible () const;
|
[[nodiscard]] bool isVisible () const;
|
||||||
CScene* getScene () const;
|
[[nodiscard]] CScene* getScene () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CObject (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, std::string type,
|
CObject (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles);
|
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles);
|
||||||
|
|
||||||
void insertEffect (Objects::CEffect* effect);
|
void insertEffect (Objects::CEffect* effect);
|
||||||
void insertDependency (uint32_t dependency);
|
void insertDependency (int dependency);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_type;
|
std::string m_type;
|
||||||
|
|
||||||
CUserSettingBoolean* m_visible;
|
CUserSettingBoolean* m_visible;
|
||||||
uint32_t m_id;
|
int m_id;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
CUserSettingVector3* m_origin;
|
CUserSettingVector3* m_origin;
|
||||||
CUserSettingVector3* m_scale;
|
CUserSettingVector3* m_scale;
|
||||||
glm::vec3 m_angles;
|
glm::vec3 m_angles;
|
||||||
|
|
||||||
std::vector<Objects::CEffect*> m_effects;
|
std::vector<Objects::CEffect*> m_effects;
|
||||||
std::vector<uint32_t> m_dependencies;
|
std::vector<int> m_dependencies;
|
||||||
|
|
||||||
CScene* m_scene;
|
CScene* m_scene;
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, CObject* ob
|
|||||||
|
|
||||||
for (const auto& passCur : material->getPasses ()) {
|
for (const auto& passCur : material->getPasses ()) {
|
||||||
if (textures_it != cur->end ()) {
|
if (textures_it != cur->end ()) {
|
||||||
int textureNumber = 0;
|
std::vector<std::string>::size_type textureNumber = 0;
|
||||||
|
|
||||||
for (const auto& texturesCur : (*textures_it)) {
|
for (const auto& texturesCur : (*textures_it)) {
|
||||||
std::string texture;
|
std::string texture;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
using namespace WallpaperEngine::Core::Objects;
|
using namespace WallpaperEngine::Core::Objects;
|
||||||
using namespace WallpaperEngine::Core::UserSettings;
|
using namespace WallpaperEngine::Core::UserSettings;
|
||||||
|
|
||||||
CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, uint32_t id, std::string name,
|
CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, int id, std::string name,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
||||||
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
||||||
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough,
|
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough,
|
||||||
@ -31,7 +31,7 @@ CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean*
|
|||||||
m_autosize (autosize) {}
|
m_autosize (autosize) {}
|
||||||
|
|
||||||
WallpaperEngine::Core::CObject* CImage::fromJSON (CScene* scene, json data, CContainer* container,
|
WallpaperEngine::Core::CObject* CImage::fromJSON (CScene* scene, json data, CContainer* container,
|
||||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
CUserSettingBoolean* visible, int id, std::string name,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale,
|
CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||||
const glm::vec3& angles) {
|
const glm::vec3& angles) {
|
||||||
const auto image_it = data.find ("image");
|
const auto image_it = data.find ("image");
|
||||||
|
@ -28,7 +28,7 @@ class CImage : public CObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static CObject* fromJSON (CScene* scene, json data, CContainer* container, CUserSettingBoolean* visible,
|
static CObject* fromJSON (CScene* scene, json data, CContainer* container, CUserSettingBoolean* visible,
|
||||||
uint32_t id, std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
int id, std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||||
const glm::vec3& angles);
|
const glm::vec3& angles);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ class CImage : public CObject {
|
|||||||
[[nodiscard]] bool isAutosize () const;
|
[[nodiscard]] bool isAutosize () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, uint32_t id, std::string name,
|
CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, int id, std::string name,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
||||||
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
||||||
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough, bool autosize);
|
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough, bool autosize);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
using namespace WallpaperEngine::Core::Objects;
|
using namespace WallpaperEngine::Core::Objects;
|
||||||
|
|
||||||
CParticle* CParticle::fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
CParticle* CParticle::fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
||||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale) {
|
CUserSettingVector3* scale) {
|
||||||
json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
|
json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
|
||||||
const auto controlpoint_it = data.find ("controlpoint");
|
const auto controlpoint_it = data.find ("controlpoint");
|
||||||
const auto starttime_it = jsonFindRequired (data, "starttime", "Particles must have start time");
|
const auto starttime_it = jsonFindRequired (data, "starttime", "Particles must have start time");
|
||||||
@ -29,7 +29,7 @@ CParticle* CParticle::fromFile (CScene* scene, const std::string& filename, CCon
|
|||||||
return particle;
|
return particle;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticle::CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, uint32_t id,
|
CParticle::CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, int id,
|
||||||
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale) :
|
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale) :
|
||||||
CObject (scene, visible, id, std::move (name), Type, origin, scale, glm::vec3 ()),
|
CObject (scene, visible, id, std::move (name), Type, origin, scale, glm::vec3 ()),
|
||||||
m_starttime (starttime),
|
m_starttime (starttime),
|
||||||
|
@ -18,7 +18,7 @@ class CParticle : public CObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static CParticle* fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
static CParticle* fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
||||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
CUserSettingBoolean* visible, int id, std::string name,
|
||||||
CUserSettingVector3* origin, CUserSettingVector3* scale);
|
CUserSettingVector3* origin, CUserSettingVector3* scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ class CParticle : public CObject {
|
|||||||
[[nodiscard]] const std::vector<Particles::CInitializer*>& getInitializers () const;
|
[[nodiscard]] const std::vector<Particles::CInitializer*>& getInitializers () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, uint32_t id,
|
CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, int id,
|
||||||
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale);
|
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Core::Objects;
|
using namespace WallpaperEngine::Core::Objects;
|
||||||
|
|
||||||
CSound::CSound (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, CUserSettingVector3* origin,
|
CSound::CSound (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||||
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat) :
|
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat) :
|
||||||
CObject (scene, visible, id, std::move (name), Type, origin, scale, angles),
|
CObject (scene, visible, id, std::move (name), Type, origin, scale, angles),
|
||||||
m_repeat (repeat) {}
|
m_repeat (repeat) {}
|
||||||
|
|
||||||
WallpaperEngine::Core::CObject* CSound::fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, uint32_t id,
|
WallpaperEngine::Core::CObject* CSound::fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, int id,
|
||||||
const std::string& name, CUserSettingVector3* origin,
|
const std::string& name, CUserSettingVector3* origin,
|
||||||
CUserSettingVector3* scale, const glm::vec3& angles) {
|
CUserSettingVector3* scale, const glm::vec3& angles) {
|
||||||
bool repeat = false;
|
bool repeat = false;
|
||||||
|
@ -15,7 +15,7 @@ class CSound : public CObject {
|
|||||||
friend class CObject;
|
friend class CObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CObject* fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, uint32_t id,
|
static CObject* fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, int id,
|
||||||
const std::string& name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
const std::string& name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||||
const glm::vec3& angles);
|
const glm::vec3& angles);
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ class CSound : public CObject {
|
|||||||
[[nodiscard]] bool isRepeat () const;
|
[[nodiscard]] bool isRepeat () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CSound (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, CUserSettingVector3* origin,
|
CSound (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||||
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat);
|
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ void CPass::insertTexture (const std::string& texture) {
|
|||||||
this->m_textures.push_back (texture);
|
this->m_textures.push_back (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPass::setTexture (int index, const std::string& texture) {
|
void CPass::setTexture (std::vector<std::string>::size_type index, const std::string& texture) {
|
||||||
this->m_textures.at (index) = texture;
|
this->m_textures.at (index) = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class CPass {
|
|||||||
* @param index
|
* @param index
|
||||||
* @param texture
|
* @param texture
|
||||||
*/
|
*/
|
||||||
void setTexture (int index, const std::string& texture);
|
void setTexture (std::vector<std::string>::size_type index, const std::string& texture);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO: CREATE ENUMERATIONS FOR THESE INSTEAD OF USING STRING VALUES!
|
// TODO: CREATE ENUMERATIONS FOR THESE INSTEAD OF USING STRING VALUES!
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Core::Scenes;
|
using namespace WallpaperEngine::Core::Scenes;
|
||||||
|
|
||||||
CProjection::CProjection (uint32_t width, uint32_t height) : m_isAuto (false), m_width (width), m_height (height) {}
|
CProjection::CProjection (int width, int height) : m_isAuto (false), m_width (width), m_height (height) {}
|
||||||
|
|
||||||
CProjection::CProjection (bool isAuto) : m_isAuto (isAuto), m_width (0), m_height (0) {}
|
CProjection::CProjection (bool isAuto) : m_isAuto (isAuto), m_width (0), m_height (0) {}
|
||||||
|
|
||||||
const uint32_t& CProjection::getWidth () const {
|
const int& CProjection::getWidth () const {
|
||||||
return this->m_width;
|
return this->m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t& CProjection::getHeight () const {
|
const int& CProjection::getHeight () const {
|
||||||
return this->m_height;
|
return this->m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,11 +18,11 @@ bool CProjection::isAuto () const {
|
|||||||
return this->m_isAuto;
|
return this->m_isAuto;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProjection::setWidth (uint32_t width) {
|
void CProjection::setWidth (int width) {
|
||||||
this->m_width = width;
|
this->m_width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProjection::setHeight (uint32_t height) {
|
void CProjection::setHeight (int height) {
|
||||||
this->m_height = height;
|
this->m_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,20 +9,20 @@ class CProjection {
|
|||||||
public:
|
public:
|
||||||
static CProjection* fromJSON (json data);
|
static CProjection* fromJSON (json data);
|
||||||
|
|
||||||
const uint32_t& getWidth () const;
|
[[nodiscard]] const int& getWidth () const;
|
||||||
const uint32_t& getHeight () const;
|
[[nodiscard]] const int& getHeight () const;
|
||||||
bool isAuto () const;
|
[[nodiscard]] bool isAuto () const;
|
||||||
|
|
||||||
void setWidth (uint32_t width);
|
void setWidth (int width);
|
||||||
void setHeight (uint32_t height);
|
void setHeight (int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CProjection (uint32_t width, uint32_t height);
|
CProjection (int width, int height);
|
||||||
explicit CProjection (bool isAuto);
|
explicit CProjection (bool isAuto);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_width;
|
int m_width;
|
||||||
uint32_t m_height;
|
int m_height;
|
||||||
bool m_isAuto;
|
bool m_isAuto;
|
||||||
};
|
};
|
||||||
} // namespace WallpaperEngine::Core::Scenes
|
} // namespace WallpaperEngine::Core::Scenes
|
||||||
|
@ -123,12 +123,12 @@ class CWallpaper : public Helpers::CContextAware {
|
|||||||
/**
|
/**
|
||||||
* @return The width of this wallpaper
|
* @return The width of this wallpaper
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint32_t getWidth () const = 0;
|
[[nodiscard]] virtual int getWidth () const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The height of this wallpaper
|
* @return The height of this wallpaper
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual uint32_t getHeight () const = 0;
|
[[nodiscard]] virtual int getHeight () const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of CWallpaper based on the information provided by the read backgrounds
|
* Creates a new instance of CWallpaper based on the information provided by the read backgrounds
|
||||||
|
@ -61,8 +61,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
|||||||
|
|
||||||
const int viewportWidth = this->getViewportWidth ();
|
const int viewportWidth = this->getViewportWidth ();
|
||||||
const int viewportHeight = this->getViewportHeight ();
|
const int viewportHeight = this->getViewportHeight ();
|
||||||
uint32_t projectionWidth = this->getProjectionWidth ();
|
int projectionWidth = this->getProjectionWidth ();
|
||||||
uint32_t projectionHeight = this->getProjectionHeight ();
|
int projectionHeight = this->getProjectionHeight ();
|
||||||
|
|
||||||
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
||||||
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
||||||
@ -82,8 +82,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
|||||||
|
|
||||||
const int viewportWidth = this->getViewportWidth ();
|
const int viewportWidth = this->getViewportWidth ();
|
||||||
const int viewportHeight = this->getViewportHeight ();
|
const int viewportHeight = this->getViewportHeight ();
|
||||||
uint32_t projectionWidth = this->getProjectionWidth ();
|
int projectionWidth = this->getProjectionWidth ();
|
||||||
uint32_t projectionHeight = this->getProjectionHeight ();
|
int projectionHeight = this->getProjectionHeight ();
|
||||||
|
|
||||||
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
||||||
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
||||||
@ -103,8 +103,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
|||||||
|
|
||||||
const int viewportWidth = this->getViewportWidth ();
|
const int viewportWidth = this->getViewportWidth ();
|
||||||
const int viewportHeight = this->getViewportHeight ();
|
const int viewportHeight = this->getViewportHeight ();
|
||||||
const uint32_t projectionWidth = this->getProjectionWidth ();
|
const int projectionWidth = this->getProjectionWidth ();
|
||||||
const uint32_t projectionHeight = this->getProjectionHeight ();
|
const int projectionHeight = this->getProjectionHeight ();
|
||||||
|
|
||||||
if ((viewportHeight > viewportWidth && projectionWidth >= projectionHeight) ||
|
if ((viewportHeight > viewportWidth && projectionWidth >= projectionHeight) ||
|
||||||
(viewportWidth > viewportHeight && projectionHeight > projectionWidth)) {
|
(viewportWidth > viewportHeight && projectionHeight > projectionWidth)) {
|
||||||
|
@ -70,12 +70,12 @@ class CWallpaperState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @return The width of viewport
|
// @return The width of viewport
|
||||||
uint32_t getProjectionWidth () const {
|
int getProjectionWidth () const {
|
||||||
return projection.width;
|
return projection.width;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @return The height of viewport
|
// @return The height of viewport
|
||||||
uint32_t getProjectionHeight () const {
|
int getProjectionHeight () const {
|
||||||
return projection.height;
|
return projection.height;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ class CWallpaperState {
|
|||||||
|
|
||||||
// Wallpaper dimensions
|
// Wallpaper dimensions
|
||||||
struct {
|
struct {
|
||||||
uint32_t width;
|
int width;
|
||||||
uint32_t height;
|
int height;
|
||||||
} projection {};
|
} projection {};
|
||||||
|
|
||||||
// Are Vs coordinates fliped
|
// Are Vs coordinates fliped
|
||||||
|
@ -203,7 +203,8 @@ void CWaylandOpenGLDriver::onLayerClose (Output::CWaylandOutputViewport* viewpor
|
|||||||
wl_surface_destroy (viewport->surface);
|
wl_surface_destroy (viewport->surface);
|
||||||
|
|
||||||
// remove the output from the list
|
// remove the output from the list
|
||||||
std::remove (this->m_screens.begin (), this->m_screens.end (), viewport);
|
this->m_screens.erase (std::remove (this->m_screens.begin (), this->m_screens.end (), viewport),
|
||||||
|
this->m_screens.end ());
|
||||||
|
|
||||||
// reset the viewports
|
// reset the viewports
|
||||||
this->getOutput ().reset ();
|
this->getOutput ().reset ();
|
||||||
|
@ -74,7 +74,7 @@ bool CX11FullScreenDetector::anythingFullscreen () const {
|
|||||||
XFree (children);
|
XFree (children);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nchildren; i++) {
|
for (unsigned int i = 0; i < nchildren; i++) {
|
||||||
if (!XGetWindowAttributes (this->m_display, children [i], &attribs))
|
if (!XGetWindowAttributes (this->m_display, children [i], &attribs))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ void CImage::render () {
|
|||||||
#if !NDEBUG
|
#if !NDEBUG
|
||||||
std::string str = "Rendering ";
|
std::string str = "Rendering ";
|
||||||
|
|
||||||
if (this->getScene ()->getScene ()->isBloom () && this->getId () == 0xFFFFFFFF)
|
if (this->getScene ()->getScene ()->isBloom () && this->getId () == -1)
|
||||||
str += "bloom";
|
str += "bloom";
|
||||||
else {
|
else {
|
||||||
str += this->getImage ()->getName () + " (" + std::to_string (this->getId ()) + ", " +
|
str += this->getImage ()->getName () + " (" + std::to_string (this->getId ()) + ", " +
|
||||||
|
@ -12,7 +12,7 @@ CSound::CSound (CScene* scene, Core::Objects::CSound* sound) : CObject (scene, T
|
|||||||
void CSound::load () {
|
void CSound::load () {
|
||||||
for (const auto& cur : this->m_sound->getSounds ()) {
|
for (const auto& cur : this->m_sound->getSounds ()) {
|
||||||
uint32_t filesize = 0;
|
uint32_t filesize = 0;
|
||||||
const void* filebuffer = this->getContainer ()->readFile (cur, &filesize);
|
const uint8_t* filebuffer = this->getContainer ()->readFile (cur, &filesize);
|
||||||
|
|
||||||
auto stream = new Audio::CAudioStream (this->getScene ()->getAudioContext (), filebuffer, filesize);
|
auto stream = new Audio::CAudioStream (this->getScene ()->getAudioContext (), filebuffer, filesize);
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ void Compiler::parseParameterConfiguration (const std::string& type, const std::
|
|||||||
// extract the texture number from the name
|
// extract the texture number from the name
|
||||||
const char value = name.at (std::string ("g_Texture").length ());
|
const char value = name.at (std::string ("g_Texture").length ());
|
||||||
// now convert it to integer
|
// now convert it to integer
|
||||||
int index = value - '0';
|
size_t index = value - '0';
|
||||||
|
|
||||||
if (combo != data.end ()) {
|
if (combo != data.end ()) {
|
||||||
// if the texture exists (and is not null), add to the combo
|
// if the texture exists (and is not null), add to the combo
|
||||||
|
@ -96,8 +96,7 @@ CScene::CScene (Core::CScene* scene, CRenderContext& context, CAudioContext& aud
|
|||||||
"\t\"origin\": \"" +
|
"\t\"origin\": \"" +
|
||||||
std::to_string (sceneWidth / 2) + " " + std::to_string (sceneHeight / 2) +
|
std::to_string (sceneWidth / 2) + " " + std::to_string (sceneHeight / 2) +
|
||||||
" 0.0\","
|
" 0.0\","
|
||||||
"\t\"id\": " +
|
"\t\"id\": -1" +
|
||||||
std::to_string (0xFFFFFFFF) +
|
|
||||||
","
|
","
|
||||||
"\t\"effects\":"
|
"\t\"effects\":"
|
||||||
"\t["
|
"\t["
|
||||||
@ -246,11 +245,11 @@ Core::CScene* CScene::getScene () const {
|
|||||||
return this->getWallpaperData ()->as<Core::CScene> ();
|
return this->getWallpaperData ()->as<Core::CScene> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CScene::getWidth () const {
|
int CScene::getWidth () const {
|
||||||
return this->getScene ()->getOrthogonalProjection ()->getWidth ();
|
return this->getScene ()->getOrthogonalProjection ()->getWidth ();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CScene::getHeight () const {
|
int CScene::getHeight () const {
|
||||||
return this->getScene ()->getOrthogonalProjection ()->getHeight ();
|
return this->getScene ()->getOrthogonalProjection ()->getHeight ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ class CScene final : public CWallpaper {
|
|||||||
|
|
||||||
Core::CScene* getScene () const;
|
Core::CScene* getScene () const;
|
||||||
|
|
||||||
uint32_t getWidth () const override;
|
int getWidth () const override;
|
||||||
uint32_t getHeight () const override;
|
int getHeight () const override;
|
||||||
|
|
||||||
glm::vec2* getMousePosition ();
|
glm::vec2* getMousePosition ();
|
||||||
glm::vec2* getMousePositionLast ();
|
glm::vec2* getMousePositionLast ();
|
||||||
|
@ -67,7 +67,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& aud
|
|||||||
this->setupFramebuffers ();
|
this->setupFramebuffers ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideo::setSize (int64_t width, int64_t height) {
|
void CVideo::setSize (int width, int height) {
|
||||||
this->m_width = width > 0 ? width : this->m_width;
|
this->m_width = width > 0 ? width : this->m_width;
|
||||||
this->m_height = height > 0 ? height : this->m_height;
|
this->m_height = height > 0 ? height : this->m_height;
|
||||||
|
|
||||||
@ -117,11 +117,11 @@ Core::CVideo* CVideo::getVideo () {
|
|||||||
return this->getWallpaperData ()->as<Core::CVideo> ();
|
return this->getWallpaperData ()->as<Core::CVideo> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CVideo::getWidth () const {
|
int CVideo::getWidth () const {
|
||||||
return this->m_width;
|
return this->m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CVideo::getHeight () const {
|
int CVideo::getHeight () const {
|
||||||
return this->m_height;
|
return this->m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ class CVideo final : public CWallpaper {
|
|||||||
|
|
||||||
Core::CVideo* getVideo ();
|
Core::CVideo* getVideo ();
|
||||||
|
|
||||||
uint32_t getWidth () const override;
|
[[nodiscard]] int getWidth () const override;
|
||||||
uint32_t getHeight () const override;
|
[[nodiscard]] int getHeight () const override;
|
||||||
|
|
||||||
void setSize (int64_t width, int64_t height);
|
void setSize (int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void renderFrame (glm::ivec4 viewport) override;
|
void renderFrame (glm::ivec4 viewport) override;
|
||||||
|
@ -36,7 +36,7 @@ CWeb::CWeb (Core::CWeb* web, CRenderContext& context, CAudioContext& audioContex
|
|||||||
CefBrowserHost::CreateBrowserSync (window_info, m_client.get (), htmlURL, browserSettings, nullptr, nullptr);
|
CefBrowserHost::CreateBrowserSync (window_info, m_client.get (), htmlURL, browserSettings, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeb::setSize (int64_t width, int64_t height) {
|
void CWeb::setSize (int width, int height) {
|
||||||
this->m_width = width > 0 ? width : this->m_width;
|
this->m_width = width > 0 ? width : this->m_width;
|
||||||
this->m_height = height > 0 ? height : this->m_height;
|
this->m_height = height > 0 ? height : this->m_height;
|
||||||
|
|
||||||
@ -96,8 +96,6 @@ CWeb::~CWeb () {
|
|||||||
|
|
||||||
CWeb::RenderHandler::RenderHandler (CWeb* webdata) : m_webdata (webdata) {}
|
CWeb::RenderHandler::RenderHandler (CWeb* webdata) : m_webdata (webdata) {}
|
||||||
|
|
||||||
CWeb::RenderHandler::~RenderHandler () {}
|
|
||||||
|
|
||||||
// Required by CEF
|
// Required by CEF
|
||||||
void CWeb::RenderHandler::GetViewRect (CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
void CWeb::RenderHandler::GetViewRect (CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||||
rect = CefRect (0, 0, this->m_webdata->getWidth (), this->m_webdata->getHeight ());
|
rect = CefRect (0, 0, this->m_webdata->getWidth (), this->m_webdata->getHeight ());
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <glm/ext.hpp>
|
#include <glm/ext.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -20,12 +21,12 @@ namespace WallpaperEngine::Render
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CWeb (Core::CWeb* scene, CRenderContext& context, CAudioContext& audioContext, WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext, const CWallpaperState::TextureUVsScaling& scalingMode);
|
CWeb (Core::CWeb* scene, CRenderContext& context, CAudioContext& audioContext, WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext, const CWallpaperState::TextureUVsScaling& scalingMode);
|
||||||
~CWeb();
|
~CWeb() override;
|
||||||
uint32_t getWidth () const override { return this->m_width; }
|
[[nodiscard]] int getWidth () const override { return this->m_width; }
|
||||||
|
|
||||||
uint32_t getHeight () const override { return this->m_height; }
|
[[nodiscard]] int getHeight () const override { return this->m_height; }
|
||||||
|
|
||||||
void setSize (int64_t width, int64_t height);
|
void setSize (int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void renderFrame (glm::ivec4 viewport) override;
|
void renderFrame (glm::ivec4 viewport) override;
|
||||||
@ -46,14 +47,10 @@ namespace WallpaperEngine::Render
|
|||||||
class RenderHandler: public CefRenderHandler
|
class RenderHandler: public CefRenderHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RenderHandler(CWeb* webdata);
|
explicit RenderHandler(CWeb* webdata);
|
||||||
|
|
||||||
//! \brief
|
//! \brief
|
||||||
~RenderHandler();
|
~RenderHandler() override = default;
|
||||||
|
|
||||||
//! \brief Compile OpenGL shaders and create OpenGL objects (VAO,
|
|
||||||
//! VBO, texture, locations ...)
|
|
||||||
bool init();
|
|
||||||
|
|
||||||
//! \brief CefRenderHandler interface
|
//! \brief CefRenderHandler interface
|
||||||
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) override;
|
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) override;
|
||||||
@ -70,10 +67,10 @@ namespace WallpaperEngine::Render
|
|||||||
private:
|
private:
|
||||||
CWeb* m_webdata;
|
CWeb* m_webdata;
|
||||||
|
|
||||||
uint32_t getWidth () const {
|
int getWidth () const {
|
||||||
return this->m_webdata->getWidth();
|
return this->m_webdata->getWidth();
|
||||||
};
|
};
|
||||||
uint32_t getHeight () const {
|
int getHeight () const {
|
||||||
return this->m_webdata->getHeight();
|
return this->m_webdata->getHeight();
|
||||||
};
|
};
|
||||||
//! \brief Return the OpenGL texture handle
|
//! \brief Return the OpenGL texture handle
|
||||||
@ -90,8 +87,8 @@ namespace WallpaperEngine::Render
|
|||||||
class BrowserClient: public CefClient
|
class BrowserClient: public CefClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BrowserClient(CefRefPtr<CefRenderHandler> ptr)
|
explicit BrowserClient(CefRefPtr<CefRenderHandler> ptr)
|
||||||
: m_renderHandler(ptr)
|
: m_renderHandler(std::move(ptr))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CefRefPtr<CefRenderHandler> GetRenderHandler() override
|
CefRefPtr<CefRenderHandler> GetRenderHandler() override
|
||||||
@ -109,8 +106,8 @@ namespace WallpaperEngine::Render
|
|||||||
CefRefPtr<BrowserClient> m_client;
|
CefRefPtr<BrowserClient> m_client;
|
||||||
RenderHandler* m_render_handler = nullptr;
|
RenderHandler* m_render_handler = nullptr;
|
||||||
|
|
||||||
int64_t m_width;
|
int m_width;
|
||||||
int64_t m_height;
|
int m_height;
|
||||||
|
|
||||||
glm::vec2 m_mousePosition;
|
glm::vec2 m_mousePosition;
|
||||||
glm::vec2 m_mousePositionLast;
|
glm::vec2 m_mousePositionLast;
|
||||||
|
Loading…
Reference in New Issue
Block a user