OPC_VolumeCollider.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_VOLUMECOLLIDER_H__
21 #define __OPC_VOLUMECOLLIDER_H__
22 
24  {
27 
29  const BaseModel* Model;
30  };
31 
33  {
34  public:
35  // Constructor / Destructor
37  virtual ~VolumeCollider() = 0;
38 
39  // Collision report
40 
42 
48  inline_ udword GetNbTouchedPrimitives() const { return mTouchedPrimitives ? mTouchedPrimitives->GetNbEntries() : 0; }
50 
52 
58  inline_ const udword* GetTouchedPrimitives() const { return mTouchedPrimitives ? mTouchedPrimitives->GetEntries() : null; }
60 
61  // Stats
62 
64 
69  inline_ udword GetNbVolumeBVTests() const { return mNbVolumeBVTests; }
71 
73 
78  inline_ udword GetNbVolumePrimTests() const { return mNbVolumePrimTests; }
80 
81  // Settings
82 
84 
88  override(Collider) const char* ValidateSettings();
90 
91  protected:
92  // Touched primitives
94 
95  // Dequantization coeffs
98  // Stats
101  // Internal methods
102  void _Dump(const AABBCollisionNode* node);
103  void _Dump(const AABBNoLeafNode* node);
104  void _Dump(const AABBQuantizedNode* node);
105  void _Dump(const AABBQuantizedNoLeafNode* node);
106 
108 
111  override(Collider) inline_ void InitQuery()
113  {
114  // Reset stats & contact status
115  mNbVolumeBVTests = 0;
116  mNbVolumePrimTests = 0;
118  }
119 
121  {
122  // We're going to do a volume-vs-model query.
123  if(cache.Model!=mCurrentModel)
124  {
125  // Cached list was for another model so we can't keep it
126  // Keep track of new owner and reset cache
127  cache.Model = mCurrentModel;
128  return FALSE;
129  }
130  else
131  {
132  // Same models, no problem
133  return TRUE;
134  }
135  }
136  };
137 
138 #endif // __OPC_VOLUMECOLLIDER_H__
udword mNbVolumePrimTests
Number of Volume-Primitive tests.
#define FALSE
Definition: OPC_IceHook.h:9
#define null
our own NULL pointer
Definition: IceTypes.h:57
inline_ BOOL IsCacheValid(VolumeCache &cache)
const BaseModel * Model
Owner.
#define TRUE
Definition: OPC_IceHook.h:13
#define inline_
Definition: IcePoint.h:25
virtual inline_ void InitQuery()
Definition: OPC_Collider.h:173
#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
const BaseModel * mCurrentModel
Current model for collision query (owner of touched faces)
Definition: OPC_Collider.h:146
virtual const char * ValidateSettings()=0
udword mNbVolumeBVTests
Number of Volume-BV tests.
Container * mTouchedPrimitives
List of touched primitives.
Container TouchedPrimitives
Indices of touched primitives.


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:40