当前位置: 首页>>代码示例>>C++>>正文


C++ CopyWinding函数代码示例

本文整理汇总了C++中CopyWinding函数的典型用法代码示例。如果您正苦于以下问题:C++ CopyWinding函数的具体用法?C++ CopyWinding怎么用?C++ CopyWinding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CopyWinding函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Q3_FaceOnWinding

//===========================================================================
// returns the amount the face and the winding overlap
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
float Q3_FaceOnWinding(dsurface_t *surface, winding_t *winding)
{
    int i;
    float dist, area;
    dplane_t plane;
    vec_t *v1, *v2;
    vec3_t normal, edgevec;
    winding_t *w;

    //copy the winding before chopping
    w = CopyWinding(winding);
    //retrieve the surface plane
    Q3_SurfacePlane(surface, plane.normal, &plane.dist);
    //chop the winding with the surface edge planes
    for (i = 0; i < surface->numVerts && w; i++)
    {
        v1 = drawVerts[surface->firstVert + ((i) % surface->numVerts)].xyz;
        v2 = drawVerts[surface->firstVert + ((i+1) % surface->numVerts)].xyz;
        //create a plane through the edge from v1 to v2, orthogonal to the
        //surface plane and with the normal vector pointing inward
        VectorSubtract(v2, v1, edgevec);
        CrossProduct(edgevec, plane.normal, normal);
        VectorNormalize(normal);
        dist = DotProduct(normal, v1);
        //
        ChopWindingInPlace(&w, normal, dist, -0.1); //CLIP_EPSILON
    } //end for
    if (w)
    {
        area = WindingArea(w);
        FreeWinding(w);
        return area;
    } //end if
    return 0;
} //end of the function Q3_FaceOnWinding
开发者ID:tkmorris,项目名称:OpenMOHAA,代码行数:42,代码来源:l_bsp_q3.c

示例2: AllocBrush

brush_t *CopyBrush( brush_t *brush ){
	brush_t     *newBrush;
	size_t size;
	int i;


	/* copy brush */
	size = (size_t)&( ( (brush_t*) 0 )->sides[ brush->numsides ] );
	newBrush = AllocBrush( brush->numsides );
	memcpy( newBrush, brush, size );

	/* ydnar: nuke linked list */
	newBrush->next = NULL;

	/* copy sides */
	for ( i = 0; i < brush->numsides; i++ )
	{
		if ( brush->sides[ i ].winding != NULL ) {
			newBrush->sides[ i ].winding = CopyWinding( brush->sides[ i ].winding );
		}
	}

	/* return it */
	return newBrush;
}
开发者ID:xonotic,项目名称:netradient,代码行数:25,代码来源:brush.c

示例3: ClipWindingEpsilon

void	ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist, 
				vec_t epsilon, winding_t **front, winding_t **back)
{
	ClipWindingEpsilonStrict(in, normal, dist, epsilon, front, back);
	/* apparently most code expects that in the winding-on-plane case, the back winding is the original winding */
	if(!*front && !*back)
		*back = CopyWinding(in);
}
开发者ID:clbr,项目名称:netradiant,代码行数:8,代码来源:polylib.c

示例4: NewFaceFromFace

bface_t	*CopyFace (bface_t *f)
{
	bface_t	*n;

	n = NewFaceFromFace (f);
	n->w = CopyWinding (f->w);
	VectorCopy (f->mins, n->mins);
	VectorCopy (f->maxs, n->maxs);
	return n;
}
开发者ID:6779660,项目名称:halflife,代码行数:10,代码来源:qcsg.c

示例5: AllocBspFace

/*
=================
BspFaceForPortal
=================
*/
bspFace_t      *BspFaceForPortal(portal_t * p)
{
	bspFace_t      *f;

	f = AllocBspFace();
	f->w = CopyWinding(p->winding);
	f->planenum = p->onnode->planenum & ~1;

	return f;
}
开发者ID:otty,项目名称:cake3,代码行数:15,代码来源:facebsp.c

示例6: AllocBspFace

face_t *MakeVisibleBSPFaceList( brush_t *list ){
	brush_t     *b;
	int i;
	side_t      *s;
	winding_t   *w;
	face_t      *f, *flist;


	flist = NULL;
	for ( b = list; b != NULL; b = b->next )
	{
		if ( b->detail ) {
			continue;
		}

		for ( i = 0; i < b->numsides; i++ )
		{
			/* get side and winding */
			s = &b->sides[ i ];
			w = s->visibleHull;
			if ( w == NULL ) {
				continue;
			}

			/* ydnar: skip certain faces */
			if ( s->compileFlags & C_SKIP ) {
				continue;
			}

			/* allocate a face */
			f = AllocBspFace();
			f->w = CopyWinding( w );
			f->planenum = s->planenum & ~1;
			f->compileFlags = s->compileFlags;  /* ydnar */

			/* ydnar: set priority */
			f->priority = 0;
			if ( f->compileFlags & C_HINT ) {
				f->priority += HINT_PRIORITY;
			}
			if ( f->compileFlags & C_ANTIPORTAL ) {
				f->priority += ANTIPORTAL_PRIORITY;
			}
			if ( f->compileFlags & C_AREAPORTAL ) {
				f->priority += AREAPORTAL_PRIORITY;
			}

			/* get next face */
			f->next = flist;
			flist = f;
		}
	}

	return flist;
}
开发者ID:Crowbar-Sledgehammer,项目名称:GtkRadiant,代码行数:55,代码来源:facebsp.c

示例7: DivideWinding

void
DivideWinding (winding_t *in, plane_t *split, winding_t **front,
			   winding_t **back)
{
	int         i;
	int         counts[3];
	plane_t     plane;
	vec_t       dot;
	winding_t  *tmp;

	counts[0] = counts[1] = counts[2] = 0;

	// determine sides for each point
	for (i = 0; i < in->numpoints; i++) {
		dot = DotProduct (in->points[i], split->normal) - split->dist;
		if (dot > ON_EPSILON)
			counts[SIDE_FRONT]++;
		else if (dot < -ON_EPSILON)
			counts[SIDE_BACK]++;
	}

	*front = *back = NULL;

	if (!counts[SIDE_FRONT]) {
		*back = in;
		return;
	}
	if (!counts[SIDE_BACK]) {
		*front = in;
		return;
	}

	tmp = CopyWinding (in);
	*front = ClipWinding (tmp, split, 0);

	plane.dist = -split->dist;
	VectorNegate (split->normal, plane.normal);

	tmp = CopyWinding (in);
	*back = ClipWinding (tmp, &plane, 0);
}
开发者ID:EIREXE,项目名称:Quakeforge-gcw0,代码行数:41,代码来源:winding.c

示例8: FaceFromPortal

static face_t* FaceFromPortal (portal_t* p, bool pside)
{
	face_t* f;
	side_t* side = p->side;

	/* portal does not bridge different visible contents */
	if (!side)
		return nullptr;

	/* nodraw/caulk faces */
	if (side->surfaceFlags & SURF_NODRAW)
		return nullptr;

	f = AllocFace();

	f->texinfo = side->texinfo;
	f->planenum = (side->planenum & ~1) | pside;
	f->portal = p;

	if ((p->nodes[pside]->contentFlags & CONTENTS_WINDOW)
	 && VisibleContents(p->nodes[!pside]->contentFlags ^ p->nodes[pside]->contentFlags) == CONTENTS_WINDOW)
		return nullptr;	/* don't show insides of windows */

	/* do back-clipping */
	if (!config.nobackclip && mapplanes[f->planenum].normal[2] < -0.9) {
		/* this face is not visible from birds view - optimize away
		 * but only if it's not light emitting surface */
		const entity_t* e = &entities[side->brush->entitynum];
		if (!Q_streq(ValueForKey(e, "classname"), "func_rotating")) {
			if (!(curTile->texinfo[f->texinfo].surfaceFlags & SURF_LIGHT)) {
				/* e.g. water surfaces are removed if we set the surfaceFlags
				 * to SURF_NODRAW for this side */
				/*side->surfaceFlags |= SURF_NODRAW;*/
				return nullptr;
			}
		}
	}

	if (pside) {
		f->w = ReverseWinding(p->winding);
		f->contentFlags = p->nodes[1]->contentFlags;
	} else {
		f->w = CopyWinding(p->winding);
		f->contentFlags = p->nodes[0]->contentFlags;
	}
	return f;
}
开发者ID:ArkyRomania,项目名称:ufoai,代码行数:47,代码来源:faces.cpp

示例9: CopyBrush

/**
 * @brief Duplicates the brush, the sides, and the windings
 * @sa AllocBrush
 */
bspbrush_t* CopyBrush (const bspbrush_t* brush)
{
	bspbrush_t* newbrush;
	int i;
	const size_t size = offsetof(bspbrush_t, sides) + sizeof(((bspbrush_t*)0)->sides) * brush->numsides;

	newbrush = AllocBrush(brush->numsides);
	memcpy(newbrush, brush, size);

	for (i = 0; i < brush->numsides; i++) {
		const side_t* side = &brush->sides[i];
		if (side->winding)
			newbrush->sides[i].winding = CopyWinding(side->winding);
	}

	return newbrush;
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:21,代码来源:bspbrush.cpp

示例10: sizeof

//===========================================================================
// Duplicates the brush, the sides, and the windings
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
bspbrush_t *CopyBrush (bspbrush_t *brush)
{
	bspbrush_t *newbrush;
	size_t		size;
	int			i;

	size = sizeof(*newbrush) + sizeof(*brush->sides) * brush->numsides;

	newbrush = AllocBrush (brush->numsides);
	memcpy (newbrush, brush, size);

	for (i=0 ; i<brush->numsides ; i++)
	{
		if (brush->sides[i].winding)
			newbrush->sides[i].winding = CopyWinding (brush->sides[i].winding);
	}

	return newbrush;
} //end of the function CopyBrush
开发者ID:Garux,项目名称:netradiant-custom,代码行数:26,代码来源:brushbsp.c

示例11: Q1_FaceOnWinding

//===========================================================================
// returns the amount the face and the winding overlap
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
float Q1_FaceOnWinding(q1_dface_t *face, winding_t *winding)
{
    int i, edgenum, side;
    float dist, area;
    q1_dplane_t plane;
    vec_t *v1, *v2;
    vec3_t normal, edgevec;
    winding_t *w;

    //
    w = CopyWinding(winding);
    memcpy(&plane, &q1_dplanes[face->planenum], sizeof(q1_dplane_t));
    //check on which side of the plane the face is
    if (face->side)
    {
        VectorNegate(plane.normal, plane.normal);
        plane.dist = -plane.dist;
    } //end if
    for (i = 0; i < face->numedges && w; i++)
    {
        //get the first and second vertex of the edge
        edgenum = q1_dsurfedges[face->firstedge + i];
        side = edgenum > 0;
        //if the face plane is flipped
        v1 = q1_dvertexes[q1_dedges[abs(edgenum)].v[side]].point;
        v2 = q1_dvertexes[q1_dedges[abs(edgenum)].v[!side]].point;
        //create a plane through the edge vector, orthogonal to the face plane
        //and with the normal vector pointing out of the face
        VectorSubtract(v1, v2, edgevec);
        CrossProduct(edgevec, plane.normal, normal);
        VectorNormalize(normal);
        dist = DotProduct(normal, v1);
        //
        ChopWindingInPlace(&w, normal, dist, 0.9); //CLIP_EPSILON
    } //end for
    if (w)
    {
        area = WindingArea(w);
        FreeWinding(w);
        return area;
    } //end if
    return 0;
} //end of the function Q1_FaceOnWinding
开发者ID:he110world,项目名称:quake3-ios,代码行数:50,代码来源:map_q1.c

示例12: AllocBrush

/*
==================
CopyBrush

Duplicates the brush, the sides, and the windings
==================
*/
bspbrush_t *CopyBrush (bspbrush_t *brush)
{
	bspbrush_t *newbrush;
	int			size;
	int			i;
	
	size = (int)&(((bspbrush_t *)0)->sides[brush->numsides]);

	newbrush = AllocBrush (brush->numsides);
	memcpy (newbrush, brush, size);

	for (i=0 ; i<brush->numsides ; i++)
	{
		if (brush->sides[i].winding)
			newbrush->sides[i].winding = CopyWinding (brush->sides[i].winding);
	}

	return newbrush;
}
开发者ID:wouterpleizier,项目名称:source-sdk-2013,代码行数:26,代码来源:brushbsp.cpp

示例13: AllocFace

//-----------------------------------------------------------------------------
// Purpose: Given an original side and chopped winding, make a face_t 
// Input  : *side - side of the original brush
//			*winding - winding for this face (portion of the side)
// Output : face_t
//-----------------------------------------------------------------------------
face_t *MakeBrushFace( side_t *originalSide, winding_t *winding )
{
	face_t *f = AllocFace();
	f->merged = NULL;
	f->split[0] = f->split[1] = NULL;
	f->w = CopyWinding( winding );
	f->originalface = originalSide;
	//
	// save material info
	//
	f->texinfo = originalSide->texinfo;
	f->dispinfo = -1;

	// save plane info
	f->planenum = originalSide->planenum;
	f->contents = originalSide->contents;

	return f;
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:25,代码来源:detail.cpp

示例14: CopyFacesToOutside

/*
==================
CopyFacesToOutside
==================
*/
static void CopyFacesToOutside( const brush_t *b )
{
	face_t		*f, *newf;

	outside = NULL;
	for( f = b->faces; f; f = f->next ) {
		if( !f->winding )
			continue;

		numcsgbrushfaces++;
		newf = AllocFace ();
		newf->texturenum = f->texturenum;
		newf->planenum = f->planenum;
		newf->planeside = f->planeside;
		newf->original = f->original;
		newf->winding = CopyWinding( f->winding );
		newf->next = outside;
		newf->contents[0] = CONTENTS_EMPTY;
		newf->contents[1] = b->contents;
		outside = newf;
	}
}
开发者ID:dommul,项目名称:super8,代码行数:27,代码来源:csg4.c

示例15: DispGetFaceInfo

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void DispGetFaceInfo( mapbrush_t *pBrush )
{
	int		i;
	side_t	*pSide;

	// we don't support displacement on entities at the moment!!
	if( pBrush->entitynum != 0 )
	{
		char* pszEntityName = ValueForKey( &entities[pBrush->entitynum], "classname" );
		Error( "Error: displacement found on a(n) %s entity - not supported\n", pszEntityName );
	}

	for( i = 0; i < pBrush->numsides; i++ )
	{
		pSide = &pBrush->original_sides[i];
		if( pSide->pMapDisp )
		{
			// error checking!!
			if( pSide->winding->numpoints != 4 )
				Error( "Trying to create a non-quad displacement!\n" );

			pSide->pMapDisp->face.originalface = pSide;
			pSide->pMapDisp->face.texinfo = pSide->texinfo;
			pSide->pMapDisp->face.dispinfo = -1;
			pSide->pMapDisp->face.planenum = pSide->planenum;
			pSide->pMapDisp->face.numpoints = pSide->winding->numpoints;
			pSide->pMapDisp->face.w = CopyWinding( pSide->winding );
			pSide->pMapDisp->face.contents = pBrush->contents;

			pSide->pMapDisp->face.merged = FALSE;
			pSide->pMapDisp->face.split[0] = FALSE;
			pSide->pMapDisp->face.split[1] = FALSE;

			pSide->pMapDisp->entitynum = pBrush->entitynum;
			pSide->pMapDisp->brushSideID = pSide->id;
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:40,代码来源:disp_vbsp.cpp


注:本文中的CopyWinding函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。