"L. Spiro Engine"
|
00001 00019 #ifndef __LSC_MISC_H__ 00020 #define __LSC_MISC_H__ 00021 00022 #include "../LSCCompressionLib.h" 00023 #include "../BitStream/LSCBitStream.h" 00024 #include "Vector/LSMVector2.h" 00025 #include "Vector/LSMVector3.h" 00026 #include "Vector/LSTLVectorPoD.h" 00027 00028 namespace lsc { 00029 00039 class CMisc { 00040 public : 00041 // == Types. 00045 typedef CVectorPoD<LSUINT8, LSUINT32, 1048576UL>LSC_BUFFER; 00046 00047 00048 // == Functions 00060 static LSBOOL LSE_CALL CompressNormals( const CVector3 * _pvIn, LSUINT32 _ui32Total, 00061 CVectorPoD<CVector2, LSUINT32> &_vOut, 00062 lsc::CBitStream &_bsSigns ); 00063 00072 static LSVOID LSE_CALL DecompressNormals( const CVector2 * _pvNormal2d, 00073 const lsc::CBitStream &_bsSigns, LSUINT32 _ui32Total, 00074 CVector3 * _pvOut ); 00075 00086 static LSBOOL LSE_CALL Compress( const LSUINT8 * _pui8Input, LSUINT32 _ui32Length, LSUINT32 _ui32Bits, lsc::CBitStream &_bsStream, LSUINT32 _ui32MaxSize = ~0UL ); 00087 00097 static LSBOOL LSE_CALL CompressBest( const LSUINT8 * _pui8Input, LSUINT32 _ui32Length, LSUINT32 &_ui32Bits, lsc::CBitStream &_bsStream ); 00098 00107 static LSBOOL LSE_CALL CompressToBuffer( const LSUINT8 * _pui8Input, LSUINT32 _ui32Length, LSC_BUFFER &_bBuffer ); 00108 00118 static LSBOOL LSE_CALL DecompressToBuffer( const LSVOID * _pvData, LSUINTPTR _uiptrSize, LSC_BUFFER &_bBuffer ); 00119 00128 static LSBOOL LSE_CALL DecompressToBuffer( const lsstd::IStream &_isStream, LSC_BUFFER &_bBuffer ); 00129 00138 static LSBOOL LSE_CALL CompressIndices( const LSUINT32 * _pui32Input, LSUINT32 _ui32Length, lsc::CBitStream &_bsStream ); 00139 00147 static LSBOOL LSE_CALL DecompressIndices( const lsc::CBitStream &_bsStream, LSC_BUFFER &_bBuffer ); 00148 00157 static LSBOOL LSE_CALL CompressIndicesToBuffer( const LSUINT32 * _pui32Input, LSUINT32 _ui32Length, LSC_BUFFER &_bBuffer ); 00158 00167 static LSBOOL LSE_CALL DecompressIndicesToBuffer( const LSVOID * _pvData, LSUINTPTR _uiptrSize, LSC_BUFFER &_bBuffer ); 00168 00176 static LSBOOL LSE_CALL DecompressIndicesToBuffer( const lsstd::IStream &_isStream, LSC_BUFFER &_bBuffer ); 00177 00178 00179 protected : 00180 // == Functions. 00189 static LSBOOL LSE_CALL WriteBytes( const LSUINT8 * _pui8Bytes, LSUINT32 _ui32Length, LSC_BUFFER &_bBuffer ); 00190 00198 static LSBOOL LSE_CALL WriteUChar( LSUINT8 _ui8Val, LSC_BUFFER &_bBuffer ); 00199 00207 static LSBOOL LSE_CALL WriteUInt( LSUINT32 _ui32Val, LSC_BUFFER &_bBuffer ); 00208 00215 static LSUINT32 LSE_CALL GetBitsNeededForSignedValue( LSINT32 _i32Value ); 00216 00224 static LSINT32 LSE_CALL GetSignedValue( const lsc::CBitStream &_bsStream, LSUINT32 _ui32Bits ); 00225 }; 00226 00227 } // namespace lsc 00228 00229 #endif // __LSC_MISC_H__