daily pastebin goal
7%
SHARE
TWEET

The code that reads the lod data....

a guest Dec 10th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool rmv2_file::readLodData(string strFileName)
  2. {
  3.     for (int lod = 0; lod < m_File.FileHeader.LodsCount; lod++)
  4.     {
  5.        
  6.         for (int group = 0; group < m_File.PPLodHeaders[lod].GroupsCount; group++)
  7.         {
  8.             //uint32 uiMaterialId;      // 4 Bytes[UInt32] - ? // Looks like and ID or a flag, it's always 65 for the moment.
  9.             m_File.LodData[lod][group] = new _RMV2_Lod_Data;
  10.  
  11.             readBuffer(&m_File.LodData[lod][group]->Header, sizeof(_RMV2_Lod_Data_Header));
  12.  
  13.            
  14.             //**** read supplementary bones
  15.             for (int i = 0; i < m_File.LodData[lod][group]->Header.uiSupplementarBonesCount; i++)
  16.             {
  17.                 m_File.LodData[lod][group]->PSupplementaryBone_Data[i] = new _RMV2_SupplementaryBone_Data;
  18.                 readBuffer(m_File.LodData[lod][group]->PSupplementaryBone_Data[i], sizeof(_RMV2_SupplementaryBone_Data));
  19.             }
  20.  
  21.             // *****  read textures info
  22.             for (int i = 0; i < m_File.LodData[lod][group]->Header.uiTextureCount; i++)
  23.             {
  24.                 m_File.LodData[lod][group]->PTextureData[i] = new _RMV2_Texture_Data;
  25.                 readBuffer(m_File.LodData[lod][group]->PTextureData[i], sizeof(_RMV2_Texture_Data));
  26.             }
  27.            
  28.             //  jump over that "padding"           
  29.             seekBuffer(4, seek_direction::seek_forward);
  30.             if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::tiled_dirtmap)
  31.                 seekBuffer(16, seek_direction::seek_forward);  // file.seekg(16, ios_base::cur);
  32.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::decal
  33.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_decal
  34.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_decal)
  35.                 seekBuffer(20, seek_direction::seek_forward); // file.seekg(20, ios_base::cur);
  36.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::dirtmap
  37.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_dirtmap
  38.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_dirtmap)
  39.                 seekBuffer(32, seek_direction::seek_forward); // file.seekg(32, ios_base::cur);
  40.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::decal_dirtmap
  41.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_decal_dirtmap
  42.                 || m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::weighted_skin_decal_dirtmap)
  43.                 seekBuffer(52, seek_direction::seek_forward); // file.seekg(52, ios_base::cur);
  44.             else if (m_File.LodData[lod][group]->Header.uiMaterialId == RigidMaterial::tree)
  45.                 seekBuffer(56, seek_direction::seek_forward); // file.seekg(56, ios_base::cur);
  46.             seekBuffer(4, seek_direction::seek_forward); // "alpha mode"
  47.            
  48.             //jump over vertices
  49.             //seekBuffer(vertex_size * m_File.LodData[lod][group]->Header.uiVerticesCount, seek_direction::seek_forward );
  50.             dword vertex_size = 0;
  51.             dword indice_size = 6;
  52.  
  53.             switch (m_File.LodData[lod][group]->Header.wVertexFormat)
  54.             {
  55.                 case vertex_format::default_format: vertex_size = 32;
  56.                     break;
  57.                 case vertex_format::weighted_format: vertex_size = 28;
  58.                     break;
  59.                 case vertex_format::cinematic_format: vertex_size = 32;
  60.            
  61.             }
  62.                
  63.             for (size_t k = 0; k < m_File.LodData[lod][group]->Header.uiIndicesCount/3; ++k)
  64.                 seekBuffer(6,  seek_direction::seek_forward);
  65.                
  66.             //for (size_t k = 0; k < m_File.LodData[lod][group]->Header.uiVerticesCount; ++k)
  67.             seekBuffer(vertex_size * m_File.LodData[lod][group]->Header.uiVerticesCount, seek_direction::seek_forward);
  68.                        
  69.         }
  70.     }
  71.     //26044
  72.    
  73.     return true;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top