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

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

?? voxrend.cpp

?? quake 游戲原代碼
?? CPP
字號:
#include <mem.h>
#include "ray.h"
#include "globals.h"
#include "voxel.h"
#include "rayrend.h"
#include "asm.h"
#include "screen.h"
#include "mymem.h"
#include "shading.h"
#include "sprvox.h"
#include "scrconf.h"
#include "voxsky.h"
#include "rcvars.h"
#include "sortseg.h"
#include "fixed.h"
#include "prevarr.h"
#include "skipping.h"

#define XT_TO_VOX_SHIFT 4
#define NORM_TO_VOX 2
#define SMOOTH_DELIMATOR_X 0x00004000
#define SMOOTH_DELIMATOR_Y 0x00400000
#define BLUE_COLOR 0x3f
#define DIST_MIN_FIXED (DIST_SCALER*DIST_MIN<<SHIFT)
#define DIST_MAX_FIXED (DIST_SCALER*DIST_MAX<<SHIFT)
#define DIST_INC (DIST_SCALER<<SHIFT)
#define MAX_SS_VECTORS 100
#define DOUBLE_DIS 30
#define QUAD_DIS 60

typedef struct VOX_RUN * pvox_run;
typedef struct VOX_RUN{
   short left, right;
   } vox_run;

shade_mode do_shading;
skipping_mode do_skipping;

void Set_Shading(shade_mode new_mode)
{
do_shading=new_mode;
}

void Set_Skipping(skipping_mode new_mode)
{
do_skipping=new_mode;
}

void Transform_Points(pvector2 start_list, pvector2 dest_list, short vector_count);
short Clip_Points_Max(pvector2 start_list, pvector2 dest_list, short vector_count);
short Clip_Points_Min(pvector2 start_list, pvector2 dest_list, short vector_count);

void Make_Vox_Runs(
   pvector2 point_list,
   short point_count,
   pvox_run dest_runs,
   short & start_line,
   short & end_line);

void Render_Vox_Runs(
   pssector vox_ssector,
   pvox_run screen_runs,
   short start_line,
   short end_line);

void Render_Voxel_Sub_Sector(pssector vox_ssector)
{
   vector2 trans_list[MAX_SS_VECTORS];
   vector2 clipped_points[MAX_SS_VECTORS];
   vector2 clipped_intermediates[MAX_SS_VECTORS];
   vox_run screen_runs[DIST_MAX];
   short start_line, end_line;
   psorted_vector_type start_list;
   short clipped_point_count;

   start_list=(psorted_vector_type)vox_ssector->extra_data;

   // transform points relative to viewer
   Transform_Points(start_list->vectors, trans_list, start_list->vector_count);

   // perform clipping, first against maximum distance, and then against minimum distance

   clipped_point_count=Clip_Points_Max(trans_list, clipped_intermediates, 
      start_list->vector_count);
   // has polygon been clipped out of existence?
   if (clipped_point_count==0)
      return;

   clipped_point_count=Clip_Points_Min(clipped_intermediates, clipped_points,
      clipped_point_count);
   // has polygon been clipped out of existence?
   if (clipped_point_count==0)
      return;

   Make_Vox_Runs(
      clipped_points,
      clipped_point_count,
      screen_runs,
      start_line,
      end_line);
   Render_Vox_Runs( 
      vox_ssector,
      screen_runs,
      start_line,
      end_line);
}

void Transform_Points(pvector2 start_list, pvector2 dest_list, short vector_count) {
   short vec_index;
   // get a translated list
   for (vec_index=0; vec_index<vector_count; vec_index++) {
      rotate_x=((start_list[vec_index].x<<SHIFT)-render_x);
      rotate_y=((start_list[vec_index].y<<SHIFT)-render_y);
      rotate_angle=render_view_angle;
      dest_list[vec_index].x=FixedRotateY();
      dest_list[vec_index].y=FixedRotateX();
      }
}

short Clip_Points_Max(pvector2 start_list, pvector2 dest_list, short vector_count) {
   pvector2 cur_vec, next_vec;
   short vec_index;
   short clip_counter;

   clip_counter=0;
   cur_vec=start_list+(vector_count-1);
   for (vec_index=0; vec_index<vector_count; vec_index++) {
      next_vec=start_list+vec_index;

      // categorize edges by types

      if ((cur_vec->y <= DIST_MAX_FIXED) && (next_vec->y <= DIST_MAX_FIXED)) {
         // edge not at all behind view volume
         dest_list[clip_counter].x=next_vec->x;
         dest_list[clip_counter++].y=next_vec->y;
      } /* endif */

      if ((cur_vec->y > DIST_MAX_FIXED) && (next_vec->y > DIST_MAX_FIXED)) {
         // all behind volume, so go on
         }

      if ((cur_vec->y <= DIST_MAX_FIXED) && (next_vec->y > DIST_MAX_FIXED)) {
         // edge is leaving view volume
         MYFIXED slope=fixeddiv(next_vec->x-cur_vec->x, next_vec->y-cur_vec->y);
         dest_list[clip_counter].y=DIST_MAX_FIXED;
         dest_list[clip_counter++].x=cur_vec->x +
            fixedmult(slope, DIST_MAX_FIXED-cur_vec->y);
         }

      if ((cur_vec->y > DIST_MAX_FIXED) && (next_vec->y <=DIST_MAX_FIXED)) {
         // edge is entering view volume
         MYFIXED slope=fixeddiv(next_vec->x-cur_vec->x, next_vec->y-cur_vec->y);
         dest_list[clip_counter].y=DIST_MAX_FIXED;
         dest_list[clip_counter++].x=cur_vec->x + 
            fixedmult(slope, DIST_MAX_FIXED-cur_vec->y);
         dest_list[clip_counter].x=next_vec->x;
         dest_list[clip_counter++].y=next_vec->y;
         }
      cur_vec=next_vec;
      }

return clip_counter;
}

short Clip_Points_Min(pvector2 start_list, pvector2 dest_list, short vector_count) {
   pvector2 cur_vec, next_vec;
   short vec_index;
   short clip_counter;

   clip_counter=0;
   cur_vec=start_list+(vector_count-1);
   for (vec_index=0; vec_index<vector_count; vec_index++) {
      next_vec=start_list+vec_index;

      // categorize edges by types

      if ((cur_vec->y >= DIST_MIN_FIXED) && (next_vec->y >= DIST_MIN_FIXED)) {
         // edge not at all inf front of view volume
         dest_list[clip_counter].x=next_vec->x;
         dest_list[clip_counter++].y=next_vec->y;
      } /* endif */

      if ((cur_vec->y < DIST_MIN_FIXED) && (next_vec->y < DIST_MIN_FIXED)) {
         // all in front of volume, so go on
         }

      if ((cur_vec->y >= DIST_MIN_FIXED) && (next_vec->y < DIST_MIN_FIXED)) {
         // edge is leaving view volume
         MYFIXED slope=fixeddiv(next_vec->x-cur_vec->x, next_vec->y-cur_vec->y);
         dest_list[clip_counter].y=DIST_MIN_FIXED;
         dest_list[clip_counter++].x=cur_vec->x +
            fixedmult(slope, DIST_MIN_FIXED-cur_vec->y);
         }

      if ((cur_vec->y < DIST_MIN_FIXED) && (next_vec->y >=DIST_MIN_FIXED)) {
         // edge is entering view volume
         MYFIXED slope=fixeddiv(next_vec->x-cur_vec->x, next_vec->y-cur_vec->y);
         dest_list[clip_counter].y=DIST_MIN_FIXED;
         dest_list[clip_counter++].x=cur_vec->x + 
            fixedmult(slope, DIST_MIN_FIXED-cur_vec->y);
         dest_list[clip_counter].x=next_vec->x;
         dest_list[clip_counter++].y=next_vec->y;
         }
      cur_vec=next_vec;
      }

return clip_counter;
}

void Make_Vox_Runs(
   pvector2 point_list,
   short point_count,
   pvox_run dest_runs,
   short & start_line,
   short & end_line) {

   short vec_index;
   short cur_dist;
   MYFIXED max_dist, min_dist;
   MYFIXED left_x, right_x;
   MYFIXED left_slope, right_slope;
   MYFIXED fixed_dist;
   short max_dist_index, left_vec, right_vec, last_vec;
 
   max_dist=0; 
   min_dist=MAXMYFIXED;
   max_dist_index=0;
   for (vec_index=0; vec_index<point_count; vec_index++) {
      if (point_list[vec_index].y<min_dist) {
         min_dist=point_list[vec_index].y;
      }
      if (point_list[vec_index].y>max_dist) {
         max_dist=point_list[vec_index].y;
         max_dist_index=vec_index;
      }
   }

   start_line=(min_dist+(DIST_INC-1))/DIST_INC;
   end_line=(max_dist+(DIST_INC-1))/DIST_INC;

   left_vec=max_dist_index;
   right_vec=max_dist_index;
   for (cur_dist=end_line-1; cur_dist>=start_line; cur_dist--) {
      fixed_dist=cur_dist*DIST_INC;

      // get on the correct left edge
      if (point_list[left_vec].y>fixed_dist) {
         while (point_list[left_vec].y>fixed_dist) {
            last_vec=left_vec;
            left_vec=(left_vec-1+point_count)%point_count;
            }
         left_slope=fixeddiv(point_list[left_vec].x-point_list[last_vec].x,
                           point_list[left_vec].y-point_list[last_vec].y);
         left_x=point_list[last_vec].x-fixedmult(left_slope, point_list[last_vec].y-fixed_dist);
      }

      // get on the correct right edge
      if (point_list[right_vec].y>fixed_dist) {
         while (point_list[right_vec].y>fixed_dist) {
            last_vec=right_vec;
            right_vec=(right_vec+1)%point_count;
            }
         right_slope=fixeddiv(point_list[right_vec].x-point_list[last_vec].x,
                           point_list[right_vec].y-point_list[last_vec].y);
         right_x=point_list[last_vec].x-fixedmult(right_slope, point_list[last_vec].y-fixed_dist);
      }

      // project values and put them in runs
      dest_runs[cur_dist].left=Project(left_x, fixed_dist);
      if (dest_runs[cur_dist].left<0) {
         dest_runs[cur_dist].left=0;
      }
      dest_runs[cur_dist].right=Project(right_x, fixed_dist);
      if (dest_runs[cur_dist].right>WINDOW_WIDTH) {
         dest_runs[cur_dist].right=WINDOW_WIDTH;
      }

      // update x values
      left_x-=fixedmult(left_slope, DIST_INC);
      right_x-=fixedmult(right_slope, DIST_INC);
   }
}

void Render_Vox_Runs(
   pssector vox_ssector,
   pvox_run screen_runs,
   short start_line,
   short end_line) {

   MYFIXED inc_scaler_x, inc_scaler_y;
   MYFIXED fixed_x, fixed_y;
   short left, right;
   psector vox_sector;
   short temp_light;

   vox_sector=GetSecFromSSec(vox_ssector);

   alt_array=(PUCHAR)vox_sector->extra_data;
   Setup_Vox_Sprite_Rend(vox_ssector->objects, start_line, end_line);
   // make sure previous run causes no drawing

   // setup constants for getting positions in map
   fixed_x=(render_x/VOXEL_SPEED_SCALE)<<(VOX_FP_SHIFT-SHIFT);
   fixed_y=(render_y/VOXEL_SPEED_SCALE)<<(VOX_FP_SHIFT-SHIFT);
 
   inc_scaler_x=(-floor_trans_x)>>XT_TO_VOX_SHIFT;
   inc_scaler_y=(-floor_trans_y)>>XT_TO_VOX_SHIFT;

   // file in any sprites before first line
   for (long cur_dis=0; cur_dis<start_line; cur_dis++)
      Do_Vox_Sprite_Line(0);

   short dist_inc;
   if (do_skipping) {
   if (start_line>DOUBLE_DIS) {
      if (start_line>QUAD_DIS) {
         dist_inc=4;
      } else {
         dist_inc=2;
      }
   } else {
      dist_inc=1;
   }
   } else dist_inc=1;

   // loop through a constant number of distances, draw a voxel row at each distance
   for (cur_dis=start_line; cur_dis<end_line; cur_dis+=dist_inc) {
      
      // Do them's sprites
      for (short cur_line=cur_dis-dist_inc+1; cur_line<=cur_dis; cur_line++)
        Do_Vox_Sprite_Line(cur_line*DIST_SCALER);

      // setup light table
      temp_light=(SecLight(vox_sector)-
         ((cur_dis*DIST_SCALER) >> (SecLTSpeed(vox_sector))) );
      if (temp_light<0) temp_light=0;
      if (temp_light>MAX_LIGHT) temp_light=MAX_LIGHT;
      v_light_table=pal_table[temp_light];
      // Setup correct scaling table
      cur_scaler=alt_scaler[cur_dis];

      // Setup top value for drawing
      starting_y=(SHORT)(GetZScVal(ALT_MAX*HEIGHT_SCALER, (cur_dis*DIST_SCALER)<<SHIFT)
         >> SHIFT);

      // get horizontal positions from run list
      left=screen_runs[cur_dis].left;
      right=screen_runs[cur_dis].right;

      // Get map positions at start of ray
      x_loc=(((rcos_table[render_view_angle]+floor_offsets_x[right-1]) * cur_dis)<<NORM_TO_VOX)+
         (fixed_x);
      y_loc=(((rsin_table[render_view_angle]+floor_offsets_y[right-1]) * cur_dis)<<NORM_TO_VOX)+
         (fixed_y);

      // Get increment in map
      x_inc=(cur_dis * inc_scaler_x);
      y_inc=(cur_dis * inc_scaler_y);

      // set horizontal render constants
      v_horiz_length=right-left;
      if (v_horiz_length<=0)
         continue;
      vox_buff=buff+left;
      prev_vox_colors=prev_colors+left;
      prev_vox_heights=win_bottoms+left;

      // adjust y to scale correctly through altitude bitmap
      y_loc<<=8;
      y_inc<<=8;


      if (do_shading) {
        //if ((ABS(x_inc)<SMOOTH_DELIMATOR_X)&&(ABS(y_inc)<SMOOTH_DELIMATOR_Y))
           Draw_Vox_Row_Smooth();
        //else Draw_Vox_Row();
      } else {
        Draw_Vox_Row_Fast();
      } /* endif */

      if (do_skipping) {
      if (cur_dis==DOUBLE_DIS) {
        dist_inc=2;
      }
      if (cur_dis==QUAD_DIS) {
        dist_inc=4;
      }
      }
   } /* endfor */

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品女同一区二区三区| 99精品视频中文字幕| 欧美另类z0zxhd电影| 一二三区精品视频| 一本大道久久a久久精品综合| 亚洲人被黑人高潮完整版| 91丨九色丨尤物| 国产精品九色蝌蚪自拍| 色婷婷av一区二区三区软件| 一区二区三区成人| 欧美精品乱人伦久久久久久| 精品一二三四在线| 国产精品初高中害羞小美女文| 不卡免费追剧大全电视剧网站| 亚洲视频免费观看| 欧美精品日韩一区| 国产精品1区二区.| 亚洲最大色网站| 欧美一区二区视频在线观看2022| 精品一区二区在线免费观看| 中文字幕国产一区二区| 在线视频综合导航| 美女网站一区二区| 国产精品美女久久久久久2018 | 欧美日韩美少妇| 日本91福利区| 国产精品国产成人国产三级 | 久久不见久久见中文字幕免费| 欧美mv日韩mv| 色婷婷精品大在线视频| 久久精品国产亚洲5555| 国产精品麻豆网站| 欧美一级欧美三级| 91麻豆国产香蕉久久精品| 日本美女视频一区二区| 欧美激情一区二区三区| 欧美电影在线免费观看| 成人小视频在线| 日韩高清不卡在线| 中文字幕亚洲不卡| 欧美成人艳星乳罩| 91国产精品成人| 国产成人在线观看免费网站| 亚洲小少妇裸体bbw| 久久精品一区四区| 在线播放一区二区三区| av欧美精品.com| 国精品**一区二区三区在线蜜桃| 一区二区三区日本| 国产精品美女久久久久久2018| 欧美一区二区啪啪| 在线中文字幕一区二区| 国产不卡高清在线观看视频| 丝袜美腿成人在线| 一区二区三区国产精品| 国产精品视频yy9299一区| 日韩视频免费观看高清完整版在线观看| 99精品视频一区| 懂色av一区二区夜夜嗨| 精品一区二区三区香蕉蜜桃 | 国产精品理论片| 精品国产三级a在线观看| 欧美久久久久久久久中文字幕| av一区二区三区| 国产精品一区二区无线| 美女任你摸久久| 亚洲一区二区三区三| 一区二区中文字幕在线| 欧美激情艳妇裸体舞| 国产三级一区二区三区| 欧美成va人片在线观看| 日韩一区二区不卡| 欧美一区二区三区在线看| 欧美性三三影院| 91久久国产最好的精华液| 色悠久久久久综合欧美99| 91丨porny丨国产入口| 成人h动漫精品一区二| 国产一区二区美女诱惑| 国产在线麻豆精品观看| 久久99精品国产麻豆不卡| 美女视频一区二区| 国产一区二区三区黄视频| 国内成人精品2018免费看| 久久69国产一区二区蜜臀| 日韩av中文字幕一区二区| 麻豆精品视频在线观看免费| 麻豆精品精品国产自在97香蕉| 日本视频中文字幕一区二区三区| 另类小说一区二区三区| 久久99国产精品尤物| 久久99精品久久久久久国产越南| 精品亚洲成a人在线观看| 国产资源精品在线观看| 成人中文字幕在线| 一本色道久久加勒比精品| 欧美在线免费观看亚洲| 91精品国产综合久久精品| 精品国产乱码久久久久久夜甘婷婷 | 国产情人综合久久777777| 国产精品免费aⅴ片在线观看| 最新不卡av在线| 亚洲国产色一区| 日韩成人av影视| 久久99久久精品| 国产成人av自拍| 色先锋资源久久综合| 欧美日韩激情一区二区三区| 日韩视频免费观看高清完整版在线观看 | 一区二区三区在线观看视频| 夜夜嗨av一区二区三区四季av| 日本成人在线不卡视频| 国产一区二区剧情av在线| 91在线免费看| 欧美福利视频导航| 中文无字幕一区二区三区| 亚洲裸体xxx| 久久精品国产99久久6| www.99精品| 在线不卡a资源高清| 国产欧美一区二区三区鸳鸯浴| 亚洲欧美视频在线观看视频| 亚洲第一精品在线| 国产精品1024| 欧美三级中文字| 国产欧美日韩精品在线| 亚洲综合激情小说| 国产一区二区在线免费观看| 欧美日韩在线观看一区二区 | 成人av网站在线| 欧美一级生活片| 亚洲猫色日本管| 国产乱理伦片在线观看夜一区| 色婷婷综合在线| 日韩欧美在线不卡| 亚洲激情图片小说视频| 极品美女销魂一区二区三区免费| 91麻豆精东视频| 久久亚洲一级片| 日韩成人av影视| 欧美性生活久久| 亚洲色图19p| 风间由美一区二区av101| 欧美日韩亚洲综合在线| 国产精品久久久久婷婷二区次| 日本中文字幕一区二区视频 | 97国产一区二区| 久久久欧美精品sm网站| 免费看欧美女人艹b| 在线区一区二视频| 亚洲国产成人在线| 国产精品一区二区三区99| 91精品国产aⅴ一区二区| 亚洲一区二区在线免费看| proumb性欧美在线观看| 久久综合九色综合97婷婷| 午夜精品久久久久久不卡8050| www.亚洲精品| 丝袜美腿亚洲一区| 欧美精品久久一区二区三区| 亚洲综合免费观看高清完整版在线| 成人亚洲精品久久久久软件| 久久嫩草精品久久久精品| 麻豆freexxxx性91精品| 日韩欧美一级特黄在线播放| 午夜电影一区二区三区| 欧美日韩视频不卡| 香蕉久久一区二区不卡无毒影院| 在线精品视频一区二区| 亚洲天堂av老司机| 91久久精品一区二区三| 一区二区三区加勒比av| 91久久国产综合久久| 亚洲激情在线播放| 欧洲日韩一区二区三区| 亚洲夂夂婷婷色拍ww47| 欧美三级资源在线| 午夜欧美2019年伦理| 欧美丰满高潮xxxx喷水动漫| 丝袜亚洲另类丝袜在线| 91精品国产综合久久精品图片| 午夜不卡av免费| 日韩一区二区三区四区| 韩国视频一区二区| 欧美草草影院在线视频| 国产成人av在线影院| 国产精品视频免费| 91猫先生在线| 亚洲va欧美va人人爽午夜| 日韩免费性生活视频播放| 国内久久婷婷综合| 国产精品超碰97尤物18| 91精品91久久久中77777| 亚洲国产日韩精品| 欧美草草影院在线视频| 成人av网站在线| 亚洲aⅴ怡春院| 久久综合九色综合欧美亚洲| 成人动漫视频在线| 午夜欧美大尺度福利影院在线看|