/*****************************************************************************

	File: ClipmapConfig.h
	Desc: Some default values, don't change any if you don't know what 
	      you are doing :)
	Date: 2005/01/01

	Author: Wim Lemkens

*****************************************************************************/

#ifndef __CLIPMAPCONFIG_H
#define __CLIPMAPCONFIG_H

namespace Ogre
{

/**
 * The macro's for the directions
 */
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LEFT 3

/**
 * Equivalent macro's for the directions but with wind directions an sub
 * wind directions
 * (don't know if that's correctly translated)
 */
#define N 0
#define E 1
#define S 2
#define W 3
#define NW 4
#define NE 5
#define SE 6
#define SW 7


/**
 * Using normals or not?
 */
#define USE_NORMALS	    1

/**
 * Using textures or not?
 */
#define USE_TEXTURES    1

/**
 * Using short indices for the vertex-data? Better not
 */
#define USE_16BIT_INDICES 0

/**
 * The size of a clipmap region
 * WARNING : if too big the graphics-card will be flooded and it won't work
 * On Linux it goes for me to 90, in windows it seems to go above 128
 */
#define REGIONSIZE 64

/**
 * The area of vertices to buffer.
 * If it is too small a return to previous vertices causes the vertices to be
 * 	read again from disk
 * If it is too big the memory will be needlessly filled
 */
#define BUFFERSIZE (((REGIONSIZE+2)>>1)+(REGIONSIZE+2))

/**
 * Just a macro for the ease of use. 
 * Gives the possible amount of vertices in a buffer
 */
#define BUFFERVOLUME (BUFFERSIZE*BUFFERSIZE)

/**
 * The size of the transition between two levels of detail
 * If too small the transition will be visible
 * If too big detail will be lost
 */
#define TRANSITION (REGIONSIZE/10)

/**
 * A macro for the ease of use.
 * Gives the minimum of the transitionsize and a given paramater (normally
 * 	the width or the height of the patch so small regions will cause no errors)
 */
#define TRANSITIONSIZE(x) min(TRANSITION,x+1)

/**
 * A macro for the ease of use.
 * Gives the amount of vertices in a clipmap-region (in a level) including the
 * 	hidden vertices
 */
#define REGIONSURF ((REGIONSIZE+1)*(REGIONSIZE+1))

/**
 * The maximum amount of vertices that may be updated
 * (This is a crude under estimate. It will always complete a region)
 */
#define MAXUPDATES (REGIONSURF)*6

/**
 * The size that has to be reserved for normals
 */
#if USE_NORMALS
	#define VERTEXSIZE2 3
#else
	#define VERTEXSIZE2 0
#endif

/**
 * The size that has to be reserved for normals
 * Not used
 */
#if USE_COLOURS
	#define COLOURSIZE (sizeof(Real)/sizeof(unsigned long))
#else
	#define COLOURSIZE 0
#endif

/**
 * The size that has to be reserved for texture-coordinates
 */
#if USE_TEXTURES
	#define VERTEXSIZE3 2
#else
	#define VERTEXSIZE3 0
#endif

/**
 * The size of a vertex
 */
#define VERTEXSIZE (3+VERTEXSIZE2+VERTEXSIZE3+COLOURSIZE)

/**
 * The size of a vertex using only usefull data
 */
#define SIMPLESIZE (3+VERTEXSIZE2+VERTEXSIZE3)

/**
 * The number of or vertices quads to be read at once from the inputfile for a
 * better throughput
 */
#define NBOFQUADSTOREAD (REGIONSIZE>>1)
#define NBOFVERTICESTOREAD NBOFQUADSTOREAD


} // namespace Ogre

#define BEGINX 0
#define BEGINY 600
#define BEGINZ 0

#define NBEXTRALVLS 0

#define CUBEA 0
#define CUBEB 6


#endif
