示例#1
0
	bool TestPointAgainstSkySurface( Vector const &pt, dface_t *pFace )
	{
		// Create sky face winding.
		winding_t *pWinding = WindingFromFace( pFace, Vector( 0.0f, 0.0f, 0.0f ) );

		// Test point in winding. (Since it is at the node, it is in the plane.)
		bool bRet = PointInWinding( pt, pWinding );

		FreeWinding( pWinding );

		return bRet;
	}
示例#2
0
文件: qrad.c 项目: jpiolho/halflife
/*
=============
MakePatches
=============
*/
void MakePatches (void)
{
	int		i, j, k;
	dface_t	*f;
	int		fn;
	winding_t	*w;
	dmodel_t	*mod;
	vec3_t		origin;
	entity_t	*ent;
	char		*s;

	ParseEntities ();
	qprintf ("%i faces\n", numfaces);

	for (i=0 ; i<nummodels ; i++)
	{
		mod = dmodels+i;
		ent = EntityForModel (i);
		VectorCopy (vec3_origin, origin);

		// bmodels with origin brushes need to be offset into their
		// in-use position
		if ( *(s = ValueForKey(ent,"origin")) )
		{
			double	v1, v2, v3;
			if ( sscanf (s, "%lf %lf %lf", &v1, &v2, &v3) == 3 )
			{
				origin[0] = v1;
				origin[1] = v2;
				origin[2] = v3;
			}
		}

		for (j=0 ; j<mod->numfaces ; j++)
		{
			fn = mod->firstface + j;
			face_entity[fn] = ent;
			VectorCopy (origin, face_offset[fn]);
			f = dfaces+fn;
			w = WindingFromFace (f);
			for (k=0 ; k<w->numpoints ; k++)
			{
				VectorAdd (w->p[k], origin, w->p[k]);
			}
			MakePatchForFace (fn, w);
		}
	}

	qprintf ("%i square feet [%.2f square inches]\n", (int)(totalarea/144), totalarea );
}
示例#3
0
/*
   =============
   MakePatches
   =============
 */
void MakePatches( void ){
	int i, j, k;
	dface_t *f;
	int fn;
	winding_t   *w;
	dmodel_t    *mod;
	vec3_t origin;
	entity_t    *ent;

	Sys_FPrintf( SYS_VRB, "%i faces\n", numfaces );

	for ( i = 0 ; i < nummodels ; i++ )
	{
		mod = &dmodels[i];
		ent = EntityForModel( i );
		// bmodels with origin brushes need to be offset into their
		// in-use position
		GetVectorForKey( ent, "origin", origin );
//VectorCopy (vec3_origin, origin);

		for ( j = 0 ; j < mod->numfaces ; j++ )
		{
			fn = mod->firstface + j;
			face_entity[fn] = ent;
			VectorCopy( origin, face_offset[fn] );
			f = &dfaces[fn];
			w = WindingFromFace( f );
			for ( k = 0 ; k < w->numpoints ; k++ )
			{
				VectorAdd( w->p[k], origin, w->p[k] );
			}
			MakePatchForFace( fn, w );
		}
	}

	Sys_FPrintf( SYS_VRB, "%i sqaure feet\n", (int)( totalarea / 64 ) );
}
示例#4
0
/**
 * @brief Create surface fragments for light-emitting surfaces so that light sources
 * may be computed along them.
 */
void BuildPatches (void)
{
	int i;

	OBJZERO(face_patches);

	for (i = 0; i < curTile->nummodels; i++) {
		const dBspModel_t* mod = &curTile->models[i];
		const entity_t* ent = EntityForModel(i);
		vec3_t origin;
		int j;
		/* bmodels with origin brushes (like func_door) need to be offset into their
		 * in-use position */
		GetVectorForKey(ent, "origin", origin);

		for (j = 0; j < mod->numfaces; j++) {
			const int facenum = mod->firstface + j;
			dBspSurface_t* f = &curTile->faces[facenum];
			winding_t* w;
			int k;

			/* store the origin in case of moving bmodels (e.g. func_door) */
			VectorCopy(origin, face_offset[facenum]);

			if (!HasLight(f))  /* no light */
				continue;

			w = WindingFromFace(f);

			for (k = 0; k < w->numpoints; k++)
				VectorAdd(w->p[k], origin, w->p[k]);

			BuildPatch(facenum, w);
		}
	}
}