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

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

?? demo8_8.cpp

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

// compute delta's
height = y3-y1;

dx_left  = (x3-x1)/height;
dx_right = (x3-x2)/height;

// set starting points
xs = (float)x1;
xe = (float)x2+(float)0.5;

// perform y clipping
if (y1 < min_clip_y)
   {
   // compute new xs and ys
   xs = xs+dx_left*(float)(-y1+min_clip_y);
   xe = xe+dx_right*(float)(-y1+min_clip_y);

   // reset y1
   y1=min_clip_y;

   } // end if top is off screen

if (y3>max_clip_y)
   y3=max_clip_y;

// compute starting address in video memory
dest_addr = dest_buffer+y1*mempitch;

// test if x clipping is needed
if (x1>=min_clip_x && x1<=max_clip_x &&
    x2>=min_clip_x && x2<=max_clip_x &&
    x3>=min_clip_x && x3<=max_clip_x)
    {
    // draw the triangle
    for (temp_y=y1; temp_y<=y3; temp_y++,dest_addr+=mempitch)
        {
        memset((UCHAR *)dest_addr+(unsigned int)xs,
                color,(unsigned int)(xe-xs+1));

        // adjust starting point and ending point
        xs+=dx_left;
        xe+=dx_right;

        } // end for

    } // end if no x clipping needed
else
   {
   // clip x axis with slower version

   // draw the triangle
   for (temp_y=y1; temp_y<=y3; temp_y++,dest_addr+=mempitch)
       {
       // do x clip
       left  = (int)xs;
       right = (int)xe;

       // adjust starting point and ending point
       xs+=dx_left;
       xe+=dx_right;

       // clip line
       if (left < min_clip_x)
          {
          left = min_clip_x;

          if (right < min_clip_x)
             continue;
          }

       if (right > max_clip_x)
          {
          right = max_clip_x;

          if (left > max_clip_x)
             continue;
          }

       memset((UCHAR  *)dest_addr+(unsigned int)left,
              color,(unsigned int)(right-left+1));

       } // end for

   } // end else x clipping needed

} // end Draw_Top_Tri

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

void Draw_Bottom_Tri(int x1,int y1, 
                     int x2,int y2, 
                     int x3,int y3,
                     int color,
                     UCHAR *dest_buffer, int mempitch)
{
// this function draws a triangle that has a flat bottom

float dx_right,    // the dx/dy ratio of the right edge of line
      dx_left,     // the dx/dy ratio of the left edge of line
      xs,xe,       // the starting and ending points of the edges
      height;      // the height of the triangle

int temp_x,        // used during sorting as temps
    temp_y,
    right,         // used by clipping
    left;

// destination address of next scanline
UCHAR  *dest_addr;

// test order of x1 and x2
if (x3 < x2)
   {
   temp_x = x2;
   x2     = x3;
   x3     = temp_x;
   } // end if swap

// compute delta's
height = y3-y1;

dx_left  = (x2-x1)/height;
dx_right = (x3-x1)/height;

// set starting points
xs = (float)x1;
xe = (float)x1; // +(float)0.5;

// perform y clipping
if (y1<min_clip_y)
   {
   // compute new xs and ys
   xs = xs+dx_left*(float)(-y1+min_clip_y);
   xe = xe+dx_right*(float)(-y1+min_clip_y);

   // reset y1
   y1=min_clip_y;

   } // end if top is off screen

if (y3>max_clip_y)
   y3=max_clip_y;

// compute starting address in video memory
dest_addr = dest_buffer+y1*mempitch;

// test if x clipping is needed
if (x1>=min_clip_x && x1<=max_clip_x &&
    x2>=min_clip_x && x2<=max_clip_x &&
    x3>=min_clip_x && x3<=max_clip_x)
    {
    // draw the triangle
    for (temp_y=y1; temp_y<=y3; temp_y++,dest_addr+=mempitch)
        {
        memset((UCHAR  *)dest_addr+(unsigned int)xs,
                color,(unsigned int)(xe-xs+1));

        // adjust starting point and ending point
        xs+=dx_left;
        xe+=dx_right;

        } // end for

    } // end if no x clipping needed
else
   {
   // clip x axis with slower version

   // draw the triangle

   for (temp_y=y1; temp_y<=y3; temp_y++,dest_addr+=mempitch)
       {
       // do x clip
       left  = (int)xs;
       right = (int)xe;

       // adjust starting point and ending point
       xs+=dx_left;
       xe+=dx_right;

       // clip line
       if (left < min_clip_x)
          {
          left = min_clip_x;

          if (right < min_clip_x)
             continue;
          }

       if (right > max_clip_x)
          {
          right = max_clip_x;

          if (left > max_clip_x)
             continue;
          }

       memset((UCHAR  *)dest_addr+(unsigned int)left,
              color,(unsigned int)(right-left+1));

       } // end for

   } // end else x clipping needed

} // end Draw_Bottom_Tri

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

void Draw_TriangleFP_2D(int x1,int y1,
                        int x2,int y2,
                        int x3,int y3,
                        int color,
    	   			    UCHAR *dest_buffer, int mempitch)
{
// this function draws a triangle on the destination buffer using fixed point
// it decomposes all triangles into a pair of flat top, flat bottom

int temp_x, // used for sorting
    temp_y,
    new_x;

// test for h lines and v lines
if ((x1==x2 && x2==x3)  ||  (y1==y2 && y2==y3))
   return;

// sort p1,p2,p3 in ascending y order
if (y2<y1)
   {
   temp_x = x2;
   temp_y = y2;
   x2     = x1;
   y2     = y1;
   x1     = temp_x;
   y1     = temp_y;
   } // end if

// now we know that p1 and p2 are in order
if (y3<y1)
   {
   temp_x = x3;
   temp_y = y3;
   x3     = x1;
   y3     = y1;
   x1     = temp_x;
   y1     = temp_y;
   } // end if

// finally test y3 against y2
if (y3<y2)
   {
   temp_x = x3;
   temp_y = y3;
   x3     = x2;
   y3     = y2;
   x2     = temp_x;
   y2     = temp_y;

   } // end if

// do trivial rejection tests for clipping
if ( y3<min_clip_y || y1>max_clip_y ||
    (x1<min_clip_x && x2<min_clip_x && x3<min_clip_x) ||
    (x1>max_clip_x && x2>max_clip_x && x3>max_clip_x) )
   return;

// test if top of triangle is flat
if (y1==y2)
   {
   Draw_Top_TriFP(x1,y1,x2,y2,x3,y3,color, dest_buffer, mempitch);
   } // end if
else
if (y2==y3)
   {
   Draw_Bottom_TriFP(x1,y1,x2,y2,x3,y3,color, dest_buffer, mempitch);
   } // end if bottom is flat
else
   {
   // general triangle that's needs to be broken up along long edge
   new_x = x1 + (int)(0.5+(float)(y2-y1)*(float)(x3-x1)/(float)(y3-y1));

   // draw each sub-triangle
   Draw_Bottom_TriFP(x1,y1,new_x,y2,x2,y2,color, dest_buffer, mempitch);
   Draw_Top_TriFP(x2,y2,new_x,y2,x3,y3,color, dest_buffer, mempitch);

   } // end else

} // end Draw_TriangleFP_2D

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

void Draw_Triangle_2D(int x1,int y1,
                      int x2,int y2,
                      int x3,int y3,
                      int color,
					  UCHAR *dest_buffer, int mempitch)
{
// this function draws a triangle on the destination buffer
// it decomposes all triangles into a pair of flat top, flat bottom

int temp_x, // used for sorting
    temp_y,
    new_x;

// test for h lines and v lines
if ((x1==x2 && x2==x3)  ||  (y1==y2 && y2==y3))
   return;

// sort p1,p2,p3 in ascending y order
if (y2<y1)
   {
   temp_x = x2;
   temp_y = y2;
   x2     = x1;
   y2     = y1;
   x1     = temp_x;
   y1     = temp_y;
   } // end if

// now we know that p1 and p2 are in order
if (y3<y1)
   {
   temp_x = x3;
   temp_y = y3;
   x3     = x1;
   y3     = y1;
   x1     = temp_x;
   y1     = temp_y;
   } // end if

// finally test y3 against y2
if (y3<y2)
   {
   temp_x = x3;
   temp_y = y3;
   x3     = x2;
   y3     = y2;
   x2     = temp_x;
   y2     = temp_y;

   } // end if

// do trivial rejection tests for clipping
if ( y3<min_clip_y || y1>max_clip_y ||
    (x1<min_clip_x && x2<min_clip_x && x3<min_clip_x) ||
    (x1>max_clip_x && x2>max_clip_x && x3>max_clip_x) )
   return;

// test if top of triangle is flat
if (y1==y2)
   {
   Draw_Top_Tri(x1,y1,x2,y2,x3,y3,color, dest_buffer, mempitch);
   } // end if
else
if (y2==y3)
   {
   Draw_Bottom_Tri(x1,y1,x2,y2,x3,y3,color, dest_buffer, mempitch);
   } // end if bottom is flat
else
   {
   // general triangle that's needs to be broken up along long edge
   new_x = x1 + (int)(0.5+(float)(y2-y1)*(float)(x3-x1)/(float)(y3-y1));

   // draw each sub-triangle
   Draw_Bottom_Tri(x1,y1,new_x,y2,x2,y2,color, dest_buffer, mempitch);
   Draw_Top_Tri(x2,y2,new_x,y2,x3,y3,color, dest_buffer, mempitch);

   } // end else

} // end Draw_Triangle_2D

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


int Draw_Text_GDI(char *text, int x,int y,int color, LPDIRECTDRAWSURFACE7 lpdds)
{
// this function draws the sent text on the sent surface 
// using color index as the color in the palette

HDC xdc; // the working dc

// get the dc from surface
if (FAILED(lpdds->GetDC(&xdc)))
   return(0);

// set the colors for the text up
SetTextColor(xdc,RGB(palette[color].peRed,palette[color].peGreen,palette[color].peBlue) );

// set background mode to transparent so black isn't copied
SetBkMode(xdc, TRANSPARENT);

// draw the text a
TextOut(xdc,x,y,text,strlen(text));

// release the dc
lpdds->ReleaseDC(xdc);

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

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


int Set_Palette_Entry(int color_index, LPPALETTEENTRY color)
{
// this function sets a palette color in the palette
lpddpal->SetEntries(0,color_index,1,color);

// set data in shadow palette
memcpy(&palette[color_index],color,sizeof(PALETTEENTRY));

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

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

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] - 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美中文字幕一区二区三区| 欧美色图天堂网| 欧美日韩一区二区电影| 久久伊99综合婷婷久久伊| 日韩美女啊v在线免费观看| 另类小说一区二区三区| 91老师片黄在线观看| 精品福利视频一区二区三区| 一区二区三区丝袜| av在线不卡网| 午夜国产精品影院在线观看| 成人三级在线视频| 精品欧美久久久| 视频一区在线视频| 色婷婷久久一区二区三区麻豆| 久久久久久久久久久久久夜| 亚洲国产成人av| 91在线观看免费视频| 久久久国产精品午夜一区ai换脸| 日韩一区精品字幕| 91行情网站电视在线观看高清版| 国产精品婷婷午夜在线观看| 久久99久久99| 日韩精品一区在线| 日韩精品成人一区二区三区| 欧美综合视频在线观看| 亚洲嫩草精品久久| av电影在线观看不卡| 国产欧美一区二区在线观看| 国产美女精品在线| 精品1区2区在线观看| 美国毛片一区二区三区| 制服丝袜在线91| 免费成人在线观看视频| 亚洲午夜电影在线观看| 色88888久久久久久影院按摩| 亚洲欧美综合色| av一区二区三区黑人| 中文字幕一区二区三区四区不卡| www.久久久久久久久| 国产精品久久三| 91蜜桃免费观看视频| 亚洲欧美日韩小说| 欧美日韩精品欧美日韩精品一| 亚洲亚洲人成综合网络| 欧美日韩你懂的| 另类综合日韩欧美亚洲| 久久夜色精品一区| 成人爽a毛片一区二区免费| 最新国产成人在线观看| 色乱码一区二区三区88| 亚洲亚洲人成综合网络| 日韩欧美综合一区| 国模一区二区三区白浆| 中文字幕在线一区| 国产精品丝袜91| 欧美亚洲一区二区在线| 奇米影视一区二区三区| 久久精品水蜜桃av综合天堂| 成人精品一区二区三区中文字幕| 亚洲人123区| 7777精品伊人久久久大香线蕉超级流畅 | 91精品国产综合久久久久久久| 日本aⅴ亚洲精品中文乱码| 2021中文字幕一区亚洲| 国产99久久久久| 亚洲在线视频免费观看| 日韩欧美在线影院| 99久久免费视频.com| 婷婷国产v国产偷v亚洲高清| 国产亚洲精品aa午夜观看| 色噜噜久久综合| 国产一区999| 亚洲超丰满肉感bbw| 久久先锋资源网| 欧美日韩国产乱码电影| 丁香啪啪综合成人亚洲小说| 亚洲成在人线免费| 国产精品久久久久一区二区三区共| 欧美人xxxx| eeuss鲁片一区二区三区| 视频在线观看一区| 亚洲欧美综合网| 国产亚洲精品aa午夜观看| 欧美老年两性高潮| 色综合久久中文字幕| 国产黄人亚洲片| 日本不卡视频在线观看| 一区二区高清在线| 国产欧美一区二区三区网站| 欧美一级一区二区| 欧美日韩一区在线| av不卡免费电影| 国产黄人亚洲片| 久久99精品久久久久久国产越南| 亚洲黄一区二区三区| 亚洲国产高清aⅴ视频| 日韩欧美第一区| 欧美酷刑日本凌虐凌虐| 91麻豆.com| 91捆绑美女网站| 成人亚洲精品久久久久软件| 黑人巨大精品欧美一区| 免费高清在线视频一区·| www.视频一区| 成人app网站| 成人午夜看片网址| 国产成人免费视频精品含羞草妖精| 久久精品二区亚洲w码| 日韩高清国产一区在线| 亚洲不卡一区二区三区| 手机精品视频在线观看| 亚洲6080在线| 天天av天天翘天天综合网| 亚洲一区二区三区四区不卡| 亚洲女与黑人做爰| 一区二区三区视频在线观看| 亚洲另类色综合网站| 一区二区三区中文在线| 一区二区久久久| 午夜欧美一区二区三区在线播放| 亚洲成人一区二区| 午夜电影网亚洲视频| 奇米影视7777精品一区二区| 蜜桃视频第一区免费观看| 免费成人在线播放| 国产毛片一区二区| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 国产乱国产乱300精品| 国产激情视频一区二区三区欧美| 高清国产一区二区三区| 99久久婷婷国产综合精品| 色综合色综合色综合色综合色综合| 91首页免费视频| 欧美精品一二三区| 欧美成人女星排行榜| 中文字幕国产一区| 一区二区三区在线视频观看58| 午夜电影一区二区三区| 国产精品一级黄| 一本色道久久综合精品竹菊| 欧美在线不卡视频| 日韩精品最新网址| 中文字幕乱码亚洲精品一区| 亚洲色图欧洲色图婷婷| 婷婷综合在线观看| 福利一区在线观看| 欧美日韩在线观看一区二区 | 国产精品女人毛片| 亚洲国产精品久久人人爱蜜臀| 久久精品国产久精国产| 99久久免费视频.com| 日韩欧美久久久| 亚洲日本欧美天堂| 蜜臀91精品一区二区三区| 成人免费视频国产在线观看| 欧美日韩另类一区| 国产日产欧美一区二区三区| 亚洲成年人影院| 国产aⅴ精品一区二区三区色成熟| 欧美在线影院一区二区| 久久久综合视频| 香蕉久久夜色精品国产使用方法| 国产又粗又猛又爽又黄91精品| 在线观看一区二区精品视频| 久久一区二区视频| 日韩av二区在线播放| 99re视频精品| 久久久精品综合| 三级亚洲高清视频| 91在线porny国产在线看| 午夜av一区二区三区| 国产成人午夜精品影院观看视频| 91久久香蕉国产日韩欧美9色| 久久久久久久久久久久久久久99| 亚洲成人自拍一区| 99久久久精品| 欧美激情中文字幕一区二区| 性做久久久久久久久| 一本色道**综合亚洲精品蜜桃冫| 国产偷v国产偷v亚洲高清| 秋霞国产午夜精品免费视频| 欧美视频完全免费看| 日本一区二区综合亚洲| 激情六月婷婷综合| 3751色影院一区二区三区| 亚洲国产精品影院| 在线精品视频一区二区三四| 国产精品麻豆欧美日韩ww| 国产高清精品网站| 欧美电影免费观看高清完整版在| 午夜精品久久久久久久| 在线国产亚洲欧美| 一区二区三区中文字幕在线观看| av一区二区不卡| 国产精品麻豆久久久| 白白色亚洲国产精品| 国产精品国产三级国产| 成人激情校园春色| 国产精品美女视频|