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

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

?? r_edge.c

?? 著名游戲quake2原代碼最新版本(vc6.0可以編譯的)
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program 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.

This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
// r_edge.c

#include "r_local.h"

#ifndef id386
void R_SurfacePatch (void)
{
}

void R_EdgeCodeStart (void)
{
}

void R_EdgeCodeEnd (void)
{
}
#endif


#if 0
the complex cases add new polys on most lines, so dont optimize for keeping them the same
have multiple free span lists to try to get better coherence?
low depth complexity -- 1 to 3 or so

have a sentinal at both ends?
#endif


edge_t	*auxedges;
edge_t	*r_edges, *edge_p, *edge_max;

surf_t	*surfaces, *surface_p, *surf_max;

// surfaces are generated in back to front order by the bsp, so if a surf
// pointer is greater than another one, it should be drawn in front
// surfaces[1] is the background, and is used as the active surface stack

edge_t	*newedges[MAXHEIGHT];
edge_t	*removeedges[MAXHEIGHT];

espan_t	*span_p, *max_span_p;

int		r_currentkey;

int	current_iv;

int	edge_head_u_shift20, edge_tail_u_shift20;

static void (*pdrawfunc)(void);

edge_t	edge_head;
edge_t	edge_tail;
edge_t	edge_aftertail;
edge_t	edge_sentinel;

float	fv;

static int	miplevel;

float		scale_for_mip;
int			ubasestep, errorterm, erroradjustup, erroradjustdown;

// FIXME: should go away
extern void			R_RotateBmodel (void);
extern void			R_TransformFrustum (void);



void R_GenerateSpans (void);
void R_GenerateSpansBackward (void);

void R_LeadingEdge (edge_t *edge);
void R_LeadingEdgeBackwards (edge_t *edge);
void R_TrailingEdge (surf_t *surf, edge_t *edge);


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

EDGE SCANNING

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

/*
==============
R_BeginEdgeFrame
==============
*/
void R_BeginEdgeFrame (void)
{
	int		v;

	edge_p = r_edges;
	edge_max = &r_edges[r_numallocatededges];

	surface_p = &surfaces[2];	// background is surface 1,
								//  surface 0 is a dummy
	surfaces[1].spans = NULL;	// no background spans yet
	surfaces[1].flags = SURF_DRAWBACKGROUND;

// put the background behind everything in the world
	if (sw_draworder->value)
	{
		pdrawfunc = R_GenerateSpansBackward;
		surfaces[1].key = 0;
		r_currentkey = 1;
	}
	else
	{
		pdrawfunc = R_GenerateSpans;
		surfaces[1].key = 0x7FFfFFFF;
		r_currentkey = 0;
	}

// FIXME: set with memset
	for (v=r_refdef.vrect.y ; v<r_refdef.vrectbottom ; v++)
	{
		newedges[v] = removeedges[v] = NULL;
	}
}


#if	!id386

/*
==============
R_InsertNewEdges

Adds the edges in the linked list edgestoadd, adding them to the edges in the
linked list edgelist.  edgestoadd is assumed to be sorted on u, and non-empty (this is actually newedges[v]).  edgelist is assumed to be sorted on u, with a
sentinel at the end (actually, this is the active edge table starting at
edge_head.next).
==============
*/
void R_InsertNewEdges (edge_t *edgestoadd, edge_t *edgelist)
{
	edge_t	*next_edge;

	do
	{
		next_edge = edgestoadd->next;
edgesearch:
		if (edgelist->u >= edgestoadd->u)
			goto addedge;
		edgelist=edgelist->next;
		if (edgelist->u >= edgestoadd->u)
			goto addedge;
		edgelist=edgelist->next;
		if (edgelist->u >= edgestoadd->u)
			goto addedge;
		edgelist=edgelist->next;
		if (edgelist->u >= edgestoadd->u)
			goto addedge;
		edgelist=edgelist->next;
		goto edgesearch;

	// insert edgestoadd before edgelist
addedge:
		edgestoadd->next = edgelist;
		edgestoadd->prev = edgelist->prev;
		edgelist->prev->next = edgestoadd;
		edgelist->prev = edgestoadd;
	} while ((edgestoadd = next_edge) != NULL);
}

#endif	// !id386
	

#if	!id386

/*
==============
R_RemoveEdges
==============
*/
void R_RemoveEdges (edge_t *pedge)
{

	do
	{
		pedge->next->prev = pedge->prev;
		pedge->prev->next = pedge->next;
	} while ((pedge = pedge->nextremove) != NULL);
}

#endif	// !id386


#if	!id386

/*
==============
R_StepActiveU
==============
*/
void R_StepActiveU (edge_t *pedge)
{
	edge_t		*pnext_edge, *pwedge;

	while (1)
	{
nextedge:
		pedge->u += pedge->u_step;
		if (pedge->u < pedge->prev->u)
			goto pushback;
		pedge = pedge->next;
			
		pedge->u += pedge->u_step;
		if (pedge->u < pedge->prev->u)
			goto pushback;
		pedge = pedge->next;
			
		pedge->u += pedge->u_step;
		if (pedge->u < pedge->prev->u)
			goto pushback;
		pedge = pedge->next;
			
		pedge->u += pedge->u_step;
		if (pedge->u < pedge->prev->u)
			goto pushback;
		pedge = pedge->next;
			
		goto nextedge;		
		
pushback:
		if (pedge == &edge_aftertail)
			return;
			
	// push it back to keep it sorted		
		pnext_edge = pedge->next;

	// pull the edge out of the edge list
		pedge->next->prev = pedge->prev;
		pedge->prev->next = pedge->next;

	// find out where the edge goes in the edge list
		pwedge = pedge->prev->prev;

		while (pwedge->u > pedge->u)
		{
			pwedge = pwedge->prev;
		}

	// put the edge back into the edge list
		pedge->next = pwedge->next;
		pedge->prev = pwedge;
		pedge->next->prev = pedge;
		pwedge->next = pedge;

		pedge = pnext_edge;
		if (pedge == &edge_tail)
			return;
	}
}

#endif	// !id386


/*
==============
R_CleanupSpan
==============
*/
void R_CleanupSpan (void)
{
	surf_t	*surf;
	int		iu;
	espan_t	*span;

// now that we've reached the right edge of the screen, we're done with any
// unfinished surfaces, so emit a span for whatever's on top
	surf = surfaces[1].next;
	iu = edge_tail_u_shift20;
	if (iu > surf->last_u)
	{
		span = span_p++;
		span->u = surf->last_u;
		span->count = iu - span->u;
		span->v = current_iv;
		span->pnext = surf->spans;
		surf->spans = span;
	}

// reset spanstate for all surfaces in the surface stack
	do
	{
		surf->spanstate = 0;
		surf = surf->next;
	} while (surf != &surfaces[1]);
}


/*
==============
R_LeadingEdgeBackwards
==============
*/
void R_LeadingEdgeBackwards (edge_t *edge)
{
	espan_t			*span;
	surf_t			*surf, *surf2;
	int				iu;

// it's adding a new surface in, so find the correct place
	surf = &surfaces[edge->surfs[1]];

// don't start a span if this is an inverted span, with the end
// edge preceding the start edge (that is, we've already seen the
// end edge)
	if (++surf->spanstate == 1)
	{
		surf2 = surfaces[1].next;

		if (surf->key > surf2->key)
			goto newtop;

	// if it's two surfaces on the same plane, the one that's already
	// active is in front, so keep going unless it's a bmodel
		if (surf->insubmodel && (surf->key == surf2->key))
		{
		// must be two bmodels in the same leaf; don't care, because they'll
		// never be farthest anyway
			goto newtop;
		}

continue_search:

		do
		{
			surf2 = surf2->next;
		} while (surf->key < surf2->key);

		if (surf->key == surf2->key)
		{
		// if it's two surfaces on the same plane, the one that's already
		// active is in front, so keep going unless it's a bmodel
			if (!surf->insubmodel)
				goto continue_search;

		// must be two bmodels in the same leaf; don't care which is really
		// in front, because they'll never be farthest anyway
		}

		goto gotposition;

newtop:
	// emit a span (obscures current top)
		iu = edge->u >> 20;

		if (iu > surf2->last_u)
		{
			span = span_p++;
			span->u = surf2->last_u;
			span->count = iu - span->u;
			span->v = current_iv;
			span->pnext = surf2->spans;
			surf2->spans = span;
		}

		// set last_u on the new span
		surf->last_u = iu;
				
gotposition:
	// insert before surf2
		surf->next = surf2;
		surf->prev = surf2->prev;
		surf2->prev->next = surf;
		surf2->prev = surf;
	}
}


/*
==============
R_TrailingEdge
==============
*/
void R_TrailingEdge (surf_t *surf, edge_t *edge)
{
	espan_t			*span;
	int				iu;

// don't generate a span if this is an inverted span, with the end
// edge preceding the start edge (that is, we haven't seen the
// start edge yet)
	if (--surf->spanstate == 0)
	{
		if (surf == surfaces[1].next)
		{
		// emit a span (current top going away)
			iu = edge->u >> 20;
			if (iu > surf->last_u)
			{
				span = span_p++;
				span->u = surf->last_u;
				span->count = iu - span->u;
				span->v = current_iv;
				span->pnext = surf->spans;
				surf->spans = span;
			}

		// set last_u on the surface below
			surf->next->last_u = iu;
		}

		surf->prev->next = surf->next;
		surf->next->prev = surf->prev;
	}
}


#if	!id386

/*
==============
R_LeadingEdge
==============
*/
void R_LeadingEdge (edge_t *edge)
{
	espan_t			*span;
	surf_t			*surf, *surf2;
	int				iu;
	float			fu, newzi, testzi, newzitop, newzibottom;

	if (edge->surfs[1])
	{
	// it's adding a new surface in, so find the correct place
		surf = &surfaces[edge->surfs[1]];

	// don't start a span if this is an inverted span, with the end
	// edge preceding the start edge (that is, we've already seen the
	// end edge)
		if (++surf->spanstate == 1)
		{
			surf2 = surfaces[1].next;

			if (surf->key < surf2->key)
				goto newtop;

		// if it's two surfaces on the same plane, the one that's already
		// active is in front, so keep going unless it's a bmodel
			if (surf->insubmodel && (surf->key == surf2->key))
			{
			// must be two bmodels in the same leaf; sort on 1/z
				fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000);
				newzi = surf->d_ziorigin + fv*surf->d_zistepv +
						fu*surf->d_zistepu;
				newzibottom = newzi * 0.99;

				testzi = surf2->d_ziorigin + fv*surf2->d_zistepv +
						fu*surf2->d_zistepu;

				if (newzibottom >= testzi)
				{
					goto newtop;
				}

				newzitop = newzi * 1.01;
				if (newzitop >= testzi)
				{
					if (surf->d_zistepu >= surf2->d_zistepu)
					{
						goto newtop;
					}
				}
			}

continue_search:

			do
			{
				surf2 = surf2->next;
			} while (surf->key > surf2->key);

			if (surf->key == surf2->key)
			{
			// if it's two surfaces on the same plane, the one that's already
			// active is in front, so keep going unless it's a bmodel
				if (!surf->insubmodel)
					goto continue_search;

			// must be two bmodels in the same leaf; sort on 1/z
				fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000);
				newzi = surf->d_ziorigin + fv*surf->d_zistepv +
						fu*surf->d_zistepu;
				newzibottom = newzi * 0.99;

				testzi = surf2->d_ziorigin + fv*surf2->d_zistepv +
						fu*surf2->d_zistepu;

				if (newzibottom >= testzi)
				{
					goto gotposition;
				}

				newzitop = newzi * 1.01;
				if (newzitop >= testzi)
				{
					if (surf->d_zistepu >= surf2->d_zistepu)
					{
						goto gotposition;
					}
				}

				goto continue_search;
			}

			goto gotposition;

newtop:
		// emit a span (obscures current top)
			iu = edge->u >> 20;

			if (iu > surf2->last_u)
			{
				span = span_p++;
				span->u = surf2->last_u;
				span->count = iu - span->u;
				span->v = current_iv;
				span->pnext = surf2->spans;
				surf2->spans = span;
			}

			// set last_u on the new span
			surf->last_u = iu;
				
gotposition:
		// insert before surf2
			surf->next = surf2;
			surf->prev = surf2->prev;
			surf2->prev->next = surf;
			surf2->prev = surf;
		}
	}
}


/*
==============
R_GenerateSpans
==============
*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av亚洲精华国产精华| 亚洲成人动漫av| 国产盗摄精品一区二区三区在线| 日韩精品一区二区三区在线播放| 美国欧美日韩国产在线播放| 精品国产三级电影在线观看| 欧美日韩一区二区在线观看视频 | 日本二三区不卡| 亚洲精品成人在线| 欧美日本国产视频| 美脚の诱脚舐め脚责91| 中文字幕欧美日韩一区| 日本道免费精品一区二区三区| 亚洲在线中文字幕| 精品国产乱码久久久久久蜜臀| 国产传媒欧美日韩成人| 一区二区三区在线观看网站| 日韩一二三四区| 粉嫩一区二区三区在线看| 一区二区三区精密机械公司| 欧美一区二区三区婷婷月色| 国产成人综合自拍| 亚洲国产一二三| 2020日本不卡一区二区视频| 91丨国产丨九色丨pron| 奇米在线7777在线精品| 国产精品私人自拍| 欧美一区二区视频在线观看2022| 国产激情偷乱视频一区二区三区| 亚洲精品国产第一综合99久久 | 亚洲一区二区三区四区不卡| 欧美一区二区日韩一区二区| av色综合久久天堂av综合| 日韩成人免费看| 亚洲色大成网站www久久九九| 欧美丰满嫩嫩电影| 99精品一区二区三区| 免费亚洲电影在线| 一区二区三区四区蜜桃| 国产视频在线观看一区二区三区 | 中文字幕一区二区日韩精品绯色| 欧美久久久一区| youjizz久久| 精品一区二区久久| 亚洲午夜日本在线观看| 国产精品久久久久影院老司| 欧美大胆一级视频| 欧美卡1卡2卡| 91尤物视频在线观看| 国产精品一线二线三线| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲午夜久久久久| 日韩理论电影院| 日日噜噜夜夜狠狠视频欧美人| 中文av一区特黄| xf在线a精品一区二区视频网站| 欧美性猛交xxxx黑人交| 色婷婷久久久久swag精品| 国产高清久久久久| 久久成人综合网| 日韩中文字幕亚洲一区二区va在线| 日韩美女啊v在线免费观看| 国产网站一区二区| 欧美一二三区在线观看| 欧美精三区欧美精三区| 在线中文字幕不卡| 91麻豆福利精品推荐| 成人av综合在线| 国产精品99久久久久久久女警| 精品一区二区国语对白| 久久精品二区亚洲w码| 美女任你摸久久| 久久国产精品99久久久久久老狼 | 午夜精品久久久久久久99樱桃| 亚洲天堂2014| 亚洲人成电影网站色mp4| 国产精品不卡视频| 亚洲天堂免费看| 亚洲欧洲制服丝袜| 一区二区三区不卡在线观看| 亚洲自拍偷拍麻豆| 亚洲成av人片观看| 亚洲成a人片在线不卡一二三区| 亚洲一卡二卡三卡四卡无卡久久| 一区二区三区 在线观看视频| 亚洲一区在线观看视频| 亚洲sss视频在线视频| 日韩av中文字幕一区二区| 毛片不卡一区二区| 国产精品一区二区三区乱码| 成人aa视频在线观看| 91在线视频播放地址| 欧美自拍丝袜亚洲| 日韩视频一区二区三区| 久久夜色精品国产欧美乱极品| 久久美女艺术照精彩视频福利播放| 国产目拍亚洲精品99久久精品| 国产精品久久午夜夜伦鲁鲁| 一区二区视频免费在线观看| 亚洲福利视频一区二区| 韩国精品主播一区二区在线观看 | 国产精品国产三级国产普通话三级| 日本一区二区免费在线| 亚洲精品成人精品456| 丝袜a∨在线一区二区三区不卡 | 国产一区二区调教| av一区二区不卡| 欧美日韩一区成人| 久久综合国产精品| 亚洲男人天堂av| 麻豆国产欧美一区二区三区| 国产999精品久久久久久| 色哟哟精品一区| 精品少妇一区二区三区视频免付费| 中文字幕av免费专区久久| 亚洲国产cao| 国产精品亚洲一区二区三区在线| 色婷婷精品大在线视频| 日韩欧美在线综合网| 国产精品国产三级国产aⅴ入口 | 狠狠色丁香久久婷婷综合_中| 成人激情电影免费在线观看| 欧美日韩一区二区电影| 中文字幕不卡在线观看| 日产国产高清一区二区三区| thepron国产精品| 日韩一区二区不卡| 亚洲日本免费电影| 国产一区二区在线电影| 欧美高清视频www夜色资源网| 日本一区二区三级电影在线观看 | 国内外成人在线| 在线视频一区二区免费| 国产欧美日韩精品a在线观看| 日韩精品成人一区二区三区| 99久久er热在这里只有精品15 | 国产91精品精华液一区二区三区 | 国产日韩av一区| 蜜桃久久久久久| 欧美日韩国产三级| 亚洲免费观看高清| 国产成人在线视频免费播放| 51午夜精品国产| 亚洲已满18点击进入久久| 成人免费高清在线| 久久久综合视频| 九色|91porny| 日韩一区二区免费视频| 午夜精品久久久久久久| 色悠久久久久综合欧美99| 国产精品乱码人人做人人爱| 精品一区二区三区香蕉蜜桃| 欧美日韩国产影片| 亚洲一区在线视频观看| 91九色最新地址| 最好看的中文字幕久久| 成人国产亚洲欧美成人综合网| 久久久无码精品亚洲日韩按摩| 青青草国产精品97视觉盛宴| 欧美视频一区二| 一级中文字幕一区二区| 色综合激情五月| 日韩毛片高清在线播放| 99精品偷自拍| 一区二区三区在线视频观看58| 一本色道**综合亚洲精品蜜桃冫| 亚洲欧洲av另类| 色国产精品一区在线观看| 亚洲欧美一区二区三区国产精品| 99久久久免费精品国产一区二区| 日本一区二区视频在线观看| 国产麻豆一精品一av一免费| 精品对白一区国产伦| 国产精品自在在线| 欧美国产97人人爽人人喊| 丰满少妇久久久久久久| 国产精品少妇自拍| 99精品1区2区| 日韩伦理电影网| 欧美日韩亚洲综合在线| 日韩电影在线免费观看| 日韩天堂在线观看| 国产精品一卡二卡在线观看| 国产欧美日韩视频一区二区| 成人高清在线视频| 一区二区三区产品免费精品久久75| 欧美日韩国产免费| 精品制服美女丁香| 国产亚洲女人久久久久毛片| 99在线精品免费| 亚洲国产综合人成综合网站| 欧美一区二区三区影视| 国产精品伊人色| 伊人开心综合网| 日韩视频在线一区二区| 成人国产精品免费观看| 亚洲v日本v欧美v久久精品| 日韩欧美国产综合一区 | 九九九久久久精品| 国产精品热久久久久夜色精品三区 |