mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 23:19:06 +00:00
Merge pull request #1 from ad044/glsl-float32-time-animation
Using time reference value to fit in 32bit float.
This commit is contained in:
commit
30bf8ac954
1 changed files with 4 additions and 2 deletions
|
@ -73,14 +73,16 @@ const LevelSprite = (props: LevelSpriteConstructorProps) => {
|
||||||
void main() {
|
void main() {
|
||||||
vec4 t1 = texture2D(tex1,vUv);
|
vec4 t1 = texture2D(tex1,vUv);
|
||||||
vec4 t2 = texture2D(tex2,vUv);
|
vec4 t2 = texture2D(tex2,vUv);
|
||||||
float bias = abs(sin(timeMSeconds));
|
float bias = abs(sin(timeMSeconds / (1600.0 / M_PI)));
|
||||||
gl_FragColor = mix(t1, t2, bias);
|
gl_FragColor = mix(t1, t2, bias);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const timeRef = Date.now();
|
||||||
|
|
||||||
useFrame(() => {
|
useFrame(() => {
|
||||||
if (materialRef.current) {
|
if (materialRef.current) {
|
||||||
(materialRef.current! as any).uniforms.timeMSeconds.value = 1.5;
|
(materialRef.current! as any).uniforms.timeMSeconds.value = Date.now() - timeRef;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue