-
Notifications
You must be signed in to change notification settings - Fork 179
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
animate: Add helix animation #2417
base: master
Are you sure you want to change the base?
Conversation
This will help avoid conflicts of the same variable name in scope.
This doesn't change anything visually here, but it's more correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The effect works quite well but I think it uses lots of CPU and I also think we can make it work almost entirely on the GPU .. let me know what you think about that.
push_to_parent(ev->region); | ||
}; | ||
|
||
wayfire_view view; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as I see this variable is not used anywhere.
public: | ||
using duration_t::duration_t; | ||
}; | ||
class helix_transformer : public wf::scene::view_2d_transformer_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for deriving from view_2d_transformer_t
instead of transformer_base_node_t
directly?
damage |= wf::region_t{self->animation_geometry}; | ||
} | ||
|
||
void render(const wf::render_target_t& target, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this, I have an idea on how to make this less CPU-intensive, because I am getting 50%+ cpu usage even on 1080p (the effect will be much more pronounced on 4k displays since the algorithm is linear in height):
Compute a vertex buffer with strips spanning a simple [0,1]x[0,1] rectangle (the rectangle can be easily scaled to match the view size with a matrix multiplication in the vertex shader).
Based on the actual view height at runtime, we select how many strips to render.
Rotation is also doable in the vertex shader - for example by using something like floor(gl_VertexID / 6.0
you can get the strip index, and from the strip index you can calculate the rotation for the strip.
Does that sound about right? Maybe I misunderstand the implementation, but feels like the computation-intensive part of this effect can thus be offloaded completely to the GPU.
My initial thought is that it would be a lot of work for relatively little payoff.
Maybe, but I'll leave you to experiment with this idea. |
You previously mentioned that helix takes about 50% cpu in your tests. I did my own tests, of each animation, running wayfire with nothing more than what is required to do the tests. Here are the results:
It seems fire is the worst, at 40%, followed by shatter at 38% and blinds at 22%. Helix is nearly on par with the built-in transformer animations at 15%. Please let me know what you think in light of this. |
Add helix animation.