Free Electron
FollicleOp.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 __operator_FollicleOp_h__
8 #define __operator_FollicleOp_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Operator to edit surface locations
17 
18  @ingroup operator
19 *//***************************************************************************/
20 class FE_DL_EXPORT FollicleOp:
21  public OperatorState,
22  public Initialize<FollicleOp>
23 {
24  public:
25 
26  FollicleOp(void):
27  m_brushed(FALSE),
28  m_lastX(-1),
29  m_lastY(-1),
30  m_lastUV(-1,-1),
31  m_dragging(FALSE),
32  m_clearOnRelease(FALSE),
33  m_areaSelect(FALSE),
34  m_addShowStash(0),
35  m_addReplacement(0.0,0.0,0.0),
36  m_addRadius(0.0),
37  m_addFalloff(0.0),
38  m_addWheel(0),
39  m_addOpacity(0) {}
40 
41 virtual ~FollicleOp(void) {}
42 
43  void initialize(void);
44 
45  //* As HandlerI
46 virtual void handle(Record& a_rSignal);
47 
48  protected:
49 
50 virtual BWORD undo(String a_label,sp<Counted> a_spCounted);
51 virtual BWORD redo(String a_label,sp<Counted> a_spCounted);
52 
53  void syncToInput(void);
54 
55  void createFollicle(const SpatialVector& a_intersection);
56 
57  Record getEdit(I32 a_index);
58  void movePicked(const SpatialVector& a_rDelta);
59  void slideOnUV(I32 a_index,const Vector2 a_deltaUV);
60  void snapToSurface(I32 a_index);
61 
62  void setValueLimited(Record a_edit,SpatialVector a_value);
63  void addValue(SpatialVector a_increase,
64  SpatialVector a_mask,BWORD a_flood);
65  void scaleValue(Real a_scale,
66  SpatialVector a_mask,BWORD a_flood);
67  void paintValue(SpatialVector a_replacement,
68  SpatialVector a_mask,BWORD a_flood);
69  void restoreValue(SpatialVector a_mask,BWORD a_flood);
70 
71  BWORD calcWeightedAverage(SpatialVector& rAverage,
72  BWORD a_flood);
73  BWORD calcLimits(SpatialVector& rMinimum,
74  SpatialVector& rMaximum,BWORD a_flood);
75  void smoothValue(SpatialVector a_mask,BWORD a_flood);
76 
77  void conformValue(BWORD a_flood);
78  void revertValue(BWORD a_flood);
79 
80  void convergeValue(SpatialVector a_mask,BWORD a_flood);
81  void divergeValue(SpatialVector a_mask,BWORD a_flood);
82 
83  BWORD revert(I32 a_index);
84  BWORD hideToggle(I32 a_index);
85  BWORD hidden(I32 a_index);
86  void hide(I32 a_index);
87 
88  BWORD moved(I32 a_index);
89 
90 virtual void setupState(void);
91 virtual BWORD loadState(const String& rBuffer);
92 
93  private:
94  BWORD sampleValue(SpatialVector a_point,I32 a_hitLimit,
95  Vector2& a_rUv,SpatialVector& a_rSample);
96  void appendPoint(Record a_edit);
97 
98  void clearPositionalCaches(void);
99 
100  void updateAction(String& a_rAction);
101  void updateNeighbors(void);
102 
103  SpatialVector inputValue(I32 a_pointIndex);
104 
105  sp<SurfaceAccessibleI> m_spOutputAccessible;
106  sp<SurfaceAccessorI> m_spInputElement;
107  sp<SurfaceAccessorI> m_spOutputUV;
108  sp<SurfaceAccessorI> m_spInputAttribute;
109  sp<SurfaceAccessorI> m_spOutputAttribute;
110  sp<SurfaceAccessorI> m_spHideGroup;
111  sp<SurfaceAccessorI> m_spDriverUV;
112  sp<SurfaceI> m_spDriver;
113  sp<SurfaceI> m_spPoints;
114  sp<SurfaceI::GaugeI> m_spDriverGauge;
115  WindowEvent m_event;
116  String m_attributeType;
117  Array<SpatialVector> m_inputPosition;
118  Array<SpatialVector> m_outputPosition;
119  Array<SpatialVector> m_inputValue;
120  Array<I32> m_elementTransformed;
121  Array<SpatialTransform> m_elementTransform;
122  Array<I32> m_elementOfPoint;
123  Array<I32> m_elementDirty;
124 
125  sp<DrawI> m_spOutputDraw;
126  sp<DrawMode> m_spWireframe;
127  sp<DrawMode> m_spNarrowWire;
128  sp<DrawMode> m_spWideWire;
129  sp<DrawMode> m_spSolid;
130  sp<DrawMode> m_spHazy;
131  sp<DrawMode> m_spForeshadow;
132  sp<DrawMode> m_spLittleDot;
133  sp<DrawMode> m_spBigDot;
134  sp<DrawMode> m_spBehind;
135 
136  sp< RecordMap<I32> > m_spEditMap;
137 
138  Accessor<SpatialVector> m_aSyncLocation;
139  Accessor<SpatialVector> m_aLocation;
140  Accessor<Vector2> m_aUV;
141  Accessor<SpatialVector> m_aValue;
142 
143  BWORD m_brushed;
144  I32 m_lastX;
145  I32 m_lastY;
146  Vector2 m_lastUV;
147  SpatialVector m_pickPoint;
148  SpatialVector m_pickNormal;
149  String m_changing;
150 
151  Array<SpatialVector> m_facingArray;
152  Array< Array<I32> > m_neighborTable;
153  Array< sp<SurfaceI::ImpactI> > m_impactArray;
154  Array< Array<Vector3i> > m_triangleArrays;
155 
156  Array<Real> m_weightArray;
157  Array<Color> m_colorRim;
158  Array<Color> m_colorCenter;
159  BWORD m_dragging;
160  BWORD m_clearOnRelease;
161  BWORD m_areaSelect;
162  I32 m_addShowStash;
163  SpatialVector m_addReplacement;
164  Real m_addRadius;
165  Real m_addFalloff;
166  I32 m_addWheel;
167  Real m_addOpacity;
168 };
169 
170 } /* namespace ext */
171 } /* namespace fe */
172 
173 #endif /* __operator_FollicleOp_h__ */
Operator base class to save and reload state.
Definition: OperatorState.h:20
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
The main data access class for the data system.
Definition: Accessor.h:128
Generalized windowing event.
Definition: WindowEvent.h:43
Automatically reference-counted string container.
Definition: String.h:128
Operator to edit surface locations.
Definition: FollicleOp.h:20
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53