home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 5036 / source.7z / x_geom.h < prev    next >
Encoding:
C/C++ Source or Header  |  2012-02-05  |  2.3 KB  |  122 lines

  1. #ifndef __XENTAX_GEOM_H
  2. #define __XENTAX_GEOM_H
  3.  
  4. #define VERTEX_POSITION 0x1
  5. #define VERTEX_NORMAL   0x2
  6. #define VERTEX_UV       0x4
  7. #define VERTEX_WEIGHTS  0x8
  8.  
  9. #define FACE_FORMAT_UINT_08 0x1
  10. #define FACE_FORMAT_UINT_16 0x2
  11. #define FACE_FORMAT_UINT_32 0x4
  12.  
  13. #define FACE_TYPE_TRIANGLES   0x1
  14. #define FACE_TYPE_TRISTRIP    0x2
  15. #define FACE_TYPE_TRISTRIPCUT 0x4
  16.  
  17. struct VERTEX {
  18.  float vx, vy, vz;
  19.  float nx, ny, nz;
  20.  float tu, tv;
  21.  float w1, w2, w3, w4;
  22.  unsigned short b1, b2, b3, b4;
  23. };
  24.  
  25. struct VERTEX_BUFFER {
  26.  unsigned char flags;
  27.  uint32 elem;
  28.  boost::shared_array<VERTEX> data;
  29. };
  30.  
  31. struct INDEX_BUFFER {
  32.  unsigned char format;
  33.  unsigned char type;
  34.  string name;
  35.  uint32 reference;
  36.  uint32 elem;
  37.  boost::shared_array<char> data;
  38. };
  39.  
  40. /*
  41. ** GEOMETRY SUPPORT
  42. */
  43. struct VTX_BUFFER {
  44.  unsigned char flags;
  45.  uint32 elem;
  46.  boost::shared_array<VERTEX> data;
  47.  uint32 skeleton;
  48. };
  49.  
  50. typedef deque<VTX_BUFFER> VTXBLIST;
  51. typedef deque<VTX_BUFFER>::iterator VTXBLIST_ITERATOR;
  52.  
  53. struct IDX_BUFFER {
  54.  unsigned char format;
  55.  unsigned char type;
  56.  string name;
  57.  uint32 elem;
  58.  boost::shared_array<char> data;
  59.  uint32 material;
  60. };
  61.  
  62. typedef deque<IDX_BUFFER> IDXBLIST;
  63. typedef deque<IDX_BUFFER>::iterator IDXBLIST_ITERATOR;
  64.  
  65. /*
  66. ** MATERIAL SUPPORT
  67. */
  68. struct MATERIAL {
  69.  string id;      // identifier
  70.  uint32 basemap; // reference to texture id
  71.  uint32 specmap; // reference to texture id
  72.  uint32 bumpmap; // reference to texture id
  73.  uint32 normmap; // reference to texture id
  74. };
  75.  
  76. typedef deque<MATERIAL> MATERIAL_LIST;
  77. typedef deque<MATERIAL>::iterator MATERIAL_LIST_ITERATOR;
  78.  
  79. /*
  80. ** SKELETON SUPPORT
  81. */
  82. struct SKELETON {
  83.  std::string id;
  84.  JOINTTREE tree;
  85. };
  86.  
  87. typedef std::deque<SKELETON> SKELETON_LIST;
  88. typedef SKELETON_LIST SKELETON_LIST_ITERATOR;
  89.  
  90. /*
  91. ** TEXTURE SUPPORT
  92. */
  93. struct TEXTURE {
  94.  string id;
  95.  string filename;
  96. };
  97.  
  98. typedef deque<TEXTURE> TEXTURE_LIST;
  99. typedef TEXTURE_LIST::iterator TEXTURE_LIST_ITERATOR;
  100.  
  101. /*
  102. ** MESH SUPPORT
  103. */
  104. struct MESH {
  105.  VTX_BUFFER vertices;
  106.  deque<IDX_BUFFER> surfaces;
  107. };
  108.  
  109. struct GEOMETRY {
  110.  string id;
  111.  string name;
  112.  deque<boost::shared_ptr<MESH>> meshlist;
  113. };
  114.  
  115. /*
  116. ** BONE SUPPORT
  117. */
  118.  
  119. bool GeometryToOBJ(const char* path, const char* name, const deque<VERTEX_BUFFER>& vd, const deque<INDEX_BUFFER>& fd);
  120.  
  121. #endif
  122.