1 | #ifndef FOLIAGE_H
|
---|
2 | #define FOLIAGE_H
|
---|
3 |
|
---|
4 | #include "GeoSubMesh.h"
|
---|
5 | #include "tlista.h"
|
---|
6 | #include "VertexData.h"
|
---|
7 | #include "Leaf.h"
|
---|
8 | #include "GeoTreeSimpSequence.h"
|
---|
9 |
|
---|
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 |
|
---|
21 | class Foliage
|
---|
22 | {
|
---|
23 | public :
|
---|
24 |
|
---|
25 | ActiveLeafNode *Acth; // first active leaf
|
---|
26 | int begin, final;
|
---|
27 | int active_leaf_count;
|
---|
28 |
|
---|
29 | Foliage (const Geometry::SubMesh *, const Geometry::TreeSimplificationSequence *, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
|
---|
30 | Foliage (const Foliage *);
|
---|
31 | virtual ~Foliage (void); // Destructor
|
---|
32 |
|
---|
33 | void CalculateLOD(int nhojas);
|
---|
34 |
|
---|
35 | Geometry::VertexData *vertexdata;
|
---|
36 | Geometry::IndexData *indexdata;
|
---|
37 |
|
---|
38 | Leaf *Leaves;
|
---|
39 | ActiveLeafNode *MinDet; // first active leaf
|
---|
40 | int leafCount;
|
---|
41 | int leafTotal;
|
---|
42 |
|
---|
43 | int minLeaves;
|
---|
44 | int TotalVerts;
|
---|
45 |
|
---|
46 | private:
|
---|
47 | Geometry::CREATEVERTEXDATAFUNC create_vertex_data_func;
|
---|
48 | Geometry::CREATEINDEXDATAFUNC create_index_data_func;
|
---|
49 |
|
---|
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 |
|
---|
57 | void ReadLeafs(const Geometry::SubMesh *);
|
---|
58 | void ReadVertices(const Geometry::SubMesh *);
|
---|
59 | bool ReadSimpSeq(const Geometry::TreeSimplificationSequence *); /// returns true when successful
|
---|
60 | void FillRoot(void);
|
---|
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);
|
---|
67 | void CalculateTexCoordsAndNorms(void);
|
---|
68 |
|
---|
69 | };
|
---|
70 |
|
---|
71 | #endif |
---|