134 lines
3.0 KiB
Plaintext
134 lines
3.0 KiB
Plaintext
|
|
|
|
|
|
|
|
$PI,"<PI 2>",2$
|
|
|
|
|
|
|
|
|
|
|
|
I8 *r1,*r2;
|
|
|
|
|
|
void DrawIt(TssStruct *tss)
|
|
{
|
|
GrBitMap *mp0base=GrAlias(grbase2,tss);
|
|
I8 *old_r=mp0base->r;
|
|
|
|
ClearWinText(tss);
|
|
|
|
mp0base->r=r1;
|
|
mp0base->x=200;
|
|
mp0base->y=200;
|
|
mp0base->flags|=BMF_TRANSFORMATION;
|
|
|
|
mp0base->pen_width=2;
|
|
mp0base->bkcolor=BLACK;
|
|
GrElemsPlot(mp0base,0,0,0,$IB,"<IB 2>",2$);
|
|
|
|
mp0base->color=BLACK;
|
|
GrBox3(mp0base,50,75,0,100,50);
|
|
GrBox3(mp0base,75,50,0,50,100);
|
|
mp0base->color=GREEN;
|
|
GrEllipse3(mp0base,100,100,0,50,25);
|
|
GrEllipse3(mp0base,100,100,0,50,25,pi/2);
|
|
mp0base->color=LTGREEN;
|
|
GrEllipse3(mp0base,100,100,0,50,25,pi/6);
|
|
GrEllipse3(mp0base,100,100,0,50,25,pi/3);
|
|
|
|
mp0base->r=old_r;
|
|
GrDel(mp0base);
|
|
}
|
|
|
|
|
|
void MPDrawIt(TssStruct *main_tss)
|
|
{
|
|
GrBitMap *mp1base=GrAlias(Gs->grbase,Fs);
|
|
I8 *old_r=mp1base->r;
|
|
|
|
mp1base->win_tss=main_tss;
|
|
mp1base->r=r2;
|
|
mp1base->x=200;
|
|
mp1base->y=200;
|
|
mp1base->flags|=BMF_TRANSFORMATION;
|
|
|
|
GrClear(mp1base);
|
|
|
|
mp1base->pen_width=2;
|
|
mp1base->bkcolor=BLACK^WHITE;
|
|
GrElemsPlot(mp1base,0,0,0,$IB,"<IB 2>",2$);
|
|
|
|
mp1base->color=BLACK^WHITE;
|
|
GrBox3(mp1base,50,75,0,100,50);
|
|
GrBox3(mp1base,75,50,0,50,100);
|
|
|
|
mp1base->color=GREEN^WHITE;
|
|
GrEllipse3(mp1base,100,100,0,50,25);
|
|
GrEllipse3(mp1base,100,100,0,50,25,pi/2);
|
|
mp1base->color=LTGREEN^WHITE;
|
|
GrEllipse3(mp1base,100,100,0,50,25,pi/6);
|
|
GrEllipse3(mp1base,100,100,0,50,25,pi/3);
|
|
WbInvd;
|
|
|
|
mp1base->r=old_r;
|
|
GrDel(mp1base);
|
|
}
|
|
|
|
void MPClearIt()
|
|
{
|
|
GrBitMap *mp1base=GrAlias(Gs->grbase,Fs);
|
|
GrClear(mp1base);
|
|
GrDel(mp1base);
|
|
}
|
|
|
|
void MPDemo2()
|
|
{
|
|
double theta2=0,phi2=0,theta3=0,phi3=0;
|
|
I8 *r1_temp,*r2_temp,*temp;
|
|
U8 swap_time;
|
|
void *old_update=Fs->update_win;
|
|
Fs->update_win=&DrawIt;
|
|
|
|
while (!ScanKey) {
|
|
swap_time=GetTimeStamp+time_stamp_freq/33;
|
|
|
|
r1_temp=GrTheta(theta2);
|
|
r2_temp=GrPhi(phi2);
|
|
temp=r1;
|
|
r1=GrMulMat(r1_temp,r2_temp);
|
|
Free(temp);
|
|
Free(r1_temp);
|
|
Free(r2_temp);
|
|
|
|
r1_temp=GrTheta(theta3);
|
|
r2_temp=GrPhi(phi3);
|
|
temp=r2;
|
|
r2=GrMulMat(r1_temp,r2_temp);
|
|
Free(temp);
|
|
Free(r1_temp);
|
|
Free(r2_temp);
|
|
WbInvd; $FG,2$//r1 and r2 need to be flushed out of cache$FG$
|
|
|
|
$FG,2$//Pass the tss of the window as data item to job.$FG$
|
|
MPQueueJob(&MPDrawIt,Fs);
|
|
|
|
WinSync; $FG,2$//I don't know if this helps$FG$
|
|
while (GetTimeStamp<swap_time)
|
|
SwapInNext;
|
|
|
|
theta2+=pi2/100;
|
|
phi2 +=pi2/130;
|
|
theta3-=pi2/100;
|
|
phi3 -=pi2/130;
|
|
}
|
|
$FG,2$//This works if there is just one
|
|
//extra core. Not sure what to do otherwise
|
|
//except traverse $LK,"mp_cpu_structs","MN:mp_cpu_structs"$.$FG$
|
|
MPQueueJob(&MPClearIt);
|
|
|
|
Fs->update_win=old_update;
|
|
}
|
|
|
|
MPDemo2;
|
|
|