Esempio n. 1
0
/*
================
R_AliasDrawModel
================
*/
void R_AliasDrawModel(alight_t *plighting)
{
	finalvert_t		finalverts[MAXALIASVERTS +
							   ((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1];
	auxvert_t		auxverts[MAXALIASVERTS];

	r_amodels_drawn++;

// cache align
	pfinalverts = (finalvert_t *)
				  (((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
	pauxverts = &auxverts[0];

	paliashdr = (aliashdr_t *)Mod_Extradata(currententity->model);
	pmdl = (mdl_t *)((byte *)paliashdr + paliashdr->model);

	R_AliasSetupSkin();
	R_AliasSetUpTransform(currententity->trivial_accept);
	R_AliasSetupLighting(plighting);
	R_AliasSetupFrame();

	if (!currententity->colormap)
	{
		Sys_Error("R_AliasDrawModel: !currententity->colormap");
	}

	r_affinetridesc.drawtype = (currententity->trivial_accept == 3) &&
							   r_recursiveaffinetriangles;

	if (r_affinetridesc.drawtype)
	{
		D_PolysetUpdateTables();		// FIXME: precalc...
	}
	else
	{
#if	id386
		D_Aff8Patch(currententity->colormap);
#endif
	}

	acolormap = currententity->colormap;

	if (currententity != &cl.viewent)
	{
		ziscale = (float)0x8000 * (float)0x10000;
	}
	else
	{
		ziscale = (float)0x8000 * (float)0x10000 * 3.0;
	}

	if (currententity->trivial_accept)
	{
		R_AliasPrepareUnclippedPoints();
	}
	else
	{
		R_AliasPreparePoints();
	}
}
Esempio n. 2
0
void
R_AliasDrawModel (alight_t *plighting)
{
	int          size;
	finalvert_t *finalverts;

	r_amodels_drawn++;

	if (!(paliashdr = currententity->model->aliashdr))
		paliashdr = Cache_Get (&currententity->model->cache);
	pmdl = (mdl_t *) ((byte *) paliashdr + paliashdr->model);

	size = (CACHE_SIZE - 1)
		+ sizeof (finalvert_t) * (pmdl->numverts + 1)
		+ sizeof (auxvert_t) * pmdl->numverts;
	finalverts = (finalvert_t *) Hunk_TempAlloc (size);
	if (!finalverts)
		Sys_Error ("R_AliasDrawModel: out of memory");

	// cache align
	pfinalverts = (finalvert_t *)
		(((intptr_t) &finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
	pauxverts = (auxvert_t *) &pfinalverts[pmdl->numverts + 1];

	R_AliasSetupSkin ();
	R_AliasSetUpTransform (currententity->trivial_accept);
	R_AliasSetupLighting (plighting);
	R_AliasSetupFrame ();

	r_affinetridesc.drawtype = (currententity->trivial_accept == 3) &&
		r_recursiveaffinetriangles;

	if (!acolormap)
		acolormap = vid.colormap8;

	if (r_affinetridesc.drawtype) {
		D_PolysetUpdateTables ();		// FIXME: precalc...
	} else {
#ifdef USE_INTEL_ASM
		D_Aff8Patch (acolormap);
#endif
	}

	if (currententity != vr_data.view_model)
		ziscale = (float) 0x8000 *(float) 0x10000;
	else
		ziscale = (float) 0x8000 *(float) 0x10000 *3.0;

	if (currententity->trivial_accept && pmdl->ident != HEADER_MDL16)
		R_AliasPrepareUnclippedPoints ();
	else
		R_AliasPreparePoints ();

	if (!currententity->model->aliashdr)
		Cache_Release (&currententity->model->cache);
}
Esempio n. 3
0
static void
iqm_setup_skin (swiqm_t *sw, int skinnum)
{
	tex_t      *skin = sw->skins[skinnum];

	r_affinetridesc.pskin = skin->data;
	r_affinetridesc.skinwidth = skin->width;
	r_affinetridesc.skinheight = skin->height;
	r_affinetridesc.seamfixupX16 = (skin->width >> 1) << 16;

	if (r_affinetridesc.drawtype) {
		D_PolysetUpdateTables ();		// FIXME: precalc...
	} else {
#ifdef USE_INTEL_ASM
		D_Aff8Patch (acolormap);
#endif
	}
}
Esempio n. 4
0
/*
================
D_Patch
================
*/
void D_Patch (void)
{
#if id386
	extern void D_Aff8Patch( void );
	static qboolean protectset8 = false;
	extern void D_PolysetAff8Start( void );

	if (!protectset8)
	{
		Sys_MakeCodeWriteable ((int)D_PolysetAff8Start,
						     (int)D_Aff8Patch - (int)D_PolysetAff8Start);
		Sys_MakeCodeWriteable ((long)R_Surf8Start,
						 (long)R_Surf8End - (long)R_Surf8Start);
		protectset8 = true;
	}
	colormap = vid.colormap;

	R_Surf8Patch ();
	D_Aff8Patch();
#endif
}
Esempio n. 5
0
void R_AliasDrawModelFPM (alight_FPM_t *plighting)
{

//	finalvert_t		finalverts[MAXALIASVERTS +
//						((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1];
//	auxvert_FPM_t	auxverts[MAXALIASVERTS];
//	finalvert_t		*finalverts;
//	auxvert_t		*auxverts;

	//Anders> Change malloc to static allocated memory to avoid malloc?
  //	finalverts = malloc( (sizeof(finalvert_t)*MAXALIASVERTS) + (sizeof(finalvert_t)*(((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1)));
  //        auxverts   = malloc( (sizeof(finalvert_t)*MAXALIASVERTS));

	return;

	r_amodels_drawn++;

// cache align
	pfinalverts = (finalvert_t *)
			(((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
	pauxvertsFPM = &auxverts[0];

	paliashdr = (aliashdr_t *)Mod_ExtradataFPM (currententityFPM->model);
	pmdlFPM = (mdl_FPM_t *)((byte *)paliashdr + paliashdr->model);

	R_AliasSetupSkinFPM ();
	R_AliasSetUpTransformFPM (currententityFPM->trivial_accept);
	R_AliasSetupLightingFPM (plighting);
	R_AliasSetupFrameFPM ();

	if (!currententityFPM->colormap)
		Sys_Error ("R_AliasDrawModel: !currententity->colormap");

	r_affinetridesc.drawtype = (currententityFPM->trivial_accept == 3) &&
			r_recursiveaffinetriangles;

	if (r_affinetridesc.drawtype)
	{
		D_PolysetUpdateTables ();		// FIXME: precalc...
	}
	else
	{
#if	id386
		D_Aff8Patch (currententityFPM->colormap);
#endif
	}

	acolormap = currententityFPM->colormap;

	if (currententityFPM != &clFPM.viewent)
		ziscaleFPM = ((unsigned long)0x8000 * (unsigned long)0x10000);
	else {
		ziscaleFPM = ((unsigned long)0x8000 * (unsigned long)0x10000);
		ziscaleFPM *= 3;
	}

	if (currententityFPM->trivial_accept)
		R_AliasPrepareUnclippedPointsFPM ();
	else
		R_AliasPreparePointsFPM ();

	free(finalverts);
	free(auxverts);
}
Esempio n. 6
0
/*
================
R_AliasDrawModel
================
*/
void R_AliasDrawModel (alight_t *plighting)
{
finalvert_t		finalverts[MAXALIASVERTS + ((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1];
        auxvert_t      	auxverts[MAXALIASVERTS];
//	finalvert_t		*finalverts;
//	auxvert_t		*auxverts;


	//Anders> Change malloc to static allocated memory to avoid malloc?
	//  	finalverts = malloc( (sizeof(finalvert_t)*MAXALIASVERTS) + (sizeof(finalvert_t)*(((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1)));
	//        auxverts   = malloc( (sizeof(finalvert_t)*MAXALIASVERTS));

	GpError("R_AliasDrawModel A",11);

	r_amodels_drawn++;

// cache align
	pfinalverts = (finalvert_t *)
			(((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
	pauxverts = &auxverts[0];

	GpError("R_AliasDrawModel B",11);

	paliashdr = (aliashdr_t *)Mod_Extradata (currententity->model);
	pmdl = (mdl_t *)((byte *)paliashdr + paliashdr->model);

	GpError("R_AliasDrawModel C",11);
	R_AliasSetupSkin ();
	GpError("R_AliasDrawModel D",11);
	R_AliasSetUpTransform (currententity->trivial_accept);
	GpError("R_AliasDrawModel E",11);
	R_AliasSetupLighting (plighting);
	GpError("R_AliasDrawModel F",11);
	R_AliasSetupFrame ();
	GpError("R_AliasDrawModel G",11);

	if (!currententity->colormap)
		Sys_Error ("R_AliasDrawModel: !currententity->colormap");

	r_affinetridesc.drawtype = (currententity->trivial_accept == 3) &&
			r_recursiveaffinetriangles;

	if (r_affinetridesc.drawtype)
	{
		GpError("R_AliasDrawModel H",11);
		D_PolysetUpdateTables ();		// FIXME: precalc...
	}
	else
	{
#if	id386
		D_Aff8Patch (currententity->colormap);
#endif
	}

	acolormap = currententity->colormap;

	if (currententity != &cl.viewent)
		ziscale = (float)0x8000 * (float)0x10000;
	else
		ziscale = (float)0x8000 * (float)0x10000 * 3.0;

	if (currententity->trivial_accept){
		GpError("R_AliasDrawModel I",11);
		R_AliasPrepareUnclippedPoints ();
	}
	else{
		GpError("R_AliasDrawModel J",11);
		R_AliasPreparePoints ();
	}
	//		free(finalverts);
	//		free(auxverts);
	GpError("R_AliasDrawModel end",11);
}
Esempio n. 7
0
void R_AliasDrawModel (alight_t *plighting)
#endif
{
// h2
	int		mls;
	int		i, j;
	byte	*dest, *source, *sourceA;
// h2

	finalvert_t		finalverts[MAXALIASVERTS +
						((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 1];
	auxvert_t		auxverts[MAXALIASVERTS];

	r_amodels_drawn++;

// cache align
	pfinalverts = (finalvert_t *)
			(((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));


#ifdef INTERPOL7
	if(r_lerpmodels->value)
	pauxverts = &r_auxverts[0];
	else
	pauxverts = &auxverts[0];
#else
	pauxverts = &auxverts[0];
#endif
	paliashdr = (aliashdr_t *)Mod_Extradata (currententity->model);
	pmdl = (mdl_t *)((byte *)paliashdr + paliashdr->model);

	R_AliasSetupSkin ();
#ifdef INTERPOL7
	if (r_lerpmodels->value)
	R_AliasSetUpTransform (0);
		else
	R_AliasSetUpTransform (currententity->trivial_accept);
//	R_AliasSetUpTransform (currententity->trivial_accept);
#else
	R_AliasSetUpTransform (currententity->trivial_accept);
#endif
	if (r_shading->value > 1 && (lightingavailable))
		R_AliasSetupLighting_enhanced (plighting);	// leilei - further hacked
	else if (r_shading->value > 1 && !lightingavailable)
		R_AliasSetupLighting (plighting);	// no lighting available so we fall back
		else
		if (r_shading->value)
		R_AliasSetupLighting (plighting);
		else
			R_AliasSetupLightingSimple (plighting);
#ifdef INTERPOL7
		R_AliasSetupFrame (currententity);
#else
		R_AliasSetupFrame ();
#endif


	if (!currententity->colormap)
		Sys_Error ("R_AliasDrawModel: !currententity->colormap");

	if (!coloredlights){
	r_affinetridesc.drawtype = (currententity->trivial_accept == 3) &&
			r_recursiveaffinetriangles;
	}
	
	if (r_affinetridesc.drawtype)
	{
		D_PolysetUpdateTables ();		// FIXME: precalc...

	}
	else
	{
#if	id386broken
		D_Aff8Patch (currententity->colormap);
#endif
	}

	acolormap = currententity->colormap;
#ifdef VMTOC
//	if (viewmodel)
//		ziscale = (float)0x8000 * (float)0x10000 * 3.0;
//	else
	 if (viewmodel)
		ziscale = (float)0x8000 * (float)0x10000 * 3.0;
	else
		ziscale = (float)0x8000 * (float)0x10000;
#else
	if (currententity != &cl.viewent)
		ziscale = (float)0x8000 * (float)0x10000;
	 else
		ziscale = (float)0x8000 * (float)0x10000 * 3.0;
#endif
	if (currententity->trivial_accept)
		R_AliasPrepareUnclippedPoints ();
	else
		R_AliasPreparePoints ();
}