aboutsummaryrefslogtreecommitdiff
path: root/addons/visualization.vortex/resources/Presets/CubeSlide.vtx
blob: 09beb21c3cdfb2c1b71a38fb5d69aec44ec10a6c (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
67
68
69
// CubeSlide.vtx
// Author - MrC
// Based on CubeSlide.r4 by Gordon Williams

Texture env;
Texture skybox;

int x,y;
float tm,tn,ofs,c;

void Init()
{
	skybox.LoadTexture("skybox.dds");
	env.LoadTexture("tex_edge.png");
}

void reset()
{
   tm = 0;
   tn = 0;
}

float tiltfunc(float p)
{
   return (Sin((ofs+p)*0.1)+Cos((ofs+p)*0.123))*10.0;
}

void Render()
{
	tm = tm + 1 * TIMEPASS * 8;

	if (TREBLE > 0.0)
		tm = tm + ((TREBLE) * TIMEPASS * 20);

	while (tm>1)
	{
		tm = tm-1;
		ofs = ofs + 1;
	}

	tn = tn + ((BASS+1.5)*TIMEPASS);


	gfxSetAspect(0);
	gfxLookAt(Cos(tn*1.23)*5,Sin(tn)*5,(tm*2)-1,Cos(tn*0.6734)*2,Sin(tn*0.2143)*2,(tm*2)+8,0,1,0);   
	gfxRotate(-tiltfunc(0)*tm,0,0,1);

	gfxSetTexture(skybox);
	gfxPushMatrix();
	gfxTranslate(0,0,tm*2);
	gfxRotate(tiltfunc(0)*tm,0,0,1);
	gfxCube(-400,-400,-400,400,400,400);
	gfxPopMatrix();
	gfxSetTexture(env);

	gfxSetBlendMode(BLEND_ADD);

	for (y=0;y<15;y=y+1)
	{
		c = 1.0 - ((y-tm)/15.0);      
		for (x=-3;x<4;x=x+1)
		{
			gfxColour(c,c,c,1);
			gfxCube((x*2)-0.75,-0.375,(y*2)-0.75, (x*2)+0.75,0.375,(y*2)+0.75);
		}
		gfxRotate(tiltfunc(y),0,0,1);
	}
   
}