summaryrefslogtreecommitdiff
path: root/mdllib/mdllib_stripinfo.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 /mdllib/mdllib_stripinfo.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'mdllib/mdllib_stripinfo.h')
-rw-r--r--mdllib/mdllib_stripinfo.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/mdllib/mdllib_stripinfo.h b/mdllib/mdllib_stripinfo.h
new file mode 100644
index 0000000..e04d98c
--- /dev/null
+++ b/mdllib/mdllib_stripinfo.h
@@ -0,0 +1,127 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#ifndef MDLLIB_STRIPINFO_H
+#define MDLLIB_STRIPINFO_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "mdllib/mdllib.h"
+#include "mdllib_utils.h"
+#include "UtlSortVector.h"
+
+
+//
+// CMdlStripInfo
+// Implementation of IMdlStripInfo interface
+//
+class CMdlStripInfo : public IMdlStripInfo
+{
+public:
+ CMdlStripInfo();
+
+ //
+ // Serialization
+ //
+public:
+ // Save the strip info to the buffer (appends to the end)
+ virtual bool Serialize( CUtlBuffer &bufStorage ) const;
+
+ // Load the strip info from the buffer (reads from the current position as much as needed)
+ virtual bool UnSerialize( CUtlBuffer &bufData );
+
+ //
+ // Stripping info state
+ //
+public:
+ // Returns the checksums that the stripping info was generated for:
+ // plChecksumOriginal if non-NULL will hold the checksum of the original model submitted for stripping
+ // plChecksumStripped if non-NULL will hold the resulting checksum of the stripped model
+ virtual bool GetCheckSum( long *plChecksumOriginal, long *plChecksumStripped ) const;
+
+ //
+ // Stripping
+ //
+public:
+
+ //
+ // StripHardwareVertsBuffer
+ // The main function that strips the vhv buffer
+ // vhvBuffer - vhv buffer, updated, size reduced
+ //
+ virtual bool StripHardwareVertsBuffer( CUtlBuffer &vhvBuffer );
+
+ //
+ // StripModelBuffer
+ // The main function that strips the mdl buffer
+ // mdlBuffer - mdl buffer, updated
+ //
+ virtual bool StripModelBuffer( CUtlBuffer &mdlBuffer );
+
+ //
+ // StripVertexDataBuffer
+ // The main function that strips the vvd buffer
+ // vvdBuffer - vvd buffer, updated, size reduced
+ //
+ virtual bool StripVertexDataBuffer( CUtlBuffer &vvdBuffer );
+
+ //
+ // StripOptimizedModelBuffer
+ // The main function that strips the vtx buffer
+ // vtxBuffer - vtx buffer, updated, size reduced
+ //
+ virtual bool StripOptimizedModelBuffer( CUtlBuffer &vtxBuffer );
+
+ //
+ // Release the object with "delete this"
+ //
+public:
+ virtual void DeleteThis();
+
+
+
+public:
+ void Reset();
+
+
+public:
+ enum Mode
+ {
+ MODE_UNINITIALIZED = 0,
+ MODE_NO_CHANGE = 1,
+ MODE_STRIP_LOD_1N = 2,
+ };
+
+ //
+ // Internal data used for stripping
+ //
+public:
+ int m_eMode;
+ long m_lChecksumOld, m_lChecksumNew;
+ CGrowableBitVec m_vtxVerts;
+ CUtlSortVector< unsigned short, CLessSimple< unsigned short > > m_vtxIndices;
+
+ //
+ // Mesh ranges fixup
+ //
+public:
+ struct MdlRangeItem
+ {
+ /* implicit */ MdlRangeItem( int offOld = 0, int numOld = 0, int offNew = 0, int numNew = 0 ) :
+ m_offOld( offOld ), m_offNew( offNew ), m_numOld( numOld ), m_numNew( numNew ) {}
+
+ int m_offOld, m_offNew;
+ int m_numOld, m_numNew;
+
+ bool operator < ( MdlRangeItem const &x ) const { return m_offNew < x.m_offNew; }
+ };
+ CUtlSortVector< CMdlStripInfo::MdlRangeItem, CLessSimple< CMdlStripInfo::MdlRangeItem > > m_vtxMdlOffsets;
+
+};
+
+
+#endif // #ifndef MDLLIB_STRIPINFO_H