home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 5 / MA_Cover_5.iso / ppc / mesa / src / fxdrv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-31  |  4.1 KB  |  173 lines

  1. /* -*- mode: C; tab-width:8;  -*-
  2.  
  3.              fxdrv.h - 3Dfx VooDoo vertices setup functions 
  4. */
  5.  
  6. /*
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Library General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Library General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Library General Public
  18.  * License along with this library; if not, write to the Free
  19.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  * See the file fxmesa1.c for more informations about authors
  22.  *
  23.  */
  24.  
  25. #ifndef FXDRV_H
  26. #define FXDRV_H
  27.  
  28. #include <assert.h>
  29.  
  30. #include "context.h"
  31. #include "macros.h"
  32. #include "matrix.h"
  33. #include "texture.h"
  34. #include "types.h"
  35. #include "vb.h"
  36. #include "xform.h"
  37.  
  38. #include "GL/fxmesa.h"
  39.  
  40. #if defined(FX) && defined(__WIN32__)
  41. #include <windows.h>
  42. #pragma warning (disable:4273)
  43. #else
  44. #define APIENTRY
  45. #define CALLBACK
  46. #define WINGDIAPI extern
  47. #endif
  48.  
  49. #ifdef __WIN32__
  50. /* A work around for the MSVC */
  51.  
  52. #define txConvert      _cdecl txConvert
  53. #define txInit3dfInfo  _cdecl txInit3dfInfo
  54. #endif
  55.  
  56. #include <texus.h>
  57.  
  58. #ifdef __WIN32__
  59. #undef txConvert
  60. #undef txInit3dfInfo
  61. #endif
  62.  
  63. #define MAXNUM_MIPMAPLEVELS 9
  64.  
  65.  
  66. #define FXCOLOR(r,g,b,a) (( ((unsigned int)(a))<<24 )|( ((unsigned int)(b))<<16 )|( ((unsigned int)(g))<<8 )|(r))
  67.  
  68.  
  69. typedef struct freetexmemlistnode {
  70.   struct freetexmemlistnode *next;
  71.   FxU32 startadr, endadr;
  72. } texmemfreenode;
  73.  
  74. typedef struct alloctexmemlistnode {
  75.   struct alloctexmemlistnode *next;
  76.   FxU32 startadr, endadr;
  77.   struct gl_texture_object *tobj;
  78. } texmemallocnode;
  79.  
  80. typedef struct {
  81.   GLboolean isintexturememory;
  82.   GLuint lasttimeused;
  83.  
  84.   texmemallocnode *tm;
  85.  
  86.   unsigned short *mipmaplevel[MAXNUM_MIPMAPLEVELS];
  87. } texmeminfo;
  88.  
  89. typedef struct {
  90.   GLboolean valid;
  91.  
  92.   texmeminfo tmi;
  93.  
  94.   GLsizei width,height;
  95.  
  96.   GrTexInfo info;
  97.  
  98.   GrTextureFilterMode_t minfilt;
  99.   GrTextureFilterMode_t maxfilt;
  100.  
  101.   GrTextureClampMode_t sclamp;
  102.   GrTextureClampMode_t tclamp;
  103.  
  104.   GrMipMapMode_t mmmode;
  105.  
  106.   GLfloat sscale,tscale;
  107.   GLint levelsdefined;
  108.  
  109.   GLboolean fixedpalette;
  110.   GuTexPalette palette;
  111. } texinfo;
  112.  
  113. typedef struct {
  114.   GLuint swapbuffer;
  115.   GLuint reqtexupload;
  116.   GLuint texupload;
  117.   GLuint memtexupload;
  118. } fxStats;
  119.  
  120. struct fx_mesa_context {
  121.   GLcontext *gl_ctx;             /* the core Mesa context */
  122.   GLvisual *gl_vis;              /* describes the color buffer */
  123.   GLframebuffer *gl_buffer;      /* the ancillary buffers */
  124.  
  125.   GLint width, height;           /* size of color buffer */
  126.   GLboolean double_buffer;
  127.   GLboolean wbuffer;
  128.   GLboolean verbose;
  129.  
  130.   GLboolean fixedpalette_texture;
  131.   GLboolean globalpalette_texture;
  132.   GuTexPalette glbpalette;
  133.  
  134.   GrBuffer_t currentfb;
  135.  
  136.   GrColor_t color;
  137.   GrColor_t clearc;
  138.   GrAlpha_t cleara;
  139.  
  140.   GLuint texbindnumber;
  141.   texmemfreenode *tmfree;
  142.   texmemallocnode *tmalloc;
  143.  
  144.   GLfloat wscale,nearval,farval;
  145.  
  146.   GLenum fogtablemode;
  147.   GLfloat fogdensity;
  148.   GrFog_t fogtable[64];
  149.  
  150.   fxStats stats;
  151.  
  152.   GrVertex gwin[VB_SIZE];
  153. };
  154.  
  155. typedef void (*setup_func)(GLcontext *, GLuint, GLuint);
  156.  
  157. extern setup_func choose_setup_function(GLcontext *);
  158. extern points_func choose_points_function(GLcontext *);
  159. extern line_func choose_line_function(GLcontext *);
  160. extern triangle_func choose_triangle_function(GLcontext *);
  161. extern quad_func choose_quad_function(GLcontext *);
  162.  
  163. extern void inittmmanager(fxMesaContext);
  164. extern void closetmmanager(fxMesaContext fxMesa);
  165. extern void moveintexturememory(fxMesaContext, struct gl_texture_object *);
  166. extern void moveouttexturememory(fxMesaContext, struct gl_texture_object *);
  167. extern void freetexture(fxMesaContext, struct gl_texture_object *);
  168. extern void reloadmipmaplevel(fxMesaContext, struct gl_texture_object *, GLint level);
  169.  
  170. extern int texgetinfo(int, int, GrLOD_t *, GrAspectRatio_t *, float *, float *, int *, int *);
  171.  
  172. #endif
  173.