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

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

?? t3dlib1.cpp

?? 一本外國人寫的關(guān)于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
// unlock the primary surface
lpddsprimary->Unlock(NULL);

// reset the primary surface
primary_buffer = NULL;
primary_lpitch = 0;

// return success
return(1);
} // end DDraw_Unlock_Primary_Surface

//////////////////////////////////////////////////////////

UCHAR *DDraw_Lock_Back_Surface(void)
{
// this function locks the secondary back surface and returns a pointer to it
// and updates the global variables secondary buffer, and back_lpitch

// is this surface already locked
if (back_buffer)
   {
   // return to current lock
   return(back_buffer);
   } // end if

// lock the primary surface
DDRAW_INIT_STRUCT(ddsd);
lpddsback->Lock(NULL,&ddsd,DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,NULL); 

// set globals
back_buffer = (UCHAR *)ddsd.lpSurface;
back_lpitch = ddsd.lPitch;

// return pointer to surface
return(back_buffer);

} // end DDraw_Lock_Back_Surface

///////////////////////////////////////////////////////////   
   
int DDraw_Unlock_Back_Surface(void)
{
// this unlocks the secondary

// is this surface valid
if (!back_buffer)
   return(0);

// unlock the secondary surface
lpddsback->Unlock(NULL);

// reset the secondary surface
back_buffer = NULL;
back_lpitch = 0;

// return success
return(1);
} // end DDraw_Unlock_Back_Surface

///////////////////////////////////////////////////////////

DWORD Get_Clock(void)
{
// this function returns the current tick count

// return time
return(GetTickCount());

} // end Get_Clock

///////////////////////////////////////////////////////////

DWORD Start_Clock(void)
{
// this function starts the clock, that is, saves the current
// count, use in conjunction with Wait_Clock()

return(start_clock_count = Get_Clock());

} // end Start_Clock

////////////////////////////////////////////////////////////

DWORD Wait_Clock(DWORD count)
{
// this function is used to wait for a specific number of clicks
// since the call to Start_Clock

while((Get_Clock() - start_clock_count) < count);
return(Get_Clock());

} // end Wait_Clock

///////////////////////////////////////////////////////////

int Draw_Clip_Line16(int x0,int y0, int x1, int y1, int color, 
                    UCHAR *dest_buffer, int lpitch)
{
// this function draws a clipped line

int cxs, cys,
	cxe, cye;

// clip and draw each line
cxs = x0;
cys = y0;
cxe = x1;
cye = y1;

// clip the line
if (Clip_Line(cxs,cys,cxe,cye))
	Draw_Line16(cxs, cys, cxe,cye,color,dest_buffer,lpitch);

// return success
return(1);

} // end Draw_Clip_Line16


///////////////////////////////////////////////////////////

int Draw_Clip_Line(int x0,int y0, int x1, int y1, int color, 
                    UCHAR *dest_buffer, int lpitch)
{
// this function draws a wireframe triangle

int cxs, cys,
	cxe, cye;

// clip and draw each line
cxs = x0;
cys = y0;
cxe = x1;
cye = y1;

// clip the line
if (Clip_Line(cxs,cys,cxe,cye))
	Draw_Line(cxs, cys, cxe,cye,color,dest_buffer,lpitch);

// return success
return(1);

} // end Draw_Clip_Line

///////////////////////////////////////////////////////////

int Clip_Line(int &x1,int &y1,int &x2, int &y2)
{
// this function clips the sent line using the globally defined clipping
// region

// internal clipping codes
#define CLIP_CODE_C  0x0000
#define CLIP_CODE_N  0x0008
#define CLIP_CODE_S  0x0004
#define CLIP_CODE_E  0x0002
#define CLIP_CODE_W  0x0001

#define CLIP_CODE_NE 0x000a
#define CLIP_CODE_SE 0x0006
#define CLIP_CODE_NW 0x0009 
#define CLIP_CODE_SW 0x0005

int xc1=x1, 
    yc1=y1, 
	xc2=x2, 
	yc2=y2;

int p1_code=0, 
    p2_code=0;

// determine codes for p1 and p2
if (y1 < min_clip_y)
	p1_code|=CLIP_CODE_N;
else
if (y1 > max_clip_y)
	p1_code|=CLIP_CODE_S;

if (x1 < min_clip_x)
	p1_code|=CLIP_CODE_W;
else
if (x1 > max_clip_x)
	p1_code|=CLIP_CODE_E;

if (y2 < min_clip_y)
	p2_code|=CLIP_CODE_N;
else
if (y2 > max_clip_y)
	p2_code|=CLIP_CODE_S;

if (x2 < min_clip_x)
	p2_code|=CLIP_CODE_W;
else
if (x2 > max_clip_x)
	p2_code|=CLIP_CODE_E;

// try and trivially reject
if ((p1_code & p2_code)) 
	return(0);

// test for totally visible, if so leave points untouched
if (p1_code==0 && p2_code==0)
	return(1);

// determine end clip point for p1
switch(p1_code)
	  {
	  case CLIP_CODE_C: break;

	  case CLIP_CODE_N:
		   {
		   yc1 = min_clip_y;
		   xc1 = x1 + 0.5+(min_clip_y-y1)*(x2-x1)/(y2-y1);
		   } break;
	  case CLIP_CODE_S:
		   {
		   yc1 = max_clip_y;
		   xc1 = x1 + 0.5+(max_clip_y-y1)*(x2-x1)/(y2-y1);
		   } break;

	  case CLIP_CODE_W:
		   {
		   xc1 = min_clip_x;
		   yc1 = y1 + 0.5+(min_clip_x-x1)*(y2-y1)/(x2-x1);
		   } break;
		
	  case CLIP_CODE_E:
		   {
		   xc1 = max_clip_x;
		   yc1 = y1 + 0.5+(max_clip_x-x1)*(y2-y1)/(x2-x1);
		   } break;

	// these cases are more complex, must compute 2 intersections
	  case CLIP_CODE_NE:
		   {
		   // north hline intersection
		   yc1 = min_clip_y;
		   xc1 = x1 + 0.5+(min_clip_y-y1)*(x2-x1)/(y2-y1);

		   // test if intersection is valid, of so then done, else compute next
			if (xc1 < min_clip_x || xc1 > max_clip_x)
				{
				// east vline intersection
				xc1 = max_clip_x;
				yc1 = y1 + 0.5+(max_clip_x-x1)*(y2-y1)/(x2-x1);
				} // end if

		   } break;
	  
	  case CLIP_CODE_SE:
      	   {
		   // south hline intersection
		   yc1 = max_clip_y;
		   xc1 = x1 + 0.5+(max_clip_y-y1)*(x2-x1)/(y2-y1);	

		   // test if intersection is valid, of so then done, else compute next
		   if (xc1 < min_clip_x || xc1 > max_clip_x)
		      {
			  // east vline intersection
			  xc1 = max_clip_x;
			  yc1 = y1 + 0.5+(max_clip_x-x1)*(y2-y1)/(x2-x1);
			  } // end if

		   } break;
	    
	  case CLIP_CODE_NW: 
      	   {
		   // north hline intersection
		   yc1 = min_clip_y;
		   xc1 = x1 + 0.5+(min_clip_y-y1)*(x2-x1)/(y2-y1);
		   
		   // test if intersection is valid, of so then done, else compute next
		   if (xc1 < min_clip_x || xc1 > max_clip_x)
		      {
			  xc1 = min_clip_x;
		      yc1 = y1 + 0.5+(min_clip_x-x1)*(y2-y1)/(x2-x1);	
			  } // end if

		   } break;
	  	  
	  case CLIP_CODE_SW:
		   {
		   // south hline intersection
		   yc1 = max_clip_y;
		   xc1 = x1 + 0.5+(max_clip_y-y1)*(x2-x1)/(y2-y1);	
		   
		   // test if intersection is valid, of so then done, else compute next
		   if (xc1 < min_clip_x || xc1 > max_clip_x)
		      {
			  xc1 = min_clip_x;
		      yc1 = y1 + 0.5+(min_clip_x-x1)*(y2-y1)/(x2-x1);	
			  } // end if

		   } break;

	  default:break;

	  } // end switch

// determine clip point for p2
switch(p2_code)
	  {
	  case CLIP_CODE_C: break;

	  case CLIP_CODE_N:
		   {
		   yc2 = min_clip_y;
		   xc2 = x2 + (min_clip_y-y2)*(x1-x2)/(y1-y2);
		   } break;

	  case CLIP_CODE_S:
		   {
		   yc2 = max_clip_y;
		   xc2 = x2 + (max_clip_y-y2)*(x1-x2)/(y1-y2);
		   } break;

	  case CLIP_CODE_W:
		   {
		   xc2 = min_clip_x;
		   yc2 = y2 + (min_clip_x-x2)*(y1-y2)/(x1-x2);
		   } break;
		
	  case CLIP_CODE_E:
		   {
		   xc2 = max_clip_x;
		   yc2 = y2 + (max_clip_x-x2)*(y1-y2)/(x1-x2);
		   } break;

		// these cases are more complex, must compute 2 intersections
	  case CLIP_CODE_NE:
		   {
		   // north hline intersection
		   yc2 = min_clip_y;
		   xc2 = x2 + 0.5+(min_clip_y-y2)*(x1-x2)/(y1-y2);

		   // test if intersection is valid, of so then done, else compute next
			if (xc2 < min_clip_x || xc2 > max_clip_x)
				{
				// east vline intersection
				xc2 = max_clip_x;
				yc2 = y2 + 0.5+(max_clip_x-x2)*(y1-y2)/(x1-x2);
				} // end if

		   } break;
	  
	  case CLIP_CODE_SE:
      	   {
		   // south hline intersection
		   yc2 = max_clip_y;
		   xc2 = x2 + 0.5+(max_clip_y-y2)*(x1-x2)/(y1-y2);	

		   // test if intersection is valid, of so then done, else compute next
		   if (xc2 < min_clip_x || xc2 > max_clip_x)
		      {
			  // east vline intersection
			  xc2 = max_clip_x;
			  yc2 = y2 + 0.5+(max_clip_x-x2)*(y1-y2)/(x1-x2);
			  } // end if

		   } break;
	    
	  case CLIP_CODE_NW: 
      	   {
		   // north hline intersection
		   yc2 = min_clip_y;
		   xc2 = x2 + 0.5+(min_clip_y-y2)*(x1-x2)/(y1-y2);
		   
		   // test if intersection is valid, of so then done, else compute next
		   if (xc2 < min_clip_x || xc2 > max_clip_x)
		      {
			  xc2 = min_clip_x;
		      yc2 = y2 + 0.5+(min_clip_x-x2)*(y1-y2)/(x1-x2);	
			  } // end if

		   } break;
	  	  
	  case CLIP_CODE_SW:
		   {
		   // south hline intersection
		   yc2 = max_clip_y;
		   xc2 = x2 + 0.5+(max_clip_y-y2)*(x1-x2)/(y1-y2);	
		   
		   // test if intersection is valid, of so then done, else compute next
		   if (xc2 < min_clip_x || xc2 > max_clip_x)
		      {
			  xc2 = min_clip_x;
		      yc2 = y2 + 0.5+(min_clip_x-x2)*(y1-y2)/(x1-x2);	
			  } // end if

		   } break;
	
	  default:break;

	  } // end switch

// do bounds check
if ((xc1 < min_clip_x) || (xc1 > max_clip_x) ||
	(yc1 < min_clip_y) || (yc1 > max_clip_y) ||
	(xc2 < min_clip_x) || (xc2 > max_clip_x) ||
	(yc2 < min_clip_y) || (yc2 > max_clip_y) )
	{
	return(0);
	} // end if

// store vars back
x1 = xc1;
y1 = yc1;
x2 = xc2;
y2 = yc2;

return(1);

} // end Clip_Line

///////////////////////////////////////////////////////////

int Draw_Line(int x0, int y0, // starting position 
              int x1, int y1, // ending position
              int color,     // color index
              UCHAR *vb_start, int lpitch) // video buffer and memory pitch
{
// this function draws a line from xo,yo to x1,y1 using differential error
// terms (based on Bresenahams work)

int dx,             // difference in x's
    dy,             // difference in y's
    dx2,            // dx,dy * 2
    dy2, 
    x_inc,          // amount in pixel space to move during drawing
    y_inc,          // amount in pixel space to move during drawing
    error,          // the discriminant i.e. error i.e. decision variable
    index;          // used for looping

// pre-compute first pixel address in video buffer
vb_start = vb_start + x0 + y0*lpitch;

// compute horizontal and vertical deltas
dx = x1-x0;
dy = y1-y0;

// test which direction the line is going in i.e. slope angle
if (dx>=0)
   {
   x_inc = 1;

   } // end if line is moving right
else
   {
   x_inc = -1;
   dx    = -dx;  // need absolute value

   } // end else moving left

// test y component of slope

if (dy>=0)
   {
   y_inc = lpitch;
   } // end if line is moving down
else
   {
   y_inc = -lpitch;
   dy    = -dy;  // need absolute value

   } // end else moving up

// compute (dx,dy) * 2
dx2 = dx << 1;
dy2 = dy << 1;

// now based on which delta is greater we can draw the line
if (dx > dy)
   {
   // initialize error term
   error = dy2 - dx; 

   // draw the line
   for (index=0; index <= dx; index++)
       {
       // set the pixel
       *vb_start = color;

       // test if error has overflowed
       if (error >= 0) 
          {
          error-=dx2;

          // move to next line
          vb_start+=y_inc;

	   } // end if error overflowed

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡av在线网| 亚洲成人动漫在线免费观看| 国产毛片精品国产一区二区三区| 在线综合亚洲欧美在线视频| 午夜精品免费在线观看| 欧美亚洲综合在线| 亚洲成人av一区二区| 91精品国产综合久久精品麻豆| 五月天视频一区| 日韩欧美精品在线视频| 久久精品国产第一区二区三区| 精品sm捆绑视频| 丁香另类激情小说| 亚洲一区二区综合| 91精品一区二区三区久久久久久| 久久精品av麻豆的观看方式| 国产欧美日韩麻豆91| av电影天堂一区二区在线 | 欧美精品一级二级三级| 天堂一区二区在线免费观看| 精品国产一区二区三区不卡 | 欧美视频精品在线| 秋霞电影网一区二区| 精品毛片乱码1区2区3区| 国产成人福利片| 一区二区三区四区视频精品免费 | 欧美群妇大交群的观看方式| 蜜桃传媒麻豆第一区在线观看| 精品1区2区在线观看| 91丨porny丨在线| 日韩avvvv在线播放| 国产日韩影视精品| 欧美中文字幕一区| 国产精品一二三四五| 亚洲久本草在线中文字幕| 欧美一区二区三区视频在线| 国产成人午夜电影网| 午夜精品福利久久久| 国产三级欧美三级| 欧美私人免费视频| 国产精品一级黄| 视频精品一区二区| 中文字幕亚洲精品在线观看| 91精品国产综合久久国产大片| 成人国产在线观看| 日本不卡免费在线视频| 亚洲视频一区在线| 精品久久一区二区| 欧美高清激情brazzers| 成人精品视频网站| 麻豆精品国产传媒mv男同| 亚洲欧美中日韩| 精品久久久久久久人人人人传媒| 欧美在线综合视频| 成人av免费在线播放| 国内成+人亚洲+欧美+综合在线 | 日韩精品午夜视频| 亚洲美女视频在线观看| 国产日韩精品一区| 精品精品国产高清a毛片牛牛| 欧美日韩免费在线视频| 91美女精品福利| 国产成人午夜精品影院观看视频| 老汉av免费一区二区三区| 亚洲国产欧美在线人成| 一区二区三区四区蜜桃| 亚洲私人黄色宅男| 亚洲视频在线一区| 国产精品久久久久影院色老大| 久久亚洲二区三区| 欧美成人vps| 日韩欧美电影在线| 日韩欧美在线123| 91精品国产色综合久久久蜜香臀| 欧美亚洲高清一区二区三区不卡| 99精品国产一区二区三区不卡| 成人av片在线观看| 99久久精品国产网站| 福利一区二区在线| 国产成人aaaa| 成人v精品蜜桃久久一区| 丁香六月久久综合狠狠色| 成人av网站在线观看免费| 成人午夜碰碰视频| 99久久精品国产导航| 99久久99久久精品国产片果冻| av一二三不卡影片| 99re这里都是精品| 91麻豆产精品久久久久久| 色中色一区二区| 欧美亚洲高清一区| 在线播放欧美女士性生活| 日韩欧美在线不卡| 久久久精品综合| 亚洲婷婷综合久久一本伊一区| 一区二区三区中文字幕在线观看| 一区二区三区鲁丝不卡| 日韩成人免费在线| 精品一区二区在线免费观看| 国产成人综合视频| 91网站在线播放| 欧美日韩一区二区三区在线看| 91精品视频网| 国产偷国产偷亚洲高清人白洁| 国产精品日韩精品欧美在线| 亚洲激情图片小说视频| 青青草91视频| 国产成a人无v码亚洲福利| bt7086福利一区国产| 欧美在线观看一二区| 日韩小视频在线观看专区| 中文天堂在线一区| 亚洲成人免费影院| 国产一区二区毛片| 日本久久一区二区三区| 欧美一区二区三区思思人| 国产精品丝袜91| 婷婷久久综合九色综合伊人色| 国产一区二区视频在线播放| 色老综合老女人久久久| 日韩欧美中文字幕一区| 亚洲欧洲av色图| 免费在线观看不卡| 99国产精品久久| 精品久久久久久久人人人人传媒| 亚洲裸体xxx| 国产综合一区二区| 欧美日韩午夜影院| 国产精品欧美经典| 美女视频网站黄色亚洲| 日本国产一区二区| 精品国精品国产| 尤物在线观看一区| 蜜桃av一区二区| 欧美日韩久久久久久| 26uuu久久天堂性欧美| 亚洲人成亚洲人成在线观看图片| 午夜精品免费在线| 色欧美88888久久久久久影院| 欧美电影免费观看高清完整版 | 欧美午夜片在线观看| 精品1区2区在线观看| 一区二区三区毛片| 亚洲久本草在线中文字幕| 国产乱码精品一区二区三| 欧美日韩激情一区| 国产精品久久三| 久久激情五月激情| 91精品国产黑色紧身裤美女| 国产精品久久二区二区| 美女爽到高潮91| 欧美在线影院一区二区| 久久色在线观看| 美女视频黄a大片欧美| 99精品欧美一区二区蜜桃免费 | 91久久精品一区二区三区| 欧美成人精品3d动漫h| 亚洲图片欧美综合| 国产激情精品久久久第一区二区 | 国产亚洲精品aa| 肉丝袜脚交视频一区二区| 日韩黄色一级片| 欧美亚洲日本国产| 1000部国产精品成人观看| 国产老女人精品毛片久久| 91精品国产一区二区三区香蕉| 亚洲综合在线观看视频| 91一区二区在线| 国产午夜久久久久| 精品一二三四区| 日韩一区二区三区精品视频| 日本欧美在线看| 91传媒视频在线播放| 中文字幕一区二区三区不卡| 欧美性做爰猛烈叫床潮| 久久久久久久久久久电影| 99久久国产免费看| 国产精品久久777777| 久久精品视频一区二区三区| 精品女同一区二区| 日本欧美肥老太交大片| 欧美精品久久99| 亚洲制服丝袜在线| 欧美福利一区二区| 亚洲电影一区二区三区| 91精品国产综合久久久久| 香蕉影视欧美成人| 欧美日本高清视频在线观看| 蜜桃av一区二区三区| 欧美成人a∨高清免费观看| 国产精品自在欧美一区| 欧美一区二区三级| 国产精品一二三四| 国产偷国产偷精品高清尤物| 色婷婷久久久亚洲一区二区三区 | 日韩精品亚洲一区| 欧美精品aⅴ在线视频| 三级欧美韩日大片在线看| 日韩一区二区三区在线| 国产一区二区福利视频|