OPC_HybridModel.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_HYBRIDMODEL_H__
00021 #define __OPC_HYBRIDMODEL_H__
00022 
00024         struct LeafTriangles
00025         {
00026                 udword                  Data;           
00027 
00029 
00033 
00034                 inline_ udword  GetNbTriangles()                                const   { return (Data & 15)+1;                                                                                 }
00035 
00037 
00041 
00042                 inline_ udword  GetTriangleIndex()                              const   { return Data>>4;                                                                                               }
00043                 inline_ void    SetData(udword nb, udword index)                { ASSERT(nb>0 && nb<=16);       nb--;   Data = (index<<4)|(nb&15);      }
00044         };
00045 
00046         class OPCODE_API HybridModel : public BaseModel
00047         {
00048                 public:
00049                 // Constructor/Destructor
00050                                                                                                         HybridModel();
00051                 virtual                                                                         ~HybridModel();
00052 
00054 
00059 
00060                 override(BaseModel)     bool                                    Build(const OPCODECREATE& create);
00061 
00063 
00067 
00068                 override(BaseModel)     udword                                  GetUsedBytes()          const;
00069 
00071 
00077 
00078                 override(BaseModel)     bool                                    Refit();
00079 
00081 
00085 
00086                 inline_                         const LeafTriangles*    GetLeafTriangles()      const   { return mTriangles;    }
00087 
00089 
00093 
00094                 inline_                         const udword*                   GetIndices()            const   { return mIndices;              }
00095 
00096                 private:
00097                                                         udword                                  mNbLeaves;              
00098                                                         LeafTriangles*                  mTriangles;             
00099                                                         udword                                  mNbPrimitives;  
00100                                                         udword*                                 mIndices;               
00101 
00102                 // Internal methods
00103                                                         void                                    Release();
00104         };
00105 
00106 #endif // __OPC_HYBRIDMODEL_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:18