///////////////////////////////////////////////////////////////////////////////
/// @file deXLoader.hpp
///
/// @brief DirectX X file loading for meshes
///
/// @author Assassin
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Mar 2002
/// @author Assassin
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////

#ifndef DEXLOADER_HPP
#define DEXLOADER_HPP

#include <d3dx8.h>
#include <d3d8types.h>
#include "deGlobalTypes.hpp"
#include "deRenderStates.hpp"

struct deXTexture
{
char Texture_Name[252];
IdeRenderTexture * RenderTexture;
};

struct deXMaterial
{
D3DMATERIAL8 Mat8;
DWORD NumIndices;
long TextureIndex;
IdeRenderMaterial* deMat;
};

struct deXTexCoord
{
	float u;
	float v;
};

class deXMesh
{
public:
	DWORD NumVerts;
	DWORD NumIndices;
	D3DVECTOR * VertList;
	D3DVECTOR * NormList;
	deXTexCoord * CoordList;

	deXMesh * Child;
	deXMesh * Next;
	D3DMATRIX Matrix;

	DWORD NumMaterials;
	deXMaterial * MaterialList;
	WORD *Indices;

	deBoolean HasVerts;
	deBoolean HasNorms;
	deBoolean HasCoords;

	deXMesh ();
	~deXMesh ();
	void AddChild(deXMesh *pChildObject);
	void AddNext (deXMesh *pChildObject);
	void GenerateNormals();
};

extern "C" deXMesh * deXLoader_LoadX(char * filename);

#endif

