OPC_BaseModel.h
Go to the documentation of this file.
00001 
00002 /*
00003  *      OPCODE - Optimized Collision Detection
00004  *      Copyright (C) 2001 Pierre Terdiman
00005  *      Homepage: http://www.codercorner.com/Opcode.htm
00006  */
00008 
00010 
00016 
00017 
00019 // Include Guard
00020 #ifndef __OPC_BASEMODEL_H__
00021 #define __OPC_BASEMODEL_H__
00022 
00024         struct OPCODE_API OPCODECREATE
00025         {
00027                                                                 OPCODECREATE();
00028 
00029                 MeshInterface*                  mIMesh;                 
00030                 BuildSettings                   mSettings;              
00031                 bool                                    mNoLeaf;                
00032                 bool                                    mQuantized;             
00033 #ifdef __MESHMERIZER_H__
00034                 bool                                    mCollisionHull; 
00035 #endif // __MESHMERIZER_H__
00036                 bool                                    mKeepOriginal;  
00037                 bool                                    mCanRemap;              
00038 
00039                 // (*) This pointer is saved internally and used by OPCODE until collision structures are released,
00040                 // so beware of the object's lifetime.
00041         };
00042 
00043         enum ModelFlag
00044         {
00045                 OPC_QUANTIZED   = (1<<0),       
00046                 OPC_NO_LEAF             = (1<<1),       
00047                 OPC_SINGLE_NODE = (1<<2)        
00048         };
00049 
00050         class OPCODE_API BaseModel
00051         {
00052                 public:
00053                 // Constructor/Destructor
00054                                                                                         BaseModel();
00055                 virtual                                                         ~BaseModel();
00056 
00058 
00063 
00064                 virtual                 bool                            Build(const OPCODECREATE& create)       = 0;
00065 
00067 
00071 
00072                 virtual                 udword                          GetUsedBytes()          const                   = 0;
00073 
00075 
00081 
00082                 virtual                 bool                            Refit();
00083 
00085 
00089 
00090                 inline_ const   AABBTree*                       GetSourceTree()         const   { return mSource;                                               }
00091 
00093 
00097 
00098                 inline_ const   AABBOptimizedTree*      GetTree()                       const   { return mTree;                                                 }
00099 
00101 
00105 
00106                 inline_                 AABBOptimizedTree*      GetTree()                                       { return mTree;                                                 }
00107 
00109 
00114 
00115                 inline_                 udword                          GetNbNodes()            const   { return mTree->GetNbNodes();                   }
00116 
00118 
00122 
00123                 inline_                 BOOL                            HasLeafNodes()          const   { return !(mModelCode & OPC_NO_LEAF);   }
00124 
00126 
00130 
00131                 inline_                 BOOL                            IsQuantized()           const   { return mModelCode & OPC_QUANTIZED;    }
00132 
00134 
00138 
00139                 inline_                 BOOL                            HasSingleNode()         const   { return mModelCode & OPC_SINGLE_NODE;  }
00140 
00142 
00146 
00147                 inline_                 udword                          GetModelCode()          const   { return mModelCode;                                    }
00148 
00150 
00154 
00155                 inline_ const   MeshInterface*          GetMeshInterface()      const                                           { return mIMesh;        }
00156 
00158 
00162 
00163                 inline_                 void                            SetMeshInterface(const MeshInterface* imesh)    { mIMesh = imesh;       }
00164 
00165                 protected:
00166                                 const   MeshInterface*          mIMesh;                 
00167                                                 udword                          mModelCode;             
00168                                                 AABBTree*                       mSource;                
00169                                                 AABBOptimizedTree*      mTree;                  
00170                 // Internal methods
00171                                                 void                            ReleaseBase();
00172                                                 bool                            CreateTree(bool no_leaf, bool quantized);
00173         };
00174 
00175 #endif //__OPC_BASEMODEL_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:55