-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPicker.h
More file actions
36 lines (26 loc) · 836 Bytes
/
Picker.h
File metadata and controls
36 lines (26 loc) · 836 Bytes
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
#ifndef PICKER_H
#define PICKER_H
#ifdef FAST_DELEGATES
#include "fast delegates/delegate.hpp"
#else
#include "delegates/delegate.hpp"
#endif // FAST_DELEGATES
#include "InputSystem.h"
#include "CameraComponent.h"
#include <DirectXMath.h>
using namespace DirectX;
class Picker
{
public:
Picker(CameraComponent *camera) : mCamera(camera) { InputSystem::GetInstance().RegisterMousePressEvent(this, &Picker::CreateRay); }
~Picker() { if (mConnection) mConnection->Disconnect(); delete mConnection; }
void CreateRay(int x, int y);
XMFLOAT3 const GetRay() const { return mRay; }
XMFLOAT3 const GetOrigin() const { return mCamera->GetPosition(); }
void Connect(ConnectionBase *connection) { mConnection = connection; }
private:
XMFLOAT3 mRay;
CameraComponent *mCamera;
ConnectionBase *mConnection;
};
#endif // PICKER_H