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

  1.  
  2. // This module does the work of generating model LODs.
  3.  
  4. #ifndef __NEWGENLOD_H__
  5. #define __NEWGENLOD_H__
  6.  
  7.  
  8.     #include "model.h"
  9.  
  10.     
  11.     class LODRequestInfo
  12.     {
  13.     public:
  14.         // Desired number of triangles at this LOD.
  15.         DWORD        m_nTris;
  16.  
  17.         // Distance this LOD occurs at.
  18.         float        m_Dist;
  19.  
  20.     
  21.     // Don't fill this stuff in.. used by BuildLODs..
  22.     public:
  23.  
  24.         BOOL        m_bProcessed;
  25.     };
  26.  
  27.     
  28.     class BuildLODRequest
  29.     {
  30.     public:
  31.  
  32.                         BuildLODRequest()
  33.                         {
  34.                             m_pModel = NULL;
  35.                             m_MaxEdgeLength = 100.0f;
  36.                             m_nMinPieceTris = 6;
  37.                         }
  38.  
  39.  
  40.         float            GetPieceWeight(DWORD i)
  41.         {
  42.             return (i >= m_PieceWeights.GetSize()) ? 1.0f : m_PieceWeights[i];
  43.         }
  44.  
  45.     public:
  46.     
  47.         Model            *m_pModel;
  48.  
  49.         // A weight on the edge length for each piece (so if a piece has a higher weight,
  50.         // its triangles will be collapsed last).
  51.         // Use GetPieceWeight to be safe...
  52.         CMoArray<float>                m_PieceWeights;
  53.  
  54.         // Tells how to generate each LOD.
  55.         CMoArray<LODRequestInfo>    m_LODInfos;
  56.         
  57.         // It won't collapse edges larger than this value
  58.         // (unless it has to...)
  59.         float            m_MaxEdgeLength;
  60.  
  61.         // It won't create edge collapses when pieces get <= this number of triangles
  62.         // (unless it has to...)
  63.         DWORD            m_nMinPieceTris;
  64.     };
  65.  
  66.  
  67.     BOOL BuildLODs(BuildLODRequest *pRequest);
  68.  
  69.  
  70. #endif
  71.  
  72.  
  73.  
  74.  
  75.