Esempio n. 1
0
void ComputeLight2DPos(EERIE_LIGHT * _pL) {
	
	TexturedVertex in, out;
	in.p = _pL->pos;
	EERIETreatPoint(&in, &out);
	
	if ((out.p.z > 0.f) && (out.p.z < 1000.f) && (out.rhw > 0))
	{
		float t;
		float siz = 50;
		float fMaxdist = 300;

		if (Project.telekinesis) fMaxdist = 850;

		t = siz * (1.0f - 1.0f / (out.rhw * fMaxdist)) + 10;

		_pL->maxs.x = out.p.x + t;
		_pL->mins.x = out.p.x - t;
		_pL->maxs.y = out.p.y + t;
		_pL->mins.y = out.p.y - t;


		if (0)
			if ((_pL->mins.x >= -200.f) && (_pL->mins.x <= 1000.f))
				if ((_pL->mins.y >= -200.f) && (_pL->mins.y <= 1000.f))
				{

					EERIEDraw2DLine(_pL->mins.x, _pL->mins.y, _pL->maxs.x, _pL->mins.y, 0.00001f, Color::white);
					EERIEDraw2DLine(_pL->maxs.x, _pL->mins.y, _pL->maxs.x, _pL->maxs.y, 0.00001f, Color::white);
					EERIEDraw2DLine(_pL->maxs.x, _pL->maxs.y, _pL->mins.x, _pL->maxs.y, 0.00001f, Color::white);
					EERIEDraw2DLine(_pL->mins.x, _pL->maxs.y, _pL->mins.x, _pL->mins.y, 0.00001f, Color::white);
				}
	}
}
Esempio n. 2
0
//***********************************************************************************************
// Draws a light source for EDITOR purpose...
//-----------------------------------------------------------------------------------------------
// VERIFIED (Cyril 2001/10/15)
//***********************************************************************************************
void EERIEDrawLight(LPDIRECT3DDEVICE7 pd3dDevice,EERIE_LIGHT * el) 
{
//	long i;
 
	D3DTLVERTEX in;
	D3DTLVERTEX center;
	SETCULL(pd3dDevice,D3DCULL_NONE);
	
	if (el!=NULL)
	if (el->treat) 
	{
		el->mins.x=999999999.f;
		in.sx=el->pos.x;
		in.sy=el->pos.y;
		in.sz=el->pos.z;

		if (ACTIVECAM->type==CAM_TOPVIEW)
			EERIEDrawSprite(pd3dDevice,&in,11.f,lightsource_tc,EERIERGB(el->rgb.r,el->rgb.g,el->rgb.b),2.f);
		else 
		{
			EERIEDrawSprite(pd3dDevice,&in,11.f,lightsource_tc,EERIERGB(el->rgb.r,el->rgb.g,el->rgb.b),2.f);
			memcpy(&el->mins,&SPRmins,sizeof(EERIE_3D));
			memcpy(&el->maxs,&SPRmaxs,sizeof(EERIE_3D));

			if (el->selected)
			{
				if ((el->mins.x>=-200.f) && (el->mins.x<=1000.f))
				if ((el->mins.y>=-200.f) && (el->mins.y<=1000.f))
				{
					in.sx=el->pos.x;
					in.sy=el->pos.y;
					in.sz=el->pos.z;
					EERIETreatPoint(&in,&center);	

					if ((center.sz>0.f) && (center.sz<1000.f))
					{
						float t=(1.f-center.sz)*ACTIVECAM->use_focal*DIV3000;
						float rad=el->fallstart*t;
						EERIEDrawCircle(center.sx,center.sy,rad,0xFFFFFF00,0.0001f);
						rad=el->fallend*t;
						EERIEDrawCircle(center.sx,center.sy,rad,0xFFFF0000,0.0001f);
						rad=el->intensity*200.f*t;
						EERIEDrawCircle(center.sx,center.sy,rad,0xFF00FF00,0.0001f);
					}
				}
			}			
		}
	}
}