source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCBillboardClusterData.h @ 751

Revision 751, 3.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef _BBCBILLBOARDCLUSTERDATA_H
2#define _BBCBILLBOARDCLUSTERDATA_H
3
4#include <BBCEntityCluster.h>
5
6namespace BBC {
7
8// Fordward declaration...
9class BillboardClusterData;
10
11namespace boost
12{
13    void intrusive_ptr_add_ref(BillboardClusterData * p);
14    void intrusive_ptr_release(BillboardClusterData * p);
15};
16
17class _BBCExport BillboardClusterData
18{
19private:
20    long references;
21    friend void boost::intrusive_ptr_add_ref(BillboardClusterData * p);
22    friend void boost::intrusive_ptr_release(BillboardClusterData * p);
23
24  public:
25    BillboardClusterData();
26
27    virtual ~BillboardClusterData();
28
29        void setNormal(Ogre::Vector3 value);
30
31        Ogre::Vector3 getNormal();
32
33        void setD(float value);
34
35        float getD();
36
37    EntityClusterPtr getEntityCluster();
38
39        void setEntityCluster(EntityClusterPtr value);
40
41        virtual void readBillboardClusterData(TiXmlNode *parentNode, int iBillboardGroup);
42
43        virtual void writeBillboardClusterData(TiXmlNode *parentNode, int iBillboardGroup);
44
45        virtual void generateBillboardBoundingQuad();
46
47        unsigned int getNumUVMapGroups();
48
49        Ogre::Vector3 getQuadTopLeftCorner();
50
51        Ogre::Vector3 getQuadTopRightCorner();
52
53        Ogre::Vector3 getQuadBottomLeftCorner();
54
55        Ogre::Vector3 getQuadBottomRightCorner();
56
57        void setQuadTopLeftCorner(Ogre::Vector3 topLeft);
58
59        void setQuadTopRightCorner(Ogre::Vector3 topRight);
60
61        void setQuadBottomLeftCorner(Ogre::Vector3 bottomLeft);
62
63        void setQuadBottomRightCorner(Ogre::Vector3 bottomRight);
64
65        Ogre::Vector3 getAxisX();
66
67        Ogre::Vector3 getAxisY();
68
69        Ogre::Vector3 getAxisZ();
70
71        void setAxisX(Ogre::Vector3 axisX);
72
73        void setAxisY(Ogre::Vector3 axisY);
74
75        void setAxisZ(Ogre::Vector3 axisZ);
76
77        Ogre::Vector2 getBillboardUVMapMin(unsigned int iBillboardGroup);
78
79        void addBillboardUVMapMin(Ogre::Vector2 minVec);
80
81        void removeBillboardUVMapMin(unsigned int iBillboardGroup);
82
83        Ogre::Vector2 getBillboardUVMapMax(unsigned int iBillboardGroup);
84
85        void addBillboardUVMapMax(Ogre::Vector2 maxVec);
86
87        void removeBillboardUVMapMax(unsigned int iBillboardGroup);
88
89
90protected:
91        EntityClusterPtr mEntityCluster;
92       
93        Ogre::Vector3 mAxisX;
94
95        Ogre::Vector3 mAxisY;
96
97        Ogre::Vector3 mAxisZ;
98
99    enum BoundingQuadVertex {
100        QUAD_TOP_LEFT,
101        QUAD_TOP_RIGHT,
102        QUAD_BOTTOM_RIGHT,
103        QUAD_BOTTOM_LEFT
104    };
105
106        Ogre::Vector3 mBillboardCorners[4];
107
108        Ogre::Vector3 mNormal;
109
110        std::vector<Ogre::Vector2> mGroupedBillboardUVMapMinList;
111
112        std::vector<Ogre::Vector2> mGroupedBillboardUVMapMaxList;
113
114        float mD;
115
116};
117
118// class specific addref/release implementation
119// the two function overloads must be in the boost namespace on most compilers:
120namespace boost
121{
122 inline void intrusive_ptr_add_ref(BillboardClusterData * p)
123  {
124    // increment reference count of object *p
125    ++(p->references);
126  }
127
128
129
130 inline void intrusive_ptr_release(BillboardClusterData * p)
131  {
132   // decrement reference count, and delete object when reference count reaches 0
133   if (--(p->references) == 0)
134     delete p;
135  }
136} // namespace boost
137
138typedef ::boost::intrusive_ptr<BillboardClusterData> BillboardClusterDataPtr;
139
140}
141#endif
Note: See TracBrowser for help on using the repository browser.