mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
fix: visibility wasn't entirely right, move dependant elements up the render chain
This commit is contained in:
parent
9c62125a1f
commit
d6bcd62d1a
@ -234,11 +234,7 @@ void CImage::setup () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: SETUP RECALCULATION OF THINGS WHEN A VISIBILITY VALUE CHANGES!!
|
// TODO: CHECK ORDER OF THINGS, 2419444134'S ID 27 DEPENDS ON 104'S COMPOSITE_A WHEN OUR LAST RENDER IS ON COMPOSITE_B
|
||||||
if (!this->m_image.visible->value->getBool ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: SUPPORT PASSTHROUGH (IT'S A SHADER)
|
// TODO: SUPPORT PASSTHROUGH (IT'S A SHADER)
|
||||||
// passthrough images without effects are bad, do not draw them
|
// passthrough images without effects are bad, do not draw them
|
||||||
if (this->m_image.model->passthrough && this->m_image.effects.empty ()) {
|
if (this->m_image.model->passthrough && this->m_image.effects.empty ()) {
|
||||||
@ -317,9 +313,7 @@ void CImage::setup () {
|
|||||||
new CPass (*this, fboProvider, config, std::nullopt, std::nullopt, (*curEffect)->target.value ())
|
new CPass (*this, fboProvider, config, std::nullopt, std::nullopt, (*curEffect)->target.value ())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
auto curPass = (*curEffect)->material.value ()->passes.begin ();
|
for (auto& pass : (*curEffect)->material.value ()->passes) {
|
||||||
auto endPass = (*curEffect)->material.value ()->passes.end ();
|
|
||||||
|
|
||||||
const auto override =
|
const auto override =
|
||||||
curOverride != endOverride
|
curOverride != endOverride
|
||||||
? **curOverride
|
? **curOverride
|
||||||
@ -329,7 +323,8 @@ void CImage::setup () {
|
|||||||
: std::optional<std::reference_wrapper<std::string>> (std::nullopt);
|
: std::optional<std::reference_wrapper<std::string>> (std::nullopt);
|
||||||
|
|
||||||
this->m_passes.push_back (
|
this->m_passes.push_back (
|
||||||
new CPass (*this, fboProvider, **curPass, override, (*curEffect)->binds, target));
|
new CPass (*this, fboProvider, *pass, override, (*curEffect)->binds, target));
|
||||||
|
}
|
||||||
|
|
||||||
if (curOverride != endOverride) {
|
if (curOverride != endOverride) {
|
||||||
curOverride++;
|
curOverride++;
|
||||||
|
@ -64,14 +64,8 @@ CScene::CScene (
|
|||||||
this->createObject (*object);
|
this->createObject (*object);
|
||||||
|
|
||||||
// copy over objects by render order
|
// copy over objects by render order
|
||||||
for (const auto& cur : scene->objects) {
|
for (const auto& object : scene->objects) {
|
||||||
auto obj = this->m_objects.find (cur->id);
|
this->addObjectToRenderOrder (*object);
|
||||||
|
|
||||||
// ignores not created objects like particle systems
|
|
||||||
if (obj == this->m_objects.end ())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
this->m_objectsByRenderOrder.emplace_back (obj->second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create extra framebuffers for the bloom effect
|
// create extra framebuffers for the bloom effect
|
||||||
@ -203,6 +197,50 @@ Render::CObject* CScene::createObject (const Object& object) {
|
|||||||
return renderObject;
|
return renderObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScene::addObjectToRenderOrder (const Object& object) {
|
||||||
|
auto obj = this->m_objects.find (object.id);
|
||||||
|
|
||||||
|
// ignores not created objects like particle systems
|
||||||
|
if (obj == this->m_objects.end ())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// take into account any dependency first
|
||||||
|
for (const auto& dep : object.dependencies) {
|
||||||
|
// self-dependency is possible
|
||||||
|
if (dep == object.id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the dependency to the list if it's created
|
||||||
|
auto depIt = std::find_if (
|
||||||
|
this->getScene ().objects.begin (),
|
||||||
|
this->getScene ().objects.end (),
|
||||||
|
[&dep] (const auto& o) {
|
||||||
|
return o->id == dep;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (depIt != this->getScene ().objects.end ()) {
|
||||||
|
this->addObjectToRenderOrder (**depIt);
|
||||||
|
} else {
|
||||||
|
sLog.error ("Cannot find dependency ", dep, " for object ", object.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure we're added only once to the render list
|
||||||
|
const auto renderIt = std::find_if (
|
||||||
|
this->m_objectsByRenderOrder.begin (),
|
||||||
|
this->m_objectsByRenderOrder.end (),
|
||||||
|
[&object] (const auto& o) {
|
||||||
|
return o->getId () == object.id;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (renderIt == this->m_objectsByRenderOrder.end ()) {
|
||||||
|
this->m_objectsByRenderOrder.emplace_back (obj->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CCamera& CScene::getCamera () const {
|
CCamera& CScene::getCamera () const {
|
||||||
return *this->m_camera;
|
return *this->m_camera;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ class CScene final : public CWallpaper {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Render::CObject* createObject (const Object& object);
|
Render::CObject* createObject (const Object& object);
|
||||||
|
void addObjectToRenderOrder (const Object& object);
|
||||||
|
|
||||||
std::unique_ptr<CCamera> m_camera;
|
std::unique_ptr<CCamera> m_camera;
|
||||||
ObjectUniquePtr m_bloomObjectData;
|
ObjectUniquePtr m_bloomObjectData;
|
||||||
|
Loading…
Reference in New Issue
Block a user