// - loise v.01 - 19 sept 2003
// elout
// based on my early zab0/loise work created around 1999
float zpos;
//------mouse rotation stuff
int mx,my,sx=140,sy=120, middenx,middeny;
float xangle,yangle,zangle;
int points=300;
float xd[]=new float[points];
float yd[]=new float[points];
float zd[]=new float[points];
float qdx,qdy,qdz;
int nolights=4;
int fx=0;
int maxfx=5;
int mygrey=80;
void setup()
{
size(500,500);
background(mygrey,mygrey,mygrey);
zpos=0.0f;
middenx=width/2;
middeny=height/2;
//noStroke();
stroke(0,0,0);
fill(255,255,255,160);
lights();
//set-up the lights
for (int i=0;i middenx){sx=0-((middenx-mx));}
else{sx=((mx-middenx));}
if ( my > middeny){sy=0-((middeny-my));}
else{sy=((my-middeny));}
xangle= (sy/1800.0f);
yangle= ((sx-sy)/1800.0f);
zangle= (sx/1800.0f);
if(keyPressed)
{
if (key == UP)
{
zpos=zpos+20.0f;
}
if (key == DOWN)
{
zpos=zpos-20.0f;
}
if (key == 'a' || key == 'A')
{
noStroke();
}
if (key == 's' || key == 'S')
{
stroke(0,0,0);
}
}
//calculate the 3D model
for (int i=points-1; i>0; i--)
{
xd[i]=xd[i-1];
yd[i]=yd[i-1];
zd[i]=zd[i-1];
}
//first point gets updated
xd[0]=(mx-middenx)/1.2;
yd[0]=(my-middeny)/1.2;
zd[0]=sx/1.2;
//set the light position
for (int i=0,ii=0;imaxfx){fx=0;}
//change the background color
mygrey=(int) random(255);
background(mygrey,mygrey,mygrey);
}