Code Search for Developers
 
 
  

aas_edgemelting.c from Nxabega at Krugle


Show aas_edgemelting.c syntax highlighted

/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.

This file is part of Quake III Arena source code.

Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/

#include "qbsp.h"
#include "../botlib/aasfile.h"
#include "aas_create.h"

//===========================================================================
// try to melt the windings of the two faces
// FIXME: this is buggy
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
int AAS_MeltFaceWinding(tmp_face_t * face1, tmp_face_t * face2)
{
	int             i, n;
	int             splits = 0;
	winding_t      *w2, *neww;
	plane_t        *plane1;

#ifdef DEBUG
	if(!face1->winding)
		Error("face1 %d without winding", face1->num);
	if(!face2->winding)
		Error("face2 %d without winding", face2->num);
#endif							//DEBUG
	w2 = face2->winding;
	plane1 = &mapplanes[face1->planenum];
	for(i = 0; i < w2->numpoints; i++)
	{
		if(PointOnWinding(face1->winding, plane1->normal, plane1->dist, w2->p[i], &n))
		{
			neww = AddWindingPoint(face1->winding, w2->p[i], n);
			FreeWinding(face1->winding);
			face1->winding = neww;

			splits++;
		}						//end if
	}							//end for
	return splits;
}								//end of the function AAS_MeltFaceWinding

//===========================================================================
// melt the windings of the area faces
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
int AAS_MeltFaceWindingsOfArea(tmp_area_t * tmparea)
{
	int             side1, side2, num_windingsplits = 0;
	tmp_face_t     *face1, *face2;

	for(face1 = tmparea->tmpfaces; face1; face1 = face1->next[side1])
	{
		side1 = face1->frontarea != tmparea;
		for(face2 = tmparea->tmpfaces; face2; face2 = face2->next[side2])
		{
			side2 = face2->frontarea != tmparea;
			if(face1 == face2)
				continue;
			num_windingsplits += AAS_MeltFaceWinding(face1, face2);
		}						//end for
	}							//end for
	return num_windingsplits;
}								//end of the function AAS_MeltFaceWindingsOfArea

//===========================================================================
// melt the windings of the faces of all areas
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
void AAS_MeltAreaFaceWindings(void)
{
	tmp_area_t     *tmparea;
	int             num_windingsplits = 0;

	Log_Write("AAS_MeltAreaFaceWindings\r\n");
	qprintf("%6d edges melted", num_windingsplits);
	//NOTE: first convex area (zero) is a dummy
	for(tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next)
	{
		num_windingsplits += AAS_MeltFaceWindingsOfArea(tmparea);
		qprintf("\r%6d", num_windingsplits);
	}							//end for
	qprintf("\n");
	Log_Write("%6d edges melted\r\n", num_windingsplits);
}								//end of the function AAS_MeltAreaFaceWindings




See more files for this project here

Nxabega

Nxabega is a First Person Shooter (FPS) based upon the open sourced Quake 3 engine and game code. The final intention is to provide a rich single player game.

Project homepage: http://sourceforge.net/projects/nxabega
Programming language(s): C,C++
License: other

  Conscript
  Makefile
  _files.c
  aas_areamerging.c
  aas_areamerging.h
  aas_cfg.c
  aas_cfg.h
  aas_create.c
  aas_create.h
  aas_edgemelting.c
  aas_edgemelting.h
  aas_facemerging.c
  aas_facemerging.h
  aas_file.c
  aas_file.h
  aas_gsubdiv.c
  aas_gsubdiv.h
  aas_map.c
  aas_map.h
  aas_prunenodes.c
  aas_prunenodes.h
  aas_store.c
  aas_store.h
  aasfile.h
  be_aas_bspc.c
  be_aas_bspc.h
  brushbsp.c
  bspc.c
  bspc.sln
  bspc.vcproj
  cfgq3.c
  csg.c
  faces.c
  gldraw.c
  glfile.c
  l_bsp_ent.c
  l_bsp_ent.h
  l_bsp_hl.c
  l_bsp_hl.h
  l_bsp_q1.c
  l_bsp_q1.h
  l_bsp_q2.c
  l_bsp_q2.h
  l_bsp_q3.c
  l_bsp_q3.h
  l_bsp_sin.c
  l_bsp_sin.h
  l_cmd.c
  l_cmd.h
  l_log.c
  l_log.h
  l_math.c
  l_math.h
  l_mem.c
  l_mem.h
  l_poly.c
  l_poly.h
  l_qfiles.c
  l_qfiles.h
  l_threads.c
  l_threads.h
  l_utils.c
  l_utils.h
  lcc.mak
  leakfile.c
  linux-i386.mak
  map.c
  map_hl.c
  map_q1.c
  map_q2.c
  map_q3.c
  map_sin.c
  nodraw.c
  portals.c
  prtfile.c
  q2files.h
  q3files.h
  qbsp.h
  qfiles.h
  sinfiles.h
  tetrahedron.c
  tetrahedron.h
  textures.c
  tree.c
  writebsp.c