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

feat(ColorSetting): chroma effect options #4800

Draft
wants to merge 6 commits into
base: nextgen
Choose a base branch
from
Draft

Conversation

ccetl
Copy link
Contributor

@ccetl ccetl commented Dec 4, 2024

Adds a cyclic rainbow mode and a pulse mode to color settings.
TODOs (mainly about the GUI):

  • Complete the ClickGUI options implementation
  • Adjust the default values
  • Display the temporary color in the ClickGUI (calculate the current color it the ClickGUI)
  • Fix the ClickGUI only sending changes on color change but not on mode / speed change
  • Fix the ClickGUI being stuck for whatever reason when i create an HTMLElement


override fun update(value: ColorValue, time: Long) {
val frequency = getFrequency(value)
val oscillation = abs((time % (frequency * 2)) - frequency) / frequency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add easing. I think something like sine or quadratic easing should look good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did choose modulo for performance

Copy link
Contributor

@superblaubeere27 superblaubeere27 Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what performance? Calculating a sine takes 40 ns.

If you do something computationally expensive, there is no problem if you do it like 10 times per frame.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

40ns sounds a bit low unless you have a fast CPU. The JVM can barely optimize this function as it has a new time value each time. Considering it could run on different modules multiple time per frame i think this should be considered (mainly because i had issues with the speed when i implemented that before).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One cache miss is as expensive as calculating a sin. If that function runs more than 10 times per frame something is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to calculate it for each setting that has it enabled as we can change the speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants