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

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

?? demo8_9.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
				ystart2++;

   		      } // end if

			} // end if
			else 
            {
  	  	    // increment edge 1 on X and edge 2 on Y:
		    count1=xdiff1;    // count for X increment on edge 1
		    count2=ydiff2;    // count for Y increment on edge 2
			
            while (count1 && count2) 
                  {  // continue drawing until one edge is done
   			         // calculate edge 1:
 				  while ((errorterm1 < xdiff1) && (count1 > 0)) 
                        { // finished w/edge 1?
				   	    if (count1--) 
                           {
                           // count down on edge 1
						   offset1+=xunit1;  // increment pixel offset
						   xstart1+=xunit1;
						   } // end if

						errorterm1+=ydiff1; // increment error term

						if (errorterm1 < xdiff1) 
                           {  // If not more than XDIFF
						   vbuffer[offset1]=(UCHAR)poly->color; // ...plot a pixel
						   } // end if

         				} // end while

					errorterm1-=xdiff1; // If time to increment X, restore error term

  			        // calculate edge 2:
					errorterm2+=xdiff2; // increment error term
					
                    if (errorterm2 >= ydiff2)  
                       { // if time to increment Y...
					   errorterm2-=ydiff2;        // ...restore error term
					   offset2+=xunit2;           // ...and advance offset to next pixel
					   xstart2+=xunit2;
     				   } // end if

			        count2--;

			        // draw line from edge 1 to edge 2:

					length=offset2-offset1; // determine length of horizontal line

					if (length < 0)  
                       { // if negative...
					   length=-length;       // ...make it positive
					   start=offset2;        // and set START to edge 2
					   } // end if
					else 
                       start=offset1;        // else set START to edge 1

			        for (int index=start; index < start+length+1; index++)  // from edge to edge
				        {
                        vbuffer[index]=(UCHAR)poly->color;         // ...draw the line
                        } // end for index
 
            		offset1+=mempitch;           // advance edge 1 offset to next line
					ystart1++;
					offset2+=mempitch;           // advance edge 2 offset to next line
					ystart2++;

				} // end while
			} // end if
		} // end if
		else 
            {
			if (xdiff2 > ydiff2) 
               {
   		       // increment edge 1 on Y and edge 2 on X:

			   count1=ydiff1;  // count for Y increment on edge 1
			   count2=xdiff2;  // count for X increment on edge 2

			   while(count1 && count2) 
                    {  // continue drawing until one edge is done
			          // calculate edge 1:

					errorterm1+=xdiff1; // Increment error term

					if (errorterm1 >= ydiff1)  
                       {  // if time to increment Y...
					   errorterm1-=ydiff1;         // ...restore error term
					   offset1+=xunit1;            // ...and advance offset to next pixel
					   xstart1+=xunit1;
					   } // end if

      			    count1--;

    			    // Calculate edge 2:

					while ((errorterm2 < xdiff2) && (count2 > 0)) 
                          { // finished w/edge 1?
						  if (count2--) 
                             { // count down on edge 2
							 offset2+=xunit2;  // increment pixel offset
							 xstart2+=xunit2;
						     } // end if

						  errorterm2+=ydiff2; // increment error term

						  if (errorterm2 < xdiff2) 
                             {  // if not more than XDIFF
							 vbuffer[offset2]=(UCHAR)poly->color; // ...plot a pixel
						     } // end if
					       } // end while

					errorterm2-=xdiff2;  // if time to increment X, restore error term

			       // draw line from edge 1 to edge 2:

					length=offset2-offset1; // determine length of horizontal line

					if (length < 0) 
                       {    // if negative...
					   length=-length;  // ...make it positive
					   start=offset2;   // and set START to edge 2
					   } // end if
					else 
                       start=offset1;  // else set START to edge 1

  			        for (int index=start; index < start+length+1; index++) // from edge to edge...
				        {
                        vbuffer[index]=(UCHAR)poly->color;      // ...draw the line
                        } // end for index

					offset1+=mempitch;         // advance edge 1 offset to next line
					ystart1++;
					offset2+=mempitch;         // advance edge 2 offset to next line
					ystart2++;

      		  } // end if
			} // end if
			else 
               {
			   // increment edge 1 on Y and edge 2 on Y:
  			   count1=ydiff1;  // count for Y increment on edge 1
			   count2=ydiff2;  // count for Y increment on edge 2

			   while(count1 && count2) 
                    {  
                    // continue drawing until one edge is done
      			    // calculate edge 1:
					errorterm1+=xdiff1;  // increment error term

					if (errorterm1 >= ydiff1)  
                       {                           // if time to increment Y
					   errorterm1-=ydiff1;         // ...restore error term
					   offset1+=xunit1;            // ...and advance offset to next pixel
					   xstart1+=xunit1;
					   } // end if
			 
                    count1--;

  	 		        // calculate edge 2:
					errorterm2+=xdiff2;            // increment error term

					if (errorterm2 >= ydiff2)  
                       {                           // if time to increment Y
					   errorterm2-=ydiff2;         // ...restore error term
					   offset2+=xunit2;            // ...and advance offset to next pixel
					   xstart2+=xunit2;
					   } // end if

       			    --count2;

			        // draw line from edge 1 to edge 2:

					length=offset2-offset1;  // determine length of horizontal line

					if (length < 0) 
                       {          
                       // if negative...
					   length=-length;        // ...make it positive
					   start=offset2;         // and set START to edge 2
					   } // end if
					else 
                       start=offset1;         // else set START to edge 1

			        for (int index=start; index < start+length+1; index++)   
                        { // from edge to edge
				        vbuffer[index]=(UCHAR)poly->color;   // ...draw the linee
                        } // end for index

					offset1+=mempitch;            // advance edge 1 offset to next line
					ystart1++;
					offset2+=mempitch;            // advance edge 2 offset to next line
					ystart2++;

				} // end while

			} // end else

		} // end if

	    // another edge (at least) is complete. Start next edge, if any.
		if (!count1) 
           {                      // if edge 1 is complete...
		   --edgecount;           // decrement the edge count
		   startvert1=endvert1;   // make ending vertex into start vertex
		   --endvert1;            // and get new ending vertex
		
           if (endvert1 < 0) 
              endvert1=poly->num_verts-1; // check for wrap

			xend1=poly->vlist[endvert1].x+poly->x0;  // get x & y of new end vertex
			yend1=poly->vlist[endvert1].y+poly->y0;
		    } // end if

		if (!count2) 
           {                     // if edge 2 is complete...
		   --edgecount;          // decrement the edge count
		   startvert2=endvert2;  // make ending vertex into start vertex
		   endvert2++;           // and get new ending vertex
		
           if (endvert2==(poly->num_verts)) 
              endvert2=0;                // check for wrap

			xend2=poly->vlist[endvert2].x+poly->x0;  // get x & y of new end vertex
			yend2=poly->vlist[endvert2].y+poly->y0;

		   } // end if

	} // end while

} // end Draw_Filled_Polygon2D

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

int Translate_Polygon2D(POLYGON2D_PTR poly, int dx, int dy)
{
// this function translates the center of a polygon

// test for valid pointer
if (!poly)
   return(0);

// translate
poly->x0+=dx;
poly->y0+=dy;

// return success
return(1);

} // end Translate_Polygon2D

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

int Rotate_Polygon2D(POLYGON2D_PTR poly, int theta)
{
// this function rotates the local coordinates of the polygon

// test for valid pointer
if (!poly)
   return(0);

// loop and rotate each point, very crude, no lookup!!!
for (int curr_vert = 0; curr_vert < poly->num_verts; curr_vert++)
    {

    // perform rotation
    float xr = (float)poly->vlist[curr_vert].x*cos_look[theta] - 
                    (float)poly->vlist[curr_vert].y*sin_look[theta];

    float yr = (float)poly->vlist[curr_vert].x*sin_look[theta] + 
                    (float)poly->vlist[curr_vert].y*cos_look[theta];

    // store result back
    poly->vlist[curr_vert].x = xr;
    poly->vlist[curr_vert].y = yr;

    } // end for curr_vert

// return success
return(1);

} // end Rotate_Polygon2D

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

int Scale_Polygon2D(POLYGON2D_PTR poly, float sx, float sy)
{
// this function scalesthe local coordinates of the polygon

// test for valid pointer
if (!poly)
   return(0);

// loop and scale each point
for (int curr_vert = 0; curr_vert < poly->num_verts; curr_vert++)
    {
    // scale and store result back
    poly->vlist[curr_vert].x *= sx;
    poly->vlist[curr_vert].y *= sy;

    } // end for curr_vert

// return success
return(1);

} // end Scale_Polygon2D

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

inline int Draw_Pixel(int x, int y,int color,
                      UCHAR *video_buffer, int lpitch)
{
// this function plots a single pixel at x,y with color
video_buffer[x + y*lpitch] = color;

// return success
return(1);

} // end Draw_Pixel

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

int DDraw_Fill_Surface(LPDIRECTDRAWSURFACE7 lpdds,int color)
{
DDBLTFX ddbltfx; // this contains the DDBLTFX structure

// clear out the structure and set the size field 
DDRAW_INIT_STRUCT(ddbltfx);

// set the dwfillcolor field to the desired color
ddbltfx.dwFillColor = color; 

// ready to blt to surface
lpdds->Blt(NULL,       // ptr to dest rectangle
           NULL,       // ptr to source surface, NA            
           NULL,       // ptr to source rectangle, NA
           DDBLT_COLORFILL | DDBLT_WAIT,   // fill and wait                   
           &ddbltfx);  // ptr to DDBLTFX structure

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

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

LRESULT CALLBACK WindowProc(HWND hwnd, 
						    UINT msg, 
                            WPARAM wparam, 
                            LPARAM lparam)
{
// this is the main message handler of the system
PAINTSTRUCT		ps;		// used in WM_PAINT
HDC				hdc;	// handle to a device context
char buffer[80];        // used to print strings

// what is the message 
switch(msg)
	{	
	case WM_CREATE: 
        {
		// do initialization stuff here
        // return success
		return(0);
		} break;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久精品黄色| 国产欧美一区二区精品性色| 国产成人小视频| 国产露脸91国语对白| 蜜臀av一区二区在线免费观看| 亚洲国产精品视频| 五月综合激情日本mⅴ| 亚洲成a人在线观看| 亚洲图片一区二区| 日韩中文字幕一区二区三区| 天堂蜜桃一区二区三区 | 亚洲一区二区三区视频在线| 亚洲人成网站精品片在线观看| 国产精品国产自产拍在线| 国产亚洲精久久久久久| 日韩毛片视频在线看| 亚洲精品第一国产综合野| 亚洲成a人v欧美综合天堂下载| 午夜精品视频一区| 久草这里只有精品视频| 成人在线一区二区三区| 91视频在线看| 日韩亚洲欧美成人一区| 国产日韩欧美在线一区| 亚洲综合色区另类av| 麻豆高清免费国产一区| 成人综合在线网站| 欧美日韩色一区| 久久久亚洲精华液精华液精华液 | 欧美一区二区在线不卡| 欧美精品一区二区三区一线天视频| 国产欧美日韩麻豆91| 亚洲资源中文字幕| 国产激情视频一区二区在线观看| 91麻豆免费观看| 精品国产欧美一区二区| 中文字幕一区二区不卡| 日本欧美一区二区三区乱码| 成人激情黄色小说| 日韩色视频在线观看| 中文字幕永久在线不卡| 久久99精品一区二区三区三区| 99re这里只有精品首页| 精品久久久久久久久久久久久久久| 亚洲视频1区2区| 国产盗摄一区二区| 欧美一区二区视频网站| 亚洲人快播电影网| 国产a精品视频| 欧美成人女星排行榜| 亚洲国产va精品久久久不卡综合| 国产一区二区三区美女| 制服丝袜亚洲播放| 亚洲综合999| 99re这里都是精品| 久久久综合视频| 蜜臂av日日欢夜夜爽一区| 91黄色激情网站| ●精品国产综合乱码久久久久 | 国产亚洲一区二区三区四区 | 欧美日韩亚洲综合| 亚洲欧洲一区二区在线播放| 国产在线视频一区二区| 欧美一区国产二区| 亚洲成a人片在线不卡一二三区| 色婷婷国产精品| 国产婷婷色一区二区三区四区| 琪琪久久久久日韩精品| 在线播放亚洲一区| 爽好久久久欧美精品| 色偷偷成人一区二区三区91 | 精品视频一区三区九区| 亚洲四区在线观看| 色猫猫国产区一区二在线视频| 欧美经典一区二区三区| 国产美女精品在线| 欧美激情一区二区三区不卡 | 日韩在线a电影| 9191精品国产综合久久久久久| 亚洲自拍都市欧美小说| 在线观看视频91| 亚洲国产日韩一级| 欧美精品1区2区| 奇米亚洲午夜久久精品| 欧美大胆人体bbbb| 麻豆91小视频| 久久蜜桃av一区精品变态类天堂| 狠狠狠色丁香婷婷综合久久五月| 2020国产成人综合网| 国产成人精品一区二| 国产精品久久久久久久久久久免费看 | 日韩国产精品91| 日韩一区二区三区免费看| 九色|91porny| 国产精品情趣视频| 91福利国产精品| 日本aⅴ亚洲精品中文乱码| 精品国产91乱码一区二区三区| 国产老妇另类xxxxx| 中文字幕在线一区| 欧美三级韩国三级日本三斤| 老司机午夜精品| 中文字幕日韩一区二区| 欧美午夜精品免费| 久久99精品久久只有精品| 中文字幕中文字幕一区二区| 欧美高清性hdvideosex| 激情久久五月天| 亚洲免费观看高清| 日韩一区二区精品| 91在线porny国产在线看| 日本中文字幕不卡| 国产精品欧美极品| 日韩一区二区麻豆国产| 91最新地址在线播放| 精品一区二区精品| 亚洲欧美另类久久久精品| 日韩美女在线视频| 欧美色偷偷大香| www.66久久| 国内久久精品视频| 亚洲一二三区视频在线观看| 国产婷婷一区二区| 欧美刺激午夜性久久久久久久| 91丨九色丨尤物| 国产成人精品免费| 麻豆专区一区二区三区四区五区| 亚洲人精品一区| 国产精品情趣视频| 精品国产123| 91精品国产福利在线观看| 色一情一伦一子一伦一区| 国产剧情一区二区| 国产91精品一区二区| 精品一区精品二区高清| 亚洲福利一二三区| 亚洲精品综合在线| 欧美国产一区视频在线观看| 精品少妇一区二区三区视频免付费 | 国产乱子伦一区二区三区国色天香| 亚洲激情五月婷婷| 国产精品成人一区二区三区夜夜夜 | 岛国精品在线观看| 国产乱码一区二区三区| 日韩极品在线观看| 午夜精品久久久久久| 一区二区三区四区在线免费观看 | 久久精品国产77777蜜臀| 视频在线观看一区| 亚洲一区二区在线免费看| 亚洲黄网站在线观看| 亚洲精品ww久久久久久p站| 亚洲天堂久久久久久久| 国产人久久人人人人爽| 中文一区二区完整视频在线观看| 国产拍揄自揄精品视频麻豆| 国产亚洲短视频| 国产精品私人影院| 国产精品免费av| 亚洲美女屁股眼交| 午夜视频在线观看一区二区| 亚洲国产一区二区三区 | 欧美国产欧美综合| 亚洲欧美自拍偷拍色图| 亚洲乱码国产乱码精品精小说| 亚洲男女毛片无遮挡| 亚洲电影激情视频网站| 麻豆精品久久精品色综合| 韩国女主播一区| 国产蜜臀97一区二区三区| 欧美乱妇15p| 国产精品一二三| 成人av动漫网站| 狠狠网亚洲精品| 日日摸夜夜添夜夜添亚洲女人| 国产精品乡下勾搭老头1| 欧美视频精品在线| 国产精品不卡在线| 国产成人在线电影| 精品99一区二区三区| 亚洲午夜久久久久| 91麻豆高清视频| 国产欧美一区二区精品久导航| 久久精品国产精品亚洲精品| 7777精品伊人久久久大香线蕉的 | 国产一区二区三区四区在线观看| 欧美三级日韩在线| 夜夜嗨av一区二区三区中文字幕| 成人精品免费视频| 国产欧美日韩不卡免费| 国产福利一区二区三区在线视频| 日韩精品一区二| 久久丁香综合五月国产三级网站| 欧美一级电影网站| 麻豆精品一区二区三区| 56国语精品自产拍在线观看| 日韩精品欧美精品| 日韩欧美国产综合在线一区二区三区| 亚洲伊人伊色伊影伊综合网| 欧美在线免费观看亚洲|