Ignore:
Timestamp:
03/31/06 17:29:32 (18 years ago)
Author:
igarcia
Message:
 
Location:
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMG.h

    r700 r721  
    1 #ifndef _LBBC_H 
    2 #define _LBBC_H 
    3  
    4 #include <LBBCPrerequisites.h> 
    5 #include <LBBCRoot.h> 
    6 #include <LBBCLeaves.h> 
    7 #include <LBBCLeafKdTreeClusterData.h> 
    8 #include <LBBCSampleConfigFile.h> 
     1#ifndef _IMG_H 
     2#define _IMG_H 
    93 
    104#endif 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBBox.h

    r700 r721  
    2727class BBox: public Ogre::AxisAlignedBox { 
    2828  public: 
    29     inline BBox() { BBox::StartBoundingBox(); } 
     29    BBox(); 
    3030 
    31     inline void StartBoundingBox() { 
    32                  mMinimum.x =  BOUNDINGBOX_MAXVALUE; 
    33          mMinimum.y =  BOUNDINGBOX_MAXVALUE; 
    34          mMinimum.z =  BOUNDINGBOX_MAXVALUE; 
    35          mMaximum.x = -BOUNDINGBOX_MAXVALUE; 
    36          mMaximum.y = -BOUNDINGBOX_MAXVALUE; 
    37          mMaximum.z = -BOUNDINGBOX_MAXVALUE; 
    38        }; 
     31        ~BBox(); 
    3932 
    40         inline Ogre::Vector3 GetMinimum() { return mMinimum; } 
     33    void StartBoundingBox(); 
    4134 
    42     //   
    43     //  Vector3 * GetMinimum() 
    44     //  {  
    45     //          Vector3 *Vector3; 
    46     //   
    47     //  Ogre::Vector3 v = mMinimum;      
    48     //  Vector3.x = v.x; 
    49     //  Vector3.y = v.y; 
    50     //  Vector3.z = v.z; 
    51     //   
    52     //  return v; 
    53     //  } 
    54      
    55         inline Ogre::Vector3 GetMaximum() { return mMaximum;}; 
     35        Ogre::Vector3 GetMinimum(); 
    5636 
    57     // 
    58     //  Vector3 GetMaximum() 
    59     //  {  
    60     //   
    61     //          Vector3 Vector3; 
    62     //  Ogre::Vector3 v = mMaximum;      
    63     //  Vector3.x = v.x; 
    64     //  Vector3.y = v.y; 
    65     //  Vector3.z = v.z; 
    66     //          return Vector3; 
    67     //  } 
    68     //   
    69     inline void AddBoundingVector3(float x, float y, float z) { 
    70         if (x < mMinimum.x) mMinimum.x = x; if (x > mMaximum.x) mMaximum.x = x; 
    71         if (y < mMinimum.y) mMinimum.y = y; if (y > mMaximum.y) mMaximum.y = y; 
    72         if (z < mMinimum.z) mMinimum.z = z; if (z > mMaximum.z) mMaximum.z = z; 
    73       }; 
     37        Ogre::Vector3 GetMaximum(); 
    7438 
    75     inline void Print() { 
    76         printf("\nValor de la Caixa: (%.4f, %.4f, %.4f) - (%.4f, %.4f, %.4f)\n\n", mMinimum.x, mMinimum.y, mMinimum.z, mMaximum.x, mMaximum.y, mMaximum.z); 
    77       }; 
     39    void AddBoundingVector3(float x, float y, float z); 
    7840 
    79     //Ogre::Vector3* GetCorner (int corner) const 
    80         inline Ogre::Vector3 * GetCorner(int corner) const { 
    81         
    82         //if (corner < 0 || corner > 7) return Ogre::Vector3 (-1111111111, -1111111111, -1111111111); 
    83         //return Ogre::AxisAlignedBox::getAllCorners ()[corner]; 
    84         //printf("\nGetCorner: %d", corner); 
    85          
    86         if (corner < 0 || corner > 7) return NULL; 
    87          
    88         Ogre::Vector3 *vector;           
    89         switch (corner) 
    90         { 
    91                 /* 
    92                 case BOX_CORNER_xyz: return vector = new Ogre::Vector3(mMinimum.x, mMinimum.y, mMinimum.z ); 
    93                 case BOX_CORNER_xyZ: return vector = new Ogre::Vector3(mMinimum.x, mMinimum.y, mMaximum.z ); 
    94                 case BOX_CORNER_xYz: return vector = new Ogre::Vector3(mMinimum.x, mMaximum.y, mMinimum.z ); 
    95                 case BOX_CORNER_xYZ: return vector = new Ogre::Vector3(mMinimum.x, mMaximum.y, mMaximum.z ); 
    96                 case BOX_CORNER_Xyz: return vector = new Ogre::Vector3(mMaximum.x, mMinimum.y, mMinimum.z ); 
    97                 case BOX_CORNER_XyZ: return vector = new Ogre::Vector3(mMaximum.x, mMinimum.y, mMaximum.z ); 
    98                 case BOX_CORNER_XYz: return vector = new Ogre::Vector3(mMaximum.x, mMaximum.y, mMinimum.z ); 
    99                 case BOX_CORNER_XYZ: return vector = new Ogre::Vector3(mMaximum.x, mMaximum.y, mMaximum.z ); 
    100                 */ 
    101                         case BOX_CORNER_xyz: vector = new Ogre::Vector3(mMinimum.x, mMinimum.y, mMinimum.z ); break; 
    102                 case BOX_CORNER_xyZ: vector = new Ogre::Vector3(mMinimum.x, mMinimum.y, mMaximum.z ); break; 
    103                 case BOX_CORNER_xYz: vector = new Ogre::Vector3(mMinimum.x, mMaximum.y, mMinimum.z ); break; 
    104                 case BOX_CORNER_xYZ: vector = new Ogre::Vector3(mMinimum.x, mMaximum.y, mMaximum.z ); break; 
    105                 case BOX_CORNER_Xyz: vector = new Ogre::Vector3(mMaximum.x, mMinimum.y, mMinimum.z ); break; 
    106                 case BOX_CORNER_XyZ: vector = new Ogre::Vector3(mMaximum.x, mMinimum.y, mMaximum.z ); break; 
    107                 case BOX_CORNER_XYz: vector = new Ogre::Vector3(mMaximum.x, mMaximum.y, mMinimum.z ); break; 
    108                 case BOX_CORNER_XYZ: vector = new Ogre::Vector3(mMaximum.x, mMaximum.y, mMaximum.z ); break; 
    109         } 
    110          
    111         //vector->Print(); 
    112         return vector; 
    113        }; 
     41    void Print(); 
    11442 
    115     inline bool intersects(Ogre::Vector3 * v) { 
    116                 return Ogre::AxisAlignedBox::intersects(*v);  
    117         }; 
     43        Ogre::Vector3 GetCorner(int corner) const; 
    11844 
    119     ~BBox(); 
     45    bool intersects(Ogre::Vector3 v); 
    12046 
    12147}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBox2d.h

    r700 r721  
    22#define _IMGBOX2D_H 
    33 
    4 #include "IMGBBox.h" 
     4#include <IMGBBox.h> 
    55 
    66namespace IMG { 
    77 
    88//* this class represents a 2d bound box for a texture  
    9 class Box2d { 
    10   public: 
    11     inline Box2d() { 
    12                 mMinimum.x =  BOUNDINGBOX_MAXVALUE; 
    13                 mMinimum.y =  BOUNDINGBOX_MAXVALUE; 
    14                  
    15                 mMaximum.x = -BOUNDINGBOX_MAXVALUE; 
    16                 mMaximum.y = -BOUNDINGBOX_MAXVALUE;              
    17         }; 
     9class Box2d  
     10{ 
     11        public: 
     12                Box2d(); 
    1813 
    19     // GametoolsError -- Isma 17/08/2005 
    20     inline Box2d & operator =(const Box2d & p) { 
    21                 mMinimum = p.mMinimum; 
    22                 mMaximum = p.mMaximum; 
    23         }; 
     14                ~Box2d(); 
    2415 
    25         inline Ogre::Vector2 GetMinimum() {  
    26                 return mMinimum; 
    27         }; 
     16                // GametoolsError -- Isma 17/08/2005 
     17                Box2d & Box2d::operator =(const Box2d & p) 
     18                { 
     19                        mMinimum = p.mMinimum; 
     20                        mMaximum = p.mMaximum; 
     21                        return (*this); 
     22                } 
    2823 
    29         inline Ogre::Vector2 GetMaximum() {  
    30                 return mMaximum;  
    31         }; 
     24                Ogre::Vector2 GetMinimum(); 
    3225 
    33     inline void SetBoundBox(float x, float y, float X, float Y) { 
    34                 mMinimum.x = x; 
    35                 mMinimum.y = y; 
    36                 mMaximum.x = X; 
    37                 mMaximum.y = Y; 
    38         }; 
     26                Ogre::Vector2 GetMaximum();  
    3927 
    40     inline void AddBoundingVector3(float x, float y) { 
    41                         if (x < mMinimum.x) mMinimum.x = x; if (x > mMaximum.x) mMaximum.x = x; 
    42                         if (y < mMinimum.y) mMinimum.y = y; if (y > mMaximum.y) mMaximum.y = y; 
    43         }; 
     28                void SetBoundBox(float x, float y, float X, float Y);  
    4429 
    45     inline void Print() { 
    46                 printf("\nValor de la Caixa: (%.4f, %.4f) - (%.4f, %.4f)", mMinimum.x, mMinimum.y, mMaximum.x, mMaximum.y); 
    47         }; 
     30                void AddBoundingVector3(float x, float y); 
    4831 
    49         inline Ogre::Vector2 * GetCorner(int corner) const { 
    50         
    51                 //if (corner < 0 || corner > 7) return Ogre::Vector3 (-1111111111, -1111111111, -1111111111); 
    52                 //return Ogre::AxisAlignedBox::getAllCorners ()[corner]; 
    53                 //printf("\nGetCorner: %d", corner); 
    54                  
    55                 if (corner < 0 || corner > 4) return NULL; 
    56                                  
    57                         Ogre::Vector2 *vector; 
    58                 switch (corner) 
    59                 {                
    60                         case BOX_CORNER_xy: vector = new Ogre::Vector2(mMinimum.x, mMinimum.y ); break; 
    61                         case BOX_CORNER_xY: vector = new Ogre::Vector2(mMinimum.x, mMaximum.y ); break; 
    62                         case BOX_CORNER_Xy: vector = new Ogre::Vector2(mMaximum.x, mMinimum.y ); break; 
    63                         case BOX_CORNER_XY: vector = new Ogre::Vector2(mMaximum.x, mMaximum.y ); break; 
    64                          
    65                 } 
    66                  
    67                 return vector; 
    68          }; 
     32                void Print();  
    6933 
    70     inline bool In(int w, int h) { 
    71                 if (w <= (mMaximum.x - mMinimum.x) && 
    72                     h <= (mMaximum.y - mMinimum.y)) return true; 
    73                     
    74                 return false; 
    75         }; 
     34                Ogre::Vector2 GetCorner(int corner) const; 
    7635 
    77     inline bool FitPerfect(int w, int h) {       
    78                 if (w == (mMaximum.x - mMinimum.x) && 
    79                     h == (mMaximum.y - mMinimum.y)) return true; 
    80                    
    81                 return false; 
    82         }; 
     36                bool In(int w, int h);  
    8337 
    84     ~Box2d(); 
     38                bool FitPerfect(int w, int h); 
    8539 
    86         private: 
     40        protected: 
    8741                Ogre::Vector2 mMinimum, mMaximum; 
    8842}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBsp.h

    r700 r721  
    99class Bsp { 
    1010  public: 
    11     inline Bsp() : root(NULL), countleaf(0), counttotal(0){}; 
     11    Bsp(); 
    1212 
    13     inline void SetRoot(NodeBsp * node) { 
    14                 root = node; 
    15                 counttotal++; 
    16         }; 
     13    virtual ~Bsp(); 
    1714 
    18     inline void Print() { 
    19                 printf("\nImprimint Arbre BSP, num nodes leaf: %d, totals: %d", countleaf, counttotal); 
    20                 Print(root); 
    21         }; 
     15    void SetRoot(NodeBspPtr node); 
    2216 
    23     inline void PrintLeaf() { 
    24                 PrintLeaf(root); 
    25         }; 
     17    void Print(); 
    2618 
    27     inline NodeBsp * Insert(int w, int h, int idcluster) { 
    28                 //printf("\nInsret dins Bsp: %d, %d", w, h); 
    29                  
    30                 NodeBsp *node = root->Insert (w,h); 
    31                  
    32                 //printf("\nNode on s'insertarà finalment éS: "); node->Print(); 
    33                  
    34                 if (idcluster != -1) 
    35                 { 
    36                         node->SetId (idcluster); 
    37                         countleaf++;                     
    38                 } 
    39                 else counttotal++; 
    40                  
    41                 //Copiar pixels de la imatge al node 
    42                  
    43                 return node; 
    44         }; 
     19    void PrintLeaf();  
    4520 
    46     inline NodeBsp * Get(int i) { 
    47                 return root->Get (root, i); 
    48         }; 
     21    NodeBspPtr Insert(int w, int h, int idcluster); 
    4922 
     23    NodeBspPtr Get(int i); 
    5024 
    51   private: 
    52     NodeBsp * root; 
     25  protected: 
     26    NodeBspPtr root; 
    5327 
    5428    int countleaf; 
     
    5630    int counttotal; 
    5731 
    58     inline void Print(NodeBsp * node) { 
    59                 if (!node) return; 
    60                 node->Print(); 
    61                 Print(node->GetChild(0)); 
    62                 Print(node->GetChild(1)); 
    63         }; 
     32    void Print(NodeBspPtr node); 
    6433 
    65     inline void PrintLeaf(NodeBsp * node) { 
    66                 if (!node) return; 
    67                  
    68                  
    69                 if (node->GetChild(0) == NULL && node->GetChild(1) == NULL) node->Print(); 
    70                  
    71                 PrintLeaf (node->GetChild(0)); 
    72                 PrintLeaf (node->GetChild(1)); 
    73                  
    74         }; 
    75  
    76  
    77   public: 
    78     ~Bsp(); 
     34    void PrintLeaf(NodeBspPtr node); 
    7935 
    8036}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster.h

    r700 r721  
    22#define _IMGCLUSTER_H 
    33 
    4 #include "IMGPrerequisites.h" 
    5 #include "IMGBBox.h" 
    6 #include "IMGBox2d.h" 
    7 #include "IMGPlane3.h" 
     4#include <IMGPrerequisites.h> 
     5#include <IMGBBox.h> 
     6#include <IMGBox2d.h> 
     7#include <IMGPlane3.h> 
     8#include <IMGCluster2d.h> 
    89 
    9 namespace IMG { class Cluster2d; }  
     10namespace IMG  
     11{ 
    1012 
    11 namespace IMG { 
    12  
    13 class Cluster { 
     13class Cluster  
     14{ 
    1415  public: 
    1516    Cluster(); 
     
    1920    Cluster(const Cluster & p); 
    2021 
    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; }; 
     22        void SetNormal(Ogre::Vector3* n); 
    2723 
    28         inline Ogre::Vector3* GetNormal() { return &normal; }; 
     24        Ogre::Vector3* GetNormal(); 
    2925 
    30     inline BBox* GetBound() { return bound; }; 
     26    BBox* GetBound(); 
    3127 
    32     inline Box2d* GetBspNodeBound() { return bspnodebound; }; 
     28    Box2d* GetBspNodeBound(); 
    3329 
    34     inline void SetBspNodeBound(Box2d* box) { 
    35                 bspnodebound = box; 
    36         }; 
     30    void SetBspNodeBound(Box2d* box); 
    3731 
    3832    void Print(); 
     
    4135    int AxisProjected(); 
    4236 
    43     inline int GetId() const { return id; }; 
     37    int GetId() const; 
    4438 
    45     inline void SetId(int id_) { id = id;}; 
     39    void SetId(int id_); 
    4640 
    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; }; 
     41        std::vector<Ogre::Vector3>* GetVector3sVector(); 
    5142 
    52         inline Ogre::Vector3* GetVector3sTex() const { return Vector3s_triangle_text;}; 
     43        Ogre::Vector3* GetVector3sTex() const; 
    5344 
    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     //} 
    7345    void Finish(); 
    7446 
    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         }; 
     47        void SetPlane(Ogre::Vector3* normal, Ogre::Vector3 * point); 
    8148 
    82     inline Plane3 * GetPlane() { return &plane; }; 
     49    Plane3 * GetPlane(); 
    8350 
    8451    //* Return the increment in U (lumel increment in x). For patchs calculation  
     
    9158        Ogre::Vector3 GetOrigin(); 
    9259 
    93     // 
    94     //  void CreateVector3s() 
    95     //  {  
    96     //           
    97     //          //Vector3s = new Vector3[4]; 
    98     //          //Vector3s_triangle_text = new Vector3[4]; 
    99     //  } 
    100     //   
    10160        bool PointIn(Ogre::Vector3 & point); 
    10261 
    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 
     62        Ogre::Real *pointeru[4];  
     63 
     64        Ogre::Real *pointerv[4];  
     65 
     66        Ogre::Vector2 *uv; 
    10667 
    10768  private: 
    108     BBox * bound; 
     69    BBox bound; 
    10970 
    110     Box2d * bspnodebound; 
     71    Box2d bspnodebound; 
    11172 
    11273    static unsigned int ID_CLUSTER; 
     
    11778 
    11879        std::vector<Ogre::Vector3> Vector3s_vector; 
     80 
    11981        Ogre::Vector3 *Vector3s; 
     82 
    12083        Ogre::Vector3 *Vector3s_triangle_text; 
    12184 
     
    13093    Plane3 plane; 
    13194 
    132     // Gametools -- Isma 17/08/2005 
    133     //Listid patchlistid; 
    134     //Listid trianglelistid; 
    135         int CalcPatch(Ogre::Vector3 & point); 
    136  
    137  
    13895  public: 
    139     ~Cluster(); 
     96    virtual ~Cluster(); 
    14097 
    14198}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster2d.h

    r700 r721  
    22#define _IMGCLUSTER2D_H 
    33 
    4 #include "IMGCluster.h" 
     4#include <IMGPrerequisites.h> 
    55 
    66namespace IMG { 
    77 
     8class Cluster; 
     9 
    810class Cluster2d { 
    911  public: 
    10     inline Cluster2d() { 
    11                 Vector3s = NULL; 
    12                 cluster =NULL; 
    13                 normal = NULL; 
    14         }; 
     12    Cluster2d(); 
     13 
     14        virtual ~Cluster2d(); 
    1515 
    1616    //* Create a 2d polygon from a polygon 3d. The projecte polygon is belong the dominant normal. 
     
    2121    void Print(); 
    2222 
    23         inline Ogre::Vector2 * GetVector3s() { return Vector3s; } 
     23        Ogre::Vector2 * GetVector3s(); 
    2424 
    25         inline std::vector<Ogre::Vector2> * GetVector3sVector() { return &Vector3s2_vector; }  
     25        std::vector<Ogre::Vector2> * GetVector3sVector(); 
    2626 
    27         inline Ogre::Vector3 * GetNormal() { return normal; } 
     27        Ogre::Vector3 * GetNormal(); 
    2828 
     29  protected: 
    2930 
    30   private: 
    3131    unsigned int id; 
    3232 
     
    3434 
    3535        Ogre::Vector2 *Vector3s; 
     36 
    3637        std::vector<Ogre::Vector2> Vector3s2_vector; 
    3738 
    3839        Ogre::Vector3 *normal; 
    39  
    40   public: 
    41     ~Cluster2d(); 
    4240 
    4341}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGClusterList.h

    r709 r721  
    77namespace IMG { 
    88 
    9 //* 
    10 //      ClusterList 
    11 //* 
    12 class ClusterList { 
     9class ClusterList  
     10{ 
    1311  public: 
    14     inline ClusterList() { 
    15         list.reserve(100); 
    16       }; 
     12    ClusterList(); 
    1713 
    18     //std::vector<Polygon*> * GetList() { return &list;}        //return the pointer to the list of voxels 
    19     inline std::vector<Cluster> * GetList() { return &list;}; 
     14    virtual ~ClusterList(); 
     15     
     16    std::vector<Cluster> * GetList(); 
    2017 
    2118    //return the pointer to the list of voxels 
    22     inline unsigned int GetSize() const { return list.size(); } 
     19    unsigned int GetSize() const; 
    2320 
    2421    //return the number of elements of list 
    25     inline Cluster * Get(unsigned int i) { 
    26         if (i <= list.size()) return &list[i]; 
    27         //if (i <= list.size()) return list[i]; 
    28         return NULL; 
    29       }; 
     22    Cluster * Get(unsigned int i); 
    3023 
    3124    bool Insert(Cluster * p); 
     
    3427 
    3528 
    36   private: 
     29  protected: 
     30 
    3731    std::vector<Cluster> list; 
    38  
    39   public: 
    40     ~ClusterList(); 
    4132 
    4233}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGNodeBsp.h

    r700 r721  
    77namespace IMG { 
    88 
    9 class NodeBsp { 
     9// Fordward declaration... 
     10class NodeBsp; 
     11 
     12typedef ::boost::intrusive_ptr<NodeBsp> NodeBspPtr; 
     13 
     14namespace boost 
     15{ 
     16    void intrusive_ptr_add_ref(NodeBsp * p); 
     17    void intrusive_ptr_release(NodeBsp * p); 
     18}; 
     19 
     20class NodeBsp  
     21{ 
    1022  public: 
    1123    NodeBsp(); 
    1224 
    13     Box2d * GetBound(); 
     25    virtual ~NodeBsp(); 
    1426 
    15     inline void SetBound(Box2d * box) { bound = box; }; 
     27    Box2d* GetBound(); 
    1628 
    17     inline NodeBsp * GetChild(int i) { return child[i]; }; 
     29    void SetBound(Box2d *box); 
    1830 
    19     inline void SetId(int id_) { id = id_; }; 
     31    NodeBspPtr GetChild(int i); 
    2032 
    21     inline unsigned int GetId() const { return id; }; 
     33    void SetId(int id_); 
    2234 
    23     inline void SetChild(NodeBsp * node, int i) { child[i] = node; }; 
     35    unsigned int GetId() const; 
     36 
     37    void SetChild(NodeBspPtr node, int i); 
    2438 
    2539    void Print(); 
    2640 
    27     //void SetPlane (Plane3 *pla) { plane = pla; } 
    28     //Plane3 * GetPlane () { return plane; } 
    29     NodeBsp * Insert(int w, int h); 
     41    NodeBspPtr Insert(int w, int h); 
    3042 
    31     inline NodeBsp * Get(NodeBsp * node, int i) { 
    32                 if (!node) return NULL; 
    33                 if (node->GetId() == i ) return node; 
    34                  
    35                 NodeBsp *nod;  
    36                 if (nod = node->GetChild(0)->Get (node->GetChild(0), i)) return nod; 
    37                  
    38                 return node->GetChild(0)->Get (node->GetChild(1), i); 
    39                  
    40         }; 
     43    NodeBspPtr Get(NodeBspPtr node, int i); 
    4144 
     45  protected: 
    4246 
    43   private: 
    4447    bool fit; 
    4548 
    46     Box2d * bound; 
     49    Box2d bound; 
    4750 
    48     NodeBsp * child[2]; 
     51    NodeBspPtr child[2]; 
    4952 
    5053    static unsigned int ID; 
     
    5255    int id; 
    5356 
     57private: 
     58     
     59        long references; 
    5460 
    55   public: 
    56     ~NodeBsp(); 
     61    friend void boost::intrusive_ptr_add_ref(NodeBsp * p); 
    5762 
     63    friend void boost::intrusive_ptr_release(NodeBsp * p); 
    5864}; 
     65 
     66// class specific addref/release implementation 
     67// the two function overloads must be in the boost namespace on most compilers: 
     68namespace boost 
     69{ 
     70  inline void intrusive_ptr_add_ref(NodeBsp * p) 
     71  { 
     72    // increment reference count of object *p 
     73    ++(p->references); 
     74  } 
     75 
     76 
     77 
     78  inline void intrusive_ptr_release(NodeBsp * p) 
     79  { 
     80   // decrement reference count, and delete object when reference count reaches 0 
     81   if (--(p->references) == 0) 
     82     delete p; 
     83  }  
     84} // namespace boost 
    5985 
    6086} 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPlane3.h

    r700 r721  
    22#define _IMGPLANE3_H 
    33 
    4 #include "IMGPrerequisites.h" 
     4#include <IMGPrerequisites.h> 
    55 
    66namespace IMG { 
     
    99  public: 
    1010    //a plane's interface 
    11     //Plane(); 
    12     //~Plane(); 
    13     inline Plane3 & operator =(const Plane3 & p) { 
    14                 normal.x = p.normal.x; 
    15                 normal.y = p.normal.y; 
    16                 normal.z = p.normal.z; 
    17                 d = p.d;                 
    18                 return *this; 
    19         }; 
     11    Plane3(); 
    2012 
    21         inline Ogre::Vector3 * GetNormal() { 
    22                 Ogre::Vector3 *v = new Ogre::Vector3; 
    23                 v->x = normal.x; 
    24                 v->y = normal.y; 
    25                 v->z = normal.z; 
    26                 return v; 
    27         }; 
     13    virtual ~Plane3(); 
    2814 
    29     inline void SetNormal(float x, float y, float z) { 
    30                 normal.x = x; 
    31                 normal.y = y; 
    32                 normal.z = z;            
    33         }; 
     15    Plane3 & operator =(const Plane3 & p); 
    3416 
    35     inline void SetDistance(float dist) { 
    36                 d = dist; 
    37         }; 
     17        Ogre::Vector3 * GetNormal(); 
    3818 
    39     inline float GetDistance() const { return d;}; 
     19    void SetNormal(float x, float y, float z); 
    4020 
    41     inline void Print() { 
    42                 printf("\nPrintant pla: (%.4f, %.4f, %.4f, %.4f)", normal.x, normal.y, normal.z, d); 
    43         }; 
     21    void SetDistance(float dist); 
    4422 
    45     ~Plane3(); 
     23    float GetDistance() const; 
     24 
     25    void Print(); 
    4626 
    4727}; 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPrerequisites.h

    r700 r721  
    99#include <OgreAxisAlignedBox.h>  
    1010 
     11#include <boost/smart_ptr.hpp> 
     12 
    1113#endif 
Note: See TracChangeset for help on using the changeset viewer.