コード例 #1
0
ファイル: csg4.c プロジェクト: AidHamza/eviltoys
/*
==================
SaveOutside

Saves all of the faces in the outside list to the bsp plane list
==================
*/
static void
SaveOutside(bool mirror)
{
    face_t *f, *next, *newf;
    int i;
    int planenum;

    for (f = outside; f; f = next) {
	next = f->next;
	csgfaces++;
	planenum = f->planenum;

	if (mirror) {
	    newf = NewFaceFromFace(f);

	    newf->w.numpoints = f->w.numpoints;
	    newf->planeside = f->planeside ^ 1;	// reverse side
	    newf->contents[0] = f->contents[1];
	    newf->contents[1] = f->contents[0];

	    for (i = 0; i < f->w.numpoints; i++)	// add points backwards
		VectorCopy(f->w.points[f->w.numpoints - 1 - i], newf->w.points[i]);

	    validfaces[planenum] =
		MergeFaceToList(newf, validfaces[planenum]);
	}

	validfaces[planenum] = MergeFaceToList(f, validfaces[planenum]);
	validfaces[planenum] = FreeMergeListScraps(validfaces[planenum]);
    }
}
コード例 #2
0
ファイル: merge.c プロジェクト: AidHamza/eviltoys
face_t *MergeFaceToList (face_t *face, face_t *list)
{	
  face_t	*newf, *f;
	
  for (f=list ; f ; f=f->next)
    {
      //CheckColinear (f);		
      if (mergedebug)
	{
	  Draw_ClearWindow ();
	  Draw_DrawFace (face);
	  Draw_DrawFace (f);
	  Draw_SetBlack ();
	}
      newf = TryMerge (face, f);
      if (!newf)
	continue;
      FreeFace (face);
      f->numpoints = -1;		// merged out
      return MergeFaceToList (newf, list);
    }
	
  // didn't merge, so add at start
  face->next = list;
  return face;
}
コード例 #3
0
ファイル: merge.c プロジェクト: AidHamza/eviltoys
/*
===============
MergePlaneFaces
===============
*/
void MergePlaneFaces (surface_t *plane)
{
  face_t	*f1, *next;
  face_t	*merged;
	
  merged = NULL;
	
  for (f1 = plane->faces ; f1 ; f1 = next)
    {
      next = f1->next;
      merged = MergeFaceToList (f1, merged);
    }

  // chain all of the non-empty faces to the plane
  plane->faces = FreeMergeListScraps (merged);
}
コード例 #4
0
ファイル: merge.c プロジェクト: AidHamza/eviltoys
/*
===============
MergePlaneFaces
===============
*/
void
MergePlaneFaces(surface_t *plane)
{
    face_t *f, *next;
    face_t *merged;

    merged = NULL;

    for (f = plane->faces; f; f = next) {
	next = f->next;
	merged = MergeFaceToList(f, merged);
    }

    // Remove all empty faces (numpoints == -1) and add the remaining
    // faces to the plane
    plane->faces = FreeMergeListScraps(merged);
}
コード例 #5
0
ファイル: merge.c プロジェクト: kellyrm/Q1
/*
===============
MergeFaceToList
===============
*/
face_t *MergeFaceToList (face_t *face, face_t *list)
{
	face_t	*newf, *f;

	for (f=list ; f ; f=f->next)
	{
		newf = TryMerge (face, f);
		if (!newf)
			continue;
		FreeFace (face);
		ResizeFace (f, 0);
		f->numpoints = -1;		// merged out
		return MergeFaceToList (newf, list);
	}

// didn't merge, so add at start
	face->next = list;
	return face;
}