亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
色综合久久久久久久久| 日韩精品一区二区三区四区视频| 欧美日韩精品一区二区三区四区 | 久久成人免费日本黄色| 国产精品综合二区| 欧美二区三区的天堂| 国产精品美日韩| 久久99精品久久久久| 欧美久久久久免费| 亚洲黄色性网站| 国产成人免费在线| 欧美亚洲一区二区在线| 日本一区二区动态图| 久久99精品国产麻豆婷婷| 欧美色视频在线| 亚洲欧洲日产国码二区| 在线视频一区二区免费| 日本一区二区三区免费乱视频| 麻豆精品新av中文字幕| 欧美日韩在线播放三区| 亚洲激情校园春色| 99久久精品国产一区二区三区| 久久久久国产精品人| 精品中文字幕一区二区小辣椒| 欧美日韩精品电影| 亚洲成人免费在线| 欧美日韩中文字幕一区| 亚洲高清免费一级二级三级| 色欧美片视频在线观看 | 成人99免费视频| 国产亲近乱来精品视频| 国产91在线|亚洲| 亚洲国产精品成人综合| 成人免费电影视频| 亚洲免费伊人电影| 色94色欧美sute亚洲13| 亚洲伊人色欲综合网| 欧美午夜一区二区| 亚洲国产精品一区二区尤物区| 欧美天天综合网| 视频一区二区三区在线| 欧美一级生活片| 国内精品伊人久久久久影院对白| 精品日韩成人av| 风间由美一区二区av101| 中文字幕亚洲视频| 91国产福利在线| 免费在线观看一区二区三区| 欧美精品一区男女天堂| 国产精品一级片在线观看| 国产精品久久看| 欧美图片一区二区三区| 美国十次综合导航| 国产精品久久毛片a| 欧美日韩亚州综合| 国产毛片精品视频| 亚洲欧美中日韩| 在线播放日韩导航| 国产成人av一区二区三区在线| 中文字幕视频一区二区三区久| 在线精品观看国产| 精品无人区卡一卡二卡三乱码免费卡 | 久久国产人妖系列| 国产精品久久久久久亚洲伦| 欧美午夜精品久久久久久孕妇| 美女脱光内衣内裤视频久久影院| 中文字幕 久热精品 视频在线| 欧美午夜片在线观看| 国产福利一区在线观看| 午夜亚洲福利老司机| 国产女人aaa级久久久级 | 欧美无人高清视频在线观看| 青青青伊人色综合久久| 中文字幕一区日韩精品欧美| 欧美一区二区三区播放老司机| 成人免费高清在线| 精品一区二区三区在线视频| 最好看的中文字幕久久| 精品国产亚洲在线| 欧美在线观看一二区| 国产91精品在线观看| 日日欢夜夜爽一区| 亚洲欧美日韩在线不卡| 欧美国产综合一区二区| 欧美一区2区视频在线观看| 91丨九色丨尤物| 国产精品123区| 丝袜诱惑制服诱惑色一区在线观看| 国产精品欧美一区喷水| 日韩欧美高清dvd碟片| 欧美视频一区二区| 一本色道亚洲精品aⅴ| 盗摄精品av一区二区三区| 裸体一区二区三区| 午夜久久电影网| 亚洲精品成人悠悠色影视| 国产精品热久久久久夜色精品三区| 日韩欧美国产一区二区在线播放| 欧美日韩一区成人| 91久久精品一区二区三| 91一区二区三区在线观看| 粉嫩av一区二区三区在线播放 | 日韩av电影免费观看高清完整版 | 亚洲日本在线a| 国产日韩欧美一区二区三区综合 | 亚洲激情av在线| 中文字幕一区二区三区不卡| 欧美激情一区二区三区蜜桃视频| 欧美精品一区二区三区四区| 日韩精品一区国产麻豆| 91精品国产一区二区三区蜜臀| 欧美天堂亚洲电影院在线播放| 欧洲精品一区二区三区在线观看| 一本色道久久综合狠狠躁的推荐| 99久久婷婷国产综合精品| 成人免费看的视频| 99国产精品视频免费观看| 色噜噜狠狠色综合中国| 日本高清不卡视频| 色婷婷国产精品综合在线观看| 色综合久久综合中文综合网| av成人免费在线观看| www.亚洲国产| 在线视频综合导航| 欧美欧美欧美欧美首页| 日韩午夜在线影院| www久久精品| 中文字幕一区二区三| 一区二区三区四区在线播放| 午夜久久电影网| 国产综合色在线视频区| 九九在线精品视频| 国产成人av一区二区| 91色综合久久久久婷婷| 欧美日韩午夜精品| 欧美成人国产一区二区| 国产日产欧美一区| 亚洲激情自拍偷拍| 久久成人免费网| 另类综合日韩欧美亚洲| 国产成人综合在线| 欧美成人一级视频| 国产精品欧美久久久久一区二区| 亚洲欧洲综合另类| 视频一区二区中文字幕| 国产精品小仙女| 一本在线高清不卡dvd| 日韩视频免费直播| 国产精品蜜臀av| 日韩精品亚洲专区| 国产91精品精华液一区二区三区| 色婷婷精品大在线视频| 欧美成人艳星乳罩| 一区二区三区**美女毛片| 国产在线视频精品一区| 一本大道久久精品懂色aⅴ| 日韩欧美国产一区在线观看| 亚洲欧美电影一区二区| 国产一区视频在线看| 在线观看免费视频综合| 久久久久国产一区二区三区四区| 一区二区三区鲁丝不卡| 激情六月婷婷综合| 欧美色男人天堂| 国产精品美女久久久久久久网站| 五月婷婷久久综合| 99re视频精品| 久久婷婷综合激情| 蜜桃一区二区三区四区| 日本韩国视频一区二区| 久久精品一区蜜桃臀影院| 婷婷成人激情在线网| 99国产精品久久久| 久久综合久久久久88| 视频一区中文字幕国产| 色婷婷综合激情| 国产精品国模大尺度视频| 国产麻豆成人传媒免费观看| 欧美老女人在线| 亚洲一区自拍偷拍| 99精品视频一区| 国产精品素人视频| 国产高清视频一区| 欧美成人国产一区二区| 美女脱光内衣内裤视频久久网站 | 国产欧美精品日韩区二区麻豆天美| 亚洲高清一区二区三区| 在线亚洲一区观看| 国产精品成人午夜| 成人黄色片在线观看| 日本一区二区三区久久久久久久久不| 美国十次综合导航| 欧美成人a∨高清免费观看| 日韩国产欧美在线观看| 777亚洲妇女| 蜜臀av性久久久久蜜臀av麻豆| 日韩一区二区三区免费看| 日本视频在线一区| 欧美电视剧在线观看完整版| 九九九久久久精品|