source: trunk/src/opengl/glide/cvg/texus/texusint.h

Last change on this file was 2888, checked in by sandervl, 26 years ago

Created Voodoo 2 dir

File size: 4.9 KB
Line 
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** $Revision: 1.1 $
21** $Date: 2000-02-25 00:38:01 $
22*/
23
24#ifndef __TEXUSINT_H__
25#define __TEXUSINT_H__
26
27#include "texus.h"
28
29#define GR_TEXFMT_SIZE(x) ((x < GR_TEXFMT_16BIT) ? 1: \
30 ((x < GR_TEXFMT_32BIT) ? 2: 4))
31
32#define TX_OFORMAT_3DF 10
33#define TX_OFORMAT_TGA 11
34#define TX_OFORMAT_PPM 12
35
36#define TX_MAX_LEVEL 16
37typedef struct _TxMip {
38 int format; // GR_TEXFMT_...
39 int width; // pixels
40 int height; // pixels
41 int depth; // mipmap levels
42 int size; // bytes
43 void *data[TX_MAX_LEVEL];
44 FxU32 pal[256];
45} TxMip;
46
47FxBool txMipRead(TxMip *txMip, const char *filename, int preferredFormat);
48FxBool txMipReadFromFP(TxMip *txMip, const char *debug_filename, FILE *file, int preferredFormat);
49void txMipWrite(TxMip *txMip, char *file, char *ext, int split);
50void txMipResample(TxMip *destMip, TxMip *srcMip);
51void txMipClamp( TxMip *dstMip, TxMip *srcMip );
52void txMipMipmap(TxMip *txMip);
53
54void txMipQuantize(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
55void txMipNcc(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
56void txMipNccNNet(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
57int txMipPal256(TxMip *pxMip, TxMip *txMip, int fmt, FxU32 dither, FxU32 comp);
58
59void txMipDequantize(TxMip *txMip, TxMip *pxMip);
60void txMipView(TxMip *txMip, char *filename, int wait, int bgcolor);
61void txViewClose();
62
63int txLog2(int n);
64int txFloorPow2(int n);
65int txCeilPow2(int n);
66int txGCD(int a, int b);
67int txAspectRatio(int w, int h);
68void txPanic(char *);
69void txError(char *);
70void txYABtoPal256(long *palette, const long* yabTable);
71void txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride,
72 int width, int height);
73FxBool txMipAlloc(TxMip *txMip);
74FxBool txMipSetMipPointers(TxMip *txMip);
75int txMemRequired(TxMip *txMip);
76void txBasename(const char *name, char *base);
77void txPathAndBasename(const char *name, char* pathbase);
78void txExtension(const char *name, char *ext);
79
80void txMipFree( TxMip *mip );
81void txMipTrueToFixedPal( TxMip *outputMip, TxMip *trueColorMip, const FxU32 *pal,
82 FxU32 flags );
83
84
85
86extern int txVerbose;
87extern int *explode3;
88#define DISTANCE(ar, ag, ab, br, bg, bb) \
89 ((explode3[(ar)-(br)] << 1) + (explode3[(ag)-(bg)]<<2) + explode3[(ab)-(bb)])
90
91void txDiffuseIndex(TxMip *pxMip, TxMip *txMip, int pixsize,
92 const FxU32 *palette, int ncolors);
93int txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int npal);
94
95FxBool _txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info);
96FxBool _txReadTGAData( FILE *stream, TxMip *info);
97
98FxBool _txReadRGTHeader( FILE *stream, FxU32 cookie, TxMip *info);
99FxBool _txReadRGTData( FILE *stream, TxMip *info);
100
101FxBool _txReadSBIHeader( FILE *stream, FxU32 cookie, TxMip *info);
102FxBool _txReadSBIData( FILE *stream, TxMip *info);
103
104FxBool _txReadPPMHeader( FILE *stream, FxU32 cookie, TxMip *info);
105FxBool _txReadPPMData( FILE *stream, TxMip *info);
106
107FxBool _txRead3DFHeader( FILE *stream, FxU32 cookie, TxMip *info);
108FxBool _txRead3DFData( FILE *stream, TxMip *info);
109
110int _txReadHeader( FILE *stream, TxMip *info );
111
112void txPalToNcc( GuNccTable *ncc_table, const FxU32 *pal );
113void txNccToPal( FxU32 *pal, const GuNccTable *ncc_table );
114
115#define MAX_TEXWIDTH 1024
116
117extern TxErrorCallbackFnc_t _txErrorCallback;
118
119extern char *Format_Name[];
120
121#endif /* __TEXUSINT_H__ */
Note: See TracBrowser for help on using the repository browser.