[830] | 1 | #ifndef FOLIAGE_H
|
---|
| 2 | #define FOLIAGE_H
|
---|
| 3 |
|
---|
[1019] | 4 | #include "GeoSubMesh.h"
|
---|
[830] | 5 | #include "tlista.h"
|
---|
| 6 | #include "TMatrix.h"
|
---|
[1019] | 7 | #include "VertexData.h"
|
---|
| 8 | #include "Leaf.h"
|
---|
[830] | 9 |
|
---|
[1057] | 10 | class ActiveLeafNode
|
---|
| 11 | {
|
---|
| 12 | public :
|
---|
| 13 | // Variable members
|
---|
| 14 | int index;// Array of pointers to vertices
|
---|
| 15 | int prev;
|
---|
| 16 | int next;
|
---|
| 17 |
|
---|
| 18 | ActiveLeafNode (void){ index = prev = next = -1; } // Constructor
|
---|
| 19 | };
|
---|
| 20 |
|
---|
[830] | 21 | class Foliage
|
---|
| 22 | {
|
---|
| 23 | public :
|
---|
| 24 |
|
---|
[1057] | 25 | ActiveLeafNode *Acth; // first active leaf
|
---|
[1019] | 26 | int ppio, final;
|
---|
| 27 | int nhactivas;
|
---|
| 28 | TMatrix mat_aux;
|
---|
[830] | 29 |
|
---|
[1019] | 30 | Foliage (const Geometry::SubMesh *, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
|
---|
| 31 | Foliage (const Foliage *);
|
---|
[830] | 32 | virtual ~Foliage (void); // Destructor
|
---|
| 33 |
|
---|
| 34 | //culling
|
---|
| 35 | void Culling (float frustum[6][4]);
|
---|
| 36 | bool LeafinFrustum ( int i, float frustum[6][4]);
|
---|
[1057] | 37 |
|
---|
| 38 | bool IsActive( int num) const;
|
---|
[830] | 39 | int ResolucionV ( char c, float rva, float rvb,float rvc, float rvd, float radio);
|
---|
| 40 | void ColapsaHoja (int, int&);
|
---|
| 41 | void SplitHoja (int, int&);
|
---|
| 42 | bool Forzar_Split(int, int, int&);
|
---|
| 43 | int AnteriorActivo (int h);
|
---|
| 44 | int PosteriorActivo (int h);
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | // resolucion constante
|
---|
| 48 | int ResolucionC (float dist, float dmax, float dmin);
|
---|
| 49 | void AjusteHojas( int nhojas);
|
---|
| 50 | void RCecol ( int nhojas);
|
---|
| 51 | void RCsplit ( int nhojas);
|
---|
| 52 |
|
---|
[1019] | 53 | Geometry::VertexData *vertexdata;
|
---|
| 54 | Geometry::IndexData *indexdata;
|
---|
| 55 |
|
---|
| 56 | Leaf *Leaves;
|
---|
[1057] | 57 | ActiveLeafNode *MinDet; // primera hoja activa
|
---|
[1019] | 58 | int nHojas;
|
---|
| 59 | int TotHojas;
|
---|
[830] | 60 |
|
---|
[1019] | 61 | float cx,cy,cz; //centro de la copa// para los impostores y resolucion variable
|
---|
| 62 | float rad; //radio de la esfera envolvente
|
---|
| 63 | int minHojas;
|
---|
| 64 | int TotVerts;
|
---|
| 65 |
|
---|
| 66 | private:
|
---|
| 67 | Geometry::CREATEVERTEXDATAFUNC create_vertex_data_func;
|
---|
| 68 | Geometry::CREATEINDEXDATAFUNC create_index_data_func;
|
---|
| 69 |
|
---|
| 70 | void ReadLeafs(const Geometry::SubMesh *);
|
---|
| 71 | void ReadVertices(const Geometry::SubMesh *);
|
---|
| 72 | bool ReadSimpSeq(const char*); /// returns true when successful
|
---|
| 73 | void RellenoRaiz (void);
|
---|
| 74 |
|
---|
| 75 | void GetNormalH (Leaf&);
|
---|
| 76 | // void GetNormalT(Tronco&);
|
---|
| 77 |
|
---|
| 78 | void CrossProduct(const float *v1, const float *v2, float *res);
|
---|
| 79 | void Normalize(const float *v, float *res);
|
---|
| 80 | // void CalculaNormalesVertice(void);
|
---|
| 81 | void CalculaTexCoordsYNorms(void);
|
---|
| 82 |
|
---|
[830] | 83 | };
|
---|
| 84 |
|
---|
| 85 | #endif |
---|