-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyHapticsListener.h.omni
executable file
·71 lines (52 loc) · 2.33 KB
/
MyHapticsListener.h.omni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "Haptics.h"
#include "MyApplication.h"
#include <HAPI/HapticSpring.h>
#include <HAPI/HAPIFrictionSurface.h>
#include <HAPI/HAPIHapticShape.h>
#include <HAPI/FrictionSurface.h>
#include <HAPI/HapticTriangleTree.h>
//#include "OgreWorkQueue.h"
// Forward class declarations
class MyApplication;
class MyHapticsListener : public Haptics::Proxy::HapticsListener, public Ogre::FrameListener//, public Ogre::WorkQueue::RequestHandler, public Ogre::WorkQueue::ResponseHandler
{
private:
MyApplication* mApp;
bool isPressedButtonRotate;
bool isPressedButtonMove;
HAPI::HapticSpring* m_spring;
Ogre::Radian thetaX0, thetaY0, thetaZ0;
Ogre::Radian thetaEntity,thetaBone;
Ogre::Quaternion orientation0;
Ogre::Vector3 hapticPosition0, entityPosition0, entityX, boneX, hapticDisplacement, lightPosition0, lightPositionX;
std::vector<HAPI::Collision::AABBTree*> pointer_storage_AABBTree;
std::vector<HAPI::HAPISurfaceObject*> pointer_storage_Surface;
std::vector<HAPI::HapticTriangleTree*> pointer_storage_TriangleTree;
void rotateEntityBone();
void rotateLight();
// From Haptics Listener:
void onMoved(const Haptics::Proxy::EventArgs &args);
void onPressed(const Haptics::Proxy::EventArgs& args);
void onReleased(const Haptics::Proxy::EventArgs& args);
// From Ogre FrameListener:
bool frameStarted(const Ogre::FrameEvent& frame_event);
inline bool frameRenderingQueued(const Ogre::FrameEvent& frame_event)
{ return Ogre::FrameListener::frameRenderingQueued(frame_event); }
inline bool frameEnded(const Ogre::FrameEvent& frame_event)
{ return Ogre::FrameListener::frameEnded(frame_event); }
public:
MyHapticsListener(MyApplication* app, const std::string &debugText);
~MyHapticsListener();
bool hasChanged;
std::vector<HAPI::Collision::Triangle> puppetTriangles;
std::vector<HAPI::Collision::Triangle> trianglesCloseToProxy;
};
void getMeshInformation(Ogre::Entity *entity,
size_t &vertex_count,
Ogre::Vector3 * &vertices,
size_t &index_count,
unsigned long * &indices,
const Ogre::Vector3 &position,
const Ogre::Quaternion &orient,
const Ogre::Vector3 &scale);