Free Electron
BenderOp.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 __grass_BenderOp_h__
8 #define __grass_BenderOp_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Operator to bend primitives
17 
18  @ingroup grass
19 *//***************************************************************************/
20 class FE_DL_EXPORT BenderOp:
21  public OperatorState,
22  public Initialize<BenderOp>
23 {
24  public:
25 
26  BenderOp(void):
27  m_synced(FALSE),
28  m_brushed(FALSE),
29  m_lastFrame(0.0),
30  m_keyframe(0.0),
31  m_isolate(FALSE),
32  m_isolating(-1),
33  m_dragging(FALSE),
34  m_transient(FALSE),
35  m_pickId(-1) {}
36 
37 virtual ~BenderOp(void) {}
38 
39  void initialize(void);
40 
41  //* As HandlerI
42 virtual void handle(Record& a_rSignal);
43 
44  protected:
45 
46 virtual void setupState(void);
47 virtual BWORD loadState(const String& rBuffer);
48 
49 virtual BWORD undo(String a_label,sp<Counted> a_spCounted);
50 virtual BWORD redo(String a_label,sp<Counted> a_spCounted);
51 
52  private:
53  void syncIds(void);
54  void drawOverlayKey(sp<DrawI>& r_spDrawI,I32 a_px,I32 a_py,
55  Real a_frame,const Color& a_rColor);
56  void initParam(String a_prefix,String a_label,
57  BWORD a_joined);
58  Record removeChannel(I32 a_channelIndex);
59  Record removeChannel(Record a_channel);
60  I32 keyCount(I32 a_channelIndex);
61  I32 keyCount(Record a_channel);
62  Record indexedKey(I32 a_channelIndex,I32 a_keyIndex);
63  Record indexedKey(Record a_channel,I32 a_keyIndex);
64  Record keyAt(I32 a_channelIndex,Real a_frame);
65  Record keyAt(Record a_channel,Real a_frame);
66  Record removeKey(I32 a_channelIndex,Real a_frame);
67  Record removeKey(Record a_channel,Real a_frame);
68  void findKeys(I32 a_channelIndex,Real a_frame,
69  Record& a_rBefore,Record& a_rAfter);
70  void findKeys(Record a_channel,Real a_frame,
71  Record& a_rBefore,Record& a_rAfter);
72  void findKeys(I32 a_channelIndex,Real a_frame,
73  Record& a_rBefore,Record& a_rAfter,
74  Record& a_rTwoBefore,Record& a_rTwoAfter);
75  void findKeys(Record a_channel,Real a_frame,
76  Record& a_rBefore,Record& a_rAfter,
77  Record& a_rTwoBefore,Record& a_rTwoAfter);
78  Record evalAt(I32 a_channelIndex,Real a_frame);
79  Record evalAt(Record a_channel,Real a_frame);
80 
81  BWORD calculateExtent(BWORD a_input,
82  U32 a_primIndex,
83  SpatialTransform& a_rParent,
84  SpatialTransform& a_rRoot,
85  SpatialTransform& a_rEnd);
86 
87  void calculateTransforms(Record key,
88  const SpatialTransform& a_rRoot,
89  const SpatialTransform& a_rEnd,
90  SpatialTransform& a_rBase,
91  SpatialTransform& a_rDiff);
92 
93  void interpolate(SpatialTransform& a_rPartial,
94  const SpatialTransform& a_rBase,
95  const SpatialTransform& a_rDiff,Real a_power);
96 
97  MatrixPower<SpatialTransform> m_matrixPower;
98 
99  sp<SurfaceI> m_spDriver;
100  sp<SurfaceI> m_spOutput;
101  sp<SurfaceAccessorI> m_spInputPoint;
102  sp<SurfaceAccessorI> m_spOutputPoint;
103  sp<SurfaceAccessorI> m_spInputVertices;
104  sp<SurfaceAccessorI> m_spOutputVertices;
105  sp<SurfaceAccessorI> m_spInputFragment;
106  sp<SurfaceAccessorI> m_spChangeGroup;
107  WindowEvent m_event;
108 
109  sp<DrawMode> m_spWireframe;
110  sp<DrawMode> m_spSolid;
111  sp<DrawMode> m_spChart;
112 
113  std::map<String,I32> m_indexOfFragment;
114  BWORD m_fragmented;
115  Real m_linearity;
116  BWORD m_fastPower;
117  BWORD m_synced;
118  BWORD m_brushed;
119 
120  Real m_frame;
121  Real m_startFrame;
122  Real m_endFrame;
123  Real m_lastFrame;
124  Real m_keyframe;
125  sp< RecordMap<I32> > m_spChannelMap;
126  Record m_key;
127  BWORD m_isolate;
128  I32 m_isolating;
129  BWORD m_dragging;
130  BWORD m_transient;
131  I32 m_pickId;
132  I32 m_lastX;
133  I32 m_lastY;
134  String m_changing;
135 
136  Accessor<I32> m_aIndex;
137  Accessor<String> m_aName;
138  Accessor< sp<RecordArray> > m_aKeys;
139  Accessor<Real> m_aFrame;
140  Accessor<Real> m_aLeanX;
141  Accessor<Real> m_aLeanZ;
142  Accessor<Real> m_aArcX;
143  Accessor<Real> m_aArcZ;
144  Accessor<Real> m_aSpinY;
145  Accessor<Real> m_aTwistY;
146 };
147 
148 } /* namespace ext */
149 } /* namespace fe */
150 
151 #endif /* __grass_BenderOp_h__ */
Operator base class to save and reload state.
Definition: OperatorState.h:20
kernel
Definition: namespace.dox:3
Operator to bend primitives.
Definition: BenderOp.h:20
General template for fixed size numeric matrices.
Definition: Matrix.h:42
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
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53