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

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

?? t3dlib1.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
       // adjust the error term
       error+=dy2;

       // move to the next pixel
       vb_start+=x_inc;

       } // end for

   } // end if |slope| <= 1
else
   {
   // initialize error term
   error = dx2 - dy; 

   // draw the line
   for (index=0; index <= dy; index++)
       {
       // set the pixel
       *vb_start = color;

       // test if error overflowed
       if (error >= 0)
          {
          error-=dy2;

          // move to next line
          vb_start+=x_inc;

          } // end if error overflowed

       // adjust the error term
       error+=dx2;

       // move to the next pixel
       vb_start+=y_inc;

       } // end for

   } // end else |slope| > 1

// return success
return(1);

} // end Draw_Line

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

int Draw_Line16(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

int lpitch_2 = lpitch >> 1; // USHORT strided lpitch

// pre-compute first pixel address in video buffer based on 16bit data
USHORT *vb_start2 = (USHORT *)vb_start + x0 + y0*lpitch_2;

// 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_2;
   } // end if line is moving down
else
   {
   y_inc = -lpitch_2;
   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_start2 = (USHORT)color;

       // test if error has overflowed
       if (error >= 0) 
          {
          error-=dx2;

          // move to next line
          vb_start2+=y_inc;

	   } // end if error overflowed

       // adjust the error term
       error+=dy2;

       // move to the next pixel
       vb_start2+=x_inc;

       } // end for

   } // end if |slope| <= 1
else
   {
   // initialize error term
   error = dx2 - dy; 

   // draw the line
   for (index=0; index <= dy; index++)
       {
       // set the pixel
       *vb_start2 = (USHORT)color;

       // test if error overflowed
       if (error >= 0)
          {
          error-=dy2;

          // move to next line
          vb_start2+=x_inc;

          } // end if error overflowed

       // adjust the error term
       error+=dx2;

       // move to the next pixel
       vb_start2+=y_inc;

       } // end for

   } // end else |slope| > 1

// return success
return(1);

} // end Draw_Line16

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

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 Draw_Pixel16(int x, int y,int color,
                        UCHAR *video_buffer, int lpitch)
{
// this function plots a single pixel at x,y with color

((USHORT *)video_buffer)[x + y*(lpitch >> 1)] = color;

// return success
return(1);

} // end Draw_Pixel16

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


int Draw_Rectangle(int x1, int y1, int x2, int y2, int color,
                   LPDIRECTDRAWSURFACE7 lpdds)
{
// this function uses directdraw to draw a filled rectangle

DDBLTFX ddbltfx; // this contains the DDBLTFX structure
RECT fill_area;  // this contains the destination rectangle

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

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

// fill in the destination rectangle data (your data)
fill_area.top    = y1;
fill_area.left   = x1;
fill_area.bottom = y2;
fill_area.right  = x2;

// ready to blt to surface, in this case blt to primary
lpdds->Blt(&fill_area, // 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 Draw_Rectangle

///////////////////////////////////////////////////////////
   
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 Get_Palette_Entry(int color_index,LPPALETTEENTRY color)
{
// this function retrieves a palette entry from the color
// palette

// copy data out from shadow palette
memcpy(color, &palette[color_index],sizeof(PALETTEENTRY));

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

///////////////////////////////////////////////////////////
   
int Load_Palette_From_File(char *filename, LPPALETTEENTRY palette)
{
// this function loads a palette from disk into a palette
// structure, but does not set the pallette

FILE *fp_file; // working file

// try and open file
if ((fp_file = fopen(filename,"r"))==NULL)
   return(0);

// read in all 256 colors RGBF
for (int index=0; index<MAX_COLORS_PALETTE; index++)
    {
    // read the next entry in
    fscanf(fp_file,"%d %d %d %d",&palette[index].peRed,
                                 &palette[index].peGreen,
                                 &palette[index].peBlue,                                
                                 &palette[index].peFlags);
    } // end for index

// close the file
fclose(fp_file);

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

///////////////////////////////////////////////////////////   
   
int Save_Palette_To_File(char *filename, LPPALETTEENTRY palette)
{
// this function saves a palette to disk

FILE *fp_file; // working file

// try and open file
if ((fp_file = fopen(filename,"w"))==NULL)
   return(0);

// write in all 256 colors RGBF
for (int index=0; index<MAX_COLORS_PALETTE; index++)
    {
    // read the next entry in
    fprintf(fp_file,"\n%d %d %d %d",palette[index].peRed,
                                    palette[index].peGreen,
                                    palette[index].peBlue,                                
                                    palette[index].peFlags);
    } // end for index

// close the file
fclose(fp_file);

// return success
return(1);

} // end Save_Palette_To_Disk

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

int Save_Palette(LPPALETTEENTRY sav_palette)
{
// this function saves the current palette 

memcpy(sav_palette, palette,MAX_COLORS_PALETTE*sizeof(PALETTEENTRY));

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

///////////////////////////////////////////////////////////   
   
int Set_Palette(LPPALETTEENTRY set_palette)
{
// this function writes the sent palette

// first save the new palette in shadow
memcpy(palette, set_palette,MAX_COLORS_PALETTE*sizeof(PALETTEENTRY));

// now set the new palette
lpddpal->SetEntries(0,0,MAX_COLORS_PALETTE,palette);

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

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

int Rotate_Colors(int start_index, int end_index)
{
// this function rotates the color between start and end

int colors = end_index - start_index + 1;

PALETTEENTRY work_pal[MAX_COLORS_PALETTE]; // working palette

// get the color palette
lpddpal->GetEntries(0,start_index,colors,work_pal);

// shift the colors
lpddpal->SetEntries(0,start_index+1,colors-1,work_pal);

// fix up the last color
lpddpal->SetEntries(0,start_index,1,&work_pal[colors - 1]);

// update shadow palette
lpddpal->GetEntries(0,0,MAX_COLORS_PALETTE,palette);

// return success
return(1);

} // end Rotate_Colors

///////////////////////////////////////////////////////////   
   
int Blink_Colors(int command, BLINKER_PTR new_light, int id)
{
// this function blinks a set of lights

static BLINKER lights[256]; // supports up to 256 blinking lights
static int initialized = 0; // tracks if function has initialized

// test if this is the first time function has ran
if (!initialized)
   {
   // set initialized
   initialized = 1;

   // clear out all structures
   memset((void *)lights,0, sizeof(lights));

   } // end if

// now test what command user is sending
switch (command)
       {
       case BLINKER_ADD: // add a light to the database
            {
            // run thru database and find an open light
            for (int index=0; index < 256; index++)
                {
                // is this light available?
                if (lights[index].state == 0)
                   {
                   // set light up
                   lights[index] = *new_light;

                   // set internal fields up
                   lights[index].counter =  0;
                   lights[index].state   = -1; // off

                   // update palette entry
                   lpddpal->SetEntries(0,lights[index].color_index,1,&lights[index].off_color);
 
                   // return id to caller
                   return(index);

                   } // end if

                } // end for index

            } break;

       case BLINKER_DELETE: // delete the light indicated by id
            {
            // delete the light sent in id 
            if (lights[id].state != 0)
               {
               // kill the light
               memset((void *)&lights[id],0,sizeof(BLINKER));

               // return id
               return(id);
 
               } // end if
            else
                return(-1); // problem


            } break;

       case BLINKER_UPDATE: // update the light indicated by id
            { 
            // make sure light is active
            if (lights[id].state != 0)
               {
               // update on/off parms only
               lights[id].on_color  = new_light->on_color; 
               lights[id].off_color = new_light->off_color;
               lights[id].on_time   = new_light->on_time;
               lights[id].off_time  = new_light->off_time; 

               // update palette entry
               if (lights[id].state == -1)
                  lpddpal->SetEntries(0,lights[id].color_index,1,&lights[id].off_color);
               else
                  lpddpal->SetEntries(0,lights[id].color_index,1,&lights[id].on_color);

               // return id
               return(id);
 
               } // end if
            else
                return(-1); // problem

            } break;

       case BLINKER_RUN: // run the algorithm
            {
            // run thru database and process each light
            for (int index=0; index < 256; index++)
                {
                // is this active?
                if (lights[index].state == -1)
                   {
                   // update counter
                   if (++lights[index].counter >= lights[index].off_time)
                      {
                      // reset counter
                      lights[index].counter = 0;

                      // change states 
                      lights[index].state = -lights[index].state;               
 
                      // update color
                      lpddpa

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲同性gay激情无套| 日韩精品一区二区三区四区视频| 九九九久久久精品| 日韩不卡一二三区| 久久精品噜噜噜成人av农村| 视频一区国产视频| 韩日欧美一区二区三区| 国产美女视频一区| 成人午夜大片免费观看| 不卡高清视频专区| 91在线云播放| 欧美区视频在线观看| 69av一区二区三区| 久久色视频免费观看| 亚洲国产精品二十页| 亚洲精品免费在线| 成人精品电影在线观看| 9l国产精品久久久久麻豆| 99精品久久久久久| 欧美网站大全在线观看| 日韩欧美资源站| 中文字幕欧美区| 一区二区三区在线免费视频| 日韩 欧美一区二区三区| 国产毛片精品视频| 欧美艳星brazzers| 国产亚洲污的网站| 亚洲动漫第一页| 国产成人亚洲综合色影视| 色美美综合视频| 久久精子c满五个校花| 亚洲精品伦理在线| 激情久久五月天| 91天堂素人约啪| 精品日产卡一卡二卡麻豆| 亚洲日本一区二区三区| 狠狠色丁香婷婷综合久久片| 色综合色综合色综合色综合色综合| 欧美日韩一区二区在线视频| 国产亚洲一区二区三区| 丝袜脚交一区二区| www.亚洲色图.com| 久久综合999| 日韩电影在线观看一区| 色婷婷国产精品综合在线观看| 欧美成人精精品一区二区频| 一区二区三区在线观看视频| 国产xxx精品视频大全| 7777精品伊人久久久大香线蕉超级流畅 | 欧美一区欧美二区| 亚洲最色的网站| 国产suv一区二区三区88区| 欧美一区二区在线播放| 亚洲精品成人在线| 成人av影院在线| 国产亚洲一二三区| 国内外成人在线视频| 在线播放亚洲一区| 亚洲成人黄色影院| 99re成人精品视频| 国产精品久久久久影视| 国产一区二三区好的| 日韩欧美二区三区| 蜜乳av一区二区| 欧美一区二区三区公司| 午夜精品久久久| 欧美三级一区二区| 午夜激情久久久| 欧美日韩另类国产亚洲欧美一级| 亚洲精品美腿丝袜| 在线这里只有精品| 亚洲综合一区在线| 欧美亚洲国产怡红院影院| 亚洲综合清纯丝袜自拍| 欧美私人免费视频| 国产精品一区专区| 久久精品人人做人人爽人人| 国产一区二区伦理片| 2019国产精品| 国产91在线观看丝袜| 中文字幕一区日韩精品欧美| 成人av在线一区二区| 亚洲婷婷国产精品电影人久久| 91丝袜美腿高跟国产极品老师 | 看国产成人h片视频| 日韩欧美你懂的| 国产成人免费视| 亚洲国产精品激情在线观看| www.欧美.com| 伊人一区二区三区| 欧美精品久久99| 韩日欧美一区二区三区| 国产精品久线在线观看| 在线观看视频一区| 麻豆精品国产传媒mv男同| 久久久国产综合精品女国产盗摄| 国产aⅴ综合色| 一区二区三区在线免费| 日韩视频123| 99国产欧美另类久久久精品 | 欧美性受极品xxxx喷水| 丝袜亚洲另类欧美| 久久精品一区二区三区不卡| 成人国产精品免费观看动漫| 亚洲国产色一区| 精品久久久久一区二区国产| 99视频一区二区| 久久精品久久综合| 亚洲视频在线一区| 日韩精品中文字幕在线一区| 成人精品免费看| 老司机午夜精品| 一区av在线播放| 国产欧美日韩视频在线观看| 欧美久久一二三四区| 床上的激情91.| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品久久久久四虎| 欧美一个色资源| 日本久久电影网| www.一区二区| 国产成人在线免费| 亚洲国产精品久久久久秋霞影院| 国产欧美一区二区精品忘忧草 | 狠狠色狠狠色综合系列| 亚洲小少妇裸体bbw| 国产视频一区二区三区在线观看| 欧美日韩一区二区不卡| 99久久综合国产精品| 国内精品嫩模私拍在线| 日韩精品国产精品| 亚洲国产日韩a在线播放性色| 欧美激情在线一区二区三区| 欧美成人精品1314www| 欧美日韩国产影片| 色www精品视频在线观看| 成人avav影音| 国产成人精品网址| 国产福利视频一区二区三区| 蜜臀久久99精品久久久久久9| 午夜精品国产更新| 午夜视频一区二区| 午夜国产精品一区| 亚洲国产视频直播| 五月婷婷久久综合| 日韩高清电影一区| 日本aⅴ免费视频一区二区三区| 国产美女在线精品| 国产精品亚洲人在线观看| 国内精品第一页| 国产一区二区三区蝌蚪| 国产自产v一区二区三区c| 久久精品国产99| 精品无人区卡一卡二卡三乱码免费卡 | 国模大尺度一区二区三区| 热久久免费视频| 精品在线播放免费| 国产精品一二三区| 成人sese在线| 色美美综合视频| 欧美日韩国产天堂| 欧美一区二区免费视频| 精品久久久网站| 国产精品妹子av| 亚洲乱码日产精品bd| 舔着乳尖日韩一区| 久久福利视频一区二区| 国产成人在线视频免费播放| 99在线精品观看| 91精品国产综合久久国产大片| 欧美精品久久一区| 91精品国产综合久久久久| 日韩午夜av一区| 国产精品国产三级国产普通话三级| 亚洲欧洲精品成人久久奇米网| 亚洲国产精品一区二区www在线| 舔着乳尖日韩一区| 国产精品77777竹菊影视小说| av一区二区不卡| 欧美一区二区三区不卡| 亚洲国产高清不卡| 亚洲综合网站在线观看| 久久av中文字幕片| 91丨porny丨蝌蚪视频| 欧美精品一二三四| 中文字幕中文字幕在线一区 | 中文字幕一区日韩精品欧美| 性感美女久久精品| 国产不卡在线播放| 精品视频色一区| 国产精品久久久久久久久图文区| 一区二区在线观看免费| 国产一区二区在线视频| 色诱亚洲精品久久久久久| 精品国产一区二区三区久久久蜜月| 亚洲欧美一区二区三区极速播放| 精品亚洲aⅴ乱码一区二区三区| 色香蕉久久蜜桃| 国产日韩精品一区二区三区| 日本成人超碰在线观看|