OPC_BaseModel.h
Go to the documentation of this file.
1 /*
3  * OPCODE - Optimized Collision Detection
4  * Copyright (C) 2001 Pierre Terdiman
5  * Homepage: http://www.codercorner.com/Opcode.htm
6  */
8 
10 
16 
19 // Include Guard
20 #ifndef __OPC_BASEMODEL_H__
21 #define __OPC_BASEMODEL_H__
22 
25  {
27  OPCODECREATE();
28 
31  bool mNoLeaf;
32  bool mQuantized;
33 #ifdef __MESHMERIZER_H__
34  bool mCollisionHull;
35 #endif // __MESHMERIZER_H__
37  bool mCanRemap;
38 
39  // (*) This pointer is saved internally and used by OPCODE until collision structures are released,
40  // so beware of the object's lifetime.
41  };
42 
43  enum ModelFlag
44  {
45  OPC_QUANTIZED = (1<<0),
46  OPC_NO_LEAF = (1<<1),
47  OPC_SINGLE_NODE = (1<<2)
48  };
49 
51  {
52  public:
53  // Constructor/Destructor
54  BaseModel();
55  virtual ~BaseModel();
56 
58 
63  virtual bool Build(const OPCODECREATE& create) = 0;
65 
67 
71  virtual udword GetUsedBytes() const = 0;
73 
75 
81  virtual bool Refit();
83 
85 
89  inline_ const AABBTree* GetSourceTree() const { return mSource; }
91 
93 
97  inline_ const AABBOptimizedTree* GetTree() const { return mTree; }
99 
101 
105  inline_ AABBOptimizedTree* GetTree() { return mTree; }
107 
109 
114  inline_ udword GetNbNodes() const { return mTree->GetNbNodes(); }
116 
118 
122  inline_ BOOL HasLeafNodes() const { return !(mModelCode & OPC_NO_LEAF); }
124 
126 
130  inline_ BOOL IsQuantized() const { return mModelCode & OPC_QUANTIZED; }
132 
134 
138  inline_ BOOL HasSingleNode() const { return mModelCode & OPC_SINGLE_NODE; }
140 
142 
146  inline_ udword GetModelCode() const { return mModelCode; }
148 
150 
154  inline_ const MeshInterface* GetMeshInterface() const { return mIMesh; }
156 
158 
162  inline_ void SetMeshInterface(const MeshInterface* imesh) { mIMesh = imesh; }
164 
165  protected:
170  // Internal methods
171  void ReleaseBase();
172  bool CreateTree(bool no_leaf, bool quantized);
173  };
174 
175 #endif //__OPC_BASEMODEL_H__
const MeshInterface * mIMesh
User-defined mesh interface.
bool mCanRemap
true => allows OPCODE to reorganize client arrays
Definition: OPC_BaseModel.h:37
bool mNoLeaf
true => discard leaf nodes (else use a normal tree)
Definition: OPC_BaseModel.h:31
#define inline_
AABBTree * mSource
Original source tree.
AABBOptimizedTree * mTree
Optimized tree owned by the model.
Special case for 1-node models.
Definition: OPC_BaseModel.h:47
Leaf/NoLeaf tree.
Definition: OPC_BaseModel.h:46
#define OPCODE_API
Definition: Opcode.h:68
int BOOL
Another boolean type.
Definition: IceTypes.h:102
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
BuildSettings mSettings
Builder&#39;s settings.
Definition: OPC_BaseModel.h:30
Simple wrapper around build-related settings [Opcode 1.3].
Compressed/uncompressed tree.
Definition: OPC_BaseModel.h:45
MeshInterface * mIMesh
Mesh interface (access to triangles & vertices) (*)
Definition: OPC_BaseModel.h:29
bool mKeepOriginal
true => keep a copy of the original tree (debug purpose)
Definition: OPC_BaseModel.h:36
Model creation structure.
Definition: OPC_BaseModel.h:24
udword mModelCode
Model code = combination of ModelFlag(s)
ModelFlag
Definition: OPC_BaseModel.h:43
bool mQuantized
true => quantize the tree (else use a normal tree)
Definition: OPC_BaseModel.h:32
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char *modelName)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24