1 | #ifndef _IMGCLUSTER_H |
---|
2 | #define _IMGCLUSTER_H |
---|
3 | |
---|
4 | #include "IMGPrerequisites.h" |
---|
5 | #include "IMGBBox.h" |
---|
6 | #include "IMGBox2d.h" |
---|
7 | #include "IMGPlane3.h" |
---|
8 | |
---|
9 | namespace IMG { class Cluster2d; } |
---|
10 | |
---|
11 | namespace IMG { |
---|
12 | |
---|
13 | class Cluster { |
---|
14 | public: |
---|
15 | Cluster(); |
---|
16 | |
---|
17 | Cluster & operator =(const Cluster & p); |
---|
18 | |
---|
19 | Cluster(const Cluster & p); |
---|
20 | |
---|
21 | // Gametools -- Isma 17/08/2005 |
---|
22 | //void Insert (Triangle *t); |
---|
23 | // Gametools -- Isma 17/08/2005 |
---|
24 | //* return the patchs that the point is in |
---|
25 | //int CalculaPatch (Vector3 &point); |
---|
26 | inline void SetNormal(Ogre::Vector3* n) { normal = *n; }; |
---|
27 | |
---|
28 | inline Ogre::Vector3* GetNormal() { return &normal; }; |
---|
29 | |
---|
30 | inline BBox* GetBound() { return bound; }; |
---|
31 | |
---|
32 | inline Box2d* GetBspNodeBound() { return bspnodebound; }; |
---|
33 | |
---|
34 | inline void SetBspNodeBound(Box2d* box) { |
---|
35 | bspnodebound = box; |
---|
36 | }; |
---|
37 | |
---|
38 | void Print(); |
---|
39 | |
---|
40 | //* return the dominant normal axis, for calculate the 2d projection |
---|
41 | int AxisProjected(); |
---|
42 | |
---|
43 | inline int GetId() const { return id; }; |
---|
44 | |
---|
45 | inline void SetId(int id_) { id = id;}; |
---|
46 | |
---|
47 | //Vector3 * GetVector3s() const{ return Vector3s;} |
---|
48 | //Vector3 * GetVector3s(); |
---|
49 | //Vector3 * GetVector3s() { return Vector3s_triangle_text; } |
---|
50 | inline std::vector<Ogre::Vector3>* GetVector3sVector() { return &Vector3s_vector; }; |
---|
51 | |
---|
52 | inline Ogre::Vector3* GetVector3sTex() const { return Vector3s_triangle_text;}; |
---|
53 | |
---|
54 | // Gametools -- Isma 17/08/2005 |
---|
55 | //bool CreatePatches(bool dinamic = false); |
---|
56 | // Gametools -- Isma 17/08/2005 |
---|
57 | //Listid *GetPatchList() { return &patchlistid;} |
---|
58 | //Listid *GetTriangleList(){ return &trianglelistid; } |
---|
59 | // Gametools -- Isma 17/08/2005 |
---|
60 | //int GetIdPatch (unsigned int i) |
---|
61 | //{ |
---|
62 | // if (i > patchlistid.GetSize()) return -1; |
---|
63 | // |
---|
64 | // return patchlistid.Get(i); |
---|
65 | //} |
---|
66 | // Gametools -- Isma 17/08/2005 |
---|
67 | //int GetIdTriangle (unsigned int i) |
---|
68 | //{ |
---|
69 | // if (i > trianglelistid.GetSize()) return -1; |
---|
70 | // |
---|
71 | // return trianglelistid.Get(i); |
---|
72 | //} |
---|
73 | void Finish(); |
---|
74 | |
---|
75 | inline void SetPlane(Ogre::Vector3* normal, Ogre::Vector3 * point) { |
---|
76 | plane.normal = *normal; |
---|
77 | plane.normal = -plane.normal; |
---|
78 | plane.d = -normal->dotProduct (*point); |
---|
79 | //plane.d = normal->dotProduct (*point); |
---|
80 | }; |
---|
81 | |
---|
82 | inline Plane3 * GetPlane() { return &plane; }; |
---|
83 | |
---|
84 | //* Return the increment in U (lumel increment in x). For patchs calculation |
---|
85 | Ogre::Vector3 GetIncU(); |
---|
86 | |
---|
87 | //* Return the increment in V (lumel increment in x). For patchs calculation |
---|
88 | Ogre::Vector3 GetIncV(); |
---|
89 | |
---|
90 | //* Return the origin. For patchs calculation |
---|
91 | Ogre::Vector3 GetOrigin(); |
---|
92 | |
---|
93 | // |
---|
94 | // void CreateVector3s() |
---|
95 | // { |
---|
96 | // |
---|
97 | // //Vector3s = new Vector3[4]; |
---|
98 | // //Vector3s_triangle_text = new Vector3[4]; |
---|
99 | // } |
---|
100 | // |
---|
101 | bool PointIn(Ogre::Vector3 & point); |
---|
102 | |
---|
103 | Ogre::Real *pointeru[4]; //coordentate u for obscurancemap
|
---|
104 | Ogre::Real *pointerv[4]; //coordentate v for obscurancemap
|
---|
105 | Ogre::Vector2 *uv; //Vector3 coordenates for the original texture |
---|
106 | |
---|
107 | private: |
---|
108 | BBox * bound; |
---|
109 | |
---|
110 | Box2d * bspnodebound; |
---|
111 | |
---|
112 | static unsigned int ID_CLUSTER; |
---|
113 | |
---|
114 | Ogre::Vector3 normal; |
---|
115 | |
---|
116 | unsigned int id; |
---|
117 | |
---|
118 | std::vector<Ogre::Vector3> Vector3s_vector;
|
---|
119 | Ogre::Vector3 *Vector3s;
|
---|
120 | Ogre::Vector3 *Vector3s_triangle_text; |
---|
121 | |
---|
122 | int axisproj; |
---|
123 | |
---|
124 | int order; |
---|
125 | |
---|
126 | Cluster2d * triangle2d_text; |
---|
127 | |
---|
128 | Ogre::Vector3 lumel_origin, lumel_x_axis, lumel_y_axis;
|
---|
129 | |
---|
130 | Plane3 plane; |
---|
131 | |
---|
132 | // Gametools -- Isma 17/08/2005 |
---|
133 | //Listid patchlistid; |
---|
134 | //Listid trianglelistid; |
---|
135 | int CalcPatch(Ogre::Vector3 & point); |
---|
136 | |
---|
137 | |
---|
138 | public: |
---|
139 | ~Cluster(); |
---|
140 | |
---|
141 | }; |
---|
142 | |
---|
143 | } |
---|
144 | #endif |
---|