home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 8090 / ModelEdit.7z / PieceMerge.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-08  |  1.3 KB  |  41 lines

  1. #ifndef PIECEMERGE_H
  2. #define PIECEMERGE_H
  3.  
  4. #pragma once
  5.  
  6. #include <vector>
  7. #include <list>
  8.  
  9.  
  10. class CPieceMerge
  11. {
  12. public:
  13.     CPieceMerge( Model* model, std::vector<ModelPiece*>& pieces );
  14.     ~CPieceMerge();
  15.  
  16.     // merge the pieces and return the number of resulting pieces
  17.     uint32 Merge();
  18.  
  19. private:
  20.     Model* m_Model;                                // pointer to the model
  21.     std::list<ModelPiece*> m_Pieces;            // list of pieces yet to be merged
  22.     std::vector<ModelPiece*> m_OriginalPieces;    // original pieces in order
  23.  
  24.     // get a list of pieces that can be merged with the first piece in the list and remove them from the list of pieces waiting to be merged
  25.     // returns false if no pieces were mergeable with the first piece in the list
  26.     bool GetMergeablePieces( std::list<ModelPiece*>& pieces );
  27.  
  28.     // returns true if two model pieces are mergeable
  29.     bool ArePiecesMergeable( ModelPiece* a, ModelPiece* b );
  30.  
  31.     // merge these pieces into one and delete the original pieces (must be mergeable pieces)
  32.     bool MergePieces( std::list<ModelPiece*>& pieces );
  33.  
  34.     // fix vertex animation piece mappings that were trampled in the merge
  35.     bool RemapVertexAnimations();
  36.     void RemapVertexAnimationsRecurse( AnimNode* curNode, uint32 newOriginal, uint32 newIndex );
  37. };
  38.  
  39.  
  40. #endif // PIECEMERGE_H
  41.