forked from perilouswithadollarsign/cstrike15_src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolpickface.h
117 lines (91 loc) · 3.31 KB
/
toolpickface.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Tool used for picking brush faces.
//
// $NoKeywords: $
//=============================================================================//
#ifndef TOOLPICKFACE_H
#define TOOLPICKFACE_H
#ifdef _WIN32
#pragma once
#endif
#include "MapFace.h"
#include "ToolInterface.h"
class CMapView3D;
class CToolPickFace;
//
// Selection states for entries in our list of selected faces.
//
enum FaceState_t
{
FaceState_Select = 0, //
FaceState_Partial, // Used for multiselect; the face is in at least one of the face lists being edited.
FaceState_None, // Used for multiselect; to deselect partially selected faces. Otherwise they are removed from the list.
};
//
// An entry in our list of selected faces.
//
struct SelectedFace_t
{
CMapFace *pFace; // Pointer to the face.
FaceState_t eState; // The current selection state of this face.
FaceState_t eOriginalState; // The original selection state of this face.
};
//
// Interface for notification by the face picking tool. Inherit from this if you
// are a client of the face picker.
//
class IPickFaceTarget
{
public:
virtual void OnNotifyPickFace(CToolPickFace *pTool) = 0;
};
class CToolPickFace : public CBaseTool
{
public:
//
// Constructor/Destructor
//
CToolPickFace();
~CToolPickFace();
//
// CBaseTool virtual implementations
//
virtual void OnDeactivate();
virtual ToolID_t GetToolID(void) { return TOOL_PICK_FACE; }
virtual bool OnLMouseUp3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
virtual bool OnLMouseDown3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
virtual bool OnLMouseDblClk3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
virtual bool OnRMouseUp3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
virtual bool OnRMouseDown3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
virtual bool OnMouseMove3D(CMapView3D *pView, UINT nFlags, const Vector2D &vPoint);
//
// Functions specific to this tool.
//
inline void Attach(IPickFaceTarget *pTarget);
void AllowMultiSelect(bool bAllow);
void GetSelectedFaces(CMapFaceList &FaceListFull, CMapFaceList &FaceListPartial);
void SetSelectedFaces(CMapFaceList &FaceListFull, CMapFaceList &FaceListPartial);
protected:
void CycleSelectFace(CMapFace *pFace);
void DeselectAll(void);
void DeselectFace(int nIndex);
void DeselectFace(CMapFace *pFace);
int FindFace(CMapFace *pFace);
void SelectFace(CMapFace *pFace);
void AddToList(CMapFace *pFace, FaceState_t eState);
void RemoveFromList(int nIndex);
void SetEyedropperCursor(void);
IPickFaceTarget *m_pNotifyTarget; // Object to notify when selection events occur.
bool m_bAllowMultiSelect; // If false, only one face can be selected at a time.
CUtlVector <SelectedFace_t> m_Faces; // Picked faces and their selection state (partial or full).
};
//-----------------------------------------------------------------------------
// Purpose: Attaches the given notification target to this tool. That object
// will be used for all future notifications and updates by the tool.
//-----------------------------------------------------------------------------
void CToolPickFace::Attach(IPickFaceTarget *pNotifyTarget)
{
m_pNotifyTarget = pNotifyTarget;
}
#endif // TOOLPICKFACE_H