Time transforms fix, and global default #511
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, ornil
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:
getDefault()
/setDefault()