aboutsummaryrefslogtreecommitdiff
path: root/addons/visualization.vortex/resources/Presets/WarpDrive.vtx
blob: 95d8df2c14a7408da4292a8eb0215d1b96e49734 (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
70
71
72
73
// WarpDrive.vtx
// Author - MrC
// Based on WarpDrive.r4 by Gordon Williams

Texture trail;
Texture sky;

float[] pvel(256),ppos(256),ptheta(256),prad(256),plen(256),psnd(256);
int x;
float f,g,bt;
const int cnt = 256;
float time;

void Init()
{
	sky.LoadTexture("skybox.dds");
	trail.LoadTexture("bluestrip.dds");
	
	for (x=0;x<cnt;x=x+1) newpt(x);
	bt = 0;
	time = 0;
}

void drawit(float ax,float ay,float bx, float by,float r)
{
   gfxTexCoord(0,0);
   gfxVertex(r*Cos(ax),r*Sin(ax),ay);
   gfxTexCoord(0,1);
   gfxVertex(r*Cos(bx),r*Sin(bx),ay);
   gfxTexCoord(1,1);
   gfxVertex(r*Cos(bx),r*Sin(bx),by);
   gfxTexCoord(1,0);
   gfxVertex(r*Cos(ax),r*Sin(ax),by);
}

void newpt(int p)
{
   pvel[p] = (Rand()+0.5)*2.0;
   ppos[p] = 0.0;
   ptheta[p] = Rand()*3.14159*2.0;
   prad[p] = (Rand()*1.25)+0.25;
   plen[p] = 1.0+Rand();
   psnd[p] = Rand();
} 

void Render()
{
	gfxClear(0, 0, 0.1);

	bt = bt + (TIMEPASS*(0.2+BASS));
	time += TIMEPASS;
	gfxSetBlendMode(BLEND_ADD);

	f = Sin(bt+Sin(time*1.353));
	g = Sin(f*3.14159*0.5);
	gfxTranslate(0,0,3);
	gfxRotate(90*(g+1.0),Sin(time*0.4),Cos(time*0.4),0);
	gfxSetTexture(sky);
	gfxCube(-200,-200,-200,200,200,200);
	gfxSetTexture(trail);
	gfxTranslate((Sin(bt*1.61))*0.3,(Sin(bt*1.23))*0.3,-8+(g*6.0));
	gfxBegin(PRIM_QUADLIST);
	for (x=0;x<cnt;x=x+1)
	{
		ppos[x] = ppos[x] + (pvel[x]*TIMEPASS*(0.5+(psnd[x]*BASS)+((1.0-psnd[x])*TREBLE)));
		if (ppos[x]<0) ppos[x] = 0;
		if (ppos[x]>1.0) newpt(x);
		gfxColour(1,1,1,(1.0-Cos(ppos[x]*3.14159*2.0))*0.5);
		drawit(ptheta[x],(ppos[x]*16.0)+plen[x],ptheta[x]+0.08+(prad[x]*0.025),(ppos[x]*16.0),prad[x]);
	}
	gfxEnd();

}