[830] | 1 | #ifndef FOLIAGE_H
|
---|
| 2 | #define FOLIAGE_H
|
---|
| 3 |
|
---|
[1019] | 4 | #include "GeoSubMesh.h"
|
---|
[830] | 5 | #include "tlista.h"
|
---|
[1019] | 6 | #include "VertexData.h"
|
---|
| 7 | #include "Leaf.h"
|
---|
[1078] | 8 | #include "GeoTreeSimpSequence.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
|
---|
[1058] | 26 | int begin, final;
|
---|
| 27 | int active_leaf_count;
|
---|
[830] | 28 |
|
---|
[1083] | 29 | Foliage (const Geometry::SubMesh *, const Geometry::TreeSimplificationSequence *, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
|
---|
[1019] | 30 | Foliage (const Foliage *);
|
---|
[830] | 31 | virtual ~Foliage (void); // Destructor
|
---|
| 32 |
|
---|
[1058] | 33 | void CalculateLOD(int nhojas);
|
---|
[1057] | 34 |
|
---|
[1019] | 35 | Geometry::VertexData *vertexdata;
|
---|
| 36 | Geometry::IndexData *indexdata;
|
---|
| 37 |
|
---|
| 38 | Leaf *Leaves;
|
---|
[1058] | 39 | ActiveLeafNode *MinDet; // first active leaf
|
---|
| 40 | int leafCount;
|
---|
| 41 | int leafTotal;
|
---|
[830] | 42 |
|
---|
[1058] | 43 | int minLeaves;
|
---|
| 44 | int TotalVerts;
|
---|
[1019] | 45 |
|
---|
| 46 | private:
|
---|
| 47 | Geometry::CREATEVERTEXDATAFUNC create_vertex_data_func;
|
---|
| 48 | Geometry::CREATEINDEXDATAFUNC create_index_data_func;
|
---|
| 49 |
|
---|
[1058] | 50 | bool IsActive( int num) const;
|
---|
| 51 | int PrevActive (int h);
|
---|
| 52 | int NextActive (int h);
|
---|
| 53 |
|
---|
| 54 | void RCecol(int nhojas);
|
---|
| 55 | void RCsplit(int nhojas);
|
---|
| 56 |
|
---|
[1019] | 57 | void ReadLeafs(const Geometry::SubMesh *);
|
---|
| 58 | void ReadVertices(const Geometry::SubMesh *);
|
---|
[1083] | 59 | bool ReadSimpSeq(const Geometry::TreeSimplificationSequence *); /// returns true when successful
|
---|
[1058] | 60 | void FillRoot(void);
|
---|
[1019] | 61 |
|
---|
| 62 | void GetNormalH (Leaf&);
|
---|
| 63 |
|
---|
| 64 | void CrossProduct(const float *v1, const float *v2, float *res);
|
---|
| 65 | void Normalize(const float *v, float *res);
|
---|
| 66 | // void CalculaNormalesVertice(void);
|
---|
[1058] | 67 | void CalculateTexCoordsAndNorms(void);
|
---|
[1019] | 68 |
|
---|
[830] | 69 | };
|
---|
| 70 |
|
---|
| 71 | #endif |
---|