亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一片黄亚洲嫩模| 久久精品视频网| 免费在线观看不卡| 欧美一区二区久久久| 免费成人你懂的| 一区二区三区.www| 欧美日韩黄视频| 麻豆成人在线观看| 精品福利二区三区| 99久久久国产精品| 一区二区三区精品在线观看| 欧美日韩视频在线一区二区| 日韩精品乱码免费| 精品国产三级a在线观看| 国产999精品久久久久久绿帽| 中文字幕亚洲成人| 欧美日韩午夜影院| 国产精品一品视频| 1000部国产精品成人观看| 欧美日本精品一区二区三区| 久久国产精品色| 国产精品久久久久久久蜜臀| 欧美影视一区二区三区| 久久91精品久久久久久秒播| 亚洲色欲色欲www| 日韩一区二区三区在线视频| 成人综合在线观看| 天天操天天色综合| 国产精品久久久久久久浪潮网站 | 精品久久国产97色综合| 成人免费福利片| 日本午夜精品视频在线观看| 国产精品免费视频网站| 欧美二区乱c少妇| 成人小视频在线观看| 丝袜美腿亚洲色图| 国产精品色哟哟| 日韩精品一区二区三区在线| 972aa.com艺术欧美| 精品一区二区三区av| 中文字幕一区二区在线播放| 美女一区二区三区| 亚洲色图19p| 欧美成人欧美edvon| 粉嫩av一区二区三区粉嫩| 亚洲精品老司机| 精品日韩在线一区| 99久久国产综合精品女不卡| 天堂av在线一区| 国产精品污www在线观看| 欧美日韩激情一区| 国产99一区视频免费| 蜜臀av一区二区在线免费观看| 中文字幕成人在线观看| 91精品国产高清一区二区三区| 成人激情av网| 久久激情五月激情| 亚洲午夜一区二区三区| 国产欧美视频在线观看| 欧美日韩精品福利| 91在线观看美女| 国产麻豆午夜三级精品| 午夜精品一区在线观看| 国产精品免费久久| 日韩欧美国产系列| 色综合天天综合给合国产| 国产sm精品调教视频网站| 日韩国产欧美在线观看| 曰韩精品一区二区| 国产精品久久夜| 26uuu亚洲综合色| 日韩一卡二卡三卡国产欧美| 色哦色哦哦色天天综合| 粉嫩欧美一区二区三区高清影视| 美女爽到高潮91| 亚洲超碰97人人做人人爱| 国产精品久久久久影视| 久久精品人人爽人人爽| 精品国产人成亚洲区| 欧洲在线/亚洲| 日本韩国视频一区二区| 一本大道久久a久久精二百 | 国产毛片精品一区| 蜜桃视频在线一区| 亚洲二区在线视频| 亚洲专区一二三| 亚洲激情校园春色| 亚洲人成人一区二区在线观看 | 日韩精品一区二区三区视频在线观看 | 91精品国产日韩91久久久久久| 91久久国产综合久久| 色丁香久综合在线久综合在线观看| 99久久久免费精品国产一区二区| 成人午夜av在线| 从欧美一区二区三区| 顶级嫩模精品视频在线看| 精品一区二区在线视频| 国产一二三精品| 国产精品亚洲综合一区在线观看| 国产精品一区二区三区四区| 国产一区久久久| 成人做爰69片免费看网站| 成人美女视频在线看| 99精品视频中文字幕| 日本精品一级二级| 欧美日韩高清一区二区| 91精品福利在线一区二区三区 | 久久av中文字幕片| 久久av中文字幕片| 久久99精品国产麻豆不卡| 久久精品国产亚洲aⅴ| 久久国产精品99久久久久久老狼| 激情综合一区二区三区| 国产成人免费9x9x人网站视频| fc2成人免费人成在线观看播放| 99re热这里只有精品免费视频| 91久久人澡人人添人人爽欧美| 欧美日韩国产影片| 欧美大肚乱孕交hd孕妇| 日本一区二区在线不卡| 一区二区在线观看av| 性做久久久久久久免费看| 视频一区二区欧美| 国产精品小仙女| 91在线国产福利| 7777女厕盗摄久久久| 日韩欧美123| 亚洲精品一区二区三区福利| 久久综合狠狠综合久久综合88| 专区另类欧美日韩| 免费xxxx性欧美18vr| 不卡电影一区二区三区| 欧美麻豆精品久久久久久| 久久久久久久一区| 亚洲成人免费看| 成人一区二区视频| 欧美日韩亚洲国产综合| 国产日韩欧美一区二区三区乱码| 亚洲视频小说图片| 国产乱人伦偷精品视频免下载| 色诱视频网站一区| 久久亚洲欧美国产精品乐播| 一区二区三区**美女毛片| 国产在线看一区| 欧美日韩精品一区视频| 国产精品日韩成人| 琪琪久久久久日韩精品| 成人性生交大片| 亚洲一区在线看| 成人精品在线视频观看| 老汉av免费一区二区三区| 色婷婷av一区二区三区gif| 欧美精品一区二区精品网| 亚洲国产一区二区视频| 99久久久精品| 久久久三级国产网站| 久久 天天综合| 成人午夜电影网站| 成人高清免费观看| 色婷婷激情久久| 亚洲欧美偷拍卡通变态| 岛国一区二区在线观看| 久久久精品欧美丰满| 亚洲第一av色| 91久久一区二区| 亚洲一二三区在线观看| 国产在线精品一区二区三区不卡| 欧美不卡在线视频| 亚洲美女视频一区| 91久久香蕉国产日韩欧美9色| 中文字幕字幕中文在线中不卡视频| 日本大胆欧美人术艺术动态| 7777精品伊人久久久大香线蕉经典版下载| va亚洲va日韩不卡在线观看| 99久久免费视频.com| 精品国产乱码久久久久久闺蜜| 亚洲一区二区3| 成人av免费在线观看| 国产精品久久看| 国产精品羞羞答答xxdd| 中文无字幕一区二区三区 | 成人欧美一区二区三区| 成人av网站在线观看免费| 日本韩国视频一区二区| 国产精品三级电影| 国产福利91精品一区二区三区| 精品福利一区二区三区免费视频| 日日夜夜免费精品视频| 欧美在线观看视频在线| 成人免费一区二区三区在线观看 | 日本在线观看不卡视频| 欧美中文字幕一二三区视频| 国产精品亲子乱子伦xxxx裸| 国产美女精品人人做人人爽 | 蜜桃精品视频在线| 9191精品国产综合久久久久久| 久久99国产精品久久| 91在线观看高清| 久久久久久久久久久久电影| 人人精品人人爱|