diff options
| author | yum <yum.food.vr@gmail.com> | 2025-03-28 17:25:36 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-03-28 17:25:36 -0700 |
| commit | 1e351cecd990cc25f2d3af76c52a613ad539c299 (patch) | |
| tree | fe5aabd95dbb13685cf3e65a4c441b6c6dac5e9d /shatter_wave.cginc | |
| parent | 2c9e02770250a3f3e781a2fb22357e0a910a2436 (diff) | |
Add time controls to shatterwave chronotensity feature
Diffstat (limited to 'shatter_wave.cginc')
| -rw-r--r-- | shatter_wave.cginc | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/shatter_wave.cginc b/shatter_wave.cginc index aae45ef..8975908 100644 --- a/shatter_wave.cginc +++ b/shatter_wave.cginc @@ -21,51 +21,31 @@ void shatterWaveVert(inout float3 objPos, float3 objNormal, float3 objTangent) { objPos_proj[2] = dot(objPos, wave_axis2) * normalize(wave_axis2);
objPos_proj[3] = dot(objPos, wave_axis3) * normalize(wave_axis3);
- float4 wave_t = _Time[0] * _Shatter_Wave_Speed;
#if defined(_SHATTER_WAVE_AUDIOLINK)
+ float4 wave_t;
+ [branch]
if (AudioLinkIsAvailable()) {
const uint chrono_time_scale_i = 1000 * 1000;
const float chrono_time_scale_f = 1000 * 1000;
// For some fucking reason the compiler shits itself if this is a loop.
+ float4 chrono_t = 0;
+ [unroll]
+ for (uint band = 0; band < 4; ++band)
{
- uint band = 0;
- uint chrono_raw = AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, band));
- float chrono_normalized = (chrono_raw % chrono_time_scale_i) / chrono_time_scale_f;
- wave_t.x = _Shatter_Wave_Chronotensity_Weights0[band] * chrono_normalized;
- wave_t.y = _Shatter_Wave_Chronotensity_Weights1[band] * chrono_normalized;
- wave_t.z = _Shatter_Wave_Chronotensity_Weights2[band] * chrono_normalized;
- wave_t.w = _Shatter_Wave_Chronotensity_Weights3[band] * chrono_normalized;
- }
- {
- uint band = 1;
- uint chrono_raw = AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, band));
- float chrono_normalized = (chrono_raw % chrono_time_scale_i) / chrono_time_scale_f;
- wave_t.x += _Shatter_Wave_Chronotensity_Weights0[band] * chrono_normalized;
- wave_t.y += _Shatter_Wave_Chronotensity_Weights1[band] * chrono_normalized;
- wave_t.z += _Shatter_Wave_Chronotensity_Weights2[band] * chrono_normalized;
- wave_t.w += _Shatter_Wave_Chronotensity_Weights3[band] * chrono_normalized;
- }
- {
- uint band = 2;
- uint chrono_raw = AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, band));
+ uint chrono_raw = AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(6, band));
float chrono_normalized = (chrono_raw % chrono_time_scale_i) / chrono_time_scale_f;
- wave_t.x += _Shatter_Wave_Chronotensity_Weights0[band] * chrono_normalized;
- wave_t.y += _Shatter_Wave_Chronotensity_Weights1[band] * chrono_normalized;
- wave_t.z += _Shatter_Wave_Chronotensity_Weights2[band] * chrono_normalized;
- wave_t.w += _Shatter_Wave_Chronotensity_Weights3[band] * chrono_normalized;
- }
- {
- uint band = 3;
- uint chrono_raw = AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, band));
- float chrono_normalized = (chrono_raw % chrono_time_scale_i) / chrono_time_scale_f;
- wave_t.x += _Shatter_Wave_Chronotensity_Weights0[band] * chrono_normalized;
- wave_t.y += _Shatter_Wave_Chronotensity_Weights1[band] * chrono_normalized;
- wave_t.z += _Shatter_Wave_Chronotensity_Weights2[band] * chrono_normalized;
- wave_t.w += _Shatter_Wave_Chronotensity_Weights3[band] * chrono_normalized;
+ chrono_t.x += _Shatter_Wave_Chronotensity_Weights0[band] * chrono_normalized;
+ chrono_t.y += _Shatter_Wave_Chronotensity_Weights1[band] * chrono_normalized;
+ chrono_t.z += _Shatter_Wave_Chronotensity_Weights2[band] * chrono_normalized;
+ chrono_t.w += _Shatter_Wave_Chronotensity_Weights3[band] * chrono_normalized;
}
+ wave_t = chrono_t * _Shatter_Wave_Chronotensity_Time_Factor;
+ wave_t = fmod(wave_t, 10) - 10 * 0.5;
}
-#endif
+#else
+ float4 wave_t = _Time[0] * _Shatter_Wave_Speed;
wave_t = fmod(wave_t + _Shatter_Wave_Time_Offset * _Shatter_Wave_Period, _Shatter_Wave_Period) - _Shatter_Wave_Period * 0.5;
+#endif
float4 wave_center = wave_t;
|
