vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SNCHForceFilter.h
Go to the documentation of this file.
1 #ifndef SNCH_FORCE_FILTER
2 #define SNCH_FORCE_FILTER
3 
5 
6 #ifdef COMPILE_PHANTOM_DEVICE
7 
8 #include "CollisionFilterBase.h"
9 
10 
11 namespace vreckoDP_PHANToM {
12 
13 // Flags for SNCHForceFilter::dwThreadForceFlags:
14 #define SNCH_FILTER_FFLAGS_INTERSECTION 0x00000001
15 
16 
17 
18 class SNCHForceFilter : public CollisionFilterBase {
19  friend DWORD WINAPI SNCHForceFilterThreadProc(SNCHForceFilter *filter);
20  public:
21  SNCHForceFilter();
22  ~SNCHForceFilter();
23 
24  virtual bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters);
25 
26  void apply(PHANToMSTATE &pState, osg::Vec3 &force, osg::Vec3 &torque);
27 
28  void localUpdateAndForceCalculation(bool bRunningInThread);
29  // [bRunningInThread] means "run until filter::bTerminateThread is true
30 
31 
32  protected:
33  float (*getLMDs)(void);
34  osg::Vec3 tempForce;
35 
36  HANDLE hThreadHandle;
37 
38  bool bTerminateThread;
39 
40  osg::Matrix originalScale;
41 
42  MTLockSingleProcess threadLock;
43  osg::Vec3 threadForce;
44  // Force calculated in the separate thread.
45  // Reading and setting this variable must be protected by [threadLock]
46  osg::Vec3 threadTorque;
47  // Torque calculated in the separate thread.
48  // Reading and setting this variable must be protected by [threadLock]
49  unsigned int dwThreadForceFlags;
50  // Force flags - a combination of SNCH_FILTER_FFLAGS_*
51  // Reading and setting this variable should be protected by [threadLock]
52 
53  unsigned int threadCounter;
54  // just a debug counter to see number of changes.
55  unsigned int threadLMDCounter;
56  // debug: Number of LMDs
57  unsigned int threadGlobalUpdatesCounter;
58  // debug: Number of global updates;
59 
60 
61  //float maxDistance;
62  float maxSearchingDistance;
63  //float maxSingleForce;
64  //float maxTotalForce; // only for FORCE_CALCULATION_TYPE == 3
65 };
66 
67 }
68 
69 #endif
70 
71 #endif