Free Electron
SurfaceWrapOp.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_SurfaceWrapOp_h__
8 #define __operator_SurfaceWrapOp_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Operator to update an attached surface to follow a driving surface
17 
18  @ingroup operator
19 
20  "Edgy" options are based on "Poly Translation Frames" from
21  DreamWorks Animation.
22 
23  https://research.dreamworks.com/wp-content/uploads/2018/07/Deformation_Affector_Frame_DWA_2013.pdf
24 
25 *//***************************************************************************/
26 class FE_DL_EXPORT SurfaceWrapOp:
27  public SurfaceBindOp,
28  public Initialize<SurfaceWrapOp>,
29  public ObjectSafe<SurfaceWrapOp>
30 {
31  public:
32 
33  SurfaceWrapOp(void):
34  m_brushed(FALSE),
35  m_lastFrame(-1.0),
36  m_lastSubdiv(-1),
37  m_lastBindToPoints(-1),
38  m_lastEdgyDepth(-1),
39  m_forceRecook(FALSE),
40  m_selectIndex(-1) {}
41 virtual ~SurfaceWrapOp(void) {}
42 
43  void initialize(void);
44 
45  //* As HandlerI
46 virtual void handle(Record& a_rSignal);
47 
48  using OperatorThreaded::run;
49 
50 virtual void run(I32 a_id,sp<SpannedRange> a_spRange);
51 
52  class FE_DL_EXPORT Feedback
53  {
54  public:
55  Feedback(void) {}
56  Feedback(Real a_weight,
57  sp<SurfaceI::ImpactI> a_spImpact):
58  m_weight(a_weight),
59  m_spImpact(a_spImpact) {}
60 
61  Real weight(void) const { return m_weight; }
62  sp<SurfaceI::ImpactI> impact(void) const { return m_spImpact; }
63 
64  private:
65  Real m_weight;
66  sp<SurfaceI::ImpactI> m_spImpact;
67  };
68 
69  private:
70 
71  Real calculateWeight(Real a_distance,Real a_peakDistance,
72  Real a_distanceBias,Real a_distanceScale,
73  Real a_minimum);
74 
75  sp<SurfaceAccessibleI> m_spInputAccessible;
76  sp<SurfaceAccessorI> m_spFragmentAccessor;
77 
78  sp<SurfaceI> m_spDeformed;
79  sp<SurfaceI> m_spRefEdged;
80  sp<SurfaceI> m_spDefEdged;
81  sp<SurfaceI> m_spOutput;
82 
83  sp<DrawI> m_spDrawDebug;
84  sp<DrawMode> m_spDebugGroup;
85  sp<DrawMode> m_spOverlay;
86  sp<DrawMode> m_spBrush;
87  sp<DrawMode> m_spWireframe;
88 
89  BWORD m_brushed;
90  Real m_lastFrame;
91  I32 m_lastSubdiv;
92  I32 m_lastBindToPoints;
93  I32 m_lastEdgyDepth;
94  I32 m_forceRecook;
95  WindowEvent m_event;
96  I32 m_selectIndex;
97  Array<Feedback> m_feedback;
98  BWORD m_spread;
99  I32 m_bindCount;
100  I32 m_samples;
101  String m_locatorPrefix;
102  I32 m_deformedFaceOffset;
103  I32 m_outputElementOffset;
104 
105  BWORD m_makeCache;
106  Array< Array<I32> > m_faceCaches;
107  Array< Array<SpatialBary> > m_baryCaches;
108  Array< Array<SpatialTransform> > m_driverSampleCaches;
109 
110  //* TODO store in Surface, read from Impact
111  Array<Real> m_curveLengthRef;
112  Array<Real> m_curveLengthDef;
113 
114  sp<Profiler> m_spProfiler;
115  sp<Profiler::Profile> m_spProfileAccess;
116  sp<Profiler::Profile> m_spProfileDriver;
117  sp<Profiler::Profile> m_spProfileDeformed;
118  sp<Profiler::Profile> m_spProfilePrepare;
119  sp<Profiler::Profile> m_spProfileEdgy;
120  sp<Profiler::Profile> m_spProfileMoreAccess;
121  sp<Profiler::Profile> m_spProfileCache;
122  sp<Profiler::Profile> m_spProfileRun;
123  sp<Profiler::Profile> m_spProfileFinish;
124  sp<Profiler::Profile> m_spProfilePrep;
125  sp<Profiler::Profile> m_spProfilePreload;
126  sp<Profiler::Profile> m_spProfileIterate;
127  sp<Profiler::Profile> m_spProfileFragment;
128  sp<Profiler::Profile> m_spProfileFilter;
129  sp<Profiler::Profile> m_spProfileSpread;
130  sp<Profiler::Profile> m_spProfileDistance;
131  sp<Profiler::Profile> m_spProfileLoop;
132  sp<Profiler::Profile> m_spProfileBary;
133  sp<Profiler::Profile> m_spProfileSample;
134  sp<Profiler::Profile> m_spProfileInvert;
135  sp<Profiler::Profile> m_spProfileWeight;
136  sp<Profiler::Profile> m_spProfileTable;
137  sp<Profiler::Profile> m_spProfileTransfer;
138  sp<Profiler::Profile> m_spProfileResolve;
139 };
140 
141 } /* namespace ext */
142 } /* namespace fe */
143 
144 #endif /* __operator_SurfaceWrapOp_h__ */
Object level locking for thread safety.
Definition: Safe.h:216
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Operator to correlate a attachable surface with a driving surface.
Definition: SurfaceBindOp.h:20
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
Operator to update an attached surface to follow a driving surface.
Definition: SurfaceWrapOp.h:26