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

📄 3d.inc

📁 著名的游戏开发库Allegro4.2.0 for DELPHI
💻 INC
字号:
{*         ______   ___    ___
 *        /\  _  \ /\_ \  /\_ \
 *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
 *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
 *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
 *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
 *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
 *                                           /\____/
 *                                           \_/__/
 *
 *      3D polygon drawing routines.
 *
 *      By Shawn Hargreaves.
 *
 *      See readme.txt for copyright information.
 *}
{$IFDEF ALLEGRO_INTERFACE}
const
  POLYTYPE_FLAT              = 0;
  POLYTYPE_GCOL              = 1;
  POLYTYPE_GRGB              = 2;
  POLYTYPE_ATEX              = 3;
  POLYTYPE_PTEX              = 4;
  POLYTYPE_ATEX_MASK         = 5;
  POLYTYPE_PTEX_MASK         = 6;
  POLYTYPE_ATEX_LIT          = 7;
  POLYTYPE_PTEX_LIT          = 8;
  POLYTYPE_ATEX_MASK_LIT     = 9;
  POLYTYPE_PTEX_MASK_LIT     = 10;
  POLYTYPE_ATEX_TRANS        = 11;
  POLYTYPE_PTEX_TRANS        = 12;
  POLYTYPE_ATEX_MASK_TRANS   = 13;
  POLYTYPE_PTEX_MASK_TRANS   = 14;
  POLYTYPE_MAX               = 15;
  POLYTYPE_ZBUF              = 16;

var
  scene_gap                  : ^single;

  _soft_polygon3d: procedure(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS); cdecl;
  _soft_polygon3d_f: procedure(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS_f); cdecl;
  _soft_triangle3d: procedure(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D); cdecl;
  _soft_triangle3d_f: procedure(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D_f); cdecl;
  _soft_quad3d: procedure(bmp: P_BITMAP; types: sint32; texutre: P_BITMAP; v1, v2, v3, v4: P_V3D); cdecl;
  _soft_quad3d_f: procedure(bmp: P_BITMAP; types: sint32; texutre: P_BITMAP; v1, v2, v3, v4: P_V3D_f); cdecl;
  clip3d: function(types: sint32; min_z, max_z, vc: sint32; const vtx: P_V3DS; vout, vtmp: P_V3DS; outs: p_sint32s): sint32; cdecl;
  clip3d_f: functioN(types: sint32; min_z, max_z: single; vc: sint32; const vtx: P_V3DS_f; vout, vtmp: P_V3DS_f; outs: p_sint32s): sint32; cdecl;

  polygon_z_normal: function(const v1, v2, v3: P_V3D): fixed; cdecl;
  polygon_z_normal_f: function(const v1, v2, v3: P_V3D_f): single; cdecl;

{* Note: You are not supposed to mix ZBUFFER with BITMAP even though it is
 * currently possible. This is just the internal representation, and it may
 * change in the future.
 *}
type
  P_ZBUFFER= ^ZBUFFER;
  ZBUFFER = BITMAP;

var
  create_zbuffer: function(bmp: P_BITMAP): P_ZBUFFER; cdecl;
  create_sub_zbuffer: function(parent: P_ZBUFFER; x, y, width, height: sint32): P_ZBUFFER; cdecl;
  set_zbuffer: procedure(zbuf: P_ZBUFFER); cdecl;
  clear_zbuffer: procedure(zbuf: P_ZBUFFER; z: single); cdecl;
  destroy_zbuffer: procedure(zbuf: P_ZBUFFER); cdecl;

  create_scene: function(nedge, npoly: sint32): sint32; cdecl;
  clear_scene: procedure(bmp: P_BITMAP); cdecl;
  destroy_scene: procedure; cdecl;
  scene_polygon3d: function(types: sint32; texture: P_BITMAP; vx: sint32; vtx: P_V3DS): sint32; cdecl;
  scene_polygon3d_f: function(types: sint32; texture: P_BITMAP; vx: sint32; vtx: P_V3DS_f): sint32; cdecl;
  render_scene: procedure; cdecl;
{$ENDIF ALLEGRO_INTERFACE}
{$IFDEF ALLEGRO_IMPLEMENTATION}
{$ENDIF ALLEGRO_IMPLEMENTATION}
{$IFDEF ALLEGRO_LOADVARIABLE}
  scene_gap               := LoadDLL('scene_gap');
  _soft_polygon3d         := LoadDLL('_soft_polygon3d');
  _soft_polygon3d_f       := LoadDLL('_soft_polygon3d_f');
  _soft_triangle3d        := LoadDLL('_soft_triangle3d');
  _soft_triangle3d_f      := LoadDLL('_soft_triangle3d_f');
  _soft_quad3d            := LoadDLL('_soft_quad3d');
  _soft_quad3d_f          := LoadDLL('_soft_quad3d_f');
  clip3d                  := LoadDLL('clip3d');
  clip3d_f                := LoadDLL('clip3d_f');

  polygon_z_normal        := LoadDLL('polygon_z_normal');
  polygon_z_normal_f      := LoadDLL('polygon_z_normal_f');

  create_zbuffer          := LoadDLL('create_zbuffer');
  create_sub_zbuffer      := LoadDLL('create_sub_zbuffer');
  set_zbuffer             := LoadDLL('set_zbuffer');
  clear_zbuffer           := LoadDLL('clear_zbuffer');
  destroy_zbuffer         := LoadDLL('destroy_zbuffer');

  create_scene            := LoadDLL('create_scene');
  clear_scene             := LoadDLL('clear_scene');
  destroy_scene           := LoadDLL('destroy_scene');
  scene_polygon3d         := LoadDLL('scene_polygon3d');
  scene_polygon3d_f       := LoadDLL('scene_polygon3d_f');
  render_scene            := LoadDLL('render_scene');
{$ENDIF ALLEGRO_LOADVARIABLE}

⌨️ 快捷键说明

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