// Author : Chris Tolley
// Date   : 3/27/2004
// HeightData.h contains the class declaration for a container 
// that holds and provides access to height data to be used with
// a terrain class

#if !defined(AFX_HEIGHTDATA_H__5AE89250_226A_4E14_A6CB_5C969D6D6FF6__INCLUDED_)
#define AFX_HEIGHTDATA_H__5AE89250_226A_4E14_A6CB_5C969D6D6FF6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class HeightData  
{
public:
	// Constructor
	// bmpFile is the bitmap file containing the height data,
	// cols and rows are the resolution of the height data
	HeightData( const char* rawFile, int x, int z );

	// Destructor
	virtual ~HeightData();

	// Returns the number of rows in this height map
	virtual int getRows() const;

	// Returns the number of columns in this height map
	virtual int getColumns() const;

	// Height data access parameters
	unsigned char operator[] ( int n ) const;

	// This treats the single array like a 2d array
	inline unsigned char at( int x, int z ) const 
				{ return m_ucData[ z * m_iCols + x]; };
private:
	// Holds the height map data
	unsigned char* m_ucData;

	// Keeps the size of the height map data.
	int m_iSize;

	// The number of rows
	int m_iRows;
	// The number of colums
	int m_iCols;
};

#endif // !defined(AFX_HEIGHTDATA_H__5AE89250_226A_4E14_A6CB_5C969D6D6FF6__INCLUDED_)
