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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? t3dlib1.cpp

?? 一本外國人寫的關于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一区二区三区免费野_久草精品视频
日韩三级中文字幕| 日韩高清在线一区| 奇米色一区二区三区四区| 国产精品亚洲第一区在线暖暖韩国| 在线一区二区三区四区五区| 久久精品人人做人人爽人人| 亚洲不卡一区二区三区| 波多野结衣在线一区| 精品国产欧美一区二区| 亚洲国产三级在线| 91美女视频网站| 国产精品午夜春色av| 国产一区欧美一区| 日韩免费一区二区| 日韩制服丝袜先锋影音| 欧美性生活影院| 亚洲欧美激情小说另类| 成人av中文字幕| 国产婷婷一区二区| 国产一区二区三区| 精品剧情在线观看| 精品一区二区三区视频| 日韩欧美一区二区在线视频| 婷婷成人综合网| 91精选在线观看| 日韩一区欧美二区| 欧美一区二区在线免费播放| 婷婷六月综合网| 日韩一级大片在线| 日本女优在线视频一区二区| 7777精品伊人久久久大香线蕉经典版下载| 亚洲欧美日韩国产综合在线| 色综合天天做天天爱| 一区二区在线观看av| 在线观看av不卡| 午夜精品久久久久久久99樱桃| 欧美日韩精品电影| 久久精品国产成人一区二区三区| 欧美一级久久久| 国产一区二区三区精品欧美日韩一区二区三区| 日韩欧美中文字幕精品| 国产成人在线免费观看| 最新日韩av在线| 欧美色图在线观看| 奇米影视在线99精品| 久久午夜国产精品| 99久久精品免费观看| 亚洲综合激情网| 日韩一区二区高清| 福利视频网站一区二区三区| 亚洲欧洲国产专区| 欧美人牲a欧美精品| 精品写真视频在线观看| 国产精品国产自产拍高清av| 日本道色综合久久| 欧美aaaaa成人免费观看视频| 久久久99精品免费观看不卡| 色综合久久88色综合天天免费| 亚洲国产一区二区三区青草影视| 欧美日韩电影在线播放| 国产福利一区二区三区视频在线| 亚洲欧洲精品一区二区三区 | 久久久www成人免费无遮挡大片| 国产精品一级二级三级| 亚洲男人天堂一区| 欧美大片在线观看| 成人动漫一区二区在线| 天堂蜜桃一区二区三区| 国产精品美女久久久久久久| 欧美视频日韩视频在线观看| 国产一区91精品张津瑜| 亚洲一区在线观看视频| 国产欧美综合色| 337p亚洲精品色噜噜狠狠| 国产成人精品免费在线| 首页国产欧美久久| 18成人在线视频| 欧美精品一区二区精品网| 色欧美乱欧美15图片| 国产一区久久久| 天堂影院一区二区| 亚洲欧美国产77777| 久久久久久免费网| 日韩一级完整毛片| 在线视频你懂得一区| 国产不卡视频在线播放| 美腿丝袜亚洲色图| 亚洲国产精品欧美一二99| 亚洲欧洲精品一区二区精品久久久| 欧美videossexotv100| 欧美午夜寂寞影院| 色偷偷成人一区二区三区91 | 国产精品视频一二| 日韩欧美高清在线| 欧美久久久久中文字幕| 一本大道久久精品懂色aⅴ| 国产福利91精品一区| 激情五月婷婷综合网| 奇米在线7777在线精品 | 欧美一区二区久久久| 色婷婷综合久久久久中文 | 日韩精品一区二区三区三区免费| 色婷婷香蕉在线一区二区| www.成人网.com| 成人精品电影在线观看| 国产成人aaa| 丁香一区二区三区| 国产成人精品aa毛片| 国产成人在线电影| 成人性生交大片免费看中文 | 欧美精品高清视频| 欧美日韩一区不卡| 欧美精品九九99久久| 欧美精品久久久久久久多人混战| 欧美伊人久久久久久久久影院 | 国产不卡一区视频| 久久99国产精品成人| 日韩成人精品在线| 天堂在线亚洲视频| 日本亚洲一区二区| 美女在线观看视频一区二区| 秋霞影院一区二区| 激情五月播播久久久精品| 激情亚洲综合在线| 成人在线视频一区| 一本色道亚洲精品aⅴ| 欧美亚洲综合在线| 制服丝袜中文字幕一区| 久久这里都是精品| 亚洲国产精品激情在线观看| 自拍偷在线精品自拍偷无码专区 | 国产精品理论片| 一区二区三区成人| 日韩中文字幕麻豆| 777久久久精品| 欧美群妇大交群的观看方式| 欧美成va人片在线观看| 国产三级精品三级| 亚洲制服丝袜一区| 久久精品二区亚洲w码| 成人激情av网| 欧美伦理电影网| 久久久国际精品| 亚洲综合久久av| 国产毛片一区二区| 日本高清不卡在线观看| 欧美一区二区三区啪啪| 久久久www成人免费无遮挡大片| 亚洲天堂av老司机| 另类综合日韩欧美亚洲| 91亚洲精品久久久蜜桃| 日韩三级av在线播放| 中文字幕一区在线观看视频| 五月激情综合婷婷| 国产盗摄精品一区二区三区在线| 欧美午夜精品一区| 中文字幕巨乱亚洲| 另类小说欧美激情| 欧洲av一区二区嗯嗯嗯啊| 337p日本欧洲亚洲大胆色噜噜| 亚洲猫色日本管| 久久99精品国产麻豆婷婷洗澡| 91网站在线播放| 久久久久久毛片| 日韩专区一卡二卡| 91社区在线播放| 国产视频一区二区在线观看| 亚洲丶国产丶欧美一区二区三区| 成人精品国产福利| 久久久久久久久99精品| 日韩高清在线电影| 欧美色图免费看| 1024成人网色www| 国产乱码精品一区二区三区忘忧草 | 欧美日本在线播放| 成人免费在线视频| 成人一区二区视频| 精品处破学生在线二十三| 午夜欧美大尺度福利影院在线看| 91美女在线观看| 国产精品久久久久久久久晋中| 国产福利一区二区| 国产在线精品一区二区三区不卡| 99久久伊人精品| 国产欧美日韩不卡免费| 久久精品国产99久久6| 欧美日韩国产精品成人| 亚洲综合自拍偷拍| 97久久超碰精品国产| 久久精品视频一区二区| 激情欧美一区二区| 日韩欧美一区二区视频| 亚洲成人你懂的| 欧美日韩国产成人在线91| 亚洲一区二区偷拍精品| 欧美日韩一区在线观看| 一区二区三区成人在线视频| 91久久人澡人人添人人爽欧美| 亚洲少妇30p| 日本韩国一区二区|