• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AllocWinding函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fabs

/**
 * @brief Create a massive polygon for the specified plane. This will be used
 * as the basis for all clipping operations against the plane. Double precision
 * is used to produce very accurate results; this is an improvement over the
 * Quake II tools.
 */
winding_t *WindingForPlane(const vec3_t normal, const vec_t dist) {
	dvec3_t org, vnormal, vright, vup;
	int32_t i;

	// find the major axis
	vec_t max = -BOGUS_RANGE;
	int32_t x = -1;
	for (i = 0; i < 3; i++) {
		const vec_t v = fabs(normal[i]);
		if (v > max) {
			x = i;
			max = v;
		}
	}
	if (x == -1) {
		Com_Error(ERROR_FATAL, "No axis found\n");
	}

	switch (x) {
		case 0:
		case 1:
			VectorSet(vright, -normal[1], normal[0], 0.0);
			break;
		case 2:
			VectorSet(vright, 0.0, -normal[2], normal[1]);
			break;
		default:
			Com_Error(ERROR_FATAL, "Bad axis\n");
	}

	VectorScale(vright, MAX_WORLD_COORD * 8.0, vright);

	VectorCopy(normal, vnormal);

	// CrossProduct(vnormal, vright, vup);
	vup[0] = vnormal[1] * vright[2] - vnormal[2] * vright[1];
	vup[1] = vnormal[2] * vright[0] - vnormal[0] * vright[2];
	vup[2] = vnormal[0] * vright[1] - vnormal[1] * vright[0];

	VectorScale(vnormal, dist, org);

	// project a really big	axis aligned box onto the plane
	winding_t *w = AllocWinding(4);

	VectorSubtract(org, vright, w->points[0]);
	VectorAdd(w->points[0], vup, w->points[0]);

	VectorAdd(org, vright, w->points[1]);
	VectorAdd(w->points[1], vup, w->points[1]);

	VectorAdd(org, vright, w->points[2]);
	VectorSubtract(w->points[2], vup, w->points[2]);

	VectorSubtract(org, vright, w->points[3]);
	VectorSubtract(w->points[3], vup, w->points[3]);

	w->num_points = 4;

	return w;
}
开发者ID:jdolan,项目名称:quetoo,代码行数:66,代码来源:polylib.c


示例2: VectorCopy

winding_t *WindingFromDrawSurf( mapDrawSurface_t *ds ){
	winding_t   *w;
	int i;

	// we use the first point of the surface, maybe something more clever would be useful
	// (actually send the whole draw surface would be cool?)
	if ( ds->numVerts >= MAX_POINTS_ON_WINDING ) {
		int max = ds->numVerts;
		vec3_t p[256];

		if ( max > 256 ) {
			max = 256;
		}

		for ( i = 0 ; i < max ; i++ ) {
			VectorCopy( ds->verts[i].xyz, p[i] );
		}

		xml_Winding( "WindingFromDrawSurf failed: MAX_POINTS_ON_WINDING exceeded", p, max, qtrue );
	}

	w = AllocWinding( ds->numVerts );
	w->numpoints = ds->numVerts;
	for ( i = 0 ; i < ds->numVerts ; i++ ) {
		VectorCopy( ds->verts[i].xyz, w->p[i] );
	}
	return w;
}
开发者ID:Elzair,项目名称:q3map2,代码行数:28,代码来源:fog.c


示例3: VectorSubtract

void DWinding::RemoveColinearPoints()
{
	vec3_t	p2[MAX_POINTS_ON_WINDING];

	int nump = 0;
	for (int i = 0; i < numpoints; i++)
	{
		int j = (i+1)%numpoints;
		int k = (i+numpoints-1)%numpoints;

		vec3_t	v1, v2;
		VectorSubtract (p[j], p[i], v1);
		VectorSubtract (p[i], p[k], v2);
		VectorNormalize(v1, v1);
		VectorNormalize(v2, v2);

		if (DotProduct(v1, v2) < 0.999)
		{
			VectorCopy (p[i], p2[nump]);
			nump++;
		}
	}

	if (nump == numpoints)
		return;

	AllocWinding(nump);
	memcpy (p, p2, nump*sizeof(vec3_t));
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:29,代码来源:DWinding.cpp


示例4: Error

//===========================================================================
// adds the given point to a winding at the given spot
// (for instance when spot is zero then the point is added at position zero)
// the original winding is NOT freed
//
// Parameter:				-
// Returns:					the new winding with the added point
// Changes Globals:		-
//===========================================================================
winding_t *AddWindingPoint( winding_t *w, vec3_t point, int spot ) {
	int i, j;
	winding_t *neww;

	if ( spot > w->numpoints ) {
		Error( "AddWindingPoint: num > w->numpoints" );
	} //end if
	if ( spot < 0 ) {
		Error( "AddWindingPoint: num < 0" );
	} //end if
	neww = AllocWinding( w->numpoints + 1 );
	neww->numpoints = w->numpoints + 1;
	for ( i = 0, j = 0; i < neww->numpoints; i++ )
	{
		if ( i == spot ) {
			VectorCopy( point, neww->p[i] );
		} //end if
		else
		{
			VectorCopy( w->p[j], neww->p[i] );
			j++;
		} //end else
	} //end for
	return neww;
} //end of the function AddWindingPoint
开发者ID:chegestar,项目名称:omni-bot,代码行数:34,代码来源:l_poly.c


示例5: AllocWinding

/*
=============
WindingFromFace
=============
*/
winding_t	*WindingFromFace (dface_t *f)
{
	int			i;
	int			se;
	dvertex_t	*dv;
	int			v;
	winding_t	*w;

	w = AllocWinding (f->numedges);
	w->numpoints = f->numedges;

	for (i=0 ; i<f->numedges ; i++)
	{
		se = dsurfedges[f->firstedge + i];
		if (se < 0)
			v = dedges[-se].v[1];
		else
			v = dedges[se].v[0];

		dv = &dvertexes[v];
		VectorCopy (dv->point, w->p[i]);
	}

	RemoveColinearPoints (w);

	return w;
}
开发者ID:jpiolho,项目名称:halflife,代码行数:32,代码来源:qrad.c


示例6: ProjectDecalOntoTriangles

static void ProjectDecalOntoTriangles( decalProjector_t *dp, mapDrawSurface_t *ds )
{
	int			i;
	vec4_t		plane;
	float		d;
	winding_t	*w;
	
	
	/* triangle surfaces without shaders don't get marks by default */
	if( ds->type == SURFACE_TRIANGLES && ds->shaderInfo->shaderText == NULL )
		return;
	
	/* backface check */
	if( ds->planar )
	{
		VectorCopy( mapplanes[ ds->planeNum ].normal, plane );
		plane[ 3 ] = mapplanes[ ds->planeNum ].dist + DotProduct( plane, entityOrigin );
		d = DotProduct( dp->planes[ 0 ], plane );
		if( d < -0.0001f )
			return;
	}
	
	/* iterate through triangles */
	for( i = 0; i < ds->numIndexes; i += 3 )
	{
		/* generate decal */
		w = AllocWinding( 3 );
		w->numpoints = 3;
		VectorCopy( ds->verts[ ds->indexes[ i ] ].xyz, w->p[ 0 ] );
		VectorCopy( ds->verts[ ds->indexes[ i + 1 ] ].xyz, w->p[ 1 ] );
		VectorCopy( ds->verts[ ds->indexes[ i + 2 ] ].xyz, w->p[ 2 ] );
		ProjectDecalOntoWinding( dp, ds, w );
	}
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:34,代码来源:decals.c


示例7: AllocWinding

/**
 * @brief
 */
winding_t *WindingForFace(const bsp_face_t *f) {
	int32_t i;
	bsp_vertex_t *dv;
	int32_t v;
	winding_t *w;

	w = AllocWinding(f->num_edges);
	w->num_points = f->num_edges;

	for (i = 0; i < f->num_edges; i++) {
		const int32_t se = bsp_file.face_edges[f->first_edge + i];
		if (se < 0) {
			v = bsp_file.edges[-se].v[1];
		} else {
			v = bsp_file.edges[se].v[0];
		}

		dv = &bsp_file.vertexes[v];
		VectorCopy(dv->point, w->points[i]);
	}

	RemoveColinearPoints(w);

	return w;
}
开发者ID:jdolan,项目名称:quetoo,代码行数:28,代码来源:polylib.c


示例8: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t *CopyWinding(winding_t * w) {
	intptr_t        size;
	winding_t      *c;

	c = AllocWinding(w->numpoints);
	size = (intptr_t) ((winding_t *)0)->p[w->numpoints];
	Com_Memcpy(c, w, size);
	return c;
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:14,代码来源:cm_polylib.cpp


示例9: Q_fabs

/*
=======================================================================================================================================
BaseWindingForPlane
=======================================================================================================================================
*/
winding_t *BaseWindingForPlane(vec3_t normal, vec_t dist) {
	int i, x = -1;
	vec_t max = -MAX_MAP_BOUNDS, v;
	vec3_t org, vright, vup;
	winding_t *w;

	// find the major axis
	for (i = 0; i < 3; i++) {
		v = Q_fabs(normal[i]);

		if (v > max) {
			x = i;
			max = v;
		}
	}

	if (x == -1) {
		Com_Error(ERR_DROP, "BaseWindingForPlane: no axis found");
	}

	VectorCopy(vec3_origin, vup);

	switch (x) {
		case 0:
		case 1:
			vup[2] = 1;
			break;
		case 2:
			vup[0] = 1;
			break;
	}

	v = DotProduct(vup, normal);

	VectorMA(vup, -v, normal, vup);
	vec3_norm2(vup, vup);
	VectorScale(normal, dist, org);
	vec3_cross(vup, normal, vright);
	VectorScale(vup, MAX_MAP_BOUNDS, vup);
	VectorScale(vright, MAX_MAP_BOUNDS, vright);
	// project a really big axis aligned box onto the plane
	w = AllocWinding(4);

	VectorSubtract(org, vright, w->p[0]);
	VectorAdd(w->p[0], vup, w->p[0]);
	VectorAdd(org, vright, w->p[1]);
	VectorAdd(w->p[1], vup, w->p[1]);
	VectorAdd(org, vright, w->p[2]);
	VectorSubtract(w->p[2], vup, w->p[2]);
	VectorSubtract(org, vright, w->p[3]);
	VectorSubtract(w->p[3], vup, w->p[3]);

	w->numpoints = 4;

	return w;
}
开发者ID:ioid3-games,项目名称:ioid3-wet,代码行数:61,代码来源:cm_polylib.c


示例10: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t *CopyWinding (winding_t *w)
{
	int			size;
	winding_t	*c;

	c = AllocWinding (w->numpoints);
	size = sizeof(*w) + sizeof(*w->p) * w->numpoints;
	memcpy (c, w, size);
	return c;
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:15,代码来源:l_poly.c


示例11: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t	*CopyWinding (winding_t *w)
{
    int			size;
    winding_t	*c;

    c = AllocWinding (w->numpoints);
    size = sizeof(vec3_t) * w->numpoints + sizeof(int);
    Com_Memcpy (c, w, size);
    return c;
}
开发者ID:zturtleman,项目名称:recoil,代码行数:15,代码来源:cm_polylib.c


示例12: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t	*CopyWinding (winding_t *w)
{
	int			size;
	winding_t	*c;

	c = AllocWinding (w->numpoints);
	size = (int)((size_t)((winding_t *)0)->p[w->numpoints]);
	memcpy (c, w, size);
	return c;
}
开发者ID:AEonZR,项目名称:GtkRadiant,代码行数:15,代码来源:polylib.c


示例13: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t	*CopyWinding (winding_t *w)
{
	unsigned long	size;
	winding_t	*c;

	c = AllocWinding (w->numpoints);
	size = (long)((winding_t *)0)->p[w->numpoints];
	Com_Memcpy (c, w, size);
	return c;
}
开发者ID:entdark,项目名称:q3mme,代码行数:15,代码来源:cm_polylib.c


示例14: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t *CopyWinding (winding_t *w)
{
	int			size;
	winding_t	*c;

	c = AllocWinding (w->numpoints);
	c->numpoints = w->numpoints;
	size = w->numpoints*sizeof(w->p[0]);
	memcpy (c->p, w->p, size);
	return c;
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:16,代码来源:polylib.cpp


示例15: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t *CopyWinding (winding_t *w)
{
	int			size;
	winding_t	*c;

	c = AllocWinding (w->numpoints);
	// Compute size the same way than in AllocWinding
	size = sizeof(vec_t)*3*w->numpoints + sizeof(int);
	memcpy (c, w, size);
	return c;
}
开发者ID:smokin-guns,项目名称:bspc,代码行数:16,代码来源:l_poly.c


示例16: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t	*CopyWinding (winding_t *w)
{
	size_t			size;
	winding_t	*c;

	if (!w) Error("CopyWinding: winding is NULL");

	c = AllocWinding (w->numpoints);
	size = (size_t)((winding_t *)NULL)->p[w->numpoints];
	memcpy (c, w, size);
	return c;
}
开发者ID:clbr,项目名称:netradiant,代码行数:17,代码来源:polylib.c


示例17: Error

/*
   ==================
   CopyWinding
   ==================
 */
winding_t   *CopyWinding( winding_t *w ){
	size_t size;
	winding_t   *c;

	if ( !w ) {
		Error( "CopyWinding: winding is NULL" );
	}

	c = AllocWinding( w->numpoints );
	size = sizeof( *w ) + sizeof( *w->p ) * w->numpoints;
	memcpy( c, w, size );
	return c;
}
开发者ID:TTimo,项目名称:GtkRadiant,代码行数:18,代码来源:polylib.c


示例18: AllocWinding

/*
====================
WindingFromDrawSurf
====================
*/
winding_t      *WindingFromDrawSurf(drawSurface_t * ds)
{
	winding_t      *w;
	int             i;

	w = AllocWinding(ds->numVerts);
	w->numpoints = ds->numVerts;
	for(i = 0; i < ds->numVerts; i++)
	{
		VectorCopy(ds->verts[i].xyz, w->p[i]);
	}
	return w;
}
开发者ID:otty,项目名称:cake3,代码行数:18,代码来源:fog.c


示例19: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t	*CopyWinding (winding_t *w)
{
	int			size;
	winding_t	*c;
	
	c = AllocWinding(w->numpoints);
	c->next = 0;
	c->numpoints = w->numpoints;
	c->parent = w->parent;
	c->children[0] = w->children[0];
	c->children[1] = w->children[1];
	memcpy (c->p, w->p, w->numpoints*sizeof(vertex_t));
	return c;
}
开发者ID:Arc0re,项目名称:prboom3ds,代码行数:19,代码来源:polylib.c


示例20: AllocWinding

/*
==================
CopyWinding
==================
*/
winding_t   *CopyWinding( winding_t *w ) {
	int size;
	winding_t   *c;

	c = AllocWinding( w->numpoints );
	size = (int)( (winding_t *)0 )->p[w->numpoints];

#if defined RTCW_SP
	Com_Memcpy( c, w, size );
#else
	memcpy( c, w, size );
#endif // RTCW_XX

	return c;
}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:20,代码来源:cm_polylib.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AllocateAndInitializeSid函数代码示例发布时间:2022-05-30
下一篇:
C++ AllocVec函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap