mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-16 22:32:25 +08:00
feat: add option to disable camera parallax
This commit is contained in:
parent
fe02b73d43
commit
a21e0cfa61
@ -150,6 +150,7 @@ You can use either:
|
|||||||
| `--list-properties` | Show customizable properties of a wallpaper |
|
| `--list-properties` | Show customizable properties of a wallpaper |
|
||||||
| `--set-property name=value` | Override a specific property |
|
| `--set-property name=value` | Override a specific property |
|
||||||
| `--disable-mouse` | Disable mouse interaction |
|
| `--disable-mouse` | Disable mouse interaction |
|
||||||
|
| `--disable-parallax` | Disable parallax effect on backgrounds that support it |
|
||||||
| `--no-fullscreen-pause` | Prevent pausing while fullscreen apps are running |
|
| `--no-fullscreen-pause` | Prevent pausing while fullscreen apps are running |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -209,6 +209,12 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
|
|||||||
.action ([this](const std::string& value) -> void {
|
.action ([this](const std::string& value) -> void {
|
||||||
this->settings.mouse.enabled = false;
|
this->settings.mouse.enabled = false;
|
||||||
});
|
});
|
||||||
|
configurationGroup.add_argument ("--disable-parallax")
|
||||||
|
.help ("Disables parallax effect for the backgrounds")
|
||||||
|
.flag ()
|
||||||
|
.action ([this](const std::string& value) -> void {
|
||||||
|
this->settings.mouse.disableparallax = true;
|
||||||
|
});
|
||||||
|
|
||||||
configurationGroup.add_argument ("-l", "--list-properties")
|
configurationGroup.add_argument ("-l", "--list-properties")
|
||||||
.help ("List all the available properties and their configuration")
|
.help ("List all the available properties and their configuration")
|
||||||
|
@ -91,6 +91,8 @@ class CApplicationContext {
|
|||||||
struct {
|
struct {
|
||||||
/** If the mouse movement is enabled */
|
/** If the mouse movement is enabled */
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
/** If the mouse parallax should be disabled */
|
||||||
|
bool disableparallax;
|
||||||
} mouse;
|
} mouse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,12 +121,11 @@ class CApplicationContext {
|
|||||||
.mode = NORMAL_WINDOW,
|
.mode = NORMAL_WINDOW,
|
||||||
.maximumFPS = 30,
|
.maximumFPS = 30,
|
||||||
.pauseOnFullscreen = true,
|
.pauseOnFullscreen = true,
|
||||||
.window =
|
.window = {
|
||||||
{
|
.geometry = {},
|
||||||
.geometry = {},
|
.clamp = WallpaperEngine::Assets::ITexture::TextureFlags::ClampUVs,
|
||||||
.clamp = WallpaperEngine::Assets::ITexture::TextureFlags::ClampUVs,
|
.scalingMode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs,
|
||||||
.scalingMode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs,
|
},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
.audio = {
|
.audio = {
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
@ -134,6 +135,7 @@ class CApplicationContext {
|
|||||||
},
|
},
|
||||||
.mouse = {
|
.mouse = {
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
|
.disableparallax = false,
|
||||||
},
|
},
|
||||||
.screenshot = {
|
.screenshot = {
|
||||||
.take = false,
|
.take = false,
|
||||||
|
@ -420,6 +420,11 @@ void CImage::render () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CImage::updateScreenSpacePosition () {
|
void CImage::updateScreenSpacePosition () {
|
||||||
|
// do not perform any changes to the image based on the parallax if it was explicitly disabled
|
||||||
|
if (this->getScene ()->getContext ().getApp ().getContext ().settings.mouse.disableparallax) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const double parallaxAmount = this->getScene ()->getScene ()->getCameraParallaxAmount ();
|
const double parallaxAmount = this->getScene ()->getScene ()->getCameraParallaxAmount ();
|
||||||
const glm::vec2 depth = this->getImage ()->getParallaxDepth ();
|
const glm::vec2 depth = this->getImage ()->getParallaxDepth ();
|
||||||
const glm::vec2* displacement = this->getScene ()->getParallaxDisplacement ();
|
const glm::vec2* displacement = this->getScene ()->getParallaxDisplacement ();
|
||||||
|
@ -207,7 +207,7 @@ void CScene::renderFrame (glm::ivec4 viewport) {
|
|||||||
this->updateMouse (viewport);
|
this->updateMouse (viewport);
|
||||||
|
|
||||||
// update the parallax position if required
|
// update the parallax position if required
|
||||||
if (this->getScene ()->isCameraParallax ()) {
|
if (this->getScene ()->isCameraParallax () && !this->getContext ().getApp ().getContext ().settings.mouse.disableparallax) {
|
||||||
const float influence = this->getScene ()->getCameraParallaxMouseInfluence ();
|
const float influence = this->getScene ()->getCameraParallaxMouseInfluence ();
|
||||||
const float amount = this->getScene ()->getCameraParallaxAmount ();
|
const float amount = this->getScene ()->getCameraParallaxAmount ();
|
||||||
const float delay =
|
const float delay =
|
||||||
|
Loading…
Reference in New Issue
Block a user