Exemple #1
0
static void
R_IQMPreparePoints (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame)
{
	finalvert_t *fv = pfinalverts;
	auxvert_t  *av = pauxverts;
	int         i;
	uint32_t    j;
	finalvert_t *pfv[3];

	for (i = 0; i < iqm->num_verts; i++, fv++, av++) {
		byte       *vert = iqm->vertices + i * iqm->stride;
		uint32_t    bind = *(uint32_t *) (vert + sw->bindices->offset);
		vec_t      *mat = (vec_t *) &frame[bind];
		float      *position = (float *) (vert + sw->position->offset);
		float      *normal = (float *) (vert + sw->normal->offset);
		int32_t    *texcoord = (int32_t *) (vert + sw->texcoord->offset);
		vec3_t      tv, tn;
		Mat4MultVec (mat, position, tv);
		Mat4as3MultVec (mat, normal, tn);
		av->fv[0] = DotProduct (tv, aliastransform[0]) + aliastransform[0][3];
		av->fv[1] = DotProduct (tv, aliastransform[1]) + aliastransform[1][3];
		av->fv[2] = DotProduct (tv, aliastransform[2]) + aliastransform[2][3];
		fv->v[2] = texcoord[0];
		fv->v[3] = texcoord[1];
		fv->flags = 0;
		fv->v[4] = calc_light (tn);
		R_AliasClipAndProjectFinalVert (fv, av);
	}

	for (i = 0; i < iqm->num_meshes; i++) {
		iqmmesh    *mesh = &iqm->meshes[i];
		mtriangle_t *mtri;

		iqm_setup_skin (sw, i);

		mtri = (mtriangle_t *) iqm->elements + mesh->first_triangle;
		r_affinetridesc.numtriangles = 1;
		for (j = 0; j < mesh->num_triangles; j++, mtri++) {
			pfv[0] = &pfinalverts[mtri->vertindex[0]];
			pfv[1] = &pfinalverts[mtri->vertindex[1]];
			pfv[2] = &pfinalverts[mtri->vertindex[2]];

			if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags
				& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
				continue;					// completely clipped

			if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)
				  & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) {// totally unclipped
				r_affinetridesc.pfinalverts = pfinalverts;
				r_affinetridesc.ptriangles = mtri;
				D_PolysetDraw ();
			} else {						// partially clipped
				R_AliasClipTriangle (mtri);
			}
		}
	}
}
Exemple #2
0
/*
	R_AliasPreparePoints

	General clipped case
*/
static void
R_AliasPreparePoints (void)
{
	int         i;
	stvert_t   *pstverts;
	finalvert_t *fv;
	auxvert_t  *av;
	mtriangle_t *ptri;
	finalvert_t *pfv[3];

	pstverts = (stvert_t *) ((byte *) paliashdr + paliashdr->stverts);
	r_anumverts = pmdl->numverts;
	fv = pfinalverts;
	av = pauxverts;

	if (pmdl->ident == HEADER_MDL16) {
		for (i = 0; i < r_anumverts; i++, fv++, av++, r_apverts++,
				 pstverts++) {
			R_AliasTransformFinalVert16 (av, r_apverts);
			R_AliasTransformFinalVert (fv, r_apverts, pstverts);
			R_AliasClipAndProjectFinalVert (fv, av);
		}
	} else {
		for (i = 0; i < r_anumverts; i++, fv++, av++, r_apverts++,
				 pstverts++) {
			R_AliasTransformFinalVert8 (av, r_apverts);
			R_AliasTransformFinalVert (fv, r_apverts, pstverts);
			R_AliasClipAndProjectFinalVert (fv, av);
		}
	}

	// clip and draw all triangles
	r_affinetridesc.numtriangles = 1;

	ptri = (mtriangle_t *) ((byte *) paliashdr + paliashdr->triangles);
	for (i = 0; i < pmdl->numtris; i++, ptri++) {
		pfv[0] = &pfinalverts[ptri->vertindex[0]];
		pfv[1] = &pfinalverts[ptri->vertindex[1]];
		pfv[2] = &pfinalverts[ptri->vertindex[2]];

		if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags
			& (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
			continue;					// completely clipped

		if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)
			  & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))) {	// totally unclipped
			r_affinetridesc.pfinalverts = pfinalverts;
			r_affinetridesc.ptriangles = ptri;
			D_PolysetDraw ();
		} else {						// partially clipped
			R_AliasClipTriangle (ptri);
		}
	}
}
Exemple #3
0
/*
================
R_AliasPreparePoints

General clipped case
================
*/
void R_AliasPreparePoints(void)
{
	int			i;
	stvert_t	*pstverts;
	finalvert_t	*fv;
	auxvert_t	*av;
	mtriangle_t	*ptri;
	finalvert_t	*pfv[3];

	pstverts = (stvert_t *)((byte *)paliashdr + paliashdr->stverts);
	r_anumverts = pmdl->numverts;
	fv = pfinalverts;
	av = pauxverts;

	for (i=0 ; i<r_anumverts ; i++, fv++, av++, r_apverts++, pstverts++)
	{
		R_AliasTransformFinalVert(fv, av, r_apverts, pstverts);
		if (av->fv[2] < ALIAS_Z_CLIP_PLANE)
		{
			fv->flags |= ALIAS_Z_CLIP;
		}
		else
		{
			R_AliasProjectFinalVert(fv, av);

			if (fv->v[0] < r_refdef.aliasvrect.x)
			{
				fv->flags |= ALIAS_LEFT_CLIP;
			}
			if (fv->v[1] < r_refdef.aliasvrect.y)
			{
				fv->flags |= ALIAS_TOP_CLIP;
			}
			if (fv->v[0] > r_refdef.aliasvrectright)
			{
				fv->flags |= ALIAS_RIGHT_CLIP;
			}
			if (fv->v[1] > r_refdef.aliasvrectbottom)
			{
				fv->flags |= ALIAS_BOTTOM_CLIP;
			}
		}
	}

//
// clip and draw all triangles
//
	r_affinetridesc.numtriangles = 1;

	ptri = (mtriangle_t *)((byte *)paliashdr + paliashdr->triangles);
	for (i=0 ; i<pmdl->numtris ; i++, ptri++)
	{
		pfv[0] = &pfinalverts[ptri->vertindex[0]];
		pfv[1] = &pfinalverts[ptri->vertindex[1]];
		pfv[2] = &pfinalverts[ptri->vertindex[2]];

		if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP))
		{
			continue;    // completely clipped
		}

		if (!((pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) &
				(ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP)))
		{
			// totally unclipped
			r_affinetridesc.pfinalverts = pfinalverts;
			r_affinetridesc.ptriangles = ptri;
			D_PolysetDraw();
		}
		else
		{
			// partially clipped
			R_AliasClipTriangle(ptri);
		}
	}
}
Exemple #4
0
static void
R_AliasPreparePoints (const entity_t *currententity, finalvert_t *verts, const finalvert_t *verts_max)
{
	int		i;
	dstvert_t	*pstverts;
	dtriangle_t	*ptri;
	finalvert_t	*pfv[3];

	if ((verts + s_pmdl->num_xyz) >= verts_max)
	{
		r_outofverts = true;
		return;
	}

	R_AliasTransformFinalVerts(currententity,
				   s_pmdl->num_xyz,
				   verts,	// destination for transformed verts
				   r_lastframe->verts,	// verts from the last frame
				   r_thisframe->verts	// verts from this frame
				);

	// clip and draw all triangles
	//
	pstverts = (dstvert_t *)((byte *)s_pmdl + s_pmdl->ofs_st);
	ptri = (dtriangle_t *)((byte *)s_pmdl + s_pmdl->ofs_tris);

	if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
	{
		for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
		{
			pfv[0] = &verts[ptri->index_xyz[0]];
			pfv[1] = &verts[ptri->index_xyz[1]];
			pfv[2] = &verts[ptri->index_xyz[2]];

			if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
				continue;	// completely clipped

			// insert s/t coordinates
			pfv[0]->s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
			pfv[0]->t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;

			pfv[1]->s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
			pfv[1]->t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;

			pfv[2]->s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
			pfv[2]->t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;

			if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
			{
				// totally unclipped
				R_DrawTriangle(currententity, pfv[2], pfv[1], pfv[0]);
			}
			else
			{
				R_AliasClipTriangle(currententity, pfv[2], pfv[1], pfv[0]);
			}
		}
	}
	else
	{
		for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
		{
			pfv[0] = &verts[ptri->index_xyz[0]];
			pfv[1] = &verts[ptri->index_xyz[1]];
			pfv[2] = &verts[ptri->index_xyz[2]];

			if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
				continue;	// completely clipped

			// insert s/t coordinates
			pfv[0]->s = pstverts[ptri->index_st[0]].s << SHIFT16XYZ;
			pfv[0]->t = pstverts[ptri->index_st[0]].t << SHIFT16XYZ;

			pfv[1]->s = pstverts[ptri->index_st[1]].s << SHIFT16XYZ;
			pfv[1]->t = pstverts[ptri->index_st[1]].t << SHIFT16XYZ;

			pfv[2]->s = pstverts[ptri->index_st[2]].s << SHIFT16XYZ;
			pfv[2]->t = pstverts[ptri->index_st[2]].t << SHIFT16XYZ;

			if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
			{
				// totally unclipped
				R_DrawTriangle(currententity, pfv[0], pfv[1], pfv[2]);
			}
			else
			{	// partially clipped
				R_AliasClipTriangle(currententity, pfv[0], pfv[1], pfv[2]);
			}
		}
	}
}
Exemple #5
0
/*
================
R_AliasPreparePoints

General clipped case
================
*/
static void R_AliasPreparePoints(void)
{
    int         i;
    maliasst_t  *pstverts;
    maliastri_t *ptri;
    finalvert_t *pfv[3];
    finalvert_t finalverts[MAX_ALIAS_VERTS +
                           ((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 3];
    finalvert_t *pfinalverts;

    // put work vertexes on stack, cache aligned
    pfinalverts = (finalvert_t *)
                  (((uintptr_t)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));

    R_AliasTransformFinalVerts(currentmodel->numverts, pfinalverts,
                               r_lastframe->verts, r_thisframe->verts);

// clip and draw all triangles
//
    pstverts = currentmodel->sts;
    ptri = currentmodel->tris;

    if ((currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND)) {
        for (i = 0; i < currentmodel->numtris; i++, ptri++) {
            pfv[0] = &pfinalverts[ptri->index_xyz[0]];
            pfv[1] = &pfinalverts[ptri->index_xyz[1]];
            pfv[2] = &pfinalverts[ptri->index_xyz[2]];

            if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
                continue;       // completely clipped

            // insert s/t coordinates
            pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
            pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;

            pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
            pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;

            pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
            pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;

            if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
                // totally unclipped
                aliastriangleparms.a = pfv[2];
                aliastriangleparms.b = pfv[1];
                aliastriangleparms.c = pfv[0];

                R_DrawTriangle();
            } else {
                R_AliasClipTriangle(pfv[2], pfv[1], pfv[0]);
            }
        }
    } else {
        for (i = 0; i < currentmodel->numtris; i++, ptri++) {
            pfv[0] = &pfinalverts[ptri->index_xyz[0]];
            pfv[1] = &pfinalverts[ptri->index_xyz[1]];
            pfv[2] = &pfinalverts[ptri->index_xyz[2]];

            if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
                continue;       // completely clipped

            // insert s/t coordinates
            pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
            pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;

            pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
            pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;

            pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
            pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;

            if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
                // totally unclipped
                aliastriangleparms.a = pfv[0];
                aliastriangleparms.b = pfv[1];
                aliastriangleparms.c = pfv[2];

                R_DrawTriangle();
            } else {
                // partially clipped
                R_AliasClipTriangle(pfv[0], pfv[1], pfv[2]);
            }
        }
    }
}
Exemple #6
0
/*
================
R_AliasPreparePoints

General clipped case
================
*/
static void R_AliasPreparePoints (void)
{
	int			i;
	stvert_t	*pstverts;
	finalvert_t	*fv;
	auxvert_t	*av;
	mtriangle_t	*ptri;
	finalvert_t	*pfv[3];

	pstverts = (stvert_t *)((byte *)paliashdr + paliashdr->stverts);
	r_anumverts = pmdl->numverts;
	fv = pfinalverts;
	av = pauxverts;

	for (i = 0 ; i < r_anumverts ; i++, fv++, av++, r_apverts++)
	{
		fv->flags = 0;
		R_AliasTransformFinalVert (fv, av, r_apverts);
		if (av->fv[2] < ALIAS_Z_CLIP_PLANE)
			fv->flags |= ALIAS_Z_CLIP;
		else
		{
			R_AliasProjectFinalVert (fv, av);

			if (fv->v[0] < r_refdef.aliasvrect.x)
				fv->flags |= ALIAS_LEFT_CLIP;
			if (fv->v[1] < r_refdef.aliasvrect.y)
				fv->flags |= ALIAS_TOP_CLIP;
			if (fv->v[0] > r_refdef.aliasvrectright)
				fv->flags |= ALIAS_RIGHT_CLIP;
			if (fv->v[1] > r_refdef.aliasvrectbottom)
				fv->flags |= ALIAS_BOTTOM_CLIP;
		}
	}

//
// clip and draw all triangles
//
	r_affinetridesc.numtriangles = 1;

	ptri = (mtriangle_t *)((byte *)paliashdr + paliashdr->triangles);
	for (i = 0 ; i < pmdl->numtris ; i++, ptri++)
	{
		pfv[0] = &pfinalverts[ptri->vertindex[0]];
		pfv[1] = &pfinalverts[ptri->vertindex[1]];
		pfv[2] = &pfinalverts[ptri->vertindex[2]];

		if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) )
			continue;		// completely clipped

		//jfm: fill in the triangles s and t into the finalvert
		pfv[0]->v[2] = pstverts[ptri->stindex[0]].s;
		pfv[0]->v[3] = pstverts[ptri->stindex[0]].t;
		pfv[0]->flags |= pstverts[ptri->stindex[0]].onseam;

		pfv[1]->v[2] = pstverts[ptri->stindex[1]].s;
		pfv[1]->v[3] = pstverts[ptri->stindex[1]].t;
		pfv[1]->flags |= pstverts[ptri->stindex[1]].onseam;

		pfv[2]->v[2] = pstverts[ptri->stindex[2]].s;
		pfv[2]->v[3] = pstverts[ptri->stindex[2]].t;
		pfv[2]->flags |= pstverts[ptri->stindex[2]].onseam;

		if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) )
		{	// totally unclipped
			r_affinetridesc.pfinalverts = pfinalverts;
			r_affinetridesc.ptriangles = ptri;

			if ((currententity->model->flags & EF_SPECIAL_TRANS))
				D_PolysetDrawT5 ();
			else if (currententity->drawflags & DRF_TRANSLUCENT)
				D_PolysetDrawT ();
			else if ((currententity->model->flags & EF_TRANSPARENT))
				D_PolysetDrawT2 ();
			else if ((currententity->model->flags & EF_HOLEY))
				D_PolysetDrawT3 ();
			else
				D_PolysetDraw ();
		}
		else
		{	// partially clipped
			R_AliasClipTriangle (ptri);
		}
	}
}
Exemple #7
0
void R_AliasPreparePoints (void)
{
	int			i;
	dstvert_t	*pstverts;
	dtriangle_t	*ptri;
	finalvert_t	*pfv[3];
	finalvert_t	finalverts[MAXALIASVERTS +
						((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 3];
	finalvert_t	*pfinalverts;

//PGM
	iractive = (r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE);
//	iractive = 0;
//	if(r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE)
//		iractive = 1;
//PGM

	// put work vertexes on stack, cache aligned
	pfinalverts = (finalvert_t *)
			(((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));

	aliasbatchedtransformdata.num_points = s_pmdl->num_xyz;
	aliasbatchedtransformdata.last_verts = r_lastframe->verts;
	aliasbatchedtransformdata.this_verts = r_thisframe->verts;
	aliasbatchedtransformdata.dest_verts = pfinalverts;

	R_AliasTransformFinalVerts( aliasbatchedtransformdata.num_points,
		                        aliasbatchedtransformdata.dest_verts,
								aliasbatchedtransformdata.last_verts,
								aliasbatchedtransformdata.this_verts );

// clip and draw all triangles
//
	pstverts = (dstvert_t *)((byte *)s_pmdl + s_pmdl->ofs_st);
	ptri = (dtriangle_t *)((byte *)s_pmdl + s_pmdl->ofs_tris);

	if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
	{
		for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
		{
			pfv[0] = &pfinalverts[ptri->index_xyz[0]];
			pfv[1] = &pfinalverts[ptri->index_xyz[1]];
			pfv[2] = &pfinalverts[ptri->index_xyz[2]];

			if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
				continue;		// completely clipped

			// insert s/t coordinates
			pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
			pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;

			pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
			pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;

			pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
			pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;

			if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
			{	// totally unclipped
				aliastriangleparms.a = pfv[2];
				aliastriangleparms.b = pfv[1];
				aliastriangleparms.c = pfv[0];

				R_DrawTriangle();
			}
			else
			{
				R_AliasClipTriangle (pfv[2], pfv[1], pfv[0]);
			}
		}
	}
	else
	{
#ifdef RAPTOR_RAYTRACE
	    int num_light_triangles_pushed=0;
	    vec3_t centre = {0,0,0};
        float scale = (sin(r_newrefdef.time*7)+1)/2.0f; // For pulsating light
#endif
        for (i=0 ; i<s_pmdl->num_tris ; i++, ptri++)
		{
            pfv[0] = &pfinalverts[ptri->index_xyz[0]];
			pfv[1] = &pfinalverts[ptri->index_xyz[1]];
			pfv[2] = &pfinalverts[ptri->index_xyz[2]];

#ifndef RAPTOR_RAYTRACE
			if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
				continue;		// completely clipped
#endif//RAPTOR_RAYTRACE

			// insert s/t coordinates
			pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
			pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;

			pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
			pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;

			pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
			pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;

			if (1)//! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
			{	// totally unclipped
				aliastriangleparms.a = pfv[0];
				aliastriangleparms.b = pfv[1];
				aliastriangleparms.c = pfv[2];

#ifdef RAPTOR_RAYTRACE
{
                int index;
                float local[3][3];

                for (index=0; index<3; ++index)
                {
                    local[index][0] =  pfv[index]->xyz[0];
                    local[index][1] = -pfv[index]->xyz[1];
                    local[index][2] =  pfv[index]->xyz[2];
                }

                // Do not add triangles where the vertexes form a straight line (0 area).
                if (raptor_is_straight_line(local[0], local[1], local[2]))
                    continue;

#ifdef RAPTOR_TEXTURE_MAPPING_ON
{
                vec3_t dummy = {0,0,0};

                assert(currententity->model->skins[0]->pixels[0]);
                assert(currententity->model->skins[0]->width);
                assert(currententity->model->skins[0]->height);

                // Add a skin for the current triangle. NOTE: since there are s,t coordinates,
                // the n, up, right vectors are not used (dummy).
                raptor_push_triangle_texture(currententity->model->skins[0]->pixels[0],
                                             currententity->model->skins[0]->width,
                                             currententity->model->skins[0]->height,
                                             dummy,
                                             dummy,
                                             dummy,
                                             pfv[0]->s>>16,
                                             pfv[0]->t>>16,
                                             pfv[1]->s>>16,
                                             pfv[1]->t>>16,
                                             pfv[2]->s>>16,
                                             pfv[2]->t>>16);

                if (currententity->flags & RF_GLOW)
                {
                    // For glowing items, specify that the triangles should be associated with a light.
                    raptor_push_triangle(local[0], local[1], local[2], 1, (1.0f-scale)*BONUS_ITEM_LIGHT_RED, (1.0f-scale)*BONUS_ITEM_LIGHT_GREEN, (1.0f-scale)*BONUS_ITEM_LIGHT_BLUE, raptor_triangle_light);
                    // Add upp triangle coordinates and count number of triangles so centre point of light
                    // can be calculated later.
                    VectorAdd(centre, local[0], centre);
                    VectorAdd(centre, local[1], centre);
                    VectorAdd(centre, local[2], centre);
                    ++num_light_triangles_pushed;
                }
                else
                {
                    raptor_push_triangle(local[0], local[1], local[2], 1, 255, 255, 255, raptor_is_not_a_light);
                }
}
#else
                raptor_push_triangle(local[0], local[1], local[2], 0, 255, 255, 255, raptor_is_not_a_light);
#endif//RAPTOR_TEXTURE_MAPPING_ON
}
#else
				R_DrawTriangle();
#endif
			}
			else		
			{	// partially clipped
			    R_AliasClipTriangle (pfv[0], pfv[1], pfv[2]);
			}
		}