亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
开心九九激情九九欧美日韩精美视频电影| 91福利在线导航| 在线观看网站黄不卡| 亚洲精品一区二区三区四区高清| 国产精品久久久久婷婷| 麻豆高清免费国产一区| 日本韩国一区二区三区视频| 久久久久97国产精华液好用吗 | 91蝌蚪porny| 日韩欧美综合在线| 亚洲成人资源网| 色悠悠亚洲一区二区| 国产欧美久久久精品影院| 美国十次了思思久久精品导航| 在线亚洲精品福利网址导航| 国产日韩v精品一区二区| 蜜臀久久99精品久久久画质超高清| 欧美性猛交xxxx乱大交退制版| 国产精品女主播在线观看| 国产一区二区三区| 日韩一区二区三区av| 亚洲一区在线播放| 9色porny自拍视频一区二区| 欧美国产乱子伦| 国产成人精品亚洲日本在线桃色| 久久午夜免费电影| 国产自产v一区二区三区c| 日韩欧美高清一区| 麻豆成人91精品二区三区| 日韩欧美国产午夜精品| 老司机精品视频一区二区三区| 欧美一区永久视频免费观看| 奇米777欧美一区二区| 日韩美女一区二区三区| 久久精品99国产精品日本| 欧美大白屁股肥臀xxxxxx| 一区二区三区影院| 91激情在线视频| 无码av中文一区二区三区桃花岛| 欧美性色aⅴ视频一区日韩精品| 亚洲综合一区二区精品导航| 91国模大尺度私拍在线视频| 亚洲亚洲人成综合网络| 欧美精品久久天天躁| 日韩精品三区四区| 精品国产91久久久久久久妲己 | 国产成人av电影免费在线观看| 久久婷婷成人综合色| 国产69精品一区二区亚洲孕妇| 国产精品久久久久四虎| 色天天综合色天天久久| 日韩精品乱码免费| 久久网站热最新地址| 成人av在线资源| 亚洲图片自拍偷拍| 精品少妇一区二区| heyzo一本久久综合| 亚洲一二三四区不卡| 日韩一级二级三级| 成人高清视频免费观看| 亚洲伊人色欲综合网| 欧美成人艳星乳罩| 91网站在线播放| 五月天久久比比资源色| 久久久久久黄色| 欧美在线观看视频一区二区| 久久99久久久欧美国产| 亚洲精品第一国产综合野| 欧美一级免费大片| 99麻豆久久久国产精品免费| 午夜欧美在线一二页| 日韩美女在线视频| 色就色 综合激情| 久久99久久99小草精品免视看| 国产精品色哟哟网站| 日韩一区二区三区四区五区六区| 成人国产免费视频| 七七婷婷婷婷精品国产| 亚洲欧美日韩中文字幕一区二区三区| 日韩欧美www| 在线这里只有精品| 成人免费毛片aaaaa**| 久久精品噜噜噜成人av农村| 一区二区三区在线免费观看| 国产亚洲女人久久久久毛片| 欧美二区三区91| 色综合久久88色综合天天免费| 国产资源精品在线观看| 日本特黄久久久高潮| 亚洲成人综合网站| 1区2区3区欧美| 中文字幕电影一区| 2024国产精品| 日韩欧美你懂的| 欧美日韩午夜在线| 97国产一区二区| 成人动漫一区二区三区| 国产在线精品一区二区夜色| 免费高清在线一区| 日本不卡1234视频| 偷偷要91色婷婷| 五月天激情综合网| 亚洲国产日韩综合久久精品| 亚洲综合色丁香婷婷六月图片| 亚洲欧洲精品一区二区三区不卡| 国产欧美日韩精品在线| 久久婷婷国产综合精品青草| 精品少妇一区二区三区视频免付费| 91麻豆精品国产91久久久使用方法| 色综合一区二区三区| 波波电影院一区二区三区| 成人免费看视频| 成人小视频免费观看| 国产.欧美.日韩| 国产91精品免费| www.欧美亚洲| 91在线观看下载| 91色porny在线视频| 色婷婷综合中文久久一本| 色综合欧美在线| 欧美最猛性xxxxx直播| 欧美无砖专区一中文字| 91 com成人网| 精品国产伦一区二区三区观看体验| 日韩免费观看2025年上映的电影| 日韩欧美中文字幕一区| 精品国产一区二区三区忘忧草| 欧美变态tickle挠乳网站| 久久久不卡影院| 中文字幕亚洲欧美在线不卡| 亚洲一级不卡视频| 美女视频网站久久| 国产精品自产自拍| 91尤物视频在线观看| 欧美精品黑人性xxxx| 欧美精品一区二区精品网| 亚洲国产精品成人综合| 一区二区日韩av| 蜜臀av一区二区在线观看 | 精品一二三四区| 成人深夜视频在线观看| 欧美性一级生活| 欧美精品一区二| 亚洲欧洲制服丝袜| 日韩国产欧美在线播放| 国产乱理伦片在线观看夜一区| 99综合电影在线视频| 91精品国产综合久久婷婷香蕉 | 欧美日韩国产首页| 久久亚洲综合av| 亚洲精品免费在线| 久久99精品久久久久久国产越南 | 国产精品一区二区免费不卡| 99精品桃花视频在线观看| 欧美老女人第四色| 国产欧美一区二区精品忘忧草| 亚洲国产日韩a在线播放| 国产一区二区电影| 欧美日韩国产另类不卡| 国产精品私人自拍| 蜜臀av在线播放一区二区三区| av一区二区三区黑人| 日韩一区二区精品葵司在线| 国产精品久久久久天堂| 久久国产婷婷国产香蕉| 欧美日韩一区二区电影| 中文字幕欧美激情一区| 久久精品免费看| 欧美日韩视频在线观看一区二区三区| 久久九九全国免费| 麻豆成人久久精品二区三区小说| 日本韩国视频一区二区| 欧美激情一二三区| 国内精品伊人久久久久av影院| 欧美乱妇15p| 亚洲一区二区三区自拍| av高清久久久| 久久久久久久久久久久久女国产乱 | 日韩高清不卡一区二区三区| caoporn国产精品| 久久久久久久精| 精彩视频一区二区三区| 日韩欧美中文字幕一区| 日韩av在线发布| 欧美精品tushy高清| 香蕉成人伊视频在线观看| 欧洲国内综合视频| 亚洲精品国久久99热| 99久免费精品视频在线观看| 欧美高清在线精品一区| 国产乱码精品一区二区三区忘忧草 | 国产一区二区女| 欧美tickle裸体挠脚心vk| 美腿丝袜在线亚洲一区 | 琪琪一区二区三区| 91精品国产91久久综合桃花| 日韩和的一区二区| 欧美一区二区三区视频免费播放| 日韩精品福利网| 日韩一区二区视频|