///////////////////////////////////////////////////////////////////////////////
/// @file deActorMesh.hpp
///
/// @brief This header file contains ONLY mesh routines for the Actor class
///
/// @author mittens
///
/// 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 May 2004
/// @author Trent 'mittens' Polack (trent@polycat.net)
/// @remarks Early on in development. Don't fuck with the mistakes OR YOU DIE!
///////////////////////////////////////////////////////////////////////////////
#ifndef DEACTOR_PRIV_H
#define DEACTOR_PRIV_H

#include "deActor.hpp"
#include "deResource_Helper.hpp"

class IdeSurface;
class IdeFile;

//structure for holding an MS3D mesh group (the mesh is divided into several groups)
struct deActorSubMesh {
	int m_materialIndex;
	int m_numTriangles;
	int *m_pTriangleIndices;
};

//vertex structure for the mesh (each vertex is assigned a bone ID to correspond with the vertex)
struct deActorMeshVertex {
	char m_boneID;	// for skeletal animation
	float m_location[3];
};

//structure for a triangle on the mesh
struct deActorMeshTriangle {
	float m_vertexNormals[3][3];
	float m_s[3], m_t[3];
	int m_vertexIndices[3];
};

//=========================================================
// deActorMesh
//=========================================================
class deActorMesh {
protected:
	deActorSubMesh *m_pSubMeshes;
	deActorMeshVertex *m_pVertices;
	deActorMeshTriangle *m_pTriangles;
	IdeSurface *m_pMaterials;

	int m_numMeshes;
	int m_numMaterials;
	int m_numTriangles;
	int m_numVertices;

public:

	bool LoadMeshData( const char *filename );
	void Render( );
//	void reloadTextures();

deActorMesh( );
~deActorMesh( );
};

//class that contains (or will contain, anyway) the skeletal stuff for the deActor module
class deActorSkeleton {

public:

deActorSkeleton( ) {	}
~deActorSkeleton( ) {	}
};

class deActorDef : public IdeActorDef, public deResourceBase
{
public:
	deActorDef();
	deActorDef(const char *filename);
	void * GetRscInterface(long interface_id);

	deBoolean LoadActorFile(IdeFile *file);

	static long s_ActorRscInterfaceID;
	
protected:
	// call IdeResourceBase::Release instead
	virtual ~deActorDef();
};

#endif	//DEACTOR_PRIV_H