Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment shaderz #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License (MIT)

Copyright (c) 2024 Scott Moreau
Copyright (c) 2024 Ilia Bozhinov
Copyright (c) 2024 Andrew Pliatsikas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
146 changes: 141 additions & 5 deletions metadata/pixdecor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
<default>5</default>
<min>0</min>
</option>
<option name="titlebar" type="bool">
<_short>Titlebar</_short>
<_long>Whether or not to render titlebar with title text and buttons.</_long>
<default>true</default>
</option>
<option name="maximized_borders" type="bool">
<_short>Draw borders on maximized windows</_short>
<_long>Whether or not to render side and bottom decorations on maximized windows.</_long>
<default>false</default>
</option>
<option name="maximized_shadows" type="bool">
<_short>Draw shadows on maximized windows</_short>
<_long>Whether or not to allocate space for shadows on maximized windows.</_long>
<default>false</default>
</option>
<option name="ignore_views" type="string">
<_short>Decoration disabled for specified window types</_short>
<_long>Disables window decoration for windows matching the specified criteria.</_long>
Expand Down Expand Up @@ -40,6 +55,23 @@
<_long>Color of the window titlebar text when it does not have focus.</_long>
<default>0.7 0.7 0.7 1.0</default>
</option>
<option name="overlay_engine" type="string">
<_short>Overlay Engine</_short>
<_long>Sets the overlay engine.</_long>
<default>none</default>
<desc>
<value>none</value>
<_name>None</_name>
</desc>
<desc>
<value>rounded_corners</value>
<_name>Rounded Corners</_name>
</desc>
<desc>
<value>beveled_glass</value>
<_name>Beveled Glass</_name>
</desc>
</option>
<option name="effect_type" type="string">
<_short>Effect Type</_short>
<_long>Sets the effect type.</_long>
Expand All @@ -56,18 +88,122 @@
<value>ink</value>
<_name>Ink</_name>
</desc>
<desc>
<value>fumes</value>
<_name>Fumes</_name>
</desc>
<desc>
<value>fast_smoke</value>
<_name>Fast Smoke</_name>
</desc>

<desc>
<value>clouds</value>
<_name>Clouds</_name>
</desc>
<desc>
<value>halftone</value>
<_name>Halftone</_name>
</desc>
<desc>
<value>pattern</value>
<_name>Pattern</_name>
</desc>
<desc>
<value>lava</value>
<_name>Lava</_name>
</desc>
<desc>
<value>hex</value>
<_name>Hex</_name>
</desc>
<desc>
<value>zebra</value>
<_name>Zebra</_name>
</desc>
<desc>
<value>neural_network</value>
<_name>Neural network</_name>
</desc>
<desc>
<value>hexagon_maze</value>
<_name>Hexagon maze</_name>
</desc>
<desc>
<value>raymarched_truchet</value>
<_name>Raymarched truchet</_name>
</desc>
<desc>
<value>neon_pattern</value>
<_name>Neon pattern</_name>
</desc>
<desc>
<value>neon_rings</value>
<_name>Neon rings</_name>
</desc>
<desc>
<value>deco</value>
<_name>Deco</_name>
</desc>
<desc>
<value>ice</value>
<_name>Ice</_name>
</desc>
<desc>
<value>fire</value>
<_name>Fire</_name>
</desc>
<desc>
<value>flame</value>
<_name>Flame</_name>
</desc>
</option>
<option name="compute_fragment_shader" type="string">
<_short>Shader Type</_short>
<_long>Sets the shader type.</_long>
<default>fragment_shader</default>
<desc>
<value>fragment_shader</value>
<_name>Fragment Shader</_name>
</desc>
<desc>
<value>compute_shader</value>
<_name>Compute Shader</_name>
</desc>
</option>
<option name="effect_color" type="color">
<_short>Effect Color</_short>
<_long>Color of the titlebar background effect.</_long>
<default>0.88 0.11 0.14 1.0</default>
</option>
<option name="effect_diffuse_iterations" type="int">
<_short>Effect Diffuse</_short>
<_long>How many iterations to use for diffusing the effect. Less iterations mean less shader dispatch invocations.</_long>
<option name="animate" type="bool">
<_short>Animate Effects</_short>
<_long>WARNING: Enabling this option can use lots of system resources. Enables animating and constant repainting of window decorations.</_long>
<default>false</default>
</option>
<option name="rounded_corner_radius" type="int">
<_short>Rounded Corner Radius</_short>
<_long>The radius for corners.</_long>
<default>5</default>
<min>1</min>
<max>5</max>
<min>0</min>
</option>
<option name="shadow_radius" type="int">
<_short>Shadow Radius</_short>
<_long>The radius for shadows.</_long>
<default>10</default>
<min>0</min>
</option>
<option name="shadow_color" type="color">
<_short>Shadow Color</_short>
<_long>Color of the drop shadows.</_long>
<default>0.0 0.0 0.0 0.25</default>
</option>
<option name="beveled_radius" type="int">
<_short>Beveled Radius</_short>
<_long>The radius of beveled effect.</_long>
<default>4</default>
<min>0</min>
<max>10</max>
</option>
</plugin>
</wayfire>
18 changes: 10 additions & 8 deletions src/deco-button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace wf
{
namespace decor
namespace pixdecor
{
button_t::button_t(const decoration_theme_t& t, std::function<void()> damage) :
theme(t), damage_callback(damage)
Expand Down Expand Up @@ -64,14 +64,17 @@ void button_t::set_pressed(bool is_pressed)
add_idle_damage();
}

void button_t::render(const wf::render_target_t& fb, wf::geometry_t geometry,
wf::geometry_t scissor)
void button_t::render(const wf::render_target_t& fb, wf::geometry_t geometry, const wf::region_t& scissor)
{
OpenGL::render_begin(fb);
fb.logic_scissor(scissor);
OpenGL::render_texture(button_texture.tex, fb, geometry, {1, 1, 1, this->hover},
OpenGL::TEXTURE_TRANSFORM_INVERT_Y);
OpenGL::render_end();
OpenGL::TEXTURE_TRANSFORM_INVERT_Y | OpenGL::RENDER_FLAG_CACHED);
for (auto& box : scissor)
{
fb.logic_scissor(wlr_box_from_pixman_box(box));
OpenGL::draw_cached();
}

OpenGL::clear_cached();

if (this->hover.running())
{
Expand Down Expand Up @@ -102,7 +105,6 @@ void button_t::add_idle_damage()
this->idle_damage.run_once([=] ()
{
this->damage_callback();
update_texture();
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/deco-button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace wf
{
namespace decor
namespace pixdecor
{
class decoration_theme_t;

Expand Down Expand Up @@ -66,7 +66,7 @@ class button_t
* @param scissor The scissor rectangle to render.
*/
void render(const wf::render_target_t& fb, wf::geometry_t geometry,
wf::geometry_t scissor);
const wf::region_t& scissor);

private:
const decoration_theme_t& theme;
Expand Down
Loading