| 1 | /* |
| 2 | ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY |
| 3 | ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT |
| 4 | ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX |
| 5 | ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE |
| 6 | ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). |
| 7 | ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
| 8 | ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A |
| 9 | ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. |
| 10 | ** |
| 11 | ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO |
| 12 | ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN |
| 13 | ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013, |
| 14 | ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR |
| 15 | ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF |
| 16 | ** THE UNITED STATES. |
| 17 | ** |
| 18 | ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED |
| 19 | ** |
| 20 | ** $Header: /cvsroot/glide/glide3x/h5/glide3/src/glideutl.h,v 1.3.4.2 2003/06/05 08:23:53 koolsmoky Exp $ |
| 21 | ** $Log: |
| 22 | ** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce |
| 23 | ** branching. |
| 24 | ** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the |
| 25 | ** Napalm Glide open source release. Changes include cleaned up offensive |
| 26 | ** comments and new legal headers. |
| 27 | ** 1 3dfx 1.0 09/11/99 StarTeam VTS Administrator |
| 28 | ** $ |
| 29 | ** |
| 30 | ** 4 7/24/98 1:41p Hohn |
| 31 | ** |
| 32 | ** 3 1/30/98 4:27p Atai |
| 33 | ** gufog* prototype |
| 34 | ** |
| 35 | ** 1 1/29/98 4:00p Atai |
| 36 | * |
| 37 | * 1 1/16/98 4:29p Atai |
| 38 | * create glide 3 src |
| 39 | * |
| 40 | * 11 1/07/98 11:18a Atai |
| 41 | * remove GrMipMapInfo and GrGC.mm_table in glide3 |
| 42 | * |
| 43 | * 10 1/06/98 6:47p Atai |
| 44 | * undo grSplash and remove gu routines |
| 45 | * |
| 46 | * 9 1/05/98 6:04p Atai |
| 47 | * move 3df gu related data structure from glide.h to glideutl.h |
| 48 | * |
| 49 | * 8 12/18/97 2:13p Peter |
| 50 | * fogTable cataclysm |
| 51 | * |
| 52 | * 7 12/15/97 5:52p Atai |
| 53 | * disable obsolete glide2 api for glide3 |
| 54 | * |
| 55 | * 6 8/14/97 5:32p Pgj |
| 56 | * remove dead code per GMT |
| 57 | * |
| 58 | * 5 6/12/97 5:19p Pgj |
| 59 | * Fix bug 578 |
| 60 | * |
| 61 | * 4 3/05/97 9:36p Jdt |
| 62 | * Removed guFbWriteRegion added guEncodeRLE16 |
| 63 | * |
| 64 | * 3 1/16/97 3:45p Dow |
| 65 | * Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO |
| 66 | */ |
| 67 | |
| 68 | /* Glide Utility routines */ |
| 69 | |
| 70 | #ifndef __GLIDEUTL_H__ |
| 71 | #define __GLIDEUTL_H__ |
| 72 | |
| 73 | #ifdef __cplusplus |
| 74 | extern "C" { |
| 75 | #endif |
| 76 | |
| 77 | /* |
| 78 | ** 3DF texture file structs |
| 79 | */ |
| 80 | |
| 81 | typedef struct |
| 82 | { |
| 83 | FxU32 width, height; |
| 84 | int small_lod, large_lod; |
| 85 | GrAspectRatio_t aspect_ratio; |
| 86 | GrTextureFormat_t format; |
| 87 | } Gu3dfHeader; |
| 88 | |
| 89 | typedef struct |
| 90 | { |
| 91 | FxU8 yRGB[16]; |
| 92 | FxI16 iRGB[4][3]; |
| 93 | FxI16 qRGB[4][3]; |
| 94 | FxU32 packed_data[12]; |
| 95 | } GuNccTable; |
| 96 | |
| 97 | typedef struct { |
| 98 | FxU32 data[256]; |
| 99 | } GuTexPalette; |
| 100 | |
| 101 | typedef union { |
| 102 | GuNccTable nccTable; |
| 103 | GuTexPalette palette; |
| 104 | } GuTexTable; |
| 105 | |
| 106 | typedef struct |
| 107 | { |
| 108 | Gu3dfHeader header; |
| 109 | GuTexTable table; |
| 110 | void *data; |
| 111 | FxU32 mem_required; /* memory required for mip map in bytes. */ |
| 112 | } Gu3dfInfo; |
| 113 | |
| 114 | #ifndef FX_GLIDE_NO_FUNC_PROTO |
| 115 | /* |
| 116 | ** Gamma functions |
| 117 | */ |
| 118 | |
| 119 | FX_ENTRY void FX_CALL |
| 120 | guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue ); |
| 121 | |
| 122 | /* |
| 123 | ** fog stuff |
| 124 | */ |
| 125 | FX_ENTRY float FX_CALL |
| 126 | guFogTableIndexToW( int i ); |
| 127 | |
| 128 | FX_ENTRY void FX_CALL |
| 129 | guFogGenerateExp( GrFog_t *fogtable, float density ); |
| 130 | |
| 131 | FX_ENTRY void FX_CALL |
| 132 | guFogGenerateExp2( GrFog_t *fogtable, float density ); |
| 133 | |
| 134 | FX_ENTRY void FX_CALL |
| 135 | guFogGenerateLinear(GrFog_t *fogtable, |
| 136 | float nearZ, float farZ ); |
| 137 | |
| 138 | /* |
| 139 | ** hi-level texture manipulation tools. |
| 140 | */ |
| 141 | FX_ENTRY FxBool FX_CALL |
| 142 | gu3dfGetInfo( const char *filename, Gu3dfInfo *info ); |
| 143 | |
| 144 | FX_ENTRY FxBool FX_CALL |
| 145 | gu3dfLoad( const char *filename, Gu3dfInfo *data ); |
| 146 | |
| 147 | #endif /* FX_GLIDE_NO_FUNC_PROTO */ |
| 148 | |
| 149 | #ifdef __cplusplus |
| 150 | } |
| 151 | #endif |
| 152 | |
| 153 | #endif /* __GLIDEUTL_H__ */ |