Ignore:
Timestamp:
03/31/06 17:29:32 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}; 
Note: See TracChangeset for help on using the changeset viewer.