//////////////////////////////////////////////////////////////////////
//
//                             Pixie
//
// Copyright © 1999 - 2003, Okan Arikan
//
// Contact: okan@cs.berkeley.edu
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//
//  File				:	texture.h
//  Classes				:	CTexture , CEnvironment
//  Description			:
//
////////////////////////////////////////////////////////////////////////
#ifndef TEXTURE_H
#define TEXTURE_H

#include "common/global.h"
#include "common/algebra.h"
#include "common/containers.h"
#include "attributes.h"
#include "fileResource.h"
#include "random.h"

// Texture wrapping mode
typedef enum {
	TEXTURE_PERIODIC,
	TEXTURE_BLACK,
	TEXTURE_CLAMP
} TTextureMode;


///////////////////////////////////////////////////////////////////////
// Class				:	CTexture
// Description			:	This class the the base of all texture types
// Comments				:
// Date last edited		:	9/24/2002
class	CTexture : public CFileResource {
public:

						CTexture(const char *,int,int,TTextureMode,TTextureMode);
	virtual				~CTexture();

	virtual float		lookupz(float,float,float,const CTextureLookup *);						// Depth access
	virtual	void		lookup(float *,float,float,const CTextureLookup *);						// Point access
	virtual	void		lookup4(float *,const float *,const	float *,const CTextureLookup *);	// Area access

	int					width,height;											// The dimensions of the texture (just ised to figure out the blur amount)
	TTextureMode		sMode,tMode;											// The texture wrapping mode
};



///////////////////////////////////////////////////////////////////////
// Class				:	CEnvironment
// Description			:	An environment map (also encapsulates shadow maps)
// Comments				:
// Date last edited		:	9/24/2002
class	CEnvironment : public CFileResource {
public:

						CEnvironment(const char *);
	virtual				~CEnvironment();

	virtual	void		lookup(float *,const float *,const float *,const float *,const float *,const CTextureLookup *);
};


///////////////////////////////////////////////////////////////////////
// Class				:	CDeepShadowHeader
// Description			:	The deep shadow map header
// Comments				:
// Date last edited		:	2/28/2002
class	CDeepShadowHeader {
public:
	int					xres,yres;				// The resolution of the file
	int					xTiles,yTiles;			// The number of tiles
	int					tileSize;				// The tile dimensions
	int					tileShift;				// The tile shift
	matrix				toNDC;
};


#endif

