55 lines
1.4 KiB
HLSL
55 lines
1.4 KiB
HLSL
|
|
// HMS MediaEngine - Generator (D3D11)
|
||
|
|
// Erzeugt ohne Eingangstextur; cbuffer-Satz identisch zu Filtern (§12.6).
|
||
|
|
|
||
|
|
Texture2D u_input_texture : register(t0);
|
||
|
|
SamplerState u_sampler : register(s0);
|
||
|
|
|
||
|
|
cbuffer hms_params : register(b0)
|
||
|
|
{
|
||
|
|
float4 u_resolution; // xy = Auflösung in Pixeln
|
||
|
|
float u_time_seconds;
|
||
|
|
float u_delta_seconds;
|
||
|
|
float u_frame_index;
|
||
|
|
float u_layer_opacity;
|
||
|
|
float u_audio_rms;
|
||
|
|
float u_audio_peak;
|
||
|
|
float u_audio_bass;
|
||
|
|
float u_audio_mid;
|
||
|
|
float u_audio_treble;
|
||
|
|
float u_audio_beat;
|
||
|
|
float4 param_color_a;
|
||
|
|
float4 param_color_b;
|
||
|
|
float param_type;
|
||
|
|
float param_angle;
|
||
|
|
float param_center_x;
|
||
|
|
float param_center_y;
|
||
|
|
float param_width;
|
||
|
|
float param_phase;
|
||
|
|
float param_speed;
|
||
|
|
float _pad0;
|
||
|
|
float _pad1;
|
||
|
|
float _pad2;
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
float4 mainPS(float4 pos : SV_POSITION, float2 uv : TEXCOORD0) : SV_Target
|
||
|
|
{
|
||
|
|
float2 p = uv - float2(param_center_x, param_center_y);
|
||
|
|
float ang = radians(param_angle);
|
||
|
|
float2 dir = float2(cos(ang), sin(ang));
|
||
|
|
float t;
|
||
|
|
if (param_type < 0.5)
|
||
|
|
{
|
||
|
|
t = dot(p, dir) / max(param_width, 0.0001) + 0.5;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
t = length(p) / max(param_width, 0.0001);
|
||
|
|
}
|
||
|
|
t += param_phase + u_time_seconds * param_speed;
|
||
|
|
t = frac(t);
|
||
|
|
float4 col = lerp(param_color_a, param_color_b, saturate(t));
|
||
|
|
col.a *= u_layer_opacity;
|
||
|
|
return col;
|
||
|
|
}
|