亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cmodel.c

?? 著名游戲quake2原代碼最新版本(vc6.0可以編譯的)
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):

}


/*
================
CM_TestInLeaf
================
*/
void CM_TestInLeaf (int leafnum)
{
	int			k;
	int			brushnum;
	cleaf_t		*leaf;
	cbrush_t	*b;

	leaf = &map_leafs[leafnum];
	if ( !(leaf->contents & trace_contents))
		return;
	// trace line against all brushes in the leaf
	for (k=0 ; k<leaf->numleafbrushes ; k++)
	{
		brushnum = map_leafbrushes[leaf->firstleafbrush+k];
		b = &map_brushes[brushnum];
		if (b->checkcount == checkcount)
			continue;	// already checked this brush in another leaf
		b->checkcount = checkcount;

		if ( !(b->contents & trace_contents))
			continue;
		CM_TestBoxInBrush (trace_mins, trace_maxs, trace_start, &trace_trace, b);
		if (!trace_trace.fraction)
			return;
	}

}


/*
==================
CM_RecursiveHullCheck

==================
*/
void CM_RecursiveHullCheck (int num, float p1f, float p2f, vec3_t p1, vec3_t p2)
{
	cnode_t		*node;
	cplane_t	*plane;
	float		t1, t2, offset;
	float		frac, frac2;
	float		idist;
	int			i;
	vec3_t		mid;
	int			side;
	float		midf;

	if (trace_trace.fraction <= p1f)
		return;		// already hit something nearer

	// if < 0, we are in a leaf node
	if (num < 0)
	{
		CM_TraceToLeaf (-1-num);
		return;
	}

	//
	// find the point distances to the seperating plane
	// and the offset for the size of the box
	//
	node = map_nodes + num;
	plane = node->plane;

	if (plane->type < 3)
	{
		t1 = p1[plane->type] - plane->dist;
		t2 = p2[plane->type] - plane->dist;
		offset = trace_extents[plane->type];
	}
	else
	{
		t1 = DotProduct (plane->normal, p1) - plane->dist;
		t2 = DotProduct (plane->normal, p2) - plane->dist;
		if (trace_ispoint)
			offset = 0;
		else
			offset = fabs(trace_extents[0]*plane->normal[0]) +
				fabs(trace_extents[1]*plane->normal[1]) +
				fabs(trace_extents[2]*plane->normal[2]);
	}


#if 0
CM_RecursiveHullCheck (node->children[0], p1f, p2f, p1, p2);
CM_RecursiveHullCheck (node->children[1], p1f, p2f, p1, p2);
return;
#endif

	// see which sides we need to consider
	if (t1 >= offset && t2 >= offset)
	{
		CM_RecursiveHullCheck (node->children[0], p1f, p2f, p1, p2);
		return;
	}
	if (t1 < -offset && t2 < -offset)
	{
		CM_RecursiveHullCheck (node->children[1], p1f, p2f, p1, p2);
		return;
	}

	// put the crosspoint DIST_EPSILON pixels on the near side
	if (t1 < t2)
	{
		idist = 1.0/(t1-t2);
		side = 1;
		frac2 = (t1 + offset + DIST_EPSILON)*idist;
		frac = (t1 - offset + DIST_EPSILON)*idist;
	}
	else if (t1 > t2)
	{
		idist = 1.0/(t1-t2);
		side = 0;
		frac2 = (t1 - offset - DIST_EPSILON)*idist;
		frac = (t1 + offset + DIST_EPSILON)*idist;
	}
	else
	{
		side = 0;
		frac = 1;
		frac2 = 0;
	}

	// move up to the node
	if (frac < 0)
		frac = 0;
	if (frac > 1)
		frac = 1;
		
	midf = p1f + (p2f - p1f)*frac;
	for (i=0 ; i<3 ; i++)
		mid[i] = p1[i] + frac*(p2[i] - p1[i]);

	CM_RecursiveHullCheck (node->children[side], p1f, midf, p1, mid);


	// go past the node
	if (frac2 < 0)
		frac2 = 0;
	if (frac2 > 1)
		frac2 = 1;
		
	midf = p1f + (p2f - p1f)*frac2;
	for (i=0 ; i<3 ; i++)
		mid[i] = p1[i] + frac2*(p2[i] - p1[i]);

	CM_RecursiveHullCheck (node->children[side^1], midf, p2f, mid, p2);
}



//======================================================================

/*
==================
CM_BoxTrace
==================
*/
trace_t		CM_BoxTrace (vec3_t start, vec3_t end,
						  vec3_t mins, vec3_t maxs,
						  int headnode, int brushmask)
{
	int		i;

	checkcount++;		// for multi-check avoidance

	c_traces++;			// for statistics, may be zeroed

	// fill in a default trace
	memset (&trace_trace, 0, sizeof(trace_trace));
	trace_trace.fraction = 1;
	trace_trace.surface = &(nullsurface.c);

	if (!numnodes)	// map not loaded
		return trace_trace;

	trace_contents = brushmask;
	VectorCopy (start, trace_start);
	VectorCopy (end, trace_end);
	VectorCopy (mins, trace_mins);
	VectorCopy (maxs, trace_maxs);

	//
	// check for position test special case
	//
	if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2])
	{
		int		leafs[1024];
		int		i, numleafs;
		vec3_t	c1, c2;
		int		topnode;

		VectorAdd (start, mins, c1);
		VectorAdd (start, maxs, c2);
		for (i=0 ; i<3 ; i++)
		{
			c1[i] -= 1;
			c2[i] += 1;
		}

		numleafs = CM_BoxLeafnums_headnode (c1, c2, leafs, 1024, headnode, &topnode);
		for (i=0 ; i<numleafs ; i++)
		{
			CM_TestInLeaf (leafs[i]);
			if (trace_trace.allsolid)
				break;
		}
		VectorCopy (start, trace_trace.endpos);
		return trace_trace;
	}

	//
	// check for point special case
	//
	if (mins[0] == 0 && mins[1] == 0 && mins[2] == 0
		&& maxs[0] == 0 && maxs[1] == 0 && maxs[2] == 0)
	{
		trace_ispoint = true;
		VectorClear (trace_extents);
	}
	else
	{
		trace_ispoint = false;
		trace_extents[0] = -mins[0] > maxs[0] ? -mins[0] : maxs[0];
		trace_extents[1] = -mins[1] > maxs[1] ? -mins[1] : maxs[1];
		trace_extents[2] = -mins[2] > maxs[2] ? -mins[2] : maxs[2];
	}

	//
	// general sweeping through world
	//
	CM_RecursiveHullCheck (headnode, 0, 1, start, end);

	if (trace_trace.fraction == 1)
	{
		VectorCopy (end, trace_trace.endpos);
	}
	else
	{
		for (i=0 ; i<3 ; i++)
			trace_trace.endpos[i] = start[i] + trace_trace.fraction * (end[i] - start[i]);
	}
	return trace_trace;
}


/*
==================
CM_TransformedBoxTrace

Handles offseting and rotation of the end points for moving and
rotating entities
==================
*/
#ifdef _WIN32
#pragma optimize( "", off )
#endif


trace_t		CM_TransformedBoxTrace (vec3_t start, vec3_t end,
						  vec3_t mins, vec3_t maxs,
						  int headnode, int brushmask,
						  vec3_t origin, vec3_t angles)
{
	trace_t		trace;
	vec3_t		start_l, end_l;
	vec3_t		a;
	vec3_t		forward, right, up;
	vec3_t		temp;
	qboolean	rotated;

	// subtract origin offset
	VectorSubtract (start, origin, start_l);
	VectorSubtract (end, origin, end_l);

	// rotate start and end into the models frame of reference
	if (headnode != box_headnode && 
	(angles[0] || angles[1] || angles[2]) )
		rotated = true;
	else
		rotated = false;

	if (rotated)
	{
		AngleVectors (angles, forward, right, up);

		VectorCopy (start_l, temp);
		start_l[0] = DotProduct (temp, forward);
		start_l[1] = -DotProduct (temp, right);
		start_l[2] = DotProduct (temp, up);

		VectorCopy (end_l, temp);
		end_l[0] = DotProduct (temp, forward);
		end_l[1] = -DotProduct (temp, right);
		end_l[2] = DotProduct (temp, up);
	}

	// sweep the box through the model
	trace = CM_BoxTrace (start_l, end_l, mins, maxs, headnode, brushmask);

	if (rotated && trace.fraction != 1.0)
	{
		// FIXME: figure out how to do this with existing angles
		VectorNegate (angles, a);
		AngleVectors (a, forward, right, up);

		VectorCopy (trace.plane.normal, temp);
		trace.plane.normal[0] = DotProduct (temp, forward);
		trace.plane.normal[1] = -DotProduct (temp, right);
		trace.plane.normal[2] = DotProduct (temp, up);
	}

	trace.endpos[0] = start[0] + trace.fraction * (end[0] - start[0]);
	trace.endpos[1] = start[1] + trace.fraction * (end[1] - start[1]);
	trace.endpos[2] = start[2] + trace.fraction * (end[2] - start[2]);

	return trace;
}

#ifdef _WIN32
#pragma optimize( "", on )
#endif



/*
===============================================================================

PVS / PHS

===============================================================================
*/

/*
===================
CM_DecompressVis
===================
*/
void CM_DecompressVis (byte *in, byte *out)
{
	int		c;
	byte	*out_p;
	int		row;

	row = (numclusters+7)>>3;	
	out_p = out;

	if (!in || !numvisibility)
	{	// no vis info, so make all visible
		while (row)
		{
			*out_p++ = 0xff;
			row--;
		}
		return;		
	}

	do
	{
		if (*in)
		{
			*out_p++ = *in++;
			continue;
		}
	
		c = in[1];
		in += 2;
		if ((out_p - out) + c > row)
		{
			c = row - (out_p - out);
			Com_DPrintf ("warning: Vis decompression overrun\n");
		}
		while (c)
		{
			*out_p++ = 0;
			c--;
		}
	} while (out_p - out < row);
}

byte	pvsrow[MAX_MAP_LEAFS/8];
byte	phsrow[MAX_MAP_LEAFS/8];

byte	*CM_ClusterPVS (int cluster)
{
	if (cluster == -1)
		memset (pvsrow, 0, (numclusters+7)>>3);
	else
		CM_DecompressVis (map_visibility + map_vis->bitofs[cluster][DVIS_PVS], pvsrow);
	return pvsrow;
}

byte	*CM_ClusterPHS (int cluster)
{
	if (cluster == -1)
		memset (phsrow, 0, (numclusters+7)>>3);
	else
		CM_DecompressVis (map_visibility + map_vis->bitofs[cluster][DVIS_PHS], phsrow);
	return phsrow;
}


/*
===============================================================================

AREAPORTALS

===============================================================================
*/

void FloodArea_r (carea_t *area, int floodnum)
{
	int		i;
	dareaportal_t	*p;

	if (area->floodvalid == floodvalid)
	{
		if (area->floodnum == floodnum)
			return;
		Com_Error (ERR_DROP, "FloodArea_r: reflooded");
	}

	area->floodnum = floodnum;
	area->floodvalid = floodvalid;
	p = &map_areaportals[area->firstareaportal];
	for (i=0 ; i<area->numareaportals ; i++, p++)
	{
		if (portalopen[p->portalnum])
			FloodArea_r (&map_areas[p->otherarea], floodnum);
	}
}

/*
====================
FloodAreaConnections


====================
*/
void	FloodAreaConnections (void)
{
	int		i;
	carea_t	*area;
	int		floodnum;

	// all current floods are now invalid
	floodvalid++;
	floodnum = 0;

	// area 0 is not used
	for (i=1 ; i<numareas ; i++)
	{
		area = &map_areas[i];
		if (area->floodvalid == floodvalid)
			continue;		// already flooded into
		floodnum++;
		FloodArea_r (area, floodnum);
	}

}

void	CM_SetAreaPortalState (int portalnum, qboolean open)
{
	if (portalnum > numareaportals)
		Com_Error (ERR_DROP, "areaportal > numareaportals");

	portalopen[portalnum] = open;
	FloodAreaConnections ();
}

qboolean	CM_AreasConnected (int area1, int area2)
{
	if (map_noareas->value)
		return true;

	if (area1 > numareas || area2 > numareas)
		Com_Error (ERR_DROP, "area > numareas");

	if (map_areas[area1].floodnum == map_areas[area2].floodnum)
		return true;
	return false;
}


/*
=================
CM_WriteAreaBits

Writes a length byte followed by a bit vector of all the areas
that area in the same flood as the area parameter

This is used by the client refreshes to cull visibility
=================
*/
int CM_WriteAreaBits (byte *buffer, int area)
{
	int		i;
	int		floodnum;
	int		bytes;

	bytes = (numareas+7)>>3;

	if (map_noareas->value)
	{	// for debugging, send everything
		memset (buffer, 255, bytes);
	}
	else
	{
		memset (buffer, 0, bytes);

		floodnum = map_areas[area].floodnum;
		for (i=0 ; i<numareas ; i++)
		{
			if (map_areas[i].floodnum == floodnum || !area)
				buffer[i>>3] |= 1<<(i&7);
		}
	}

	return bytes;
}


/*
===================
CM_WritePortalState

Writes the portal state to a savegame file
===================
*/
void	CM_WritePortalState (FILE *f)
{
	fwrite (portalopen, sizeof(portalopen), 1, f);
}

/*
===================
CM_ReadPortalState

Reads the portal state from a savegame file
and recalculates the area connections
===================
*/
void	CM_ReadPortalState (FILE *f)
{
	FS_Read (portalopen, sizeof(portalopen), f);
	FloodAreaConnections ();
}

/*
=============
CM_HeadnodeVisible

Returns true if any leaf under headnode has a cluster that
is potentially visible
=============
*/
qboolean CM_HeadnodeVisible (int nodenum, byte *visbits)
{
	int		leafnum;
	int		cluster;
	cnode_t	*node;

	if (nodenum < 0)
	{
		leafnum = -1-nodenum;
		cluster = map_leafs[leafnum].cluster;
		if (cluster == -1)
			return false;
		if (visbits[cluster>>3] & (1<<(cluster&7)))
			return true;
		return false;
	}

	node = &map_nodes[nodenum];
	if (CM_HeadnodeVisible(node->children[0], visbits))
		return true;
	return CM_HeadnodeVisible(node->children[1], visbits);
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷久久99综合精品jk白丝 | 久久久久久久综合色一本| 色欧美88888久久久久久影院| 国产成a人亚洲精品| 国产精品白丝jk白祙喷水网站| 久久av中文字幕片| 激情综合色综合久久| 精品综合久久久久久8888| 狠狠色丁香婷婷综合| 狠狠色综合日日| 国产一区二三区好的| 国产精品一级二级三级| 成人毛片在线观看| 成人高清免费观看| 91免费看`日韩一区二区| 91丨九色porny丨蝌蚪| 欧洲另类一二三四区| 欧美久久久久免费| 日韩欧美中文字幕一区| 精品国产一区二区在线观看| 国产婷婷一区二区| 亚洲欧美日韩电影| 午夜伊人狠狠久久| 久久精品国产精品亚洲红杏| 国内精品第一页| 粉嫩aⅴ一区二区三区四区五区| 99亚偷拍自图区亚洲| 欧美主播一区二区三区美女| 欧美福利电影网| 2020国产精品自拍| 国产精品久久三区| 爽好久久久欧美精品| 久久99久久99小草精品免视看| 国产高清无密码一区二区三区| 99久久99久久综合| 欧美日韩情趣电影| 久久久久国产精品厨房| 中文字幕亚洲成人| 五月婷婷另类国产| 国产一区二区三区不卡在线观看| 成人av中文字幕| 欧美精品丝袜久久久中文字幕| 日韩一区二区不卡| 国产精品二三区| 秋霞影院一区二区| 成人福利在线看| 5566中文字幕一区二区电影| 久久九九久久九九| 亚洲v精品v日韩v欧美v专区| 国产精品小仙女| 欧美色图12p| 国产欧美一区二区精品仙草咪| 亚洲在线一区二区三区| 国产精品一区二区三区99| 欧美在线免费观看亚洲| 久久亚洲精品国产精品紫薇| 亚洲在线中文字幕| 国产91精品精华液一区二区三区| 欧美日韩国产高清一区| 国产欧美日本一区视频| 日本成人在线一区| 日本精品视频一区二区| 久久亚洲一区二区三区明星换脸 | 国产精品国产自产拍在线| 午夜精品免费在线观看| 成人免费av资源| 欧美电影免费观看高清完整版在 | 老司机午夜精品| 一本久久精品一区二区| 久久九九99视频| 奇米777欧美一区二区| 色综合一区二区三区| 久久久午夜电影| 手机精品视频在线观看| 99久久精品国产毛片| 国产亚洲精品中文字幕| 久久99精品久久久久| 欧美精品一级二级三级| 夜夜精品浪潮av一区二区三区| 成人午夜激情片| 久久久久国产成人精品亚洲午夜| 秋霞影院一区二区| 在线不卡免费欧美| 亚洲福利视频三区| 色婷婷综合中文久久一本| 国产精品免费视频一区| 国产成人h网站| 精品1区2区在线观看| 麻豆精品在线观看| 777a∨成人精品桃花网| 午夜精品视频一区| 欧美日韩高清影院| 亚洲午夜一区二区| 欧美午夜精品久久久久久超碰| 亚洲视频在线一区观看| 成人性生交大片免费看中文网站| 国产偷国产偷亚洲高清人白洁 | 在线观看日韩精品| 日韩久久一区二区| 91首页免费视频| ㊣最新国产の精品bt伙计久久| 成人爽a毛片一区二区免费| 欧美国产国产综合| 高清视频一区二区| 中文字幕成人av| 成人激情黄色小说| 亚洲欧洲综合另类在线| 色婷婷久久久综合中文字幕| 一区二区三区产品免费精品久久75| 99精品欧美一区二区三区小说| 中文字幕中文字幕一区二区| 97久久精品人人做人人爽50路| 最近中文字幕一区二区三区| 91麻豆成人久久精品二区三区| 亚洲男人的天堂av| 欧美日韩日本视频| 99久久99久久综合| 亚洲精品日韩综合观看成人91| 色综合久久综合网欧美综合网| 亚洲小少妇裸体bbw| 日韩一区二区免费在线观看| 久久精品国产精品青草| 国产欧美日韩在线视频| 91免费在线视频观看| 五月综合激情网| 久久久久久影视| 99久久综合狠狠综合久久| 亚洲已满18点击进入久久| 91精品国产综合久久精品app | 国产一区不卡精品| 国产精品家庭影院| 精品婷婷伊人一区三区三| 青草av.久久免费一区| 国产网站一区二区三区| 色av综合在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产日韩在线不卡| 在线免费观看一区| 激情综合网av| 亚洲天堂2016| 日韩欧美国产三级电影视频| 成人av免费在线观看| 丝袜美腿亚洲色图| 国产精品免费看片| 9191久久久久久久久久久| 国产伦精一区二区三区| 亚洲黄色免费网站| 日韩欧美激情一区| 91同城在线观看| 精品中文字幕一区二区小辣椒| 中文字幕一区在线观看视频| 91精品婷婷国产综合久久| 成人动漫一区二区| 日本不卡一区二区| 亚洲欧美在线高清| 欧美一卡在线观看| 色狠狠综合天天综合综合| 另类人妖一区二区av| 一区二区三区免费在线观看| 26uuuu精品一区二区| 欧洲亚洲精品在线| 成人天堂资源www在线| 蜜桃久久av一区| 樱花草国产18久久久久| 国产午夜亚洲精品理论片色戒| 欧美高清激情brazzers| 91在线视频播放| 极品销魂美女一区二区三区| 亚洲国产欧美一区二区三区丁香婷| 国产日产亚洲精品系列| 9191国产精品| 色老综合老女人久久久| 国产成人精品影院| 精品一区二区av| 日韩国产一区二| 亚洲三级免费观看| 中文幕一区二区三区久久蜜桃| 欧美一级国产精品| 精品视频一区 二区 三区| 91亚洲精品乱码久久久久久蜜桃 | a级精品国产片在线观看| 精品一区二区精品| 首页国产丝袜综合| 亚洲一区在线观看视频| 国产精品嫩草久久久久| 久久久激情视频| 精品国产精品网麻豆系列| 欧美福利一区二区| 欧美日韩一区二区不卡| 色综合久久久久久久| 成人久久久精品乱码一区二区三区 | 欧美成人三级在线| 91麻豆精品国产自产在线| 欧美系列亚洲系列| 色悠悠久久综合| 91麻豆福利精品推荐| 97se亚洲国产综合自在线不卡| 懂色av一区二区在线播放| 国产精品一级在线| 国产成人午夜99999|