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

📄 gl_local.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
字号:
// PLEASE, don't modify this file
// 81% complete --> units GL_Xxx: ALL "external" MAYBE write in "interface" section THIS module

{----------------------------------------------------------------------------}
{                                                                            }
{ File(s): gl_local.c                                                        }
{                                                                            }
{ Initial conversion by : YgriK (Igor Karpov) - glYgriK@hotbox.ru            }
{ Initial conversion on : 14-Feb-2002                                        }
{                                                                            }
{ This File contains part of convertion of Quake2 source to ObjectPascal.    }
{ More information about this project can be found at:                       }
{ http://www.sulaco.co.za/quake2/                                            }
{                                                                            }
{ Copyright (C) 1997-2001 Id Software, Inc.                                  }
{                                                                            }
{ This program is free software; you can redistribute it and/or              }
{ modify it under the terms of the GNU General Public License                }
{ as published by the Free Software Foundation; either version 2             }
{ of the License, or (at your option) any later version.                     }
{                                                                            }
{ This program is distributed in the hope that it will be useful,            }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of             }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                       }
{                                                                            }
{ See the GNU General Public License for more details.                       }
{                                                                            }
{----------------------------------------------------------------------------}
{ Updated on :                                                               }
{ Updated by :                                                               }
{                                                                            }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on:                               }
{ 1) xxx                                                                     }
{                                                                            }
{----------------------------------------------------------------------------}
{ * TODO:                                                                    }
{ 1) Do more tests                                                           }
{                                                                            }
{----------------------------------------------------------------------------}

unit gl_local;

(*
// disable data conversion warnings

#if 0#pragma warning(disable : 4244)     // MIPS#pragma warning(disable : 4136)     // X86#pragma warning(disable : 4051)     // ALPHA#endif#ifdef _WIN32#  include <windows.h>#endif#include <stdio.h>#include <math.h>#include "qgl.h"#include "gl_model.h"*)interface
uses GL, GLU,
     ref, q_shared, gl_model_h;

(*
#ifndef GL_COLOR_INDEX8_EXT#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX#endif*)const  GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX;  const  REF_VERSION = 'GL 0.01';  // up / down  PITCH	= 0;  // left / right  YAW	= 1;  // fall over  ROLL	= 2;type  viddef_t = record//	unsigned		width, height;			// coordinates from main game    width, height : integer;  // coordinates from main game  end;//???extern	viddef_t	vid;var  vid :	viddef_t; //???{*  skins will be outline flood filled and mip mapped  pics and sprites with alpha will be outline flood filled  pic won't be mip mapped  model skin  sprite frame  wall texture  pic*}type(*typedef enum{	it_skin,	it_sprite,	it_wall,	it_pic,	it_sky} imagetype_t;*)  imagetype_t = (it_skin, it_sprite, it_wall, it_pic, it_sky);  image_s = record    name  : array [0..MAX_QPATH-1] of char;  // game path, including extension    type_ : imagetype_t;    width, height,			     // source image    upload_width, upload_height,             // after power of two and picmip    registration_sequence        : integer;  // 0 = free//	struct msurface_s	*texturechain;	// for sort-by-texture world drawing    texturechain : msurface_p;  // for sort-by-texture world drawing    texnum : integer;						// gl texture binding    sl, tl, sh, th : float;   		     // 0,0 - 1,1 unless part of the scrap    scrap,    has_alpha,    paletted  : qboolean;  end;
  image_t = image_s;
  image_p = ^image_t;const  TEXNUM_LIGHTMAPS = 1024;
  TEXNUM_SCRAPS	   = 1152;
  TEXNUM_IMAGES	   = 1153;

  MAX_GLTEXTURES   = 1024;
//===================================================================type  rserr_t = (rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown);(*void GL_BeginRendering (int *x, int *y, int *width, int *height);void GL_EndRendering (void);void GL_SetDefaultState( void );  //gl_r_misc
void GL_UpdateSwapInterval( void );  //gl_r_misc*)var  gldepthmin, gldepthmax : float;type  glvert_t = record    x, y, z,    s, t,    r, g, b : float;  end;const  MAX_LBM_HEIGHT   = 480;  BACKFACE_EPSILON = 0.01;var(*  //====================================================extern	image_t		gltextures[MAX_GLTEXTURES];extern	int			numgltextures;*)  r_notexture,  r_particletexture : image_p;  //Y: gl_rmain: little dot for particles  currententity : entity_p;  currentmodel,
  r_worldmodel : model_p;


  r_visframecount,            //Y: gl_rmain: bumped when going to a new PVS
  r_framecount    : integer;  //Y: gl_rmain: used for dlight push checking
  frustum : array [0..3] of cplane_t;  c_brush_polys, c_alias_polys : integer;(*extern	int			gl_filter_min, gl_filter_max;*)//// view origin
//
  vup,
  vpn,
  vright,
  r_origin : vec3_t;

//// screen size info
//
  r_newrefdef : refdef_t;
  r_viewcluster,
  r_viewcluster2,
  r_oldviewcluster,
  r_oldviewcluster2 : integer;
  gl_allow_software,  r_norefresh,  r_drawentities,
  _r_drawworld,
  r_speeds,
  r_fullbright,
  r_novis,
  r_nocull,
  r_lerpmodels,
  r_lefthand,
  r_lightlevel,	// FIXME: This is a HACK to get the client's light level

  gl_vertex_arrays,
  gl_ext_swapinterval,  gl_ext_palettedtexture,
  gl_ext_multitexture,
  gl_ext_pointparameters,
  gl_ext_compiled_vertex_array,
  gl_particle_min_size,  gl_particle_max_size,
  gl_particle_size,
  gl_particle_att_a,
  gl_particle_att_b,
  gl_particle_att_c,
  gl_nosubimage,
  gl_bitdepth,  gl_mode,  gl_log,  gl_lightmap,  gl_shadows,
  gl_dynamic,  gl_monolightmap,  gl_nobind,  gl_round_down,  gl_picmip,  gl_skymip,  gl_showtris,  gl_finish,  gl_ztrick,  _gl_clear,  gl_cull,  (*extern	cvar_t	*gl_poly;  extern	cvar_t	*gl_texsort;*)  gl_polyblend,  gl_flashblend,  (*extern	cvar_t	*gl_lightmaptype;*)  _gl_modulate,  gl_playermip,  gl_drawbuffer,  gl_3dlabs_broken,  gl_driver,  gl_swapinterval,  _gl_texturemode,  _gl_texturealphamode,  _gl_texturesolidmode,  gl_saturatelighting,  gl_lockpvs,
  vid_fullscreen,  vid_gamma,  intensity         : cvar_p;(*extern	int		gl_lightmap_format;extern	int		gl_solid_format;extern	int		gl_alpha_format;*)  gl_tex_solid_format,  gl_tex_alpha_format,  c_visible_lightmaps,  c_visible_textures  : integer;  r_world_matrix : array [0..15] of float;(*void R_TranslatePlayerSkin (int playernum);void GL_Bind (int texnum);void GL_MBind( GLenum target, int texnum );void GL_TexEnv( GLenum value );void GL_EnableMultitexture( qboolean enable );void GL_SelectTexture( GLenum );void R_LightPoint (vec3_t p, vec3_t color);void R_PushDlights (void);*)//====================================================================(*extern	unsigned	d_8to24table[256];extern	int		registration_sequence;void V_AddBlend (float r, float g, float b, float a, float *v_blend);int 	R_Init( void *hinstance, void *hWnd );void	R_Shutdown( void );void R_RenderView (refdef_t *fd);void GL_ScreenShot_f (void);void R_DrawAliasModel (entity_t *e);void R_DrawBrushModel (entity_t *e);void R_DrawSpriteModel (entity_t *e);void R_DrawBeam( entity_t *e );void R_DrawWorld (void);void R_RenderDlights (void);void R_DrawAlphaSurfaces (void);void R_RenderBrushPoly (msurface_t *fa);void R_InitParticleTexture (void);void Draw_InitLocal (void);void GL_SubdivideSurface (msurface_t *fa);qboolean R_CullBox (vec3_t mins, vec3_t maxs);void R_RotateForEntity (entity_t *e);void R_MarkLeaves (void);glpoly_t *WaterWarpPolyVerts (glpoly_t *p);void EmitWaterPolys (msurface_t *fa);void R_AddSkySurface (msurface_t *fa);void R_ClearSkyBox (void);void R_DrawSkyBox (void);void R_MarkLights (dlight_t *light, int bit, mnode_t *node);*)(*#if 0short LittleShort (short l);short BigShort (short l);int	LittleLong (int l);float LittleFloat (float f);char	*va(char *format, ...);// does a varargs printf into a temp buffer#endif*)(*void COM_StripExtension (char *in, char *out);void	Draw_GetPicSize (int *w, int *h, char *name);void	Draw_Pic (int x, int y, char *name);void	Draw_StretchPic (int x, int y, int w, int h, char *name);void	Draw_Char (int x, int y, int c);void	Draw_TileClear (int x, int y, int w, int h, char *name);void	Draw_Fill (int x, int y, int w, int h, int c);void	Draw_FadeScreen (void);void	Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data);void	R_BeginFrame( float camera_separation );void	R_SwapBuffers( int );void	R_SetPalette ( const unsigned char *palette);int		Draw_GetPalette (void);void GL_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out,  int outwidth, int outheight);struct image_s *R_RegisterSkin (char *name);void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height);image_t *GL_LoadPic (char *name, byte *pic, int width, int height, imagetype_t type, int bits);image_t	*GL_FindImage (char *name, imagetype_t type);void	GL_TextureMode( char *string );void	GL_ImageList_f (void);

void	GL_SetTexturePalette( unsigned palette[256] );void	GL_InitImages (void);void	GL_ShutdownImages (void);void	GL_FreeUnusedImages (void);
void GL_TextureAlphaMode( char *string );
void GL_TextureSolidMode( char *string );
*)
(*/*** GL extension emulation functions*/void GL_DrawParticles( int n, const particle_t particles[], const unsigned colortable[768] );*){*** GL config stuff*}const  GL_RENDERER_VOODOO	  = $00000001;  GL_RENDERER_VOODOO2     = $00000002;  GL_RENDERER_VOODOO_RUSH = $00000004;  GL_RENDERER_BANSHEE	  = $00000008;  GL_RENDERER_3DFX	  = $0000000F;  GL_RENDERER_PCX1	  = $00000010;  GL_RENDERER_PCX2	  = $00000020;  GL_RENDERER_PMX	  = $00000040;  GL_RENDERER_POWERVR	  = $00000070;  GL_RENDERER_PERMEDIA2	  = $00000100;  GL_RENDERER_GLINT_MX	  = $00000200;  GL_RENDERER_GLINT_TX	  = $00000400;  GL_RENDERER_3DLABS_MISC = $00000800;  GL_RENDERER_3DLABS	  = $00000F00;  GL_RENDERER_REALIZM	  = $00001000;
  GL_RENDERER_REALIZM2	  = $00002000;
  GL_RENDERER_INTERGRAPH  = $00003000;

  GL_RENDERER_3DPRO	  = $00004000;  GL_RENDERER_REAL3D	  = $00008000;  GL_RENDERER_RIVA128	  = $00010000;  GL_RENDERER_DYPIC	  = $00020000;  GL_RENDERER_V1000	  = $00040000;  GL_RENDERER_V2100	  = $00080000;  GL_RENDERER_V2200	  = $00100000;  GL_RENDERER_RENDITION	  = $001C0000;  GL_RENDERER_O2          = $00100000;  GL_RENDERER_IMPACT      = $00200000;  GL_RENDERER_RE	  = $00400000;  GL_RENDERER_IR	  = $00800000;  GL_RENDERER_SGI	  = $00F00000;  GL_RENDERER_MCD	  = $01000000;  GL_RENDERER_OTHER	  = $80000000;type  glconfig_t = record    renderer : integer;{	const char *renderer_string;	const char *vendor_string;	const char *version_string;	const char *extensions_string;}    renderer_string,    vendor_string,    version_string,    extensions_string : PChar;    allow_cds : qboolean;  end;  glstate_t = record    inverse_intensity : float;    fullscreen : qboolean;    prev_mode : integer;//	unsigned char *d_16to8table;    d_16to8table : array of byte; //???    lightmap_textures : integer;    currenttextures : array [0..1] of integer;    currenttmu : integer;

    camera_separation : float;
    stereo_enabled : qboolean;

{	unsigned char originalRedGammaTable[256];
	unsigned char originalGreenGammaTable[256];
	unsigned char originalBlueGammaTable[256];}
    originalRedGammaTable,    originalGreenGammaTable,
    originalBlueGammaTable   : array [0..255] of char; //OR byte
  end;var  gl_config : glconfig_t;  gl_state  : glstate_t;
(*/*====================================================================IMPORTED FUNCTIONS====================================================================*/extern	refimport_t	ri;*)(*/*====================================================================IMPLEMENTATION SPECIFIC FUNCTIONS====================================================================*/void		GLimp_BeginFrame( float camera_separation );void		GLimp_EndFrame( void );int 		GLimp_Init( void *hinstance, void *hWnd );void		GLimp_Shutdown( void );int     	GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );void		GLimp_AppActivate( qboolean active );void		GLimp_EnableLogging( qboolean enable );void		GLimp_LogNewFrame( void );*)implementation// End of fileend.屠屡型闻 屠奈 狍溴

⌨️ 快捷键说明

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