Waypoint_t *Waypoint_GetByVisibility(MathVector3f_t vOrigin)
{
	Waypoint_t	*wPoint;
	trace_t		tTrace;

	for (wPoint = wWaypoints; wPoint->number < waypoint_count; wPoint++)
	{
		tTrace = Traceline(NULL,vOrigin,wPoint->position,0);
		// Given point cannot be in the same place as the given origin.
		if(	Math_VectorCompare(tTrace.endpos,wPoint->position) && 
			!Math_VectorCompare(vOrigin,wPoint->position))
			return wPoint;
	}
	return NULL;
}
Esempio n. 2
0
/*	The mouse click did not hit the brush, so grab one or more side
	planes for dragging
*/
void Brush_SideSelect(brush_t *b,vec3_t origin,vec3_t dir,bool shear)
{
	face_t	*f, *f2;
	vec3_t	p1, p2;

	for(f = b->brush_faces; f; f = f->next)
	{
		Math_VectorCopy(origin,p1);
		Math_VectorMA(origin,16384,dir,p2);

		for (f2=b->brush_faces ; f2 ; f2=f2->next)
		{
			if (f2 == f)
				continue;
			Brush_ClipLineToFace(p1,p2,f2);
		}

		if(f2)
			continue;

		if(Math_VectorCompare(p1,origin))
			continue;
		if(Brush_ClipLineToFace(p1,p2,f))
			continue;

		Brush_SelectFaceForDragging (b, f, shear);
	}
}
Esempio n. 3
0
void Brush_MakeFacePlanes (brush_t *b)
{
	face_t	*f;
	int		j;
	vec3_t	t1, t2, t3;

	for (f=b->brush_faces ; f ; f=f->next)
	{
		// convert to a vector / dist plane
		for (j=0 ; j<3 ; j++)
		{
			t1[j] = f->planepts[0][j] - f->planepts[1][j];
			t2[j] = f->planepts[2][j] - f->planepts[1][j];
			t3[j] = f->planepts[1][j];
		}

		Math_CrossProduct(t1,t2,f->plane.normal);
		if(Math_VectorCompare(f->plane.normal,vec3_origin))
			printf("WARNING: brush plane with no normal!\n");
		Math_VectorNormalize(f->plane.normal);
		f->plane.dist = Math_DotProduct(t3,f->plane.normal);
	}
}