source: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h @ 1057

Revision 1057, 2.2 KB checked in by gumbau, 18 years ago (diff)
Line 
1#ifndef FOLIAGE_H
2#define FOLIAGE_H
3
4#include "GeoSubMesh.h"
5#include "tlista.h"
6#include "TMatrix.h"
7#include "VertexData.h"
8#include "Leaf.h"
9
10class 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
21class Foliage
22{
23        public :
24
25                ActiveLeafNode  *Acth; // first active leaf
26                int ppio, final;
27                int nhactivas;
28                TMatrix mat_aux;
29
30                Foliage (const Geometry::SubMesh *, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
31                Foliage (const Foliage *);
32                virtual ~Foliage (void); // Destructor
33               
34                //culling
35                void Culling (float frustum[6][4]);
36                bool LeafinFrustum ( int i, float frustum[6][4]);
37
38                bool IsActive( int num) const;
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
53                Geometry::VertexData *vertexdata;
54                Geometry::IndexData *indexdata;
55
56                Leaf   *Leaves;
57                ActiveLeafNode  *MinDet; // primera hoja activa
58                int nHojas;
59                int TotHojas;
60               
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
83};
84
85#endif
Note: See TracBrowser for help on using the repository browser.