TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VMAP::GroupModel_Raw Struct Reference

#include <TileAssembler.h>

Public Member Functions

 GroupModel_Raw ()
 
 ~GroupModel_Raw ()
 
bool Read (FILE *f)
 

Public Attributes

uint32 mogpflags
 
uint32 GroupWMOID
 
G3D::AABox bounds
 
uint32 liquidflags
 
std::vector< MeshTriangletriangles
 
std::vector< G3D::Vector3vertexArray
 
class WmoLiquidliquid
 

Constructor & Destructor Documentation

VMAP::GroupModel_Raw::GroupModel_Raw ( )
inline
78  : mogpflags(0), GroupWMOID(0), liquidflags(0),
79  liquid(NULL) { }
uint32 GroupWMOID
Definition: TileAssembler.h:70
arena_t NULL
Definition: jemalloc_internal.h:624
class WmoLiquid * liquid
Definition: TileAssembler.h:76
uint32 mogpflags
Definition: TileAssembler.h:69
uint32 liquidflags
Definition: TileAssembler.h:73
VMAP::GroupModel_Raw::~GroupModel_Raw ( )
513  {
514  delete liquid;
515  }
class WmoLiquid * liquid
Definition: TileAssembler.h:76

Member Function Documentation

bool VMAP::GroupModel_Raw::Read ( FILE *  f)
428  {
429  char blockId[5];
430  blockId[4] = 0;
431  int blocksize;
432  int readOperation = 0;
433 
434  READ_OR_RETURN(&mogpflags, sizeof(uint32));
435  READ_OR_RETURN(&GroupWMOID, sizeof(uint32));
436 
437 
438  Vector3 vec1, vec2;
439  READ_OR_RETURN(&vec1, sizeof(Vector3));
440 
441  READ_OR_RETURN(&vec2, sizeof(Vector3));
442  bounds.set(vec1, vec2);
443 
444  READ_OR_RETURN(&liquidflags, sizeof(uint32));
445 
446  // will this ever be used? what is it good for anyway??
447  uint32 branches;
448  READ_OR_RETURN(&blockId, 4);
449  CMP_OR_RETURN(blockId, "GRP ");
450  READ_OR_RETURN(&blocksize, sizeof(int));
451  READ_OR_RETURN(&branches, sizeof(uint32));
452  for (uint32 b=0; b<branches; ++b)
453  {
454  uint32 indexes;
455  // indexes for each branch (not used jet)
456  READ_OR_RETURN(&indexes, sizeof(uint32));
457  }
458 
459  // ---- indexes
460  READ_OR_RETURN(&blockId, 4);
461  CMP_OR_RETURN(blockId, "INDX");
462  READ_OR_RETURN(&blocksize, sizeof(int));
463  uint32 nindexes;
464  READ_OR_RETURN(&nindexes, sizeof(uint32));
465  if (nindexes >0)
466  {
467  uint16 *indexarray = new uint16[nindexes];
468  READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16));
469  triangles.reserve(nindexes / 3);
470  for (uint32 i=0; i<nindexes; i+=3)
471  triangles.push_back(MeshTriangle(indexarray[i], indexarray[i+1], indexarray[i+2]));
472 
473  delete[] indexarray;
474  }
475 
476  // ---- vectors
477  READ_OR_RETURN(&blockId, 4);
478  CMP_OR_RETURN(blockId, "VERT");
479  READ_OR_RETURN(&blocksize, sizeof(int));
480  uint32 nvectors;
481  READ_OR_RETURN(&nvectors, sizeof(uint32));
482 
483  if (nvectors >0)
484  {
485  float *vectorarray = new float[nvectors*3];
486  READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3);
487  for (uint32 i=0; i<nvectors; ++i)
488  vertexArray.push_back( Vector3(vectorarray + 3*i) );
489 
490  delete[] vectorarray;
491  }
492  // ----- liquid
493  liquid = 0;
494  if (liquidflags& 1)
495  {
496  WMOLiquidHeader hlq;
497  READ_OR_RETURN(&blockId, 4);
498  CMP_OR_RETURN(blockId, "LIQU");
499  READ_OR_RETURN(&blocksize, sizeof(int));
500  READ_OR_RETURN(&hlq, sizeof(WMOLiquidHeader));
501  liquid = new WmoLiquid(hlq.xtiles, hlq.ytiles, Vector3(hlq.pos_x, hlq.pos_y, hlq.pos_z), hlq.type);
502  uint32 size = hlq.xverts*hlq.yverts;
503  READ_OR_RETURN(liquid->GetHeightStorage(), size*sizeof(float));
504  size = hlq.xtiles*hlq.ytiles;
506  }
507 
508  return true;
509  }
int ytiles
Definition: wmo.h:63
float pos_z
Definition: wmo.h:66
G3D::AABox bounds
Definition: TileAssembler.h:72
uint32 GroupWMOID
Definition: TileAssembler.h:70
#define CMP_OR_RETURN(V, S)
Definition: TileAssembler.cpp:424
float * GetHeightStorage()
Definition: WorldModel.h:56
float pos_y
Definition: wmo.h:65
void set(const Point3 &low, const Point3 &high)
Definition: AABox.h:93
Definition: Vector3.h:58
int yverts
Definition: wmo.h:63
float pos_x
Definition: wmo.h:64
#define READ_OR_RETURN(V, S)
Definition: TileAssembler.cpp:420
std::vector< G3D::Vector3 > vertexArray
Definition: TileAssembler.h:75
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
class WmoLiquid * liquid
Definition: TileAssembler.h:76
uint8 * GetFlagsStorage()
Definition: WorldModel.h:57
std::vector< MeshTriangle > triangles
Definition: TileAssembler.h:74
#define READ_OR_RETURN_WITH_DELETE(V, S)
Definition: TileAssembler.cpp:422
int xtiles
Definition: wmo.h:63
uint32 mogpflags
Definition: TileAssembler.h:69
short type
Definition: wmo.h:67
Definition: wmo.h:61
uint32 liquidflags
Definition: TileAssembler.h:73
int xverts
Definition: wmo.h:63

+ Here is the call graph for this function:

Member Data Documentation

G3D::AABox VMAP::GroupModel_Raw::bounds
uint32 VMAP::GroupModel_Raw::GroupWMOID
class WmoLiquid* VMAP::GroupModel_Raw::liquid
uint32 VMAP::GroupModel_Raw::liquidflags
uint32 VMAP::GroupModel_Raw::mogpflags
std::vector<MeshTriangle> VMAP::GroupModel_Raw::triangles
std::vector<G3D::Vector3> VMAP::GroupModel_Raw::vertexArray

The documentation for this struct was generated from the following files: