This commit is contained in:
chacha
2026-02-24 00:06:40 +00:00
parent a156924d5f
commit 6eef665f4d
5 changed files with 793 additions and 0 deletions

127
glide_internal/3dfx.h Normal file
View File

@@ -0,0 +1,127 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Revision: 1.3 $
** $Date: 2000/09/11 18:51:51 $
*/
#ifndef __3DFX_H__
#define __3DFX_H__
/*
** basic data types
*/
typedef unsigned char FxU8;
typedef signed char FxI8;
typedef unsigned short FxU16;
typedef signed short FxI16;
#if defined(__alpha__) || defined (__LP64__)
typedef signed int FxI32;
typedef unsigned int FxU32;
#else
typedef signed long FxI32;
typedef unsigned long FxU32;
#endif
typedef unsigned long AnyPtr;
typedef int FxBool;
typedef float FxFloat;
typedef double FxDouble;
/*
** color types
*/
typedef unsigned long FxColor_t;
typedef struct { float r, g, b, a; } FxColor4;
/*
** fundamental types
*/
#define FXTRUE 1
#define FXFALSE 0
/*
** helper macros
*/
#define FXUNUSED( a ) ((void)(a))
#define FXBIT( i ) ( 1L << (i) )
/*
** export macros
*/
#if defined(__MSC__) || defined(_MSC_VER)
# if defined (MSVC16)
# define FX_ENTRY
# define FX_CALL
# else
# define FX_ENTRY extern
# define FX_CALL __stdcall
# endif
#elif defined(__WATCOMC__)
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined (__IBMC__) || defined (__IBMCPP__)
/* IBM Visual Age C/C++: */
# define FX_ENTRY extern
# define FX_CALL __stdcall
#elif defined(__DJGPP__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__unix__)
# define FX_ENTRY extern
# define FX_CALL
#elif defined(__MWERKS__)
# if macintosh
# define FX_ENTRY extern
# define FX_CALL
# else /* !macintosh */
# error "Unknown MetroWerks target platform"
# endif /* !macintosh */
#else
# warning define FX_ENTRY & FX_CALL for your compiler
# define FX_ENTRY extern
# define FX_CALL
#endif
/*
** x86 compiler specific stuff
*/
#if defined(__BORLANDC_)
# define REALMODE
# define REGW( a, b ) ((a).x.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int86(a,b,c)
# define INT86X( a, b, c, d ) int86x(a,b,c,d)
# define RM_SEG( a ) FP_SEG( a )
# define RM_OFF( a ) FP_OFF( a )
#elif defined(__WATCOMC__)
# undef FP_SEG
# undef FP_OFF
# define REGW( a, b ) ((a).w.b)
# define REGB( a, b ) ((a).h.b)
# define INT86( a, b, c ) int386(a,b,c)
# define INT86X( a, b, c, d ) int386x(a,b,c,d)
# define RM_SEG( a ) ( ( ( ( FxU32 ) (a) ) & 0x000F0000 ) >> 4 )
# define RM_OFF( a ) ( ( FxU16 ) (a) )
#endif
#endif /* !__3DFX_H__ */

134
glide_internal/glidesys.h Normal file
View File

@@ -0,0 +1,134 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide2x/cvg/glide/src/glidesys.h,v 1.1.1.1 1999/12/07 21:49:10 joseph Exp $
** $Log: glidesys.h,v $
** Revision 1.1.1.1 1999/12/07 21:49:10 joseph
** Initial checkin into SourceForge.
**
*
* 10 12/09/97 12:20p Peter
* mac glide port
*
* 9 11/04/97 4:00p Dow
* Banshee Mods
*
* 8 8/18/97 3:52p Peter
* pre-hw arrival fixes/cleanup
*
* 7 6/02/97 4:09p Peter
* Compile w/ gcc for Dural
*
* 6 5/27/97 1:16p Peter
* Basic cvg, w/o cmd fifo stuff.
*
* 5 5/21/97 6:05a Peter
*/
#ifndef __GLIDESYS_H__
#define __GLIDESYS_H__
/*
n** -----------------------------------------------------------------------
** COMPILER/ENVIRONMENT CONFIGURATION
** -----------------------------------------------------------------------
*/
/* Endianness is stored in bits [30:31] */
#define GLIDE_ENDIAN_SHIFT 30
#define GLIDE_ENDIAN_LITTLE (0x1 << GLIDE_ENDIAN_SHIFT)
#define GLIDE_ENDIAN_BIG (0x2 << GLIDE_ENDIAN_SHIFT)
/* OS is stored in bits [0:6] */
#define GLIDE_OS_SHIFT 0
#define GLIDE_OS_UNIX 0x1
#define GLIDE_OS_DOS32 0x2
#define GLIDE_OS_WIN32 0x4
#define GLIDE_OS_MACOS 0x8
#define GLIDE_OS_OS2 0x10
#define GLIDE_OS_OTHER 0x40 /* For Proprietary Arcade HW */
#define GLIDE_SST_SHIFT 7
#define GLIDE_SST_HW (0x2 << GLIDE_SST_SHIFT)
/* Hardware Type is stored in bits [9:13] */
#define GLIDE_HW_SHIFT 9
#define GLIDE_HW_SST1 (0x1 << GLIDE_HW_SHIFT)
#define GLIDE_HW_SST96 (0x2 << GLIDE_HW_SHIFT)
#define GLIDE_HW_H3 (0x4 << GLIDE_HW_SHIFT)
#define GLIDE_HW_CVG (0x10 << GLIDE_HW_SHIFT)
/*
** Make sure we handle all instances of WIN32
*/
#ifndef __WIN32__
# if defined (_WIN32) || defined (WIN32) || defined(__NT__)
# define __WIN32__
# endif
#endif
/* We need two checks on the OS: one for endian, the other for OS */
/* Check for endianness */
#if defined(__IRIX__) || defined(__sparc__) || defined(MACOS)
# define GLIDE_ENDIAN GLIDE_ENDIAN_BIG
#else
# define GLIDE_ENDIAN GLIDE_ENDIAN_LITTLE
#endif
/* Check for OS */
#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__)
# define GLIDE_OS GLIDE_OS_UNIX
#elif defined(__DOS__)
# define GLIDE_OS GLIDE_OS_DOS32
#elif defined(__WIN32__)
# define GLIDE_OS GLIDE_OS_WIN32
#elif defined(macintosh)
# define GLIDE_OS GLIDE_OS_MACOS
#else
#error "Unknown OS"
#endif
#define GLIDE_SST GLIDE_SST_HW
/* Check for type of hardware */
#ifdef SST96
# define GLIDE_HW GLIDE_HW_SST96
#elif defined(H3)
# define GLIDE_HW GLIDE_HW_H3
#elif defined(CVG)
# define GLIDE_HW GLIDE_HW_CVG
#else /* Default to SST1 */
# define GLIDE_HW GLIDE_HW_SST1
#endif
#define GLIDE_PLATFORM (GLIDE_ENDIAN | GLIDE_OS | GLIDE_SST | GLIDE_HW)
/*
** Control the number of TMUs
*/
#ifndef GLIDE_NUM_TMU
# define GLIDE_NUM_TMU 2
#endif
#if ((GLIDE_NUM_TMU < 0) && (GLIDE_NUM_TMU > 3))
# error "GLIDE_NUM_TMU set to an invalid value"
#endif
#endif /* __GLIDESYS_H__ */

189
glide_internal/glideutl.h Normal file
View File

@@ -0,0 +1,189 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide2x/cvg/glide/src/glideutl.h,v 1.1.1.1 1999/12/07 21:49:10 joseph Exp $
** $Log: glideutl.h,v $
** Revision 1.1.1.1 1999/12/07 21:49:10 joseph
** Initial checkin into SourceForge.
**
*
* 11 1/07/98 11:18a Atai
* remove GrMipMapInfo and GrGC.mm_table in glide3
*
* 10 1/06/98 6:47p Atai
* undo grSplash and remove gu routines
*
* 9 1/05/98 6:04p Atai
* move 3df gu related data structure from glide.h to glideutl.h
*
* 8 12/18/97 2:13p Peter
* fogTable cataclysm
*
* 7 12/15/97 5:52p Atai
* disable obsolete glide2 api for glide3
*
* 6 8/14/97 5:32p Pgj
* remove dead code per GMT
*
* 5 6/12/97 5:19p Pgj
* Fix bug 578
*
* 4 3/05/97 9:36p Jdt
* Removed guFbWriteRegion added guEncodeRLE16
*
* 3 1/16/97 3:45p Dow
* Embedded fn protos in ifndef FX_GLIDE_NO_FUNC_PROTO
*/
/* Glide Utility routines */
#ifndef __GLIDEUTL_H__
#define __GLIDEUTL_H__
#ifdef __cplusplus
extern "C" {
#endif
#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
/*
** 3DF texture file structs
*/
typedef struct
{
FxU32 width, height;
int small_lod, large_lod;
GrAspectRatio_t aspect_ratio;
GrTextureFormat_t format;
} Gu3dfHeader;
typedef struct
{
FxU8 yRGB[16];
FxI16 iRGB[4][3];
FxI16 qRGB[4][3];
FxU32 packed_data[12];
} GuNccTable;
typedef struct {
FxU32 data[256];
} GuTexPalette;
typedef union {
GuNccTable nccTable;
GuTexPalette palette;
} GuTexTable;
typedef struct
{
Gu3dfHeader header;
GuTexTable table;
void *data;
FxU32 mem_required; /* memory required for mip map in bytes. */
} Gu3dfInfo;
#endif
#ifndef FX_GLIDE_NO_FUNC_PROTO
/*
** rendering functions
*/
#ifndef GLIDE3_ALPHA
FX_ENTRY void FX_CALL
guAADrawTriangleWithClip( const GrVertex *a, const GrVertex
*b, const GrVertex *c);
FX_ENTRY void FX_CALL
guDrawTriangleWithClip(
const GrVertex *a,
const GrVertex *b,
const GrVertex *c
);
FX_ENTRY void FX_CALL
guDrawPolygonVertexListWithClip( int nverts, const GrVertex vlist[] );
/*
** hi-level rendering utility functions
*/
FX_ENTRY void FX_CALL
guAlphaSource( GrAlphaSource_t mode );
FX_ENTRY void FX_CALL
guColorCombineFunction( GrColorCombineFnc_t fnc );
FX_ENTRY int FX_CALL
guEncodeRLE16( void *dst,
void *src,
FxU32 width,
FxU32 height );
FX_ENTRY FxU16 * FX_CALL
guTexCreateColorMipMap( void );
#endif /* !GLIDE3_ALPHA */
#ifdef GLIDE3
FX_ENTRY void FX_CALL
guGammaCorrectionRGB( FxFloat red, FxFloat green, FxFloat blue );
#endif
/*
** fog stuff
*/
FX_ENTRY float FX_CALL
guFogTableIndexToW( int i );
FX_ENTRY void FX_CALL
guFogGenerateExp( GrFog_t fogtable[], float density );
FX_ENTRY void FX_CALL
guFogGenerateExp2( GrFog_t fogtable[], float density );
FX_ENTRY void FX_CALL
guFogGenerateLinear(GrFog_t fogtable[],
float nearZ, float farZ );
/*
** endian stuff
*/
#ifndef GLIDE3_ALPHA
FX_ENTRY FxU32 FX_CALL
guEndianSwapWords( FxU32 value );
FX_ENTRY FxU16 FX_CALL
guEndianSwapBytes( FxU16 value );
#endif /* !GLIDE3_ALPHA */
/*
** hi-level texture manipulation tools.
*/
FX_ENTRY FxBool FX_CALL
gu3dfGetInfo( const char *filename, Gu3dfInfo *info );
FX_ENTRY FxBool FX_CALL
gu3dfLoad( const char *filename, Gu3dfInfo *data );
#endif /* FX_GLIDE_NO_FUNC_PROTO */
#ifdef __cplusplus
}
#endif
#endif /* __GLIDEUTL_H__ */

62
glide_internal/gump.h Normal file
View File

@@ -0,0 +1,62 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Header: /cvsroot/glide/glide2x/cvg/glide/src/gump.h,v 1.1.1.1 1999/12/07 21:49:11 joseph Exp $
** $Log: gump.h,v $
** Revision 1.1.1.1 1999/12/07 21:49:11 joseph
** Initial checkin into SourceForge.
**
**
*/
/* Multipass drawing */
#ifndef __GUMP_H__
#define __GUMP_H__
#ifdef __cplusplus
extern "C" {
#endif
#define GLIDE_NUM_VIRTUAL_TMU 2 /* Number of virtual TMUs */
typedef FxU32 GrMPTextureCombineFnc_t;
#define GR_MPTEXTURECOMBINE_ADD 0x0 /* */
#define GR_MPTEXTURECOMBINE_MULTIPLY 0x1 /* */
#define GR_MPTEXTURECOMBINE_DETAIL0 0x2 /* */
#define GR_MPTEXTURECOMBINE_DETAIL1 0x3 /* */
#define GR_MPTEXTURECOMBINE_TRILINEAR0 0x4 /* */
#define GR_MPTEXTURECOMBINE_TRILINEAR1 0x5 /* */
#define GR_MPTEXTURECOMBINE_SUBTRACT 0x6 /* */
typedef struct {
GrMipMapId_t mmid[GLIDE_NUM_VIRTUAL_TMU];
GrMPTextureCombineFnc_t tc_fnc;
} GrMPState;
FX_ENTRY void FX_CALL guMPInit( void );
FX_ENTRY void FX_CALL guMPTexCombineFunction( GrMPTextureCombineFnc_t tc );
FX_ENTRY void FX_CALL guMPTexSource( GrChipID_t virtual_tmu, GrMipMapId_t mmid );
FX_ENTRY void FX_CALL guMPDrawTriangle( const GrVertex *a, const GrVertex *b, const GrVertex *c );
#ifdef __cplusplus
}
#endif
#endif /* __GUMP_H__ */

281
glide_internal/texus.h Normal file
View File

@@ -0,0 +1,281 @@
/*
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
**
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
** $Revision: 1.2 $
** $Date: 2000/06/15 00:11:40 $
*/
#ifndef __TEXUS_H__
#define __TEXUS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#ifndef __3DFX_H__
/*
** basic data types
*/
typedef unsigned char FxU8;
typedef unsigned short FxU16;
typedef short FxI16;
typedef unsigned long FxU32;
typedef long FxI32;
typedef int FxBool;
/*
** fundamental types
*/
#define FXTRUE 1
#define FXFALSE 0
#endif /* __3DFX_H__ */
#ifndef __GLIDE_H__
/* These are defined so we can use them without glide */
typedef FxU32 GrTextureFormat_t;
#define GR_TEXFMT_8BIT 0x0
#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
#define GR_TEXFMT_YIQ_422 0x1
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
#define GR_TEXFMT_P_8 0x5
#define GR_TEXFMT_RSVD1 0x6
#define GR_TEXFMT_RSVD2 0x7
#define GR_TEXFMT_16BIT 0x8
#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
#define GR_TEXFMT_AYIQ_8422 0x9
#define GR_TEXFMT_RGB_565 0xa
#define GR_TEXFMT_ARGB_1555 0xb
#define GR_TEXFMT_ARGB_4444 0xc
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
#define GR_TEXFMT_AP_88 0xe
#define GR_TEXFMT_RSVD4 0xf
typedef FxI32 GrLOD_t;
#ifdef GLIDE3
#define GR_LOD_256 0x8
#define GR_LOD_128 0x7
#define GR_LOD_64 0x6
#define GR_LOD_32 0x5
#define GR_LOD_16 0x4
#define GR_LOD_8 0x3
#define GR_LOD_4 0x2
#define GR_LOD_2 0x1
#define GR_LOD_1 0x0
#else
#define GR_LOD_256 0x0
#define GR_LOD_128 0x1
#define GR_LOD_64 0x2
#define GR_LOD_32 0x3
#define GR_LOD_16 0x4
#define GR_LOD_8 0x5
#define GR_LOD_4 0x6
#define GR_LOD_2 0x7
#define GR_LOD_1 0x8
#endif
typedef FxI32 GrAspectRatio_t;
#ifdef GLIDE3
#define GR_ASPECT_8x1 3 /* 8W x 1H */
#define GR_ASPECT_4x1 2 /* 4W x 1H */
#define GR_ASPECT_2x1 1 /* 2W x 1H */
#define GR_ASPECT_1x1 0 /* 1W x 1H */
#define GR_ASPECT_1x2 -1 /* 1W x 2H */
#define GR_ASPECT_1x4 -2 /* 1W x 4H */
#define GR_ASPECT_1x8 -3 /* 1W x 8H */
#else
#define GR_ASPECT_8x1 0x0 /* 8W x 1H */
#define GR_ASPECT_4x1 0x1 /* 4W x 1H */
#define GR_ASPECT_2x1 0x2 /* 2W x 1H */
#define GR_ASPECT_1x1 0x3 /* 1W x 1H */
#define GR_ASPECT_1x2 0x4 /* 1W x 2H */
#define GR_ASPECT_1x4 0x5 /* 1W x 4H */
#define GR_ASPECT_1x8 0x6 /* 1W x 8H */
#endif /* GLIDE3 */
/*
** 3DF texture file structs
*/
typedef struct
{
FxU32 width, height;
int small_lod, large_lod;
GrAspectRatio_t aspect_ratio;
GrTextureFormat_t format;
} Gu3dfHeader;
typedef struct
{
FxU8 yRGB[16];
FxI16 iRGB[4][3];
FxI16 qRGB[4][3];
FxU32 packed_data[12];
} GuNccTable;
typedef struct {
FxU32 data[256];
} GuTexPalette;
typedef union {
GuNccTable nccTable;
GuTexPalette palette;
} GuTexTable;
typedef struct
{
Gu3dfHeader header;
GuTexTable table;
void *data;
FxU32 mem_required; /* memory required for mip map in bytes. */
} Gu3dfInfo;
#endif // __GLIDE_H__
#define GR_TEXFMT_32BIT 0x10
#define GR_TEXFMT_ARGB_8888 GR_TEXFMT_32BIT
#define GR_TEXFMT_RGB_888 0x11
#define GR_TEXFMT_ANY 0x7fffffff
// Save typing fingers
#define GR_TEXFMT_A_8 GR_TEXFMT_ALPHA_8
#define GR_TEXFMT_I_8 GR_TEXFMT_INTENSITY_8
#define GR_TEXFMT_AI_44 GR_TEXFMT_ALPHA_INTENSITY_44
#define GR_TEXFMT_AI_88 GR_TEXFMT_ALPHA_INTENSITY_88
#define TX_DITHER_NONE 0x00000000
#define TX_DITHER_4x4 0x00000001
#define TX_DITHER_ERR 0x00000002
#define TX_DITHER_MASK 0x0000000f
#define TX_COMPRESSION_STATISTICAL 0x00000000
#define TX_COMPRESSION_HEURISTIC 0x00000010
#define TX_COMPRESSION_MASK 0x000000f0
#define TX_CLAMP_DISABLE 0x00000000
#define TX_CLAMP_ENABLE 0x00000100
#define TX_CLAMP_MASK 0x00000f00
#define TX_AUTORESIZE_DISABLE 0x00000000
#define TX_AUTORESIZE_GROW 0x00001000
#define TX_AUTORESIZE_SHRINK 0x00002000
#define TX_AUTORESIZE_MASK 0x0000f000
#define TX_TARGET_PALNCC_BESTFIT 0x00000000
#define TX_TARGET_PALNCC_SOURCE 0x00010000
#define TX_TARGET_PALNCC_MASK 0x000f0000
/*
* (GaryMcT)
* TX_FIXED_PAL_QUANT_DIST - use color distance to map a true color
* image back into a user specified palette.
* Use this when you have a lot of different
* palettes.
* TX_FIXED_PAL_QUANT_TABLE- use an inverse palette to map colors
* into a user specfied palette.
* Use this method when you have a few
* palettes. Will run faster if you
* process textures with the same
* palette sequentially since the palette
* is compiled internally to a lookup table.
*/
#define TX_FIXED_PAL_QUANT_DIST 0x00000000
#define TX_FIXED_PAL_QUANT_TABLE 0x00100000
#define TX_FIXED_PAL_QUANT_MASK 0x00f00000
#define TX_WRITE_3DF 0x00000000
#define TX_WRITE_TGA 0x00000001
#define TX_WRITE_MASK 0x0000000f
/*
* Publicly accessible functions.
*/
/*
* txInit3dfInfo:
* Set up the target parameters for a texture conversion.
* info - Glide texture structure to set up.
* destFormat - format that we will be converting to.
* destWidth, destHeight - geometry of the target texture image.
* Are modified if TX_AUTORESIZE is enabled.
* mipLevels - number of mipmap levels in the target texture.
* Either specifies the number of mipmap levels
* to create, or -1 for all possible mipmap levels.
* flags -
* auto-resample mode - TX_AUTORESIZE_*
*/
size_t txInit3dfInfo( Gu3dfInfo *info, GrTextureFormat_t destFormat,
int *destWidth, int *destHeight,
int mipLevels, FxU32 flags );
size_t txInit3dfInfoFromFile( FILE *file,
Gu3dfInfo *info, GrTextureFormat_t destFormat,
int *destWidth, int *destHeight,
int mipLevels, FxU32 flags );
/*
* txConvert: convert from an in memory texture to a Glide Gu3dfInfo.
* info - target texture info. . is set up with txInit3dfInfo.
* srcFormat - format of in-memory source texture.
* srcWidth, srcHeight - geometry of in memory source texture.
* This is not limited in size or
* aspect ratio.
* flags -
* dither mode - TX_DITHER_*
* compression - TX_COMPRESS_*
* clamp mode - TX_CLAMP_*
* palette conversion mode - TX_FIXED_PAL_QUANT_*
*/
FxBool txConvert( Gu3dfInfo *info, GrTextureFormat_t srcFormat,
int srcWidth, int srcHeight,
const void *srcImage, FxU32 flags,
const void *palNcc );
FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info,
FxU32 flags, const void *palNcc );
FxBool txWrite( Gu3dfInfo *info, FILE *fp, FxU32 flags );
/*
* Error handling.
*/
typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal );
void txErrorSetCallback( TxErrorCallbackFnc_t fnc );
/*
* TEXUS MEMORY ALLOCATION ROUTINES.
* These are not to be called directly. . .they are only here
* so that you can redefine them to your own memory management
* routines.
*/
void *txMalloc( size_t size );
void txFree( void *ptr );
void *txRealloc( void *ptr, size_t size );
#ifdef __cplusplus
}
#endif
#endif /* __TEXUS_H__ */