Debian Codegraph @

include/iclipper.h

raw
1 #pragma once
2
3 #include "imodule.h"
4 #include "iorthoview.h"
5 #include "math/Vector3.h"
6 #include "math/Plane3.h"
7
8 // The possible split modes
9 enum EBrushSplit {
10 eFront,
11 eBack,
12 eFrontAndBack,
13 };
14
15 enum PlaneClassification {
16 ePlaneFront = 0,
17 ePlaneBack = 1,
18 ePlaneOn = 2,
19 };
20
21 class ClipPoint;
22
23 const char* const MODULE_CLIPPER("Clipper");
24 const char* const RKEY_CLIPPER_CAULK_SHADER("user/ui/clipper/caulkTexture");
25
26 /* greebo: This is the interface the clipper module has to provide.
27 */
28 class IClipper :
29 public RegisterableModule
30 {
31 public:
32 // Gets called if the clip mode is toggled on/off
33 virtual void onClipMode(bool enabled) = 0;
34
35 // Returns true if the clip mode is enabled
36 virtual bool clipMode() const = 0;
37
38 // Methods to clip the selected brush or to split it (keeping both parts)
39 virtual void clip() = 0;
40 virtual void splitClip() = 0;
41
42 // Inverts the clip plane "direction" to determine which part of the brush is kept after clipping
43 virtual void flipClip() = 0;
44
45 // True when new faces should get caulked
46 virtual bool useCaulkForNewFaces() const = 0;
47
48 // Returns the name of the caulk shader to be used for clip-created planes
49 virtual const std::string& getCaulkShader() const = 0;
50
51 // Return or set the view type of the xy view (needed for the projections).
52 virtual OrthoOrientation getViewType() const = 0;
53 virtual void setViewType(OrthoOrientation viewType) = 0;
54
55 // Returns the pointer to the currently moved clip point
56 virtual ClipPoint* getMovingClip() = 0;
57 virtual void setMovingClip(ClipPoint* clipPoint) = 0;
58
59 // Retrieves the reference to the coordinates of the currently "selected" clip point
60 virtual Vector3& getMovingClipCoords() = 0;
61
62 virtual ClipPoint* find(const Vector3& point, OrthoOrientation viewtype, float scale) = 0;
63
64 // Adds the given point as new clip point.
65 virtual void newClipPoint(const Vector3& point) = 0;
66
67 // Draws the clip points into the XYView
68 virtual void draw(float scale) = 0;
69
70 // Updates the clip plane information
71 virtual void update() = 0;
72
73 // Returns the currently active clip plane (might be invalid)
74 virtual const Plane3& getClipPlane() = 0;
75 };
76
77 // The accessor for the clipper module
78 inline IClipper& GlobalClipper()
79 {
80 static module::InstanceReference<IClipper> _reference(MODULE_CLIPPER);
81 return _reference;
82 }