Пример #1
0
/*
==============
CSG_SplitBrushByFace

The incoming brush is NOT freed.
The incoming face is NOT left referenced.
==============
*/
void CSG_SplitBrushByFace (brush_t *in, face_t *f, brush_t **front, brush_t **back)
{
	brush_t	*b;
	face_t	*nf;
	vec3_t	temp;

	b = Brush_Clone (in);
	nf = Face_Clone (f);

	nf->texdef = b->brush_faces->texdef;
	nf->next = b->brush_faces;
	b->brush_faces = nf;

	Brush_Build( b );
	Brush_RemoveEmptyFaces ( b );
	if ( !b->brush_faces )
	{	// completely clipped away
		Brush_Free (b);
		*back = NULL;
	}
	else
	{
		Entity_LinkBrush (in->owner, b);
		*back = b;
	}

	b = Brush_Clone (in);
	nf = Face_Clone (f);
	// swap the plane winding
	VectorCopy (nf->planepts[0], temp);
	VectorCopy (nf->planepts[1], nf->planepts[0]);
	VectorCopy (temp, nf->planepts[1]);

	nf->texdef = b->brush_faces->texdef;
	nf->next = b->brush_faces;
	b->brush_faces = nf;

	Brush_Build( b );
	Brush_RemoveEmptyFaces ( b );
	if ( !b->brush_faces )
	{	// completely clipped away
		Brush_Free (b);
		*front = NULL;
	}
	else
	{
		Entity_LinkBrush (in->owner, b);
		*front = b;
	}
}
Пример #2
0
void Curve_BevelBrush( brush_t *b ) {
	curveBlock_t	*cb;
	face_t			*f;

	// make a copy without any curve flags, but keeping the negative flag
	bevelBrush = Brush_Clone( b );
	for (f = bevelBrush->brush_faces ; f ; f = f->next) {
		f->texdef.flags &= ~SURF_CURVE;
	}
	bevelBrush->curveBrush = false;

	cb = BrushToCurveBlock(b);
	SubdivideCurveBlock (cb);

	Brush_Build( bevelBrush );
	Brush_AddToList( bevelBrush, &active_brushes );
	Entity_LinkBrush( b->owner, bevelBrush );

	Sys_UpdateWindows (W_ALL);

	bevelBrush = NULL;
}
Пример #3
0
/*
============
Select_Clone

Creates an exact duplicate of the selection in place, then moves
the selected brushes off of their old positions
============
*/
void Select_Clone( void )
{
#if 1
	ASSERT( g_pParentWnd->ActiveXY() );
	g_bScreenUpdates = false;
	g_pParentWnd->ActiveXY()->Copy();
	g_pParentWnd->ActiveXY()->Paste();
	g_pParentWnd->NudgeSelection( 2, g_qeglobals.d_gridsize );
	g_pParentWnd->NudgeSelection( 3, g_qeglobals.d_gridsize );
	g_bScreenUpdates = true;
	Sys_UpdateWindows( W_ALL );
#else
	
	brush_s*        b, *b2, *n, *next, *next2;
	vec3_t      delta;
	entity_s*   e;
	
	g_qeglobals.d_workcount++;
	clearSelection();
	
	delta[0] = g_qeglobals.d_gridsize;
	delta[1] = g_qeglobals.d_gridsize;
	delta[2] = 0;
	
	for ( b = selected_brushes.next ; b != &selected_brushes ; b = next )
	{
		next = b->next;
		// if the brush is a world brush, handle simply
		if ( b->owner == world_entity )
		{
			n = Brush_Clone( b );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( world_entity, n );
			Brush_Build( n );
			Brush_Move( b, delta );
			continue;
		}
	
		e = Entity_Clone( b->owner );
		// clear the target / targetname
		DeleteKey( e, "target" );
		DeleteKey( e, "targetname" );
	
		// if the brush is a fixed size entity, create a new entity
		if ( b->owner->eclass->fixedsize )
		{
			n = Brush_Clone( b );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( e, n );
			Brush_Build( n );
			Brush_Move( b, delta );
			continue;
		}
	
		// brush is a complex entity, grab all the other ones now
	
		next = &selected_brushes;
	
		for ( b2 = b ; b2 != &selected_brushes ; b2 = next2 )
		{
			next2 = b2->next;
			if ( b2->owner != b->owner )
			{
				if ( next == &selected_brushes )
					next = b2;
				continue;
			}
	
			// move b2 to the start of selected_brushes,
			// so it won't be hit again
			Brush_RemoveFromList( b2 );
			Brush_AddToList( b2, &selected_brushes );
	
			n = Brush_Clone( b2 );
			Brush_AddToList( n, &active_brushes );
			Entity_LinkBrush( e, n );
			Brush_Build( n );
			Brush_Move( b2, delta, true );
		}
	
	}
	Sys_UpdateWindows( W_ALL );
#endif
}
Пример #4
0
/*
============
Select_Clone

Creates an exact duplicate of the selection in place, then moves
the selected brushes off of their old positions
============
*/
void Select_Clone (void)
{
	brush_t		*b, *b2, *n, *next, *next2;
	vec3_t		delta;
	entity_t	*e;

	g_qeglobals.d_workcount++;
	g_qeglobals.d_select_mode = sel_brush;

	delta[0] = g_qeglobals.d_gridsize;
	delta[1] = g_qeglobals.d_gridsize;
	delta[2] = 0;

	for (b=selected_brushes.next ; b != &selected_brushes ; b=next)
	{
		next = b->next;
		// if the brush is a world brush, handle simply
		if (b->owner == world_entity)
		{
			n = Brush_Clone (b);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (world_entity, n);
			Brush_Build( n );
			Brush_Move (b, delta);
			continue;
		}

		e = Entity_Clone (b->owner);
		// clear the target / targetname
		DeleteKey (e, "target");
		DeleteKey (e, "targetname");

		// if the brush is a fixed size entity, create a new entity
		if (b->owner->eclass->fixedsize)
		{
			n = Brush_Clone (b);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (e, n);
			Brush_Build( n );
			Brush_Move (b, delta);
			continue;
		}
        
		// brush is a complex entity, grab all the other ones now

		next = &selected_brushes;

		for ( b2 = b ; b2 != &selected_brushes ; b2=next2)
		{
			next2 = b2->next;
			if (b2->owner != b->owner)
			{
				if (next == &selected_brushes)
					next = b2;
				continue;
			}

			// move b2 to the start of selected_brushes,
			// so it won't be hit again
			Brush_RemoveFromList (b2);
			Brush_AddToList (b2, &selected_brushes);
			
			n = Brush_Clone (b2);
			Brush_AddToList (n, &active_brushes);
			Entity_LinkBrush (e, n);
			Brush_Build( n );
			Brush_Move (b2, delta);
		}

	}
	Sys_UpdateWindows (W_ALL);
}