//===========================================================================//
// File:	BatchExp.h                                                 
// Project: MechWarrior 4
// Contents: Plugin to adjust height of max anmiations
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 04/28/99  JSE  Initial coding, 
// 05/10/00  fwang
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Fasa Interactive, Inc.
// All Rights reserved worldwide
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL
//===========================================================================//

#if !defined(AFX_BATCHEXPORT_H__68E70A2D_B863_11D1_98AD_0040051EDCE7__INCLUDED_)
#define AFX_BATCHEXPORT_H__68E70A2D_B863_11D1_98AD_0040051EDCE7__INCLUDED_

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

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif


class BatchExp;

#include "AnimationSuite.h"
#include "ArmatureExport.h"

#include <Stuff\StuffHeaders.hpp>


class LODNODE
{
public:
	LODNODE();
	~LODNODE();
	CString name;
	LODNODE *pChild;
	LODNODE *pNext;
};

class BatchExp : public SceneExport 
{
public:
    BatchExp():m_exp("") {}
    ~BatchExp() {}

    int ExtCount() { return 1; }
    const TCHAR * Ext(int n)
    {
        switch(n) {
        case 0:
            // This cause a static string buffer overwrite
            // return GetString(IDS_EXTENSION1);
            return _T("Batch");
        }
        return _T("");
    }

    const TCHAR * LongDesc() { return GetString(IDS_LONGDESC); }
    const TCHAR * ShortDesc() {	return _T("MW4 Batch"); }
    const TCHAR * AuthorName() { return _T("Jerry Edsall,Thomas Steinke"); }
    const TCHAR * CopyrightMessage() { return GetString(IDS_COPYRIGHT); }
    const TCHAR * OtherMessage1() {	return _T(""); }
    const TCHAR * OtherMessage2() {	return _T(""); }
    unsigned int Version() { return 100; }
    void ShowAbout(HWND hWnd) {
	    CAbout dlg;
	    dlg.DoModal();
    }

    int	DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE,DWORD options=0);
	int	DoExportWrap(const TCHAR *name,ExpInterface *ei,Interface *i, bool suppressPrompts=FALSE);

	typedef enum ALIGNFLAG {AlignX=1, AlignY=2} ALIGNFLAG;

protected:
	CString m_export_directory;
	int m_current_export;
	int m_total_exports;
	Interface *m_ip;
	bool m_bIsChar;
	ALIGNFLAG m_billBoardAlign;
	int m_nBillBoardStartLOD;
	BaseGeoExporter m_exp;
	bool m_bLogStates;
	bool m_bFlatShading;
	bool m_bSetUniqueYes;

private:
	int EditPage(Page *page);
	int ExportPage(Page *page, Page *log_page=NULL);
	int ExportShape(Page *page, Page *log_page=NULL);
	int ExportObb(Page *page, Page *log_page=NULL);;
	int ExportLODShape(Page *page, Page *log_page=NULL);
	int ExportLODSkel(Page *page, Page *log_page=NULL);
	int ExportChar(Page *page, Page *log_page=NULL);
	int ExportAnim(Page *page, Page *log_page=NULL);
	int ExportMLRShape(Page *page, Page *log_page=NULL);
	int ExportBuildingData(Page *page);
	int ExportBuildingDamage(Page *page);
	int ExportBuildingSubsystems(Page *page);
	int ExportBuildingTorso(Page *);
	int ExportBuildingInstance(Page *page);
	int ExportMechData(Page *page);
	int ExportMechSubsystems(Page *page);
	int ExportMechDamage(Page *page);
	int ExportMechInstance(Page *page);
	int ExportVehicleData(Page *page);
	int ExportVehicleDamage(Page *page);
	int ExportVehicleSubsystems(Page *page);
	int ExportVehicleTorso(Page *page);
	int ExportVehicleInstance(Page *pagepage);
	int WriteDataFile(int resourceID, CString fileName, CString strReplace);

	bool LoadPlugCfg(Interface *i);
	bool MakeLightLODAndRemoveFromScene(CString file_name, CString strHintFile, CMapWordToPtr* lightLOD, int iLod);
	int	SaveMapLOD(CMapWordToPtr *,CString *,const CString&,Page *log_page=NULL);
	int MakeMapLOD(CString,int totalLODs,CString LodNames[MAXLODLEVELS],CString levels[MAXLODLEVELS],CString strHintFile,CMapStringToPtr *pTransInfo,CString strExtension,Page *log_page=NULL,CString strContains="");
	int MakeAllLODMeshs(CString,Proxies::GenericProxy *proxy,Interface *ip,CMapStringToOb *pMapNames,int iLod,CMapStringToPtr *pTransInfo,CString strContains="");
	int WriteOutLODMesh(CString,Proxies::GenericProxy *proxy, Interface *ip,CMapStringToOb *pMapNames,int iLod,CMapStringToPtr *pTransInfo);
	void WriteOBBInfo(Page* newpage, CString name);
	int MakeMegaTexture(CString strHintFile, CString hint);
	int CoalesceMegaTexture(MAXProxies::MAXScene *max_scene, ElementProxies::ElementSceneProxy *element_scene, CString hint);
	const CString GetMegaTextureHint(const CString& pagename);
	const CString GetDamagedMegaTextureHint(const CString& pagename);
	void LoadBillBoardInfo(Page* page);
	int GetEntryList(Page* page, const CString& entryName, CString entries[]);
	int GetEntryList(Page* page, const CString& entryName, int entries[]);
	void WriteSummary(Stuff::NotationFile *pLogFile);
	void LogStats(int ilod, Stuff::Scalar farDist, MidLevelRenderer::MLRShape *mlrShape, const CString& filename, Page* log_page);
};

/////////////////////////////////////////////////////////////////////////////


//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ANIMEXPORT_H__68E70A2D_B863_11D1_98AD_0040051EDCE7__INCLUDED_)
