🔧 Improve timing of trex attack

This commit is contained in:
Simon Schneegans
2022-01-27 21:34:11 +01:00
parent bc2f39fac8
commit 7b7b5cbb46
+4 -4
View File
@@ -141,8 +141,8 @@ if (utils.isInShellProcess()) {
const float NUM_CLAWS = ${settings.get_int('claw-scratch-count')}; const float NUM_CLAWS = ${settings.get_int('claw-scratch-count')};
const float WARP_INTENSITY = 1.0 + ${settings.get_double('claw-scratch-warp')}; const float WARP_INTENSITY = 1.0 + ${settings.get_double('claw-scratch-warp')};
const float FLASH_INTENSITY = 0.1; const float FLASH_INTENSITY = 0.1;
const float MAX_SPAWN_TIME = 0.5; // Scratches will only start in the first half of the animation. const float MAX_SPAWN_TIME = 0.6; // Scratches will only start in the first half of the animation.
const float FF_TIME = 0.5; // Relative time for the final fade to transparency. const float FF_TIME = 0.6; // Relative time for the final fade to transparency.
// This method generates a grid of randomly rotated, slightly shifted and scaled // This method generates a grid of randomly rotated, slightly shifted and scaled
// UV squares. It returns the texture coords of the UV square at the given actor // UV squares. It returns the texture coords of the UV square at the given actor
@@ -225,8 +225,8 @@ if (utils.isInShellProcess()) {
cogl_color_out.rgb += flashIntensity * mix(flashColor, vec3(0), progress); cogl_color_out.rgb += flashIntensity * mix(flashColor, vec3(0), progress);
// Fade out the remaining shards. // Fade out the remaining shards.
float fade = smoothstep(0, 1, 1 - clamp((progress - 1.0 + FF_TIME)/FF_TIME, 0, 1)); float fadeProgress = smoothstep(0, 1, (progress - 1.0 + FF_TIME)/FF_TIME);
cogl_color_out *= fade; cogl_color_out *= sqrt(1-fadeProgress*fadeProgress);
// These are pretty useful for understanding how this works. // These are pretty useful for understanding how this works.
// cogl_color_out = vec4(vec3(flashIntensity), 1); // cogl_color_out = vec4(vec3(flashIntensity), 1);