?? max2nmo.h
字號:
//**************************************************************************
//* Max2Nmo.h - Virtools File Exporter
//*
//* Romain Sididris - Copyright (c) Virtools 2000
//*
//* (Based on Ascii File Exporter source code
//* By Christer Janson
//* Kinetix Development
//* Copyright (c) Kinetix 1997, All Rights Reserved. )
//*
//* Class Definition
//*
//***************************************************************************
//#define _USESCRIPTS_
extern ClassDesc* GetAsciiExpDesc();
extern ClassDesc* GetVirtoolsToolDesc();
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define VERSION 150 // Version number * 100
#define CFGFILENAME _T("Max2NmoV.CFG") // Configuration file
struct TextureUVGen {
BOOL TileU,TileV;
BOOL MirrorU,MirrorV;
BOOL Cropping;
float UOffset,VOffset;
float UScale,VScale;
float AngleMap;
float UCropOffset,VCropOffset;
float UCropScale,VCropScale;
TextureUVGen() {
TileU = TileV = MirrorU = MirrorV = Cropping = FALSE;
UOffset = VOffset = AngleMap = UCropOffset =VCropOffset = 0.0f;
UScale = VScale = UCropScale = VCropScale = 0.0f;
}
};
struct NodeMeshMtl {
void* mesh;
Mtl* mtl;
CKMesh* CKMesh;
};
class MtlKeeper {
public:
BOOL AddMtl(Mtl* mtl);
int GetMtlID(Mtl* mtl);
int Count();
Mtl* GetMtl(int id);
Tab<Mtl*> mtlTab;
};
// This is the main class for the exporter.
class Max2Nmo : public SceneExport {
public:
Max2Nmo();
~Max2Nmo();
// SceneExport methods
int ExtCount(); // Number of extensions supported
const TCHAR * Ext(int n); // Extension #n (i.e. "Nmo")
const TCHAR * LongDesc(); // Long ASCII description (i.e. "Virtools Export")
const TCHAR * ShortDesc(); // Short ASCII description (i.e. "Virtools")
const TCHAR * AuthorName(); // ASCII Author name
const TCHAR * CopyrightMessage(); // ASCII Copyright message
const TCHAR * OtherMessage1(); // Other message #1
const TCHAR * OtherMessage2(); // Other message #2
unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301)
void ShowAbout(HWND hWnd); // Show DLL's "About..." box
int DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); // Export file
BOOL SupportsOptions(int ext, DWORD options);
//-------------------------------------------------------------
// Other methods
// Register All Special Parameters
BOOL RegisterAllSpecialParameters();
// Really Export
int ReallyDoExport(const TCHAR *name, Interface *inf, BOOL sel );
#ifdef _USESCRIPTS_
// Evaluate User Defined Properties
BOOL evaluateNodeUserDefinedProperties( INode* node );
#endif
// Node enumeration
BOOL nodeEnum(INode* node);
void PreProcess(INode* node, int& nodeCount);
void PostProcess(INode* node);
// High level export
void ExportMaterialList();
void ExportGeomObject(INode* node);
void ExportLightObject(INode* node);
void ExportCameraObject(INode* node);
void ExportShapeObject(INode* node);
void ExportHelperObject(INode* node);
// Mid level export
void ExportMesh(INode* node,CK3dEntity* ent);
void ExportPatchMesh(INode* node,CK3dEntity* ent);
void ExportAnimKeys(INode* node,CK3dEntity* ent);
void ExportAnimMesh(INode* node);
BOOL ExportSkinnedMesh(INode* node,CK3dEntity* ent);
BOOL ExportPhysiqueMesh(INode* node,CK3dEntity* ent);
#ifndef MAX42
BOOL ExportPhysiqueMeshCS312(INode* node,CK3dEntity* ent);
#endif
BOOL ExportPhysiqueMeshCS300(INode* node,CK3dEntity* ent);
void ExportIKJoints(INode* node);
void ExportNodeBase(INode* node,CK3dEntity* entity);
// Low level export
void DumpMaterial(Mtl* mtl);
void DumpUVGen(StdUVGen* uvGen);
// Animation
void DumpSampledAnim(INode* node,CKObjectAnimation* anim); // In case of sampling
void DumpPosKeys(Control* cont,CKObjectAnimation* anim); // In case of supported PositionController
void DumpRotKeys(Control* cont,CKObjectAnimation* anim); // In case of supported RotationController
void DumpScaleKeys(Control* cont,CKObjectAnimation* anim); // In case of supported ScaleController
void DumpMeshMorphKey(CKMorphController* ctrl,INode* node,TimeValue t);
void DumpPatchMeshMorphKey(CKMorphController* ctrl,INode* node,TimeValue t);
// Misc utility methods
Point3 GetVertexNormal(Mesh* mesh, int faceNo, RVertex* rv);
void make_face_uv(Face *f, VxUV *tv);
BOOL TMNegParity(Matrix3 &m);
BOOL CheckForAnimation(INode* node, BOOL& pos, BOOL& rot, BOOL& scale,BOOL& scaleAxis);
BOOL IsKnownController(Control* cont);
void ConvertMaxMatrix2Virtools(Matrix3 &m, VxMatrix& WM);
void ConvertMaxLightMatrix2Virtools(Matrix3 &m, VxMatrix& WM);
Modifier* FindSkinModifier (INode* node);
#ifndef MAX42
Modifier* FindSkinModifierCS312 (INode* node);
#endif
Modifier* FindSkinModifierCS300 (INode* node);
Modifier* FindPhysiqueModifier (INode* node);
#ifndef MAX42
Modifier* FindPhysiqueModifierCS312 (INode* node);
#endif
Modifier* FindPhysiqueModifierCS300 (INode* node);
TriObject* GetTriObjectFromNode(INode *node, TimeValue t, int &deleteIt);
PatchObject* GetPatchObjectFromNode(INode *node,TimeValue t,int &deleteIt);
SplineShape* GetSplineShapeFromNode(INode *node,TimeValue t,int &deleteIt);
Matrix3 GetNodeOffsetTM(INode* node);
Mtl* GetMaterialByIndex(Mtl *pMtl,DWORD MatId,int MapChannel, void*& returnedKey );
BOOL GetTextureUvGen(Mtl* pMtl,TextureUVGen& uvgen);
void ApplyUvGen(VxUV& uv,TextureUVGen& uvgen,BOOL useUVGen);
// Configuration file IO methods
TSTR GetCfgFilename();
BOOL ReadConfig();
void WriteConfig();
// Interface to member variables
inline BOOL GetShowProgressionBar() { return bShowProgressionBar; }
inline BOOL GetExportAsObjects() { return bExportAsObjects; }
inline BOOL GetExportAsCharacter() { return bExportAsCharacter; }
inline BOOL GetExportAsAnimationOnly() { return bExportAsAnimationOnly; }
inline BOOL GetConvertPhysiqueToSkin() { return bConvertPhysiqueToSkin; }
inline BOOL GetStoreOnlyFilenames() { return bStoreOnlyTextureFilenames; }
inline BOOL GetRescaleScene() { return bRescaleScene; }
inline BOOL GetSaveBipedGeom() { return bSaveBipedGeom; }
inline BOOL GetGroupAsPlace() { return bGroupAsPlace; }
inline BOOL GetSelectionAsGroup() { return bSelectionAsGroup; }
inline TSTR GetCharacterName() { return szCharacterName.Str(); }
inline TSTR GetAnimationName() { return szAnimationName.Str(); }
inline int GetMeshFrameStep() { return nMeshFrameStep; }
inline int GetKeyFrameStep() { return nKeyFrameStep; }
inline int GetStaticFrame() { return 0; }
inline int GetCompressionLevel() { return nCompressionLevel; }
inline int GetReportLevel() { return nReportLevel; }
inline Interface* GetInterface() { return ip; }
inline BOOL GetAlignAnimOnZ() { return bAlignAnimOnZ; }
inline void SetShowProgressionBar(BOOL v) { bShowProgressionBar = v; }
inline void SetExportAsObjects(BOOL v) { bExportAsObjects = v ; }
inline void SetExportAsCharacter(BOOL v) { bExportAsCharacter = v ; }
inline void SetExportAsAnimationOnly(BOOL v) { bExportAsAnimationOnly = v ; }
inline void SetConvertPhysiqueToSkin(BOOL v) { bConvertPhysiqueToSkin = v ; }
inline void SetStoreOnlyFilenames(BOOL v) { bStoreOnlyTextureFilenames = v ; }
inline void SetRescaleScene (BOOL v) { bRescaleScene = v ; }
inline void SetSaveBipedGeom(BOOL v) { bSaveBipedGeom = v ; }
inline void SetGroupAsPlace(BOOL v) { bGroupAsPlace = v ; }
inline void SetSelectionAsGroup(BOOL v) { bSelectionAsGroup = v ; }
inline void SetCharacterName(char* v) { szCharacterName = XString(v) ; }
inline void SetAnimationName(char* v) { szAnimationName = XString(v) ; }
inline void SetMeshFrameStep(int v) { nMeshFrameStep = v ; }
inline void SetKeyFrameStep(int v) { nKeyFrameStep = v ; }
inline void SetCompressionLevel(int v) { nCompressionLevel = v ; }
inline void SetReportLevel(int v) { nReportLevel = v ; }
inline void SetbAlignAnimOnZ(BOOL v) { bAlignAnimOnZ = v ; }
inline void CopyUV(void* UVDest,void* UVSrc) {
DWORD* Dst = (DWORD*)UVDest; DWORD* Src = (DWORD*)UVSrc;
*(Dst++) = *(Src++); *Dst = *Src;
}
inline float FrameTime(TimeValue t) { return ((float )t-m_StartFrame)*m_InvFrameRate; }
CKMesh* IsMeshInstance(void* mesh,Mtl* mtl);
void InsertNewMeshInstance(void* mesh,Mtl* mtl,CKMesh* ckmesh);
XArray<char> ReportBuffer;
void RescaleScene();
XString StrGroupIndent();
private:
BOOL bShowProgressionBar;
BOOL bExportAsObjects;
BOOL bExportAsCharacter;
BOOL bExportAsAnimationOnly;
BOOL bConvertPhysiqueToSkin;
BOOL bStoreOnlyTextureFilenames;
BOOL bRescaleScene;
BOOL bSaveBipedGeom;
BOOL bGroupAsPlace;
BOOL bSelectionAsGroup;
BOOL bAlignAnimOnZ;
XString szCharacterName;
XString szAnimationName;
int nMeshFrameStep;
int nKeyFrameStep;
int nCompressionLevel;
int nReportLevel;
Interface* ip;
int nTotalNodeCount;
int nCurNode;
float m_StartFrame,m_EndFrame,m_InvFrameRate;
MtlKeeper mtlList;
Export2Virtools* VirtoolsExporter;
CKContext* VirtoolsContext;
XList<CKGroup*> CKGroups;
int GroupIndent;
XArray<NodeMeshMtl> MeshTable;
CKObjectArray *m_VirtoolsObjects;
int ReportBufferPos;
void Report(int InfoLevel,char *format, ...);
//--- Hash table to retrieve Base Diffuse Material of Lightmap Shaders
XHashTable< Mtl*, XString, XHashFun<XString> > m_lightmapBaseMaterials;
};
#define REPORT_NONE 0
#define REPORT_HLEVEL 1
#define REPORT_MLEVEL 2
#define REPORT_LLEVEL 3
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -