Free Electron
ManipulatorCommon.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __operate_ManipulatorCommon_h__
8 #define __operate_ManipulatorCommon_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Partial Generic ManipulatorI Implemention
17 
18  @ingroup operate
19 *//***************************************************************************/
20 class FE_DL_EXPORT ManipulatorCommon:
21  public OperateCommon,
22  virtual public ManipulatorI,
23  public Initialize<ManipulatorCommon>
24 {
25  public:
26  ManipulatorCommon(void):
27  m_hotGrip(-1),
28  m_lastGrip(-1),
29  m_dragging(FALSE) {}
30 virtual ~ManipulatorCommon(void) {}
31 
32  void initialize(void);
33 
34  //* As ManipulatorI
35 virtual void bindOverlay(sp<DrawI>& a_spDrawOverlay);
36 
37 virtual String mode(void) const { return ""; }
38 
39  //* As HandlerI (window events)
40 virtual void handle(Record& a_rSignal);
41 
42  //* As DrawableI
43 virtual void draw(sp<DrawI> a_spDrawI,const Color *color);
44 virtual void draw(sp<DrawI> a_spDrawI,const Color *color) const {}
45 virtual void draw(const SpatialTransform &transform,
46  sp<DrawI> a_spDrawI,const Color* color) {}
47 virtual void draw(const SpatialTransform &transform,
48  sp<DrawI> a_spDrawI,const Color* color) const {}
49 virtual void draw(const SpatialTransform &transform,
50  sp<DrawI> a_spDrawI,const Color* color,
51  sp<DrawBufferI> a_spDrawBuffer,
52  sp<PartitionI> a_spPartition) {}
53 virtual void draw(const SpatialTransform &transform,
54  sp<DrawI> a_spDrawI,const Color* color,
55  sp<DrawBufferI> a_spDrawBuffer,
56  sp<PartitionI> a_spPartition) const {}
57 
58  protected:
59 
60  BWORD gripLabels(void) const
61  { return catalogOrDefault<bool>("gripLabels",FALSE); }
62  void setGripLabels(BWORD a_gripLabels)
63  { catalog<bool>("gripLabels")=a_gripLabels; }
64 
65  Real anchorScale(void) const
66  { return catalogOrDefault<Real>("anchorScale",1.0); }
67  void setAnchorScale(Real a_anchorScale)
68  { catalog<Real>("anchorScale")=a_anchorScale; }
69 
70  Real gripScale(void) const
71  { return catalogOrDefault<Real>("gripScale",1.0); }
72  void setGripScale(Real a_gripScale)
73  { catalog<Real>("gripScale")=a_gripScale; }
74 
75  Real dimming(void) const
76  { return catalogOrDefault<Real>("dimming",0.0); }
77  void setDimming(Real a_dimming)
78  { catalog<Real>("dimming")=a_dimming; }
79 
80  Real foreshadow(void) const
81  { return catalogOrDefault<Real>("foreshadow",0.0); }
82  void setForeshadow(Real a_foreshadow)
83  { catalog<Real>("foreshadow")=a_foreshadow; }
84 
85  Real aura(void) const
86  { return catalogOrDefault<Real>("aura",0.0); }
87  void setAura(Real a_aura)
88  { catalog<Real>("aura")=a_aura; }
89 
90  void drawTubeWithAura(sp<DrawI>& a_rspDraw,
91  const SpatialVector* a_point,
92  const SpatialVector* a_normal,
93  const Real* a_radius,
94  U32 a_pointCount,CurveMode a_curveMode,
95  BWORD a_multicolor,const Color *a_color,
96  const SpatialVector& a_rTowardCamera,
97  const Real a_auraScale);
98 
99  class Grip
100  {
101  public:
102  Grip(void):
103  m_hotSpot(0.0,0.0,0.0),
104  m_radius(0.0)
105  {
106  set(m_alignment[0],0.0,0.0,0.0);
107  set(m_alignment[1],0.0,0.0,0.0);
108  set(m_planeCenter,0.0,0.0,0.0);
109  set(m_planeFacing,0.0,0.0,0.0);
110  }
111 
112  //* screen-space
113  SpatialVector m_hotSpot;
114  Real m_radius;
115  String m_key[2];
116  String m_message;
117  String m_label;
118 
119  //* world-space
120  SpatialVector m_alignment[2];
121  SpatialVector m_planeCenter;
122  SpatialVector m_planeFacing;
123  };
124 
125  //* reset hotspots and update the draw cache
126 virtual void updateGrips(void);
127 
128  sp<DrawMode> m_spTubeAura;
129 
130  Array<Grip> m_gripArray;
131  I32 m_hotGrip;
132  I32 m_lastGrip;
133  BWORD m_dragging;
134  Vector2i m_lastMouse;
135 
136  sp<DrawI> m_spDrawCache;
137  sp<DrawI> m_spOverlayCache;
138  WindowEvent m_event;
139 
140  SpatialVector m_facing;
141  SpatialVector m_upwards;
142  SpatialVector m_rightways;
143 };
144 
145 } /* namespace ext */
146 } /* namespace fe */
147 
148 #endif /* __operate_ManipulatorCommon_h__ */
Common Operator/Manipulator methods.
Definition: OperateCommon.h:20
Partial Generic ManipulatorI Implemention.
Definition: ManipulatorCommon.h:20
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Special vector for color (RGBA)
Definition: Color.h:21
Generalized windowing event.
Definition: WindowEvent.h:43
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Interactive collection of grips.
Definition: ManipulatorI.h:20