Пример #1
0
//---------------------------------------------------------------------
float CBless::Render()
{
	int i = 0;

	float x = eSrc.x;
	float y = eSrc.y - 5;
	float z = eSrc.z;

	if (ulCurrentTime >= ulDuration)
	{
		return 0.f;
	}

	GRenderer->SetCulling(Renderer::CullNone);
	GRenderer->SetRenderState(Renderer::DepthWrite, false);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);

	TexturedVertex v[4];
	TexturedVertex v3[4];

	float ff = ((float)spells[spellinstance].caster_level + 10) * 6.f;
	float fBetaRadCos = (float) cos(radians(MAKEANGLE(player.angle.b))) * ff;
	float fBetaRadSin = (float) sin(radians(MAKEANGLE(player.angle.b))) * ff;

	ColorBGRA color = Color::white.toBGR();

	v[0].p.x = x - fBetaRadCos - fBetaRadSin;
	v[0].p.y = y;
	v[0].p.z = z - fBetaRadSin + fBetaRadCos;
	v[1].p.x = x + fBetaRadCos - fBetaRadSin;
	v[1].p.y = y;
	v[1].p.z = z + fBetaRadSin + fBetaRadCos;
	v[2].p.x = x - fBetaRadCos + fBetaRadSin;
	v[2].p.y = y;
	v[2].p.z = z - fBetaRadSin - fBetaRadCos;
	v[3].p.x = x + fBetaRadCos + fBetaRadSin;
	v[3].p.y = y;
	v[3].p.z = z + fBetaRadSin - fBetaRadCos;
	
	v3[0].color = color;
	v3[1].color = color;
	v3[2].color = color;
	v3[3].color = color;
	
	GRenderer->SetTexture(0, tex_sol);
	
	v3[0].uv = Vec2f::ZERO;
	v3[1].uv = Vec2f::X_AXIS;
	v3[2].uv = Vec2f::Y_AXIS;
	v3[3].uv = Vec2f::ONE;
	
	EE_RT2(&v[0], &v3[0]);
	EE_RT2(&v[1], &v3[1]);
	EE_RT2(&v[2], &v3[2]);
	EE_RT2(&v[3], &v3[3]);
	ARX_DrawPrimitive(&v3[0], &v3[1], &v3[2]);
	ARX_DrawPrimitive(&v3[1], &v3[2], &v3[3]);
	
	GRenderer->SetRenderState(Renderer::AlphaBlending, false);
	
	for(i = 0; i < 12; i++) {
		
		PARTICLE_DEF * pd = createParticle();
		if(!pd) {
			break;
		}
		
		pd->ov = eSrc - Vec3f(0.f, 20.f, 0.f);
		pd->move = Vec3f(3.f * frand2(), rnd() * 0.5f, 3.f * frand2());
		pd->siz = 0.005f;
		pd->tolive = Random::get(1000, 2000);
		pd->tc = tex_p1;
		pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
		pd->fparam = 0.0000001f;
		pd->rgb = Color3f(0.7f, 0.6f, 0.2f);
	}
	
	GRenderer->SetCulling(Renderer::CullNone);
	GRenderer->SetRenderState(Renderer::DepthWrite, false);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	
	return 1;
}
/*--------------------------------------------------------------------------*/
float CLevitate::Render(LPDIRECT3DDEVICE7 device)
{
	if (this->key > 1) return 0;

	SETALPHABLEND(device, TRUE);
	SETZWRITE(device, FALSE);

	//calcul du cone
	D3DTLVERTEX d3dvs, *d3dv;
	EERIE_3D	* vertex;
	int			nb, nbc, col;
	float		ddu = this->ang;
	float		u = ddu, du = .99999999f / (float)this->def;

	switch (this->key)
	{
		case 0:
			nbc = 2;

			while (nbc--)
			{
				vertex = this->cone[nbc].conevertex;
				d3dv = this->cone[nbc].coned3d;
				nb = (this->cone[nbc].conenbvertex) >> 1;

				while (nb)
				{
					d3dvs.sx = this->pos.x + (vertex + 1)->x + ((vertex->x - (vertex + 1)->x) * this->scale);
					d3dvs.sy = this->pos.y + (vertex + 1)->y + ((vertex->y - (vertex + 1)->y) * this->scale);
					d3dvs.sz = this->pos.z + (vertex + 1)->z + ((vertex->z - (vertex + 1)->z) * this->scale);
					
					EE_RT2(&d3dvs, d3dv);


					float fRandom	= rnd() * 80.f ;
					ARX_CHECK_INT(fRandom);

					col	= ARX_CLEAN_WARN_CAST_INT(fRandom);


					if (!ARXPausedTimer) d3dv->color = RGBA_MAKE(col, col, col, col);

					d3dv->tu = u;
					d3dv->tv = 0.f;
					vertex++;
					d3dv++;

					d3dvs.sx = this->pos.x + vertex->x;
					d3dvs.sy = this->pos.y;
					d3dvs.sz = this->pos.z + vertex->z;
					
					EE_RT2(&d3dvs, d3dv);


					fRandom = rnd() * 80.f ;
					ARX_CHECK_INT(fRandom);

					col = ARX_CLEAN_WARN_CAST_INT(fRandom);


					if (!ARXPausedTimer) d3dv->color = RGBA_MAKE(0, 0, 0, col);

					d3dv->tu = u;
					d3dv->tv = 0.9999999f;
					vertex++;
					d3dv++;

					u += du;
					nb--;
				}

				u = ddu;
				du = -du;
			}

			nbc = 3;

			while (nbc--)
			{
				int j = ARX_PARTICLES_GetFree();

				if ((j != -1) && (!ARXPausedTimer))
				{
					ParticleCount++;
					particle[j].exist = 1;
					particle[j].zdec = 0;

					float a = DEG2RAD(360.f * rnd());

					particle[j].ov.x = this->pos.x + this->rbase * EEcos(a);
					particle[j].ov.y = this->pos.y;
					particle[j].ov.z = this->pos.z + this->rbase * EEsin(a);
					float t = EEDistance3D(&particle[j].ov, &this->pos);
					particle[j].move.x = (5.f + 5.f * rnd()) * ((particle[j].ov.x - this->pos.x) / t);
					particle[j].move.y = 3.f * rnd();
					particle[j].move.z = (5.f + 5.f * rnd()) * ((particle[j].ov.z - this->pos.z) / t);
					particle[j].siz = 30.f + 30.f * rnd();
					particle[j].tolive = 3000;
					particle[j].scale.x = 1.f;
					particle[j].scale.y = 1.f;
					particle[j].scale.z = 1.f;
					particle[j].timcreation = -(long)(ARXTime + 3000); //spells[i].lastupdate;
					particle[j].tc = NULL;
					particle[j].special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
					particle[j].fparam = 0.0000001f;
					particle[j].r = 1.f;
					particle[j].g = 1.f;
					particle[j].b = 1.f;
				}
			}
			break;
		case 1:
			nbc = 2;

			while (nbc--)
			{
				vertex = this->cone[nbc].conevertex;
				d3dv = this->cone[nbc].coned3d;
				nb = (this->cone[nbc].conenbvertex) >> 1;

				while (nb)
				{
					d3dvs.sx = this->pos.x + vertex->x;
					d3dvs.sy = this->pos.y + vertex->y;
					d3dvs.sz = this->pos.z + vertex->z;
	
					EE_RT2(&d3dvs, d3dv);
					col = (int)(rnd() * 80.f);

					if (!ARXPausedTimer) d3dv->color = RGBA_MAKE(col, col, col, col);

					d3dv->tu = u;
					d3dv->tv = 0.f;
					vertex++;
					d3dv++;

					d3dvs.sx = this->pos.x + vertex->x;
					d3dvs.sy = this->pos.y;
					d3dvs.sz = this->pos.z + vertex->z;

					EE_RT2(&d3dvs, d3dv);
					col = (int)(rnd() * 80.f);

					if (!ARXPausedTimer) d3dv->color = RGBA_MAKE(0, 0, 0, col);

					d3dv->tu = u;
					d3dv->tv = 1; 
					vertex++;
					d3dv++;

					u += du;
					nb--;
				}

				u = ddu;
				du = -du;
			}

			nbc = 10;

			while (nbc--)
			{
				int j = ARX_PARTICLES_GetFree();

				if ((j != -1) && (!ARXPausedTimer))
				{
					ParticleCount++;
					particle[j].exist = 1;
					particle[j].zdec = 0;

					float a = DEG2RAD(360.f * rnd());

					particle[j].ov.x = this->pos.x + this->rbase * EEcos(a);
					particle[j].ov.y = this->pos.y;
					particle[j].ov.z = this->pos.z + this->rbase * EEsin(a);
					float t = EEDistance3D(&particle[j].ov, &this->pos);
					particle[j].move.x = (5.f + 5.f * rnd()) * ((particle[j].ov.x - this->pos.x) / t);
					particle[j].move.y = 3.f * rnd();
					particle[j].move.z = (5.f + 5.f * rnd()) * ((particle[j].ov.z - this->pos.z) / t);
					particle[j].siz = 30.f + 30.f * rnd();
					particle[j].tolive = 3000;
					particle[j].scale.x = 1.f;
					particle[j].scale.y = 1.f;
					particle[j].scale.z = 1.f;
					particle[j].timcreation = -(long)(ARXTime + 3000);
					particle[j].tc = NULL;
					particle[j].special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
					particle[j].fparam = 0.0000001f;
					particle[j].r = 1.f;
					particle[j].g = 1.f;
					particle[j].b = 1.f;
				}
			}

			break;
	}

	//tracé du cone back
	device->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
	device->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
	SETALPHABLEND(device, TRUE);
	SETTEXTUREWRAPMODE(device, D3DTADDRESS_MIRROR);

	if (this->tsouffle) device->SetTexture(0, this->tsouffle->m_pddsSurface);
	else device->SetTexture(0, NULL);

	SETCULL(device, D3DCULL_CW);
	int i = cone[1].conenbfaces - 2;
	int j = 0;

	while (i--)
	{
		ARX_DrawPrimitive_SoftClippZ(&cone[1].coned3d[j],
		                             &cone[1].coned3d[j+1],
		                             &cone[1].coned3d[j+2]);
		j++;
	}

	i = cone[0].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive_SoftClippZ(&cone[0].coned3d[j],
		                             &cone[0].coned3d[j+1],
		                             &cone[0].coned3d[j+2]);
		j++;
	}

	//tracé du cone front
	SETCULL(device, D3DCULL_CCW);
	
	i = cone[1].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive_SoftClippZ(&cone[1].coned3d[j],
		                             &cone[1].coned3d[j+1],
		                             &cone[1].coned3d[j+2]);
		j++;
	}

	i = cone[0].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive_SoftClippZ(&cone[0].coned3d[j],
		                             &cone[0].coned3d[j+1],
		                             &cone[0].coned3d[j+2]);
		j++;
	}

	//tracé des pierres
	device->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
	device->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
	this->DrawStone(device);

	device->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
	device->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
	SETALPHABLEND(device, FALSE);
	SETZWRITE(device, TRUE);

	return 0;
}
Пример #3
0
//---------------------------------------------------------------------
float CBless::Render(LPDIRECT3DDEVICE7 _pD3DDevice)
{
	int i = 0;

	float x = eSrc.x;
	float y = eSrc.y - 5;
	float z = eSrc.z;

	if (ulCurrentTime >= ulDuration)
	{
		return 0.f;
	}

	SETCULL(_pD3DDevice, D3DCULL_NONE);
	SETZWRITE(_pD3DDevice, false);
	SETALPHABLEND(_pD3DDevice, true);

	D3DTLVERTEX v[4];
	D3DTLVERTEX v3[4];

	float ff = ((float)spells[spellinstance].caster_level + 10) * 6.f;
	float fBetaRadCos = (float) cos(DEG2RAD(MAKEANGLE(player.angle.b))) * ff;
	float fBetaRadSin = (float) sin(DEG2RAD(MAKEANGLE(player.angle.b))) * ff;

	unsigned long color = D3DRGB(1, 1, 1);

	v[0].sx = x - fBetaRadCos - fBetaRadSin;
	v[0].sy = y;
	v[0].sz = z - fBetaRadSin + fBetaRadCos;
	v[1].sx = x + fBetaRadCos - fBetaRadSin;
	v[1].sy = y;
	v[1].sz = z + fBetaRadSin + fBetaRadCos;
	v[2].sx = x - fBetaRadCos + fBetaRadSin;
	v[2].sy = y;
	v[2].sz = z - fBetaRadSin - fBetaRadCos;
	v[3].sx = x + fBetaRadCos + fBetaRadSin;
	v[3].sy = y;
	v[3].sz = z + fBetaRadSin - fBetaRadCos;

	v3[0].color = color;
	v3[1].color = color;
	v3[2].color = color;
	v3[3].color = color;

	if (tex_sol && tex_sol->m_pddsSurface)
	{
		SETTC(_pD3DDevice, tex_sol);
	}

	v3[0].tu = 0;
	v3[0].tv = 0;
	v3[1].tu = 1.f;
	v3[1].tv = 0;
	v3[2].tu = 0;
	v3[2].tv = 1.f;
	v3[3].tu = 1.f;
	v3[3].tv = 1.f;

	EE_RT2(&v[0], &v3[0]);
	EE_RT2(&v[1], &v3[1]);
	EE_RT2(&v[2], &v3[2]);
	EE_RT2(&v[3], &v3[3]);
	ARX_DrawPrimitive_SoftClippZ(&v3[0],
	                             &v3[1],
	                             &v3[2]);
	ARX_DrawPrimitive_SoftClippZ(&v3[1],
	                             &v3[2],
	                             &v3[3]);
	
	//----------------------------
	SETALPHABLEND(_pD3DDevice, false);

	for (i = 0; i < 12; i++)
	{
		int j = ARX_PARTICLES_GetFree();

		if ((j != -1) && (!ARXPausedTimer))
		{
			ParticleCount++;
			particle[j].exist = 1;
			particle[j].zdec = 0;

			particle[j].ov.x		=	eSrc.x;
			particle[j].ov.y		=	eSrc.y - 20;
			particle[j].ov.z		=	eSrc.z;
			particle[j].move.x		=	3.f * frand2();
			particle[j].move.y		=	rnd() * 0.5f;
			particle[j].move.z		=	3.f * frand2();
			particle[j].siz			=	0.005f;
			particle[j].tolive		=	1000 + (unsigned long)(float)(rnd() * 1000.f);
			particle[j].scale.x		=	1.f;
			particle[j].scale.y		=	1.f;
			particle[j].scale.z		=	1.f;
			particle[j].timcreation	=	lARXTime;
			particle[j].tc			=	tex_p1;
			particle[j].special		=	FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
			particle[j].fparam		=	0.0000001f;
			particle[j].r			=	0.7f;
			particle[j].g			=	0.6f;
			particle[j].b			=	0.2f;
		}
	}

	SETCULL(_pD3DDevice, D3DCULL_NONE);
	SETZWRITE(_pD3DDevice, false);
	SETALPHABLEND(_pD3DDevice, true);

	return 1;
}
Пример #4
0
//-----------------------------------------------------------------------------
void CSummonCreature::RenderFissure()
{
    int i;
    float ff;
    TexturedVertex vt[4];
    TexturedVertex vr[4];
    TexturedVertex target;

    Vec3f etarget;
    etarget.x = fBetaRadCos;
    etarget.y = 0;
    etarget.z = fBetaRadSin;

    //-------------------------------------------------------------------------
    // computation des sommets
    float fTempCos, fTempSin;

    for (i = 0; i <= std::min(end, int(fSizeIntro)); i++)
    {
        if (i <= end * 0.5f)
        {
            ff = i / (end * 0.5f);
        }
        else
        {
            ff = 1.0f - ((i - (end + 1) * 0.5f) / (end * 0.5f));
        }

        fTempCos = ff * fBetaRadCos;
        fTempSin = ff * fBetaRadSin;

        va[i].p.x   = v1a[i].p.x   + sizeF * fTempCos;
        va[i].p.y   = v1a[i].p.y;
        va[i].p.z   = v1a[i].p.z   + sizeF * fTempSin;

        vb[i].p.x   = v1b[i].p.x   - sizeF * fTempCos;
        vb[i].p.y   = v1b[i].p.y;
        vb[i].p.z   = v1b[i].p.z   - sizeF * fTempSin;

        va[i].p.x += rnd() * 0.5f * fTempCos;
        va[i].p.z += rnd() * 0.5f * fTempSin;
        vb[i].p.x -= rnd() * 0.5f * fTempCos;
        vb[i].p.z -= rnd() * 0.5f * fTempSin;
    }

    //-------------------------------------------------------------------------
    // rendu de la fissure
    GRenderer->SetRenderState(Renderer::AlphaBlending, false);
    vr[0].color = vr[1].color = vr[2].color = vr[3].color = Color::black.toBGR();

    if (bIntro)
    {
        for (i = 0; i < std::min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&v1a[i], &vr[0]);
            EE_RT2(&v1b[i], &vr[1]);
            EE_RT2(&v1a[i+1], &vr[2]);
            EE_RT2(&v1b[i+1], &vr[3]);
            ARX_DrawPrimitive(&vr[0],
                              &vr[1],
                              &vr[2]);
            ARX_DrawPrimitive(&vr[1],
                              &vr[2],
                              &vr[3]);
        }
    }
    else
    {
        for (i = 0; i < std::min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&va[i], &vr[0]);
            EE_RT2(&vb[i], &vr[1]);
            EE_RT2(&va[i+1], &vr[2]);
            EE_RT2(&vb[i+1], &vr[3]);
            ARX_DrawPrimitive(&vr[0],
                              &vr[1],
                              &vr[2]);
            ARX_DrawPrimitive(&vr[1],
                              &vr[2],
                              &vr[3]);
        }
    }

    //-------------------------------------------------------------------------
    // rendu de la bordure
    GRenderer->SetRenderState(Renderer::AlphaBlending, true);
    vr[0].color = vr[1].color = Color::black.toBGR();
    vr[2].color = vr[3].color = fColorBorder.toBGR();

    for (i = 0; i < std::min(end, (int)fSizeIntro); i++)
    {
        vt[2].p.x = va[i].p.x   - (va[i].p.x - eSrc.x) * 0.2f;
        vt[2].p.y = va[i].p.y   - (va[i].p.y - eSrc.y) * 0.2f;
        vt[2].p.z = va[i].p.z   - (va[i].p.z - eSrc.z) * 0.2f;
        vt[3].p.x = va[i+1].p.x - (va[i+1].p.x - eSrc.x) * 0.2f;
        vt[3].p.y = va[i+1].p.y - (va[i+1].p.y - eSrc.y) * 0.2f;
        vt[3].p.z = va[i+1].p.z - (va[i+1].p.z - eSrc.z) * 0.2f;

        EE_RT2(&vt[3], &vr[0]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&va[i+1], &vr[2]);
        EE_RT2(&va[i], &vr[3]);
        ARX_DrawPrimitive(&vr[0],
                          &vr[1],
                          &vr[2]);
        ARX_DrawPrimitive(&vr[1],
                          &vr[2],
                          &vr[3]);

        vt[2].p.x = vb[i].p.x   - (vb[i].p.x - eSrc.x) * 0.2f;
        vt[2].p.y = vb[i].p.y   - (vb[i].p.y - eSrc.y) * 0.2f;
        vt[2].p.z = vb[i].p.z   - (vb[i].p.z - eSrc.z) * 0.2f;
        vt[3].p.x = vb[i+1].p.x - (vb[i+1].p.x - eSrc.x) * 0.2f;
        vt[3].p.y = vb[i+1].p.y - (vb[i+1].p.y - eSrc.y) * 0.2f;
        vt[3].p.z = vb[i+1].p.z - (vb[i+1].p.z - eSrc.z) * 0.2f;

        EE_RT2(&vb[i], &vr[3]);
        EE_RT2(&vb[i+1], &vr[2]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&vt[3], &vr[0]);
        ARX_DrawPrimitive(&vr[0],
                          &vr[1],
                          &vr[2]);
        ARX_DrawPrimitive(&vr[1],
                          &vr[2],
                          &vr[3]);

    }

    //-------------------------------------------------------------------------
    // rendu des faisceaux
    // blend additif ou mul
    // smooth sur les cotés ou pas ..
    // texture sympa avec glow au milieu ou uv wrap
    GRenderer->SetRenderState(Renderer::AlphaBlending, true);
    GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapMirror);
    GRenderer->SetTexture(0, tex_light);

    target.p.x = eSrc.x + -fBetaRadSin * (1.5f * sizeF);
    target.p.y = eSrc.y;
    target.p.z = eSrc.z + fBetaRadCos * (1.5f * sizeF);

    EE_RTP(&vt[1], &vr[0]);
    vr[0].color = vr[1].color = fColorRays1.toBGR();
    vr[2].color = vr[3].color = fColorRays2.toBGR();

    vr[0].uv.x = fTexWrap;
    vr[0].uv.y = 1;
    vr[1].uv.x = 1.0f + fTexWrap;
    vr[1].uv.y = 1;
    vr[2].uv.x = fTexWrap;
    vr[2].uv.y = 0;
    vr[3].uv.x = 1.0f + fTexWrap;
    vr[3].uv.y = 0;

    for (i = 0; i < end - 1; i++)
    {
        if (i < fSizeIntro)
        {
            vt[0].p.x = va[i].p.x;
            vt[0].p.y = va[i].p.y;
            vt[0].p.z = va[i].p.z;
            vt[1].p.x = va[i+1].p.x;
            vt[1].p.y = va[i+1].p.y;
            vt[1].p.z = va[i+1].p.z;
            vt[2].p.x = va[i].p.x + (va[i].p.x - target.p.x) * 2;
            vt[2].p.y = va[i].p.y + (va[i].p.y - target.p.y) * 2;
            vt[2].p.z = va[i].p.z + (va[i].p.z - target.p.z) * 2;
            vt[3].p.x = va[i+1].p.x + (va[i+1].p.x - target.p.x) * 2;
            vt[3].p.y = va[i+1].p.y + (va[i+1].p.y - target.p.y) * 2;
            vt[3].p.z = va[i+1].p.z + (va[i+1].p.z - target.p.z) * 2;

            vr[0].color = (fColorRays1 * tfRaysa[i]).toBGR();
            vr[1].color = (fColorRays1 * tfRaysa[i + 1]).toBGR();
            vr[2].color = (fColorRays2 * tfRaysa[i]).toBGR();
            vr[3].color = (fColorRays2 * tfRaysa[i + 1]).toBGR();

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive(&vr[0],
                              &vr[1],
                              &vr[2]);
            ARX_DrawPrimitive(&vr[1],
                              &vr[2],
                              &vr[3]);
        }

        if (i < fSizeIntro)
        {
            vt[0].p.x = vb[i+1].p.x;
            vt[0].p.y = vb[i+1].p.y;
            vt[0].p.z = vb[i+1].p.z;
            vt[1].p.x = vb[i].p.x;
            vt[1].p.y = vb[i].p.y;
            vt[1].p.z = vb[i].p.z;
            vt[2].p.x = vb[i+1].p.x + (vb[i+1].p.x - target.p.x) * 2;
            vt[2].p.y = vb[i+1].p.y + (vb[i+1].p.y - target.p.y) * 2;
            vt[2].p.z = vb[i+1].p.z + (vb[i+1].p.z - target.p.z) * 2;
            vt[3].p.x = vb[i].p.x + (vb[i].p.x - target.p.x) * 2;
            vt[3].p.y = vb[i].p.y + (vb[i].p.y - target.p.y) * 2;
            vt[3].p.z = vb[i].p.z + (vb[i].p.z - target.p.z) * 2;

            vr[0].color = (fColorRays1 * tfRaysb[i]).toBGR();
            vr[1].color = (fColorRays1 * tfRaysb[i + 1]).toBGR();
            vr[2].color = (fColorRays2 * tfRaysb[i]).toBGR();
            vr[3].color = (fColorRays2 * tfRaysb[i + 1]).toBGR();

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive(&vr[0],
                              &vr[1],
                              &vr[2]);
            ARX_DrawPrimitive(&vr[1],
                              &vr[2],
                              &vr[3]);
        }

    }
}
Пример #5
0
/*--------------------------------------------------------------------------*/
float CLevitate::Render()
{
	if (this->key > 1) return 0;

	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	GRenderer->SetRenderState(Renderer::DepthWrite, false);

	//calcul du cone
	TexturedVertex d3dvs, *d3dv;
	Vec3f	* vertex;
	int			nb, nbc, col;
	float		ddu = this->ang;
	float		u = ddu, du = .99999999f / (float)this->def;

	switch (this->key)
	{
		case 0:
			nbc = 2;

			while (nbc--)
			{
				vertex = this->cone[nbc].conevertex;
				d3dv = this->cone[nbc].coned3d;
				nb = (this->cone[nbc].conenbvertex) >> 1;

				while (nb)
				{
					d3dvs.p.x = this->pos.x + (vertex + 1)->x + ((vertex->x - (vertex + 1)->x) * this->scale);
					d3dvs.p.y = this->pos.y + (vertex + 1)->y + ((vertex->y - (vertex + 1)->y) * this->scale);
					d3dvs.p.z = this->pos.z + (vertex + 1)->z + ((vertex->z - (vertex + 1)->z) * this->scale);
					
					EE_RT2(&d3dvs, d3dv);


					float fRandom	= rnd() * 80.f;

					col = checked_range_cast<int>(fRandom);

					if (!arxtime.is_paused()) d3dv->color = Color::grayb(col).toBGR(col);

					d3dv->uv.x = u;
					d3dv->uv.y = 0.f;
					vertex++;
					d3dv++;

					d3dvs.p.x = this->pos.x + vertex->x;
					d3dvs.p.y = this->pos.y;
					d3dvs.p.z = this->pos.z + vertex->z;
					
					EE_RT2(&d3dvs, d3dv);


					fRandom = rnd() * 80.f;

					col = checked_range_cast<int>(fRandom);


					if (!arxtime.is_paused()) d3dv->color = Color::black.toBGR(col);

					d3dv->uv.x = u;
					d3dv->uv.y = 0.9999999f;
					vertex++;
					d3dv++;

					u += du;
					nb--;
				}

				u = ddu;
				du = -du;
			}

			nbc = 3;
			while(nbc--) {
				
				PARTICLE_DEF * pd = createParticle();
				if(!pd) {
					break;
				}
				
				float a = radians(360.f * rnd());
				pd->ov = pos + Vec3f(rbase * EEcos(a), 0.f, rbase * EEsin(a));
				float t = fdist(pd->ov, pos);
				pd->move = Vec3f((5.f + 5.f * rnd()) * ((pd->ov.x - pos.x) / t), 3.f * rnd(),
				                 (5.f + 5.f * rnd()) * ((pd->ov.z - pos.z) / t));
				pd->siz = 30.f + 30.f * rnd();
				pd->tolive = 3000;
				pd->timcreation = -(long(arxtime) + 3000l); // TODO WTF
				pd->special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION
				              | DISSIPATING;
				pd->fparam = 0.0000001f;
			}
			break;
		
		case 1:
			nbc = 2;

			while (nbc--)
			{
				vertex = this->cone[nbc].conevertex;
				d3dv = this->cone[nbc].coned3d;
				nb = (this->cone[nbc].conenbvertex) >> 1;

				while (nb)
				{
					d3dvs.p = this->pos + *vertex;
	
					EE_RT2(&d3dvs, d3dv);
					col = Random::get(0, 80);

					if (!arxtime.is_paused()) d3dv->color = Color::grayb(col).toBGR(col);

					d3dv->uv.x = u;
					d3dv->uv.y = 0.f;
					vertex++;
					d3dv++;

					d3dvs.p.x = this->pos.x + vertex->x;
					d3dvs.p.y = this->pos.y;
					d3dvs.p.z = this->pos.z + vertex->z;

					EE_RT2(&d3dvs, d3dv);
					col = Random::get(0, 80);

					if (!arxtime.is_paused()) d3dv->color = Color::black.toBGR(col);

					d3dv->uv.x = u;
					d3dv->uv.y = 1; 
					vertex++;
					d3dv++;

					u += du;
					nb--;
				}

				u = ddu;
				du = -du;
			}
			
			nbc = 10;
			while(nbc--) {
				
				PARTICLE_DEF * pd = createParticle();
				if(!pd) {
					break;
				}
				
				float a = radians(360.f * rnd());
				pd->ov = pos + Vec3f(rbase * EEcos(a), 0.f, rbase * EEsin(a));
				float t = fdist(pd->ov, pos);
				pd->move = Vec3f((5.f + 5.f * rnd()) * ((pd->ov.x - pos.x) / t), 3.f * rnd(),
				                 (5.f + 5.f * rnd()) * ((pd->ov.z - pos.z) / t));
				pd->siz = 30.f + 30.f * rnd();
				pd->tolive = 3000;
				pd->timcreation = -(long(arxtime) + 3000l); // TODO WTF
				pd->special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION
				              | DISSIPATING;
				pd->fparam = 0.0000001f;
			}
			
			break;
	}

	//tracé du cone back
	GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapMirror);

	GRenderer->SetTexture(0, tsouffle);

	GRenderer->SetCulling(Renderer::CullCW);
	int i = cone[1].conenbfaces - 2;
	int j = 0;

	while (i--)
	{
		ARX_DrawPrimitive(&cone[1].coned3d[j],
		                             &cone[1].coned3d[j+1],
		                             &cone[1].coned3d[j+2]);
		j++;
	}

	i = cone[0].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive(&cone[0].coned3d[j],
		                             &cone[0].coned3d[j+1],
		                             &cone[0].coned3d[j+2]);
		j++;
	}

	//tracé du cone front
	GRenderer->SetCulling(Renderer::CullCCW);
	
	i = cone[1].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive(&cone[1].coned3d[j],
		                             &cone[1].coned3d[j+1],
		                             &cone[1].coned3d[j+2]);
		j++;
	}

	i = cone[0].conenbfaces - 2;
	j = 0;

	while (i--)
	{
		ARX_DrawPrimitive(&cone[0].coned3d[j],
		                             &cone[0].coned3d[j+1],
		                             &cone[0].coned3d[j+2]);
		j++;
	}

	//tracé des pierres
	GRenderer->SetBlendFunc(Renderer::BlendSrcAlpha, Renderer::BlendInvSrcAlpha);
	this->DrawStone();

	GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendZero);
	GRenderer->SetRenderState(Renderer::AlphaBlending, false);
	GRenderer->SetRenderState(Renderer::DepthWrite, true);

	return 0;
}
Пример #6
0
void ARXDRAW_DrawPolyBoom(LPDIRECT3DDEVICE7 pd3dDevice)
{
	D3DTLVERTEX ltv[4];

	long i,k;
	float tt;

	SetZBias(pd3dDevice,8);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,0);
	unsigned long tim = ARXTimeUL(); 	
	SETALPHABLEND(pd3dDevice,TRUE);

	for ( i = 0 ; i < MAX_POLYBOOM ; i++ )
	{
		if ( polyboom[i].exist )
		{
			if ( polyboom[i].type & 128 )
			{	
				if (polyboom[i].timecreation - FrameDiff > 0)
				{
					float fCalc	=	polyboom[i].timecreation - FrameDiff;	
					ARX_CHECK_ULONG( fCalc );
					polyboom[i].timecreation	=	ARX_CLEAN_WARN_CAST_ULONG( fCalc );
				}

				if (polyboom[i].timecreation - FrameDiff > 0)
				{
					float fCalc	= 	polyboom[i].timecreation - FrameDiff;	
					ARX_CHECK_ULONG( fCalc );
					polyboom[i].timecreation	=	ARX_CLEAN_WARN_CAST_ULONG( fCalc );
				}

			}

			float t	=	(float)polyboom[i].timecreation + (float)polyboom[i].tolive - (float)tim;

			if ( t <= 0 ) 
			{
				polyboom[i].exist=0;
				BoomCount--;
				continue;
			}
			
			if (Project.hide & HIDE_BACKGROUND) continue;
			else
			{
				long typp	=	polyboom[i].type;
				typp		&=	~128;

				switch (typp) 
				{
					case 0:	
					tt	=	(float)t / (float)polyboom[i].tolive * 0.8f;

					IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
					EE_RT2(&ltv[0],&ltv[0]);
					EE_RT2(&ltv[1],&ltv[1]);
					EE_RT2(&ltv[2],&ltv[2]);

					for (k=0;k<polyboom[i].nbvert;k++) 
					{
						ltv[k].tu=polyboom[i].u[k];
						ltv[k].tv=polyboom[i].v[k];

						if (Project.improve) ltv[k].color=EERIERGB(tt*DIV2,0.f,0.f);
						else ltv[k].color=_EERIERGB(tt);

						ltv[k].specular=0xFF000000;
					}				

						if (Project.improve) 
						{
							SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
						}
						else  
						{
							SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
						}

						SETTC(pd3dDevice,Boom);
						ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
														&ltv[1],
														&ltv[2]);

						if(polyboom[i].nbvert&4)
						{
							EE_RT2(&ltv[3],&ltv[3]);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
															&ltv[2],
															&ltv[3]);
						}
					break;
					case 1:	// Blood
					{
						float div=1.f/(float)polyboom[i].tolive;
						tt=(float)t*div;
						float tr = tt * 2 - 0.5f; 

						if (tr<1.f) tr=1.f;

						D3DCOLOR col=EERIERGB(polyboom[i].rgb.r*tt,polyboom[i].rgb.g*tt,polyboom[i].rgb.b*tt);

						for (k=0;k<polyboom[i].nbvert;k++) 
						{
							ltv[k].tu=(polyboom[i].u[k]-0.5f)*(tr)+0.5f;
							ltv[k].tv=(polyboom[i].v[k]-0.5f)*(tr)+0.5f;
							ltv[k].color=col;
							ltv[k].specular=0xFF000000;
						}	


							IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
							EE_RT2(&ltv[0],&ltv[0]);							
							EE_RT2(&ltv[1],&ltv[1]);							
							EE_RT2(&ltv[2],&ltv[2]);

							if(polyboom[i].nbvert&4)
							{
								EE_RT2(&ltv[3],&ltv[3]);							
							}							

								
							{
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_CLAMP);
								SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
							SETTC(pd3dDevice, polyboom[i].tc); 

 									ARX_DrawPrimitive_SoftClippZ(		&ltv[0],
 																		&ltv[1],
 																		&ltv[2]);

 									if(polyboom[i].nbvert&4)
 									{
  										ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
  																		&ltv[2],
 																		&ltv[3]);
									}


								col=_EERIERGB(tt);
								ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=col;								
								
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);

									ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
																	&ltv[1],
																	&ltv[2]);

									if(polyboom[i].nbvert&4)
									{
										ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
																		&ltv[2],
																		&ltv[3]);
									}
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_WRAP);
							}
						}
					break;				
					case 2: // WATER
					{
						float div=1.f/(float)polyboom[i].tolive;
						tt=(float)t*div;
						float tr = (tt * 2 - 0.5f); 

						if (tr<1.f) tr=1.f;			

						float ttt=tt*0.5f;
						D3DCOLOR col=EERIERGB(	polyboom[i].rgb.r*ttt,
												polyboom[i].rgb.g*ttt,
												polyboom[i].rgb.b*ttt);

						for (k=0;k<polyboom[i].nbvert;k++) 
						{
							ltv[k].tu=(polyboom[i].u[k]-0.5f)*(tr)+0.5f;
							ltv[k].tv=(polyboom[i].v[k]-0.5f)*(tr)+0.5f;
							ltv[k].color=col;
							ltv[k].specular=0xFF000000;
						}	

						if (	(ltv[0].tu<0.f)
							&&	(ltv[1].tu<0.f)
							&&	(ltv[2].tu<0.f)
							&&	(ltv[3].tu<0.f) )
							break;

						if (	(ltv[0].tv<0.f)
							&&	(ltv[1].tv<0.f)
							&&	(ltv[2].tv<0.f)
							&&	(ltv[3].tv<0.f) )
							break;

						if (	(ltv[0].tu>1.f)
							&&	(ltv[1].tu>1.f)
							&&	(ltv[2].tu>1.f)
							&&	(ltv[3].tu>1.f) )
							break;

						if (	(ltv[0].tv>1.f)
							&&	(ltv[1].tv>1.f)
							&&	(ltv[2].tv>1.f)
							&&	(ltv[3].tv>1.f) )
							break;

							IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
							EE_RT2(&ltv[0],&ltv[0]);
							EE_RT2(&ltv[1],&ltv[1]);
							EE_RT2(&ltv[2],&ltv[2]);
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_CLAMP);
								SETBLENDMODE(pd3dDevice,D3DBLEND_INVDESTCOLOR,D3DBLEND_ONE);
						SETTC(pd3dDevice, polyboom[i].tc); 
				
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
																&ltv[1],
																&ltv[2]);

								if(polyboom[i].nbvert&4)
								{
									EE_RT2(&ltv[3],&ltv[3]);
									ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
																	&ltv[2],
																	&ltv[3]);
								}

						SETTEXTUREWRAPMODE(pd3dDevice, D3DTADDRESS_WRAP);
								
							}
					break;
				}
			}			
		}	
	}

	SetZBias(pd3dDevice,0);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,ulBKGColor);
}
Пример #7
0
//-----------------------------------------------------------------------------
void DrawArcElectrique(LPDIRECT3DDEVICE7 m_pd3dDevice, EERIE_3D * tabdef, int nbseg, TextureContainer * tex, float fBeta, int tsp)
{
	D3DTLVERTEX v[4];
	D3DTLVERTEX v2[4];

	long i;

	//-------------------------------------------------------------------------
	// rendu
	//	SETTC(m_pd3dDevice,NULL);
	SETCULL(m_pd3dDevice, D3DCULL_NONE);

	if (tex && tex->m_pddsSurface)
	{
		SETTC(m_pd3dDevice, tex);
	}

	v2[0].color = v2[1].color = v2[2].color = v2[3].color = RGBA_MAKE(tsp, tsp, tsp, 255);

	float xx;
	float zz;

	for (i = 0; i < nbseg - 2; i++)
	{
		EERIE_3D astart;

		astart.x = tabdef[i].x;
		astart.y = tabdef[i].y;
		astart.z = tabdef[i].z;

		zz = 5; // size
		xx = (float)(5 * cos(DEG2RAD(fBeta)));

		float ax = tabdef[i+1].x;
		float ay = tabdef[i+1].y;
		float az = tabdef[i+1].z;

		// version 2 faces
		v2[0].tu = 0;
		v2[0].tv = 0;
		v2[1].tu = 1;
		v2[1].tv = 0;
		v2[2].tu = 1;
		v2[2].tv = 1;
		v2[3].tu = 0;
		v2[3].tv = 1;

		v[0].sx = astart.x;
		v[0].sy = astart.y + zz;
		v[0].sz = astart.z;

		v[1].sx = astart.x;
		v[1].sy = astart.y - zz;
		v[1].sz = astart.z;

		v[2].sx = ax;
		v[2].sy = ay - zz;
		v[2].sz = az;

		v[3].sx = ax;
		v[3].sy = ay + zz;
		v[3].sz = az;

		EE_RT2(&v[0], &v2[0]);
		EE_RT2(&v[1], &v2[1]);
		EE_RT2(&v[2], &v2[2]);
		EE_RT2(&v[3], &v2[3]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[1],
		                             &v2[2]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[2],
		                             &v2[3]);

		zz *= (float) sin(DEG2RAD(fBeta));

		v[0].sx = astart.x + xx;
		v[0].sy = astart.y;
		v[0].sz = astart.z + zz;

		v[1].sx = astart.x - xx;
		v[1].sy = astart.y;
		v[1].sz = astart.z - zz;

		v[2].sx = ax - xx;
		v[2].sy = ay;
		v[2].sz = az - zz;

		v[3].sx = ax + xx;
		v[3].sy = ay;
		v[3].sz = az + zz;

		EE_RT2(&v[0], &v2[0]);
		EE_RT2(&v[1], &v2[1]);
		EE_RT2(&v[2], &v2[2]);
		EE_RT2(&v[3], &v2[3]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[1],
		                             &v2[2]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[2],
		                             &v2[3]);
	}
}
Пример #8
0
//***********************************************************************************************
// hum... to be checked again for performance and result quality.
//-----------------------------------------------------------------------------------------------
// VERIFIED (Cyril 2001/10/15)
//***********************************************************************************************
void ARXDRAW_DrawInterShadows(LPDIRECT3DDEVICE7 pd3dDevice)
{	
	bool bNoVB						=	false;
	if( bSoftRender )
	{
		bNoVB						=	GET_FORCE_NO_VB();
		SET_FORCE_NO_VB( true );
	}

	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,0);
	SetZBias(pd3dDevice,1);

	long k;
	long first=1;
	
	for (long i=0;i<TREATZONE_CUR;i++) 
	{
		if ((treatio[i].show!=1) || (treatio[i].io==NULL)) continue;

		INTERACTIVE_OBJ * io=treatio[i].io;

		if (	(!io->obj) 
			||	(io->ioflags & IO_JUST_COLLIDE)	)
		{
			continue;
		}

			if ((Project.hide & HIDE_NPC) &&  (io->ioflags & IO_NPC)) continue;

			if ((Project.hide & HIDE_ITEMS) &&  (io->ioflags & IO_ITEM)) continue;

			if ((Project.hide & HIDE_FIXINTER) && (io->ioflags & IO_FIX)) continue;

			long xx,yy;
			F2L((io->pos.x)*ACTIVEBKG->Xmul,&xx);
			F2L((io->pos.z)*ACTIVEBKG->Zmul,&yy);

			if ( (xx>=1) && (yy>=1) && (xx<ACTIVEBKG->Xsize-1) && (yy<ACTIVEBKG->Zsize-1) )
			{
				FAST_BKG_DATA * feg=(FAST_BKG_DATA *)&ACTIVEBKG->fastdata[xx][yy];

				if(!feg->treat) continue;
			}

			if (!( io->ioflags & IO_NOSHADOW ) )
			if ( io->show==SHOW_FLAG_IN_SCENE ) 
			if ( !(io->ioflags & IO_GOLD) ) 
			{
				register EERIEPOLY * ep;
				D3DTLVERTEX in;			
				
				D3DTLVERTEX ltv[4];
				ltv[0]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.3f, 0.3f) ;
				ltv[1]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.7f, 0.3f) ;
				ltv[2]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.7f, 0.7f) ;		
				ltv[3]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.3f, 0.7f) ;
				
				float s1=16.f*io->scale;
				float s2=s1 * DIV2;	

				if (io->obj->nbgroups<=1)
				{
					for (k=0;k<io->obj->nbvertex;k+=9)
					{
						ep=EECheckInPoly(&io->obj->vertexlist3[k].v);

						if (ep!=NULL)
						{
							in.sy=ep->min.y-3.f;
							float r=0.5f-((float)EEfabs(io->obj->vertexlist3[k].v.y-in.sy))*DIV500;
							r-=io->invisibility;
							r*=io->scale;

							if (r<=0.f) continue;
							
							in.sx=io->obj->vertexlist3[k].v.x-s2;						
							in.sz=io->obj->vertexlist3[k].v.z-s2;

							long lv;
							r*=255.f;
							F2L(r,&lv);
							ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=0xFF000000 | lv<<16 | lv<<8 | lv;
							
							if (first)
							{
								first=0;
								SETZWRITE(pd3dDevice, FALSE );
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
								SETALPHABLEND(pd3dDevice,TRUE);
								SETTC(pd3dDevice,Boom);
							}

							EE_RT2(&in,&ltv[0]);
							in.sx+=s1;
							EE_RT2(&in,&ltv[1]);
							in.sz+=s1;
							EE_RT2(&in,&ltv[2]);
							in.sx-=s1;
							EE_RT2(&in,&ltv[3]);

							if ((ltv[0].sz>0.f) && (ltv[1].sz>0.f) && (ltv[2].sz>0.f))
							{
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[1],
															&ltv[2],
															50.f);
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[2],
															&ltv[3],
															50.f);
							}
						}
					}	
				}
				else 
				{
					for (k=0;k<io->obj->nbgroups;k++)
					{
						long origin=io->obj->grouplist[k].origin;
						ep=EECheckInPoly(	&io->obj->vertexlist3[origin].v );

						if (ep!=NULL)
						{
							in.sy=ep->min.y-3.f;
							float r=0.8f-((float)EEfabs(io->obj->vertexlist3[origin].v.y-in.sy))*DIV500;
							r*=io->obj->grouplist[k].siz;
							r-=io->invisibility;

							if (r<=0.f) continue;

							float s1=io->obj->grouplist[k].siz*44.f;
							float s2=s1*DIV2;
							in.sx=io->obj->vertexlist3[origin].v.x-s2;						
							in.sz=io->obj->vertexlist3[origin].v.z-s2;

							long lv;
							r*=255.f;
							F2L(r,&lv);						
							ltv[0].color=	ltv[1].color	=	ltv[2].color	=	ltv[3].color	=	0xFF000000 | lv<<16 | lv<<8 | lv;

							if (first)
							{
								first=0;
								SETZWRITE(pd3dDevice, FALSE );
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
								SETALPHABLEND(pd3dDevice,TRUE);
								SETTC(pd3dDevice,Boom);
							}

							EE_RT2(&in,&ltv[0]);
							in.sx+=s1;
							EE_RT2(&in,&ltv[1]);
							in.sz+=s1;
							EE_RT2(&in,&ltv[2]);
							in.sx-=s1;
							EE_RT2(&in,&ltv[3]);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[1],
															&ltv[2],
															50.f);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[2],
															&ltv[3],
															50.f);
						}
					}
				}
			}
		
		}

	SETALPHABLEND(pd3dDevice,FALSE);
	SETZWRITE(pd3dDevice, TRUE );
	SetZBias(pd3dDevice,0);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,ulBKGColor);
	
	if( bSoftRender ) SET_FORCE_NO_VB( bNoVB );
}
Пример #9
0
//-----------------------------------------------------------------------------
void Draw3DLineTex2(Vec3f s, Vec3f e, float fSize, Color color, Color color2) {
	
	float fBeta = MAKEANGLE(player.angle.b);
	float zz = fSize; 
	float xx = (float)(fSize * cos(radians(fBeta)));

	TexturedVertex v[4];
	TexturedVertex v2[4];

	v2[0].color = v2[1].color = color.toBGRA();
	v2[2].color = v2[3].color = color2.toBGRA();

	// version 2 faces
	v2[0].uv.x = 0;
	v2[0].uv.y = 0;
	v2[1].uv.x = 1;
	v2[1].uv.y = 0;
	v2[2].uv.x = 1;
	v2[2].uv.y = 1;
	v2[3].uv.x = 0;
	v2[3].uv.y = 1;

	v[0].p.x = s.x;
	v[0].p.y = s.y + zz;
	v[0].p.z = s.z;

	v[1].p.x = s.x;
	v[1].p.y = s.y - zz;
	v[1].p.z = s.z;

	v[2].p.x = e.x;
	v[2].p.y = e.y - zz;
	v[2].p.z = e.z;

	v[3].p.x = e.x;
	v[3].p.y = e.y + zz;
	v[3].p.z = e.z;

	EE_RT2(&v[0], &v2[0]);
	EE_RT2(&v[1], &v2[1]);
	EE_RT2(&v[2], &v2[2]);
	EE_RT2(&v[3], &v2[3]);
	ARX_DrawPrimitive(&v2[0],
	                             &v2[1],
	                             &v2[3]);
	ARX_DrawPrimitive(&v2[1],
	                             &v2[2],
	                             &v2[3]);


	zz *= (float) sin(radians(fBeta));

	v[0].p.x = s.x + xx;
	v[0].p.y = s.y;
	v[0].p.z = s.z + zz;

	v[1].p.x = s.x - xx;
	v[1].p.y = s.y;
	v[1].p.z = s.z - zz;

	v[2].p.x = e.x - xx;
	v[2].p.y = e.y;
	v[2].p.z = e.z - zz;

	v[3].p.x = e.x + xx;
	v[3].p.y = e.y;
	v[3].p.z = e.z + zz;

	EE_RT2(&v[0], &v2[0]);
	EE_RT2(&v[1], &v2[1]);
	EE_RT2(&v[2], &v2[2]);
	EE_RT2(&v[3], &v2[3]);
	ARX_DrawPrimitive(&v2[0],
	                             &v2[1],
	                             &v2[3]);
	ARX_DrawPrimitive(&v2[1],
	                             &v2[2],
	                             &v2[3]);
}
Пример #10
0
//-----------------------------------------------------------------------------
void CSummonCreature::RenderFissure(LPDIRECT3DDEVICE7 m_pd3dDevice)
{
    int i;
    float ff;
    D3DTLVERTEX vt[4];
    D3DTLVERTEX vr[4];
    D3DTLVERTEX target;

    EERIE_3D etarget;
    etarget.x = fBetaRadCos;
    etarget.y = 0;
    etarget.z = fBetaRadSin;

    //-------------------------------------------------------------------------
    // computation des sommets
    float fTempCos, fTempSin;

    for (i = 0; i <= min(end, int(fSizeIntro)); i++)
    {
        if (i <= end * 0.5f)
        {
            ff = i / (end * 0.5f);
        }
        else
        {
            ff = 1.0f - ((i - (end + 1) * 0.5f) / (end * 0.5f));
        }

        fTempCos = ff * fBetaRadCos;
        fTempSin = ff * fBetaRadSin;

        va[i].sx   = v1a[i].sx   + sizeF * fTempCos;
        va[i].sy   = v1a[i].sy;
        va[i].sz   = v1a[i].sz   + sizeF * fTempSin;

        vb[i].sx   = v1b[i].sx   - sizeF * fTempCos;
        vb[i].sy   = v1b[i].sy;
        vb[i].sz   = v1b[i].sz   - sizeF * fTempSin;

        va[i].sx += rnd() * 0.5f * fTempCos;
        va[i].sz += rnd() * 0.5f * fTempSin;
        vb[i].sx -= rnd() * 0.5f * fTempCos;
        vb[i].sz -= rnd() * 0.5f * fTempSin;
    }

    //-------------------------------------------------------------------------
    // rendu de la fissure
    SETALPHABLEND(m_pd3dDevice, false);
    vr[0].color = vr[1].color = vr[2].color = vr[3].color = D3DRGB(0, 0, 0);

    if (bIntro)
    {
        for (i = 0; i < min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&v1a[i], &vr[0]);
            EE_RT2(&v1b[i], &vr[1]);
            EE_RT2(&v1a[i+1], &vr[2]);
            EE_RT2(&v1b[i+1], &vr[3]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }
    }
    else
    {
        for (i = 0; i < min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&va[i], &vr[0]);
            EE_RT2(&vb[i], &vr[1]);
            EE_RT2(&va[i+1], &vr[2]);
            EE_RT2(&vb[i+1], &vr[3]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }
    }

    //-------------------------------------------------------------------------
    // rendu de la bordure
    SETALPHABLEND(m_pd3dDevice, true);
    vr[0].color = vr[1].color = D3DRGB(0, 0, 0);
    vr[2].color = vr[3].color = D3DRGB(fColorBorder[0], fColorBorder[1], fColorBorder[2]);

    for (i = 0; i < min(end, (int)fSizeIntro); i++)
    {
        vt[2].sx = va[i].sx   - (va[i].sx - eSrc.x) * 0.2f;
        vt[2].sy = va[i].sy   - (va[i].sy - eSrc.y) * 0.2f;
        vt[2].sz = va[i].sz   - (va[i].sz - eSrc.z) * 0.2f;
        vt[3].sx = va[i+1].sx - (va[i+1].sx - eSrc.x) * 0.2f;
        vt[3].sy = va[i+1].sy - (va[i+1].sy - eSrc.y) * 0.2f;
        vt[3].sz = va[i+1].sz - (va[i+1].sz - eSrc.z) * 0.2f;

        EE_RT2(&vt[3], &vr[0]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&va[i+1], &vr[2]);
        EE_RT2(&va[i], &vr[3]);
        ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                     &vr[1],
                                     &vr[2]);
        ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                     &vr[2],
                                     &vr[3]);

        vt[2].sx = vb[i].sx   - (vb[i].sx - eSrc.x) * 0.2f;
        vt[2].sy = vb[i].sy   - (vb[i].sy - eSrc.y) * 0.2f;
        vt[2].sz = vb[i].sz   - (vb[i].sz - eSrc.z) * 0.2f;
        vt[3].sx = vb[i+1].sx - (vb[i+1].sx - eSrc.x) * 0.2f;
        vt[3].sy = vb[i+1].sy - (vb[i+1].sy - eSrc.y) * 0.2f;
        vt[3].sz = vb[i+1].sz - (vb[i+1].sz - eSrc.z) * 0.2f;

        EE_RT2(&vb[i], &vr[3]);
        EE_RT2(&vb[i+1], &vr[2]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&vt[3], &vr[0]);
        ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                     &vr[1],
                                     &vr[2]);
        ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                     &vr[2],
                                     &vr[3]);

    }

    //-------------------------------------------------------------------------
    // rendu des faisceaux
    // blend additif ou mul
    // smooth sur les cot�s ou pas ..
    // texture sympa avec glow au milieu ou uv wrap
    SETALPHABLEND(m_pd3dDevice, true);

    if (tex_light && tex_light->m_pddsSurface)
    {
        SETTEXTUREWRAPMODE(m_pd3dDevice, D3DTADDRESS_MIRROR);
        SETTC(m_pd3dDevice, tex_light);
    }

    target.sx = eSrc.x + -fBetaRadSin * (1.5f * sizeF);
    target.sy = eSrc.y;
    target.sz = eSrc.z + fBetaRadCos * (1.5f * sizeF);

    EE_RTP(&vt[1], &vr[0]);
    vr[0].color = D3DRGB(fColorRays1[0], fColorRays1[1], fColorRays1[2]);
    vr[1].color = D3DRGB(fColorRays1[0], fColorRays1[1], fColorRays1[2]);
    vr[2].color = D3DRGB(fColorRays2[0], fColorRays2[1], fColorRays2[2]);
    vr[3].color = D3DRGB(fColorRays2[0], fColorRays2[1], fColorRays2[2]);

    vr[0].tu = fTexWrap;
    vr[0].tv = 1;
    vr[1].tu = 1.0f + fTexWrap;
    vr[1].tv = 1;
    vr[2].tu = fTexWrap;
    vr[2].tv = 0;
    vr[3].tu = 1.0f + fTexWrap;
    vr[3].tv = 0;

    for (i = 0; i < end - 1; i++)
    {
        if (i < fSizeIntro)
        {
            vt[0].sx = va[i].sx;
            vt[0].sy = va[i].sy;
            vt[0].sz = va[i].sz;
            vt[1].sx = va[i+1].sx;
            vt[1].sy = va[i+1].sy;
            vt[1].sz = va[i+1].sz;
            vt[2].sx = va[i].sx + (va[i].sx - target.sx) * 2;
            vt[2].sy = va[i].sy + (va[i].sy - target.sy) * 2;
            vt[2].sz = va[i].sz + (va[i].sz - target.sz) * 2;
            vt[3].sx = va[i+1].sx + (va[i+1].sx - target.sx) * 2;
            vt[3].sy = va[i+1].sy + (va[i+1].sy - target.sy) * 2;
            vt[3].sz = va[i+1].sz + (va[i+1].sz - target.sz) * 2;

            vr[0].color = D3DRGB(tfRaysa[i] * fColorRays1[0],   tfRaysa[i] * fColorRays1[1],   tfRaysa[i] * fColorRays1[2]);
            vr[1].color = D3DRGB(tfRaysa[i+1] * fColorRays1[0], tfRaysa[i+1] * fColorRays1[1], tfRaysa[i+1] * fColorRays1[2]);
            vr[2].color = D3DRGB(tfRaysa[i] * fColorRays2[0],   tfRaysa[i] * fColorRays2[1],   tfRaysa[i] * fColorRays2[2]);
            vr[3].color = D3DRGB(tfRaysa[i+1] * fColorRays2[0], tfRaysa[i+1] * fColorRays2[1], tfRaysa[i+1] * fColorRays2[2]);

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }

        if (i < fSizeIntro)
        {
            vt[0].sx = vb[i+1].sx;
            vt[0].sy = vb[i+1].sy;
            vt[0].sz = vb[i+1].sz;
            vt[1].sx = vb[i].sx;
            vt[1].sy = vb[i].sy;
            vt[1].sz = vb[i].sz;
            vt[2].sx = vb[i+1].sx + (vb[i+1].sx - target.sx) * 2;
            vt[2].sy = vb[i+1].sy + (vb[i+1].sy - target.sy) * 2;
            vt[2].sz = vb[i+1].sz + (vb[i+1].sz - target.sz) * 2;
            vt[3].sx = vb[i].sx + (vb[i].sx - target.sx) * 2;
            vt[3].sy = vb[i].sy + (vb[i].sy - target.sy) * 2;
            vt[3].sz = vb[i].sz + (vb[i].sz - target.sz) * 2;

            vr[0].color = D3DRGB(tfRaysb[i] * fColorRays1[0],   tfRaysb[i] * fColorRays1[1],   tfRaysb[i] * fColorRays1[2]);
            vr[1].color = D3DRGB(tfRaysb[i+1] * fColorRays1[0], tfRaysb[i+1] * fColorRays1[1], tfRaysb[i+1] * fColorRays1[2]);
            vr[2].color = D3DRGB(tfRaysb[i] * fColorRays2[0],   tfRaysb[i] * fColorRays2[1],   tfRaysb[i] * fColorRays2[2]);
            vr[3].color = D3DRGB(tfRaysb[i+1] * fColorRays2[0], tfRaysb[i+1] * fColorRays2[1], tfRaysb[i+1] * fColorRays2[2]);

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }

    }
}
Пример #11
0
void ARXDRAW_DrawInterShadows()
{	
	GRenderer->SetFogColor(Color::none);
	SetZBias(1);

	long first=1;
	
	for(long i=0; i<TREATZONE_CUR; i++) {
		if(treatio[i].show != 1 || !treatio[i].io)
			continue;

		Entity *io = treatio[i].io;

		if(!io->obj || (io->ioflags & IO_JUST_COLLIDE))
			continue;


		FAST_BKG_DATA * bkgData = getFastBackgroundData(io->pos.x, io->pos.z);
		if(bkgData && !bkgData->treat) { //TODO is that correct ?
			continue;
		}

		if(!(io->ioflags & IO_NOSHADOW) && io->show==SHOW_FLAG_IN_SCENE && !(io->ioflags & IO_GOLD)) {
			TexturedVertex in;

			TexturedVertex ltv[4];
			ltv[0] = TexturedVertex(Vec3f(0, 0, 0.001f), 1.f, 0, 1, Vec2f(0.3f, 0.3f));
			ltv[1] = TexturedVertex(Vec3f(0, 0, 0.001f), 1.f, 0, 1, Vec2f(0.7f, 0.3f));
			ltv[2] = TexturedVertex(Vec3f(0, 0, 0.001f), 1.f, 0, 1, Vec2f(0.7f, 0.7f));
			ltv[3] = TexturedVertex(Vec3f(0, 0, 0.001f), 1.f, 0, 1, Vec2f(0.3f, 0.7f));

			if(io->obj->nbgroups <= 1) {
				for(size_t k=0; k < io->obj->vertexlist.size(); k += 9) {
					EERIEPOLY *ep = EECheckInPoly(&io->obj->vertexlist3[k].v);

					if(ep) {
						in.p.y=ep->min.y-3.f;
						float r=0.5f-((float)EEfabs(io->obj->vertexlist3[k].v.y-in.p.y))*( 1.0f / 500 );
						r-=io->invisibility;
						r*=io->scale;

						if(r<=0.f)
							continue;

						float s1=16.f*io->scale;
						float s2=s1*( 1.0f / 2 );
						in.p.x=io->obj->vertexlist3[k].v.x-s2;
						in.p.z=io->obj->vertexlist3[k].v.z-s2;

						r*=255.f;
						long lv = r;
						ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=0xFF000000 | lv<<16 | lv<<8 | lv;

						if(first) {
							first=0;
							GRenderer->SetRenderState(Renderer::DepthWrite, false);
							GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor);
							GRenderer->SetRenderState(Renderer::AlphaBlending, true);
							GRenderer->SetTexture(0, Boom);
						}

						EE_RT2(&in,&ltv[0]);
						in.p.x+=s1;
						EE_RT2(&in,&ltv[1]);
						in.p.z+=s1;
						EE_RT2(&in,&ltv[2]);
						in.p.x-=s1;
						EE_RT2(&in,&ltv[3]);

						if(ltv[0].p.z > 0.f && ltv[1].p.z > 0.f && ltv[2].p.z > 0.f) {
							ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2], 50.0f);
							ARX_DrawPrimitive(&ltv[0], &ltv[2], &ltv[3], 50.0f);
						}
					}
				}
			} else {
				for(long k = 0; k < io->obj->nbgroups; k++) {
					long origin=io->obj->grouplist[k].origin;
					EERIEPOLY *ep = EECheckInPoly(&io->obj->vertexlist3[origin].v);

					if(ep) {
						in.p.y=ep->min.y-3.f;
						float r=0.8f-((float)EEfabs(io->obj->vertexlist3[origin].v.y-in.p.y))*( 1.0f / 500 );
						r*=io->obj->grouplist[k].siz;
						r-=io->invisibility;

						if(r<=0.f)
							continue;

						float s1=io->obj->grouplist[k].siz*44.f;
						float s2=s1*( 1.0f / 2 );
						in.p.x=io->obj->vertexlist3[origin].v.x-s2;
						in.p.z=io->obj->vertexlist3[origin].v.z-s2;

						r*=255.f;
						long lv = r;
						ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=0xFF000000 | lv<<16 | lv<<8 | lv;

						if(first) {
							first=0;
							GRenderer->SetRenderState(Renderer::DepthWrite, false);
							GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor);
							GRenderer->SetRenderState(Renderer::AlphaBlending, true);
							GRenderer->SetTexture(0, Boom);
						}

						EE_RT2(&in,&ltv[0]);
						in.p.x+=s1;
						EE_RT2(&in,&ltv[1]);
						in.p.z+=s1;
						EE_RT2(&in,&ltv[2]);
						in.p.x-=s1;
						EE_RT2(&in,&ltv[3]);

						ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2]);
						ARX_DrawPrimitive(&ltv[0], &ltv[2], &ltv[3]);
					}
				}
			}
		}

	}

	GRenderer->SetRenderState(Renderer::AlphaBlending, false);
	GRenderer->SetRenderState(Renderer::DepthWrite, true);
	SetZBias(0);
	GRenderer->SetFogColor(ulBKGColor);
}
Пример #12
0
void ARXDRAW_DrawPolyBoom()
{
	TexturedVertex ltv[4];

	SetZBias(8);
	GRenderer->SetFogColor(Color::none);
	unsigned long tim = (unsigned long)(arxtime);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);

	std::vector<POLYBOOM>::iterator pb = polyboom.begin();
	while (pb != polyboom.end()) {

		if(pb->type & 128) {
			if(pb->timecreation - framedelay > 0) {
				float fCalc = pb->timecreation - framedelay;
				pb->timecreation = checked_range_cast<unsigned long>(fCalc);
			}

			if(pb->timecreation - framedelay > 0) {
				float fCalc =  pb->timecreation - framedelay;
				pb->timecreation = checked_range_cast<unsigned long>(fCalc);
			}
		}

		float t = (float)pb->timecreation + (float)pb->tolive - (float)tim;

		if(t <= 0) {
			pb = polyboom.erase(pb);
			continue;
		}

		long typp = pb->type;
		typp &= ~128;

		switch(typp) {
		case 0:
		{
			float tt = t / (float)pb->tolive * 0.8f;

			IncrementPolyWithNormalOutput(pb->ep,ltv);
			EE_RT2(&ltv[0],&ltv[0]);
			EE_RT2(&ltv[1],&ltv[1]);
			EE_RT2(&ltv[2],&ltv[2]);

			for(long k = 0; k < pb->nbvert; k++) {
				ltv[k].uv.x=pb->u[k];
				ltv[k].uv.y=pb->v[k];
				ltv[k].color = (Project.improve ? (Color3f::red * (tt*.5f)) : Color3f::gray(tt)).toBGR();
				ltv[k].specular = Color::black.toBGR();
			}

			if(Project.improve) {
				GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
			} else {
				GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor);
			}

			GRenderer->SetTexture(0, Boom);
			ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2]);

			if(pb->nbvert & 4) {
				EE_RT2(&ltv[3],&ltv[3]);
				ARX_DrawPrimitive(&ltv[1], &ltv[2], &ltv[3]);
			}
		}
		break;
		case 1:	// Blood
		{
			float div=1.f/(float)pb->tolive;
			float tt=(float)t*div;
			float tr = tt * 2 - 0.5f;

			if(tr < 1.f)
				tr = 1.f;

			ColorBGRA col = (pb->rgb * tt).toBGR();

			for(long k = 0; k < pb->nbvert; k++) {
				ltv[k].uv.x=(pb->u[k]-0.5f)*(tr)+0.5f;
				ltv[k].uv.y=(pb->v[k]-0.5f)*(tr)+0.5f;
				ltv[k].color=col;
				ltv[k].specular=0xFF000000;
			}

			IncrementPolyWithNormalOutput(pb->ep,ltv);
			EE_RT2(&ltv[0],&ltv[0]);
			EE_RT2(&ltv[1],&ltv[1]);
			EE_RT2(&ltv[2],&ltv[2]);

			if(pb->nbvert & 4) {
				EE_RT2(&ltv[3],&ltv[3]);
			}

			GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapClamp);
			GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
			GRenderer->SetTexture(0, pb->tc);

			ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2]);

			if(pb->nbvert & 4) {
				ARX_DrawPrimitive(&ltv[1], &ltv[2], &ltv[3]);
			}

			ltv[0].color = ltv[1].color = ltv[2].color = ltv[3].color = Color::gray(tt).toBGR();

			GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor);

			ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2]);

			if(pb->nbvert & 4) {
				ARX_DrawPrimitive(&ltv[1], &ltv[2], &ltv[3]);
			}

			GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapRepeat);
		}
		break;
		case 2: // WATER
		{
			float div=1.f/(float)pb->tolive;
			float tt=(float)t*div;
			float tr = (tt * 2 - 0.5f);

			if (tr<1.f) tr=1.f;

			float ttt=tt*0.5f;
			ColorBGRA col = (pb->rgb * ttt).toBGR();

			for(long k = 0; k < pb->nbvert; k++) {
				ltv[k].uv.x=(pb->u[k]-0.5f)*(tr)+0.5f;
				ltv[k].uv.y=(pb->v[k]-0.5f)*(tr)+0.5f;
				ltv[k].color=col;
				ltv[k].specular=0xFF000000;
			}

			if (	(ltv[0].uv.x<0.f)
				&&	(ltv[1].uv.x<0.f)
				&&	(ltv[2].uv.x<0.f)
				&&	(ltv[3].uv.x<0.f) )
				break;

			if (	(ltv[0].uv.y<0.f)
				&&	(ltv[1].uv.y<0.f)
				&&	(ltv[2].uv.y<0.f)
				&&	(ltv[3].uv.y<0.f) )
				break;

			if (	(ltv[0].uv.x>1.f)
				&&	(ltv[1].uv.x>1.f)
				&&	(ltv[2].uv.x>1.f)
				&&	(ltv[3].uv.x>1.f) )
				break;

			if (	(ltv[0].uv.y>1.f)
				&&	(ltv[1].uv.y>1.f)
				&&	(ltv[2].uv.y>1.f)
				&&	(ltv[3].uv.y>1.f) )
				break;

			IncrementPolyWithNormalOutput(pb->ep,ltv);
			EE_RT2(&ltv[0],&ltv[0]);
			EE_RT2(&ltv[1],&ltv[1]);
			EE_RT2(&ltv[2],&ltv[2]);

			GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapClamp);
			GRenderer->SetBlendFunc(Renderer::BlendInvDstColor, Renderer::BlendOne);
			GRenderer->SetTexture(0, pb->tc);

			ARX_DrawPrimitive(&ltv[0], &ltv[1], &ltv[2]);

			if(pb->nbvert & 4) {
				EE_RT2(&ltv[3],&ltv[3]);
				ARX_DrawPrimitive(&ltv[1], &ltv[2], &ltv[3]);
			}

			GRenderer->GetTextureStage(0)->SetWrapMode(TextureStage::WrapRepeat);
		}
		break;
		}

		++ pb;
	}

	SetZBias(0);
	GRenderer->SetFogColor(ulBKGColor);
}