⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aintern.inc

📁 著名的游戏开发库Allegro4.2.0 for DELPHI
💻 INC
📖 第 1 页 / 共 5 页
字号:
    height      : sint32;
    pitch       : sint32;
    data        : Pointer;
  end;

  COLORCONV_BLITTER_FUNC = procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;

var
  _get_colorconv_blitter: function(from_depth, to_depth: sint32): COLORCONV_BLITTER_FUNC; cdecl;
  _release_colorconv_blitter: procedure(blitter: COLORCONV_BLITTER_FUNC); cdecl;
  _set_colorconv_palette: procedure(const p: P_RGB; from, tos: sint32); cdecl;
  _get_colorconv_map: function: p_uint8s; cdecl;

  _colorconv_blit_8_to_8: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_8_to_15: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_8_to_16: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_8_to_24: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_8_to_32: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_15_to_8: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_15_to_16: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_15_to_24: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_15_to_32: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_16_to_8: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_16_to_15: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_16_to_24: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_16_to_32: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_24_to_8: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_24_to_15: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_24_to_16: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_24_to_32: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_32_to_8: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_32_to_15: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_32_to_16: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;
  _colorconv_blit_32_to_24: procedure(src_rect, dest_rect: P_GRAPHICS_RECT); cdecl;

  // generic color conversion blitter
  _blit_between_formats: procedure(src, dest: P_BITMAP; s_x, s_y, d_x, d_y, w, h: sint32); cdecl;

type
  pmdraw_ptr = procedure(bmp, spr: P_BITMAP; l_bmp_x, bmp_y: sint32; r_bmp_x, l_spr_x, l_spr_y,
    spr_dx, spr_dy: fixed); cdecl;
var
  // lower level functions for rotation
  _parallelogram_map: procedure(bmp, spr: P_BITMAP; xs, ys: array of fixed {xs[4]};
    draw_scanline: pmdraw_ptr; sub_pixel_accuracy: sint32); cdecl;
  _parallelogram_map_standard: procedure(bmp, sprite: P_BITMAP; xs, ys: array of fixed); cdecl;
  _rotate_scale_flip_coordinates: procedure(w, h, x, y, cx, cy, angle, scale_x, scale_y, h_flip: fixed;
    v_flip: sint32; xs, ys: array of fixed); cdecl;
  _pivot_scaled_sprite_flip: procedure(bmp, sprite: P_BITMAP; x, y, cx, cy, angle, scale: fixed; v_flip: sint32); cdecl;

const
  // number of fractional bits used by the polygon rasteriser
  POLYGON_FIX_SHIFT    = 18;

  // bitfield specifying which polygon attributes need interpolating
  INTERP_FLAT          = 1;      // no interpolation
  INTERP_1COL          = 2;      // gcol or alpha
  INTERP_3COL          = 4;      // grgb
  INTERP_FIX_UV        = 8;      // atex
  INTERP_Z             = 16;     // always in scene3d
  INTERP_FLOAT_UV      = 32;     // ptex
  OPT_FLOAT_UV_TO_FIX  = 64;     // translate ptex to atex
  COLOR_TO_RGB         = 128;    // grgb to gcol for truecolor
  INTERP_ZBUF          = 256;    // z-buffered
  INTERP_THRU          = 512;    // any kind of transparent
  INTERP_NOSOLID       = 1024;   // non-solid modes for 8-bit flat
  INTERP_BLEND         = 2048;   // lit for truecolor
  INTERP_TRANS         = 4096;   // trans for truecolor

type
  // information for polygon scanline fillers
  P_POLYGON_SEGMENT = ^POLYGON_SEGMENT;
  POLYGON_SEGMENT = record
    u, v, du, dv  : fixed;          // fixed point u/v coordinates
    c, dc         : fixed;          // single color gouraud shade values
    r, g, b       : fixed;
    dr, dg, db    : fixed;          // RGB gouraud shade values
    z, dz         : single;         // polygon depth (1/z)
    fu, fv        : single;
    dfu, dfv      : single;         // floating point u/v coordinates
    texture       : p_uint8s;       // the texture map
    umask, vmask, vshift: sint32;   // texture map size information
    seg           : sint32;         // destination bitmap selector
    zbuf_addr     : p_uint8s;       // Z-buffer address
    read_addr     : p_uint8s;       // reading address for transparency modes
  end;

  // prototype for the scanline filler functions
  SCANLINE_FILLER = procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;

  P_POLYGON_INFO = ^POLYGON_INFO;
  // an active polygon edge
  P_POLYGON_EDGE = ^POLYGON_EDGE;
  POLYGON_EDGE = record
    top     : sint32;               // top y position
    bottom  : sint32;               // bottom y position
    x, dx   : fixed;                // fixed point x position and gradient
    w       : fixed;                // width of line segment
    dat     : POLYGON_SEGMENT;      // texture/gouraud information
    prev    : P_POLYGON_EDGE;       // doubly linked list
    next    : P_POLYGON_EDGE;
    poly    : P_POLYGON_INFO;       // father polygon
  end;

  POLYGON_INFO = record             // a polygon waiting rendering
    next, prev : P_POLYGON_INFO;    // double linked list
    inside     : sint32;            // flag for "scanlining"
    flags      : sint32;            // INTERP_* flags
    color      : sint32;            // vtx[0]->c
    a, b, c    : single;            // plane's coefficients -a/d, -b/d, -c/d
    dmode      : sint32;            // drawing mode
    dpat       : P_BITMAP;          // drawing pattern
    xanchor, yanchor: sint32;       // for dpat
    alpha      : sint32;            // blender alpha
    b15, b16, b24, b32: sint32;     // blender colors
    cmap       : P_COLOR_MAP;       // trans color map
    drawer     : SCANLINE_FILLER;   // scanline drawing functions
    alt_drawer : SCANLINE_FILLER;
    left_edge  : P_POLYGON_EDGE;    // true edges used in interpolation
    right_edge : P_POLYGON_EDGE;
    info       : POLYGON_SEGMENT;   // base information for scanline functions
  end;

var
  // global variable for z-buffer
  _zbuffer: ^P_BITMAP;

  // polygon helper functions
  _optim_alternative_drawer: ^SCANLINE_FILLER;
  _add_edge: function(list, edge: P_POLYGON_EDGE; sort_by_x: sint32): P_POLYGON_EDGE; cdecl;
  _remove_edge: function(list, edge: P_POLYGON_EDGE): P_POLYGON_EDGE; cdecl;
  _fill_3d_edge_structure: function(edge: P_POLYGON_EDGE; const v1, v2: P_V3D; flags: sint32; bmp: P_BITMAP): sint32; cdecl;
  _fill_3d_edge_structure_f: function(edge: P_POLYGON_EDGE; const v1, v2: P_V3D_f; flags: sint32; bmp: P_BITMAP): sint32; cdecl;
  _get_scanline_filler: function(types: sint32; flags: p_sint32; info: P_POLYGON_SEGMENT; texture: P_BITMAP; bmp: P_BITMAP): SCANLINE_FILLER; cdecl;
  _clip_polygon_segment: procedure(info: P_POLYGON_SEGMENT; gap: fixed; flags: sint32); cdecl;
  _clip_polygon_segment_f: procedure(info: P_POLYGON_SEGMENT; gap: single; flags: sint32); cdecl;

// polygon scanline filler functions 
  _poly_scanline_dummy: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_gcol8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_grgb8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_flat8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_gcol8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_grgb8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_lit8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_trans8: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;

  _poly_scanline_grgb15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_grgb15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_lit15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_trans15: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_grgb16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_flat16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_grgb16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_lit16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_atex_mask_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_zbuf_ptex_mask_trans16: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;

  _poly_scanline_grgb24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_lit24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_lit24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_lit24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_lit24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_trans24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_trans24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_atex_mask_trans24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;
  _poly_scanline_ptex_mask_trans24: procedure(addr: p_uint8s; w: sint32; info: P_POLYGON_SEGMENT); cdecl;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -