templeos-info/public/Wb/Demo/Graphics/Shadow.HC

107 lines
2.2 KiB
HolyC
Raw Normal View History

2024-03-16 10:26:19 +00:00
F64 <EFBFBD>,<EFBFBD>,<EFBFBD>,s;
CDC *dc0,*dc1;
$SP,"<1>",BI=1$
U0 GrBlackLighting(CDC *dc,CD3I32 *,CD3I32 *,CD3I32 *,CColorROPU32)
{
dc->color=0;
}
U0 DrawShadow(CTask *task)
{
I64 r[4][4],*r2;
Mat4x4IdentEqu(dc1->r);
Mat4x4RotZ(dc1->r,<EFBFBD>);
Mat4x4RotX(dc1->r,<EFBFBD>);
Mat4x4RotZ(dc1->r,<EFBFBD>);
Mat4x4Scale(dc1->r,s);
Mat4x4TranslationEqu(dc1->r,200,200,5000);
dc1->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc1,dc1->r);
MemSet(r,0,sizeof(r));
r[0][0]=GR_SCALE;
r[1][1]=GR_SCALE/2; //Pick a plane for the shadow, to suit your taste.
r[1][2]=GR_SCALE/2; //It doesn't have to have a norm of 1.0.
r[2][2]=GR_SCALE;
r[3][3]=GR_SCALE;
Mat4x4TranslationEqu(r,0,-2200,1000);
r2=Mat4x4MulMat4x4New(r,dc1->r,task);
Free(dc1->r);
DCMat4x4Set(dc1,r2);
dc1->lighting=&GrBlackLighting;
Sprite3(dc1,0,0,0,$IB,"<1>",BI=1$);
}
U0 DrawIt(CTask *task,CDC *)
{
DCDepthBufRst(dc0);
Mat4x4IdentEqu(dc0->r);
Mat4x4RotZ(dc0->r,<EFBFBD>);
Mat4x4RotX(dc0->r,<EFBFBD>);
Mat4x4RotZ(dc0->r,<EFBFBD>);
Mat4x4Scale(dc0->r,s);
Mat4x4TranslationEqu(dc0->r,200,200,5000);
dc0->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc0,dc0->r);
if (mp_cnt>1)
JobQue(&DrawShadow,task,1);
else
DrawShadow(task);
Sprite3(dc0,0,0,0,$IB,"<1>",BI=1$);
}
U0 Shadow()
{//The shadow image b.s. Any is plausible.
dc0=DCAlias(gr.dc2,Fs);
dc1=DCAlias(gr.dc2,Fs);
DCDepthBufAlloc(dc0);
dc1->depth_buf=dc0->depth_buf;
<EFBFBD>=0;
<EFBFBD>=0;
<EFBFBD>=0;
s=1.5;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
Fs->draw_it=&DrawIt;
while (!ScanChar) {
<EFBFBD>+=2*<EFBFBD>/70;
<EFBFBD>+=2*<EFBFBD>/90;
<EFBFBD>+=2*<EFBFBD>/110;
Sleep(20);
}
SettingsPop;
DCDel(dc0);
dc1->depth_buf=NULL;
DCDel(dc1);
}
Shadow;
BdK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>