#pragma once

#include "vmodes.h"
#include "basetypes.h"
#include "const.h"

struct refdef_t
{
	vrect_t vrect;						   // subwindow in video for refresh
										   // FIXME: not need vrect next field here?
	vrect_t aliasvrect;					   // scaled Alias version
	int vrectright, vrectbottom;		   // right & bottom screen coords
	int aliasvrectright, aliasvrectbottom; // scaled Alias versions
	float vrectrightedge;				   // rightmost right edge we care about,
										   //  for use in edge list
	float fvrectx, fvrecty;				   // for floating-point compares
	float fvrectx_adj, fvrecty_adj;		   // left and top edges, for clamping
	int vrect_x_adj_shift20;			   // (vrect.x + 0.5 - epsilon) << 20
	int vrectright_adj_shift20;			   // (vrectright + 0.5 - epsilon) << 20
	float fvrectright_adj, fvrectbottom_adj;
	// right and bottom edges, for clamping
	float fvrectright;			 // rightmost edge, for Alias clamping
	float fvrectbottom;			 // bottommost edge, for Alias clamping
	float horizontalFieldOfView; // at Z = 1.0, this many X is visible
								 // 2.0 = 90 degrees
	float xOrigin;				 // should probably allways be 0.5
	float yOrigin;				 // between be around 0.3 to 0.5

	vec3_t vieworg;
	vec3_t viewangles;

	color24 ambientlight;

	qboolean onlyClientDraws;
};


bool LoadTGA2(const char* szFilename, byte* buffer, int bufferSize, int* width, int* height, bool errFail);
bool LoadTGA(const char* szFilename, byte* buffer, int bufferSize, int* width, int* height);
