// Author - MrC // Based on WaveRing.r4 by Gordon Williams Map map; int x,y; float theta,rad,dx,dy; float mx, my; void Init() { for (y=0;y<24;y=y+1) { for (x=0;x<32;x=x+1) { dx = x-15.5; dy = y-11.5; rad = Mag(dx,dy); theta = Atan2(dy,dx); mx = -(0.01*dy/rad)-Sin((rad-7.5)*0.1)*0.02*dx/rad; my = (0.01*dx/rad)-Sin((rad-7.5)*0.1)*0.02*dy/rad; map.SetValues(x, y, mx, my, (3.0+Cos(theta))*0.275, (3.0+Cos(theta*2.0))*0.275, (3.0+Cos(theta*4.0))*0.275); } } } void Render() { map.Render(); gfxSetRenderTarget(map); gfxColour(1,1,1,1); gfxBegin(PRIM_LINESTRIP); for (int x=0; x < 256; x = x+1) { rad = 0.25 + (WaveLeft(x) / 10.0f); theta = x*3.141592/128.0; gfxVertex(Cos(theta)*rad, Sin(theta)*rad,1); } gfxEnd(); gfxBegin(PRIM_LINESTRIP); for (int x=0; x < 256; x = x+1) { rad = 0.25 + (WaveRight(x) / 10.0f); theta = x*3.141592/128.0; gfxVertex(Cos(theta)*rad, Sin(theta)*rad,1); } gfxEnd(); gfxSetRenderTarget(0); gfxSetTexture(map); gfxSetAspect(0); gfxTranslate(0, 0, 2.414); gfxTexRect(-1, 1, 1, -1); }