#define  M_PI   3.14159265359
#define  M_PI_2 6.28318530718
#define  M_INV_PI_2  0.159154943091895

#define q1 _qa.x
#define q2 _qa.y
#define q3 _qa.z
#define q4 _qa.w
#define q5 _qb.x
#define q6 _qb.y
#define q7 _qb.z
#define q8 _qb.w
#define q9 _qc.x
#define q10 _qc.y
#define q11 _qc.z
#define q12 _qc.w
#define q13 _qd.x
#define q14 _qd.y
#define q15 _qd.z
#define q16 _qd.w
#define q17 _qe.x
#define q18 _qe.y
#define q19 _qe.z
#define q20 _qe.w
#define q21 _qf.x
#define q22 _qf.y
#define q23 _qf.z
#define q24 _qf.w
#define q25 _qg.x
#define q26 _qg.y
#define q27 _qg.z
#define q28 _qg.w
#define q29 _qh.x
#define q30 _qh.y
#define q31 _qh.z
#define q32 _qh.w

#define lum(x) (dot(x,float3(0.32,0.49,0.29)))
#define tex2d tex2D
#define tex3d tex3D

#define sampler sampler2D

#define getrad sqrt((uv.x-0.5)*2*(uv.x-0.5)*2+(uv.y-0.5)*2*(uv.y-0.5)*2)*.7071067
#define getang atan2(((uv.y-0.5)*2),((uv.x-0.5)*2))

#define GetMain(uv) (tex2D(sampler_main,uv).xyz)
#define GetPixel(uv) (tex2D(sampler_main,uv).xyz)

#define uv_orig uv

uniform sampler2D sampler_main;
uniform sampler2D sampler_fw_main;
uniform sampler2D sampler_pw_main;
uniform sampler2D sampler_fc_main;
uniform sampler2D sampler_pc_main;

uniform sampler2D sampler_noise_lq;
uniform sampler2D sampler_noise_lq_lite;
uniform sampler2D sampler_noise_mq;
uniform sampler2D sampler_noise_hq;
uniform sampler2D sampler_noise_perlin;
uniform sampler3D sampler_noisevol_lq;
uniform sampler3D sampler_noisevol_hq;

uniform sampler2D sampler_blur1;
uniform sampler2D sampler_blur2;
uniform sampler2D sampler_blur3;

float4 texsize_noise_lq;
float4 texsize_noise_mq;
float4 texsize_noise_hq;
float4 texsize_noise_perlin;
float4 texsize_noise_lq_lite;

float4 _qa;
float4 _qb;
float4 _qc;
float4 _qd;
float4 _qe;
float4 _qf;
float4 _qg;
float4 _qh;

float blur1_min;
float blur1_max;
float blur2_min;
float blur2_max;
float blur3_min;
float blur3_max;

#define GetBlur1(uv) (tex2D(sampler_blur1,uv).xyz*blur1_max+blur1_min)
#define GetBlur2(uv) (tex2D(sampler_blur2,uv).xyz*blur2_max+blur2_min)
#define GetBlur3(uv) (tex2D(sampler_blur3,uv).xyz*blur3_max+blur3_min)

float4 slow_roam_cos;
float4 roam_cos;
float4 slow_roam_sin;
float4 roam_sin;

float time;
float4 rand_preset;
float4 rand_frame;
float  progress;
float  frame;
float  fps;
float  bass;
float  mid;
float  treb;
float  vol;
float  bass_att;
float  mid_att;
float  treb_att;
float  vol_att;
float4 texsize;
float4 aspect;

float max( float a, float b ) {
      return (a > b ? a : b);
}

float3 max(float3 a, float4 b) {
       return float3( a.x > b.x ? a.x : b.x,
                      a.y > b.y ? a.y : b.y,
                      a.z > b.z ? a.z : b.z );
}

float3 max(float3 a, float3 b) {
       return float3( a.x > b.x ? a.x : b.x,
                      a.y > b.y ? a.y : b.y,
                      a.z > b.z ? a.z : b.z );
}

struct outtype {float4 color : COLOR;};
outtype OUT;
float3 ret;
