8000 Time transforms fix, and global default by ggcrunchy · Pull Request #511 · coronalabs/corona · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Time transforms fix, and global default #511

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

Merged
merged 4 commits into from
Feb 7, 2023

Conversation

ggcrunchy
Copy link
Contributor

The uniform that is modified by time transforms could get stuck, so that using one time-dependent shader could stop the update of another. See the example here: test time transform fix.zip


A global default time transform is now available, which will be used by a time-dependent shader if none is specified explicitly. The default will ping-pong after X number of seconds, which is linear (versus sine) and not abrupt (like modulo).

Per GL ES, without high-precision fragment shaders, i.e. with 1/1024th precision, we can still approximate 30 fps up to the [32, 64) seconds interval: (64 - 32) / 1024 = .03125. Multiplying this by 65536 (highp) gives us 2048, so the [2048, 4096) interval there. The appropriate upper bound is chosen as the ping-pong range. (Maybe this needs tuning for 60+ fps?)

At the moment the default is already installed, but if it would be preferable we could begin as "none" (see below).


You can get the current default with system.getDefault("timeTransform") (commented out in the example). This will be a table, if one is provided, or nil otherwise.

It may be replaced using setDefault and the same table arguments to assign shader transforms. (Also in the example.) The two exceptions to this are the strings "default" (restore the built-in default) or "none" (no transform; shader time is unbounded by default).


Most of the code changes are:

  • the logic for getDefault() / setDefault()
  • passing the transforms through the renderers and then the command buffer (and copied to an instance there)
  • a few utility functions for repeated code
  • moving the transforms logic around to reuse for the display defaults

@ggcrunchy ggcrunchy requested a review from Shchvova as a code owner February 4, 2023 06:21
@Shchvova Shchvova merged commit 1305733 into coronalabs:experimental Feb 7, 2023
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
0