summaryrefslogtreecommitdiff
path: root/utils/vweightexp/vweightimp.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/vweightexp/vweightimp.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/vweightexp/vweightimp.h')
-rw-r--r--utils/vweightexp/vweightimp.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/utils/vweightexp/vweightimp.h b/utils/vweightexp/vweightimp.h
new file mode 100644
index 0000000..9a0e586
--- /dev/null
+++ b/utils/vweightexp/vweightimp.h
@@ -0,0 +1,130 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+//===================================================================
+// Useful macros
+//
+#define CONSTRUCTOR
+#define DESTRUCTOR
+
+#define EXPORT_THIS __declspec(dllexport)
+
+#define DEFAULT_EXT _T("vvw")
+
+#define FStrEq(sz1, sz2) (strcmp((sz1), (sz2)) == 0)
+
+
+//===================================================================
+// Class that implements the scene-export.
+//
+class VWeightImportClass : public SceneImport
+{
+ // friend BOOL CALLBACK ImportOptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
+ // friend class DumpModelTEP;
+ // friend class DumpDeformsTEP;
+
+public:
+ CONSTRUCTOR VWeightImportClass (void);
+ DESTRUCTOR ~VWeightImportClass (void);
+
+ // Required by classes derived from SceneExport
+ virtual int ExtCount (void) { return 1; }
+ virtual const TCHAR* Ext (int i) { return DEFAULT_EXT; }
+ virtual const TCHAR* LongDesc (void) { return _T("Valve Skeletal Model Exporter for 3D Studio Max"); }
+ virtual const TCHAR* ShortDesc (void) { return _T("Valve VVW"); }
+ virtual const TCHAR* AuthorName (void) { return _T("Valve, LLC"); }
+ virtual const TCHAR* CopyrightMessage(void) { return _T("Copyright (c) 1998, Valve LLC"); }
+ virtual const TCHAR* OtherMessage1 (void) { return _T(""); }
+ virtual const TCHAR* OtherMessage2 (void) { return _T(""); }
+ virtual unsigned int Version (void) { return 201; }
+ virtual void ShowAbout (HWND hWnd) { return; }
+ // virtual int DoExport (const TCHAR *name, ExpInterface *ei, Interface *i);
+ virtual int DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BOOL suppressPrompts=FALSE); // Export file
+
+ MaxNode m_SrcMaxNode[512]; // array of nodes
+ long m_cSrcMaxNodes; // # of nodes
+
+ MaxVertWeight *m_SrcMaxVertex[10000];
+ long m_cSrcMaxVertex;
+
+ MaxNode m_MaxNode[512]; // array of nodes
+ long m_cMaxNodes; // # of nodes
+
+ int m_iToSrc[512]; // translate src nodes to local bones
+
+ // Animation metrics (gleaned from 3dsMax and cached for convenience)
+ Interval m_intervalOfAnimation;
+ TimeValue m_tvStart;
+ TimeValue m_tvEnd;
+ int m_tpf; // ticks-per-frame
+
+private:
+ void CollectNodes( INode *pnode );
+ void NodeEnum( INode *node );
+ int UpdateModel( INode *node );
+ void CollectWeights(int iVertex, MaxVertWeight *pweight);
+ void RemapSrcWeights( void );
+
+ IPhyContextExport *m_mcExport;
+ IPhysiqueExport *m_phyExport;
+ Modifier *m_phyMod;
+ Modifier *m_bonesProMod;
+ BonesPro_WeightArray *m_wa;
+
+};
+
+
+//===================================================================
+// Basically just a ClassFactory for communicating with 3DSMAX.
+//
+class VWeightImportClassDesc : public ClassDesc
+{
+public:
+ int IsPublic (void) { return TRUE; }
+ void * Create (BOOL loading=FALSE) { return new VWeightImportClass; }
+ const TCHAR * ClassName (void) { return _T("VWeightImport"); }
+ SClass_ID SuperClassID (void) { return SCENE_IMPORT_CLASS_ID; }
+ Class_ID ClassID (void) { return Class_ID(0x554b1092, 0x206a444f); }
+ const TCHAR * Category (void) { return _T(""); }
+};
+
+
+//===================================================================
+// Tree Enumeration Callback
+// Collects the nodes in the tree into the global array
+//
+class UpdateNodesTEP : public ITreeEnumProc
+{
+public:
+ virtual int callback(INode *node);
+ VWeightImportClass *m_phec;
+};
+
+
+//===================================================================
+// Tree Enumeration Callback
+// Dumps the triangle meshes to a file.
+//
+class UpdateModelTEP : public ITreeEnumProc
+{
+public:
+ virtual int callback(INode *node);
+ void cleanup(void);
+ // FILE *m_pfile; // write to this file
+ TimeValue m_tvToDump; // dump snapshot at this frame time
+ VWeightImportClass *m_phec;
+ IPhyContextExport *m_mcExport;
+ IPhysiqueExport *m_phyExport;
+ Modifier *m_phyMod;
+ Modifier *m_bonesProMod;
+ BonesPro_WeightArray *m_wa;
+private:
+ void CollectWeights( int iVertex, MaxVertWeight *pweight );
+};
+
+