//-----------------------------------------------------------------------------
//
//  $Logfile:: /Source/gl_loc1.h                                              $
// $Revision:: 4                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 8/10/01 5:50 PM                                                $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// DESCRIPTION:
// disable data conversion warnings
//

#ifndef __GL_LOC1_H__
#define __GL_LOC1_H__

#ifdef _WIN32
#include <windows.h>
#endif

#ifndef _H2INC
#include <stdio.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include <math.h>
#endif

#ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif

#ifndef __REF_H__
#include "ref.h"
#endif

#ifndef _H2INC
#ifndef __QGL_H__
#include "qgl.h"
#endif
#endif

#define	REF_VERSION	"GL 0.01"

// up / down
#define	PITCH	0

// left / right
#define	YAW		1

// fall over
#define	ROLL	2


typedef struct
{
#ifdef _H2INC
	unsigned		AMD_width, height;			// coordinates from main game
#else
/*	unsigned*/
	int				width, height;			// coordinates from main game
#endif
} gl_viddef_t;

extern	gl_viddef_t	vid;


/*

  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

*/

typedef enum
{
	it_skin,
	it_sprite,
	it_wall,
	it_pic,
	it_sky,
	it_lum,
	it_decal
} imagetype_t;

typedef struct image_s
{
#ifdef _H2INC
	char	AMD_name[MAX_QPATH];			// game path, including extension
	imagetype_t	AMD_type;
	int		AMD_width, height;				// source image
#else
	char	name[MAX_QPATH];			// game path, including extension
	imagetype_t	type;
	int		width, height;				// source image
#endif
	int		upload_width, upload_height;	// after power of two and picmip
	int		registration_sequence;		// 0 = free
	struct msurface_s	*texturechain;	// for sort-by-texture world drawing
/*	int*/
	GLuint		TextureNum;				// gl texture binding
	float	sl, tl, sh, th;				// 0,0 - 1,1 unless part of the scrap
	qboolean	scrap;
	qboolean	has_alpha;

	qboolean paletted;
	int				palette_sequence;
	int				paletteCRC;
#ifdef _H2INC
	unsigned char	*palette;
	unsigned char	*decal_data;
#else
	byte		*palette;
	byte		*decal_data;
#endif
   qboolean bilinear;
   long hash; /* Knightmare */
} image_t;

#define	TEXNUM_LIGHTMAPS	1024
#define	TEXNUM_SCRAPS		1152
#define	TEXNUM_IMAGES		1153

#define		MAX_GLTEXTURES	1024

//===================================================================

typedef enum
{
	rserr_ok,

	rserr_invalid_fullscreen,
	rserr_invalid_mode,

	rserr_unknown
} rserr_t;

#endif
