[700] | 1 | #ifndef _BBCBILLBOARDCLUSTERDATA_H |
---|
| 2 | #define _BBCBILLBOARDCLUSTERDATA_H |
---|
| 3 | |
---|
| 4 | #include <BBCEntityCluster.h> |
---|
| 5 | |
---|
| 6 | namespace BBC { |
---|
| 7 | |
---|
[721] | 8 | // Fordward declaration... |
---|
| 9 | class BillboardClusterData; |
---|
| 10 | |
---|
| 11 | namespace boost
|
---|
| 12 | {
|
---|
| 13 | void intrusive_ptr_add_ref(BillboardClusterData * p);
|
---|
| 14 | void intrusive_ptr_release(BillboardClusterData * p);
|
---|
| 15 | }; |
---|
| 16 | |
---|
| 17 | class _BBCExport BillboardClusterData |
---|
| 18 | { |
---|
| 19 | private:
|
---|
| 20 | long references;
|
---|
| 21 | friend void boost::intrusive_ptr_add_ref(BillboardClusterData * p);
|
---|
| 22 | friend void boost::intrusive_ptr_release(BillboardClusterData * p); |
---|
| 23 | |
---|
[700] | 24 | public: |
---|
| 25 | BillboardClusterData(); |
---|
| 26 | |
---|
[721] | 27 | virtual ~BillboardClusterData(); |
---|
[700] | 28 | |
---|
| 29 | void setNormal(Ogre::Vector3 value); |
---|
| 30 | |
---|
| 31 | Ogre::Vector3 getNormal(); |
---|
| 32 | |
---|
| 33 | void setD(float value); |
---|
| 34 | |
---|
| 35 | float getD(); |
---|
| 36 | |
---|
[721] | 37 | EntityClusterPtr getEntityCluster(); |
---|
[700] | 38 | |
---|
[721] | 39 | void setEntityCluster(EntityClusterPtr value); |
---|
[700] | 40 | |
---|
[745] | 41 | virtual void readBillboardClusterData(TiXmlNode *parentNode, int iBillboardGroup); |
---|
[700] | 42 | |
---|
[745] | 43 | virtual void writeBillboardClusterData(TiXmlNode *parentNode, int iBillboardGroup); |
---|
[700] | 44 | |
---|
| 45 | virtual void generateBillboardBoundingQuad(); |
---|
| 46 | |
---|
[745] | 47 | unsigned int getNumUVMapGroups(); |
---|
| 48 | |
---|
[700] | 49 | Ogre::Vector3 getQuadTopLeftCorner(); |
---|
| 50 | |
---|
| 51 | Ogre::Vector3 getQuadTopRightCorner(); |
---|
| 52 | |
---|
| 53 | Ogre::Vector3 getQuadBottomLeftCorner(); |
---|
| 54 | |
---|
| 55 | Ogre::Vector3 getQuadBottomRightCorner(); |
---|
| 56 | |
---|
[745] | 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 | |
---|
[700] | 65 | Ogre::Vector3 getAxisX(); |
---|
| 66 | |
---|
| 67 | Ogre::Vector3 getAxisY(); |
---|
| 68 | |
---|
| 69 | Ogre::Vector3 getAxisZ(); |
---|
| 70 | |
---|
[745] | 71 | void setAxisX(Ogre::Vector3 axisX); |
---|
[700] | 72 | |
---|
[745] | 73 | void setAxisY(Ogre::Vector3 axisY); |
---|
[700] | 74 | |
---|
[745] | 75 | void setAxisZ(Ogre::Vector3 axisZ); |
---|
| 76 | |
---|
| 77 | Ogre::Vector2 getBillboardUVMapMin(unsigned int iBillboardGroup); |
---|
| 78 | |
---|
[751] | 79 | void addBillboardUVMapMin(Ogre::Vector2 minVec); |
---|
[745] | 80 | |
---|
| 81 | void removeBillboardUVMapMin(unsigned int iBillboardGroup); |
---|
| 82 | |
---|
| 83 | Ogre::Vector2 getBillboardUVMapMax(unsigned int iBillboardGroup); |
---|
| 84 | |
---|
[751] | 85 | void addBillboardUVMapMax(Ogre::Vector2 maxVec); |
---|
[745] | 86 | |
---|
| 87 | void removeBillboardUVMapMax(unsigned int iBillboardGroup); |
---|
| 88 | |
---|
| 89 | |
---|
[700] | 90 | protected: |
---|
[721] | 91 | EntityClusterPtr mEntityCluster; |
---|
[700] | 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 | |
---|
[745] | 110 | std::vector<Ogre::Vector2> mGroupedBillboardUVMapMinList; |
---|
| 111 | |
---|
| 112 | std::vector<Ogre::Vector2> mGroupedBillboardUVMapMaxList; |
---|
| 113 | |
---|
[700] | 114 | float mD; |
---|
| 115 | |
---|
| 116 | }; |
---|
| 117 | |
---|
[721] | 118 | // class specific addref/release implementation
|
---|
| 119 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
| 120 | namespace 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 | |
---|
| 138 | typedef ::boost::intrusive_ptr<BillboardClusterData> BillboardClusterDataPtr; |
---|
| 139 | |
---|
[700] | 140 | } |
---|
| 141 | #endif |
---|