aboutsummaryrefslogtreecommitdiff
path: root/addons/visualization.vortex/resources/Presets/AlbumArtZoomer.vtx
blob: a7facdba758d88c606e7aac720a40ba19ca52316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// AlbumArtZoomer.vtx
// Author - MrC

float rot;
float zoom;
float dxx,dxy,dyx,dyy;

float	t;
float   px = 16;
float   py = 12;
float   pdx = 1.342;
float   pdy = 1;
float   basstime = 0;

void Init()
{
	zoom = 0;
	rot=Rand();
	px = 16;
	py = 12;
	pdx = 1.342;
	pdy = 1;
	basstime = 0;
}

void Quad(float rt, float sz)
{
   dxx = Cos(rt)*sz;
   dxy = Sin(rt)*sz;
   dyx = Sin(rt)*sz;
   dyy = 0.0f-Cos(rt)*sz;

   gfxTexCoord((0.0f-dxx)+(0.0f+dyx),(0.0f-dxy)+(0.0f+dyy));
   gfxVertex(-1 * 2,1 * 2,0);
   gfxTexCoord((0.0f+dxx)+(0.0f+dyx),(0.0f+dxy)+(0.0f+dyy));
   gfxVertex(1 * 2,1 * 2,0);
   gfxTexCoord((0.0f+dxx)+(0.0f-dyx),(0.0f+dxy)+(0.0f-dyy));
   gfxVertex(1 * 2,-1 * 2,0);
   gfxTexCoord((0.0f-dxx)+(0.0f-dyx),(0.0f-dxy)+(0.0f-dyy));
   gfxVertex(-1 * 2,-1 * 2,0);
}

void Render()
{
	zoom += BASS * 2 * TIMEPASS;
	rot += TREBLE * 4* TIMEPASS;

	t = TIMEPASS*(BASS+0.25) * 20;
	px = px + (pdx*t);
	if (px>28) { pdx = -Abs(pdx); px = 28; }
	if (px<4) { pdx = Abs(pdx); px = 4; }
	py = py + (pdy*t);
	if (py>20) { pdy = -Abs(pdy); py=20; }
	if (py<4) { pdy = Abs(pdy); py = 4; }

	// draw
	gfxSetTexture(TEXTURE_ALBUMART);
	gfxSetAspect(0);
	gfxTranslate(((px / 28.0f) - 0.5f), (py / 20.0f) - 0.5f, 2.414f);
	gfxBegin(PRIM_QUADLIST);

	gfxColour(1.0f, 1.0f, 1.0f, 1);
	Quad(Sin(rot),(Fabs(Sin(zoom)) + 0.25)*5);      
	gfxEnd();
	
}