Add getUserTimeModulo() to materials
This calculates the modulo of the user time by a given value, using the high precision user time. This is useful for animations without having to worry about resetting the time.
This commit is contained in:
committed by
Mathias Agopian
parent
1dfc7fd5ae
commit
cd00c4bbe8
@@ -1331,6 +1331,7 @@ type aliases:
|
||||
**getWorldCameraPosition()** | float3 | Position of the camera/eye in world space
|
||||
**getTime()** | float | Current time in seconds, may be reset regularly to avoid precision loss
|
||||
**getUserTime()** | float4 | Current time in seconds: `time`, `(double)time - time`, `0`, `0`
|
||||
**getUserTimeMode(float m)** | float | Current time modulo m in seconds
|
||||
**getExposure()** | float | Photometric exposure of the camera
|
||||
**getEV100()** | float | [Exposure value at ISO 100](https://en.wikipedia.org/wiki/Exposure_value) of the camera
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ HIGHP vec4 getUserTime() {
|
||||
return frameUniforms.userTime;
|
||||
}
|
||||
|
||||
HIGHP float getUserTimeMod(float m) {
|
||||
return mod(mod(frameUniforms.userTime.x, m) + mod(frameUniforms.userTime.y, m), m);
|
||||
}
|
||||
|
||||
/** @public-api */
|
||||
float getExposure() {
|
||||
return frameUniforms.exposure;
|
||||
|
||||
Reference in New Issue
Block a user