亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
夜夜夜精品看看| 亚洲国产精品99久久久久久久久| 国产亚洲女人久久久久毛片| 亚洲日本成人在线观看| 国产精品乱码人人做人人爱| 欧美日韩美少妇| 久久久美女毛片| 中文字幕中文字幕在线一区| 午夜成人免费视频| 岛国精品在线播放| 欧美日韩午夜精品| 中文无字幕一区二区三区| 国产精品欧美经典| 美女www一区二区| 91国偷自产一区二区使用方法| 精品久久久影院| 中文字幕av一区 二区| 亚洲第一搞黄网站| 成人晚上爱看视频| 日韩免费视频一区| 亚洲成av人片www| 99久久久久久| 久久这里只有精品首页| 天天综合色天天综合色h| 91玉足脚交白嫩脚丫在线播放| 欧美成人三级在线| 亚洲欧美日韩国产综合在线| 国产一区二区三区精品欧美日韩一区二区三区 | 成年人国产精品| 精品捆绑美女sm三区| 午夜精品免费在线| 色综合色狠狠综合色| 国产无遮挡一区二区三区毛片日本| 日韩激情中文字幕| 色婷婷精品久久二区二区蜜臂av| 欧美国产乱子伦| 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲一区二区三区在线| 国产福利91精品一区| 日韩精品一区二| 天天影视涩香欲综合网| 91色.com| 国产精品美女视频| 国产福利一区二区三区在线视频| 精品三级在线观看| 七七婷婷婷婷精品国产| 欧美日韩国产精品成人| 亚洲国产aⅴ成人精品无吗| av一区二区三区在线| 久久精品欧美一区二区三区不卡 | 欧美国产精品劲爆| 午夜精品免费在线观看| 成人黄色大片在线观看| 亚洲精品一区二区在线观看| 久久丁香综合五月国产三级网站| 日韩视频国产视频| 免费在线一区观看| 精品视频在线免费| 亚洲欧美偷拍卡通变态| 91原创在线视频| 国产精品乱码一区二区三区软件| 成人视屏免费看| 国产精品理伦片| 精品一区二区三区蜜桃| 久久香蕉国产线看观看99| 国产一区二区福利| 亚洲国产高清在线观看视频| 国产一区二区免费看| 国产清纯白嫩初高生在线观看91 | 日韩一区和二区| 久久精品99国产精品| 亚洲精品一区二区精华| 国产精品综合一区二区| 久久一区二区三区四区| 国产99久久精品| 亚洲四区在线观看| 欧美在线视频全部完| 婷婷一区二区三区| 欧美刺激脚交jootjob| 久久99精品久久久久| 久久这里只有精品首页| 成人在线一区二区三区| 中文字幕亚洲电影| 色综合中文综合网| 免费成人在线网站| 欧美一区二区不卡视频| 激情图片小说一区| 精品国产91九色蝌蚪| 日韩成人一级大片| 色爱区综合激月婷婷| 午夜视频在线观看一区二区三区| 欧美一区二区三区免费| 韩国三级中文字幕hd久久精品| 国产日韩欧美a| 在线观看免费成人| 麻豆一区二区三| 欧美嫩在线观看| 激情文学综合插| 亚洲乱码国产乱码精品精的特点 | 亚洲天堂网中文字| 在线播放中文一区| 日韩电影免费在线| 欧美国产综合色视频| 不卡的av电影在线观看| 中文字幕国产精品一区二区| 欧美少妇xxx| 国模大尺度一区二区三区| 中文字幕精品一区二区精品绿巨人| 欧美日韩国产中文| 丁香一区二区三区| 热久久一区二区| 亚洲欧美另类小说视频| 久久精品免费在线观看| 91麻豆精品国产自产在线观看一区| 国产99一区视频免费| 美女在线视频一区| 亚洲精品国产成人久久av盗摄| 久久亚洲综合色一区二区三区| 欧美午夜不卡视频| 成人午夜大片免费观看| 久久国产成人午夜av影院| 亚洲天堂中文字幕| 国产三级欧美三级| 欧美大片日本大片免费观看| 欧美在线免费播放| 丁香六月综合激情| 韩国一区二区在线观看| 日韩制服丝袜av| 亚洲综合激情网| 欧美国产禁国产网站cc| 久久综合久久综合久久| 6080午夜不卡| 欧美日韩久久一区二区| 91捆绑美女网站| 成人免费视频app| 国产乱码精品一区二区三区忘忧草| 一区二区免费看| 一区二区三区在线不卡| 国产精品久久久久久久岛一牛影视| 精品剧情v国产在线观看在线| 777精品伊人久久久久大香线蕉| 欧美综合在线视频| 色综合久久久久| 成人毛片在线观看| 国产suv精品一区二区883| 国产一区二区三区在线观看免费视频| 日韩一区欧美二区| 婷婷一区二区三区| 亚洲成a人v欧美综合天堂| 亚洲国产精品久久人人爱蜜臀 | 精品成a人在线观看| 欧美成人一区二区三区片免费| 欧美一区二区美女| 欧美精品一二三四| 欧美一区二区在线免费播放| 欧美日韩三级在线| 欧美精品丝袜久久久中文字幕| 欧美日韩国产影片| 欧美日韩免费观看一区三区| 欧美色中文字幕| 欧美日韩国产不卡| 91精品国产综合久久福利| 日韩亚洲电影在线| 精品日韩99亚洲| 精品国产123| 久久丝袜美腿综合| 久久精品一区二区三区不卡牛牛 | www激情久久| 日韩一区和二区| 精品欧美一区二区在线观看| 精品国产伦一区二区三区免费| 久久九九99视频| 中文字幕一区日韩精品欧美| 亚洲欧美激情在线| 亚洲一二三四久久| 日韩国产欧美一区二区三区| 蜜桃一区二区三区在线观看| 久久99精品一区二区三区| 激情深爱一区二区| 成人黄色国产精品网站大全在线免费观看 | 亚洲免费在线电影| 亚洲1区2区3区4区| 激情偷乱视频一区二区三区| 国产一区二区三区不卡在线观看| 粉嫩久久99精品久久久久久夜| caoporen国产精品视频| 欧美亚洲国产一区二区三区va| 欧美精品日韩精品| 欧美xxxx老人做受| 中文字幕欧美一区| 亚洲综合在线视频| 欧美aaaaa成人免费观看视频| 国产一区啦啦啦在线观看| av中文字幕不卡| 欧美日韩国产高清一区二区 | www成人在线观看| 中文字幕亚洲精品在线观看 | 亚洲欧美区自拍先锋| 午夜欧美视频在线观看| 免费欧美日韩国产三级电影|