HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Comb.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SOP Library (C++)
7  *
8  * COMMENTS: The Comb SOP, which works in conjunction with the
9  * Comb State and the GDT classes.
10  *
11  */
12 
13 #ifndef __SOP_Comb_h__
14 #define __SOP_Comb_h__
15 
16 #include "SOP_API.h"
17 #include <GU/GU_Brush.h>
18 
19 #include "SOP_GDT.h"
20 #include "SOP_BrushBase.h"
21 
22 class PRM_MenuEntry;
23 
24 enum {
25  // Group parameters
27 
29 
30 #define SOP_COMB_NUM_DEFORM_PARMS (6)
37 
38 #define SOP_COMB_NUM_NIB_PARMS (18)
57 
58 #define SOP_COMB_NUM_SYM_PARMS (9)
68 
69 #define SOP_COMB_NUM_RAY_PARMS (11)
81 };
82 
84 {
85 public:
86  SOP_Comb(OP_Network *net, const char *name, OP_Operator *entry);
87  ~SOP_Comb() override;
88 
89  bool updateParmsFlags() override;
90 
91  static OP_Node *myConstructor(OP_Network *net,
92  const char *name,
93  OP_Operator *entry);
94 
95  static PRM_Template myTemplateList[];
96  static PRM_Template myObsoleteList[];
97 
98  void setAccumulateStencil(bool) override
99  {
100  }
101  void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
102  {
103  setFloat(SOP_COMB_RAY_HITPOS_IDX, 0, t, orig.x());
104  setFloat(SOP_COMB_RAY_HITPOS_IDX, 1, t, orig.y());
105  setFloat(SOP_COMB_RAY_HITPOS_IDX, 2, t, orig.z());
106  }
107  void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
108  {
109  setFloat(SOP_COMB_RAY_ORIENT_IDX, 0, t, orient.x());
110  setFloat(SOP_COMB_RAY_ORIENT_IDX, 1, t, orient.y());
111  setFloat(SOP_COMB_RAY_ORIENT_IDX, 2, t, orient.z());
112  }
113  void setHitPrimitive(int primidx, fpreal t) override
114  {
115  setInt(SOP_COMB_RAY_HITPRIM_IDX, 0, t, primidx);
116  }
117  void setRadius(fpreal r, fpreal t) override
118  {
119  setFloat(SOP_COMB_RAD_IDX, 0, t, r);
120  }
121  void setUVRadius(fpreal r, fpreal t) override
122  {
123  setFloat(SOP_COMB_UVRAD_IDX, 0, t, r);
124  }
125  void setHitPoint(int pt, fpreal t) override
126  {
127  setInt(SOP_COMB_RAY_HITPT_IDX, 0, t, pt);
128  }
129  void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
130  {
134  }
135  void setHitPressure(fpreal p, fpreal t) override
136  {
138  }
140  {
141  setInt(SOP_COMB_RAY_EVENT_IDX, 0, 0, int(event));
142  }
143  void setBrushOp(SOP_BrushOp op) override
144  {
145  int iop;
146  switch (op)
147  {
148  default:
149  case SOP_BRUSHOP_COMB: iop = 0; break;
150  case SOP_BRUSHOP_SMOOTHNORMAL: iop = 1; break;
151  case SOP_BRUSHOP_ERASE: iop = 2; break;
152  case SOP_BRUSHOP_LIFT: iop = 3; break;
153  case SOP_BRUSHOP_ROTATE: iop = 4; break;
154  }
155  setInt(SOP_COMB_OP_IDX, 0, 0, iop);
156  }
157  void setBrushShape(SOP_BrushShape shape) override
158  {
159  setInt(SOP_COMB_SHAPE_IDX, 0, 0, int(shape));
160  }
161  void setProjectionType(int projtype) override
162  {
163  setInt(SOP_COMB_PROJTYPE_IDX, 0, 0, projtype);
164  }
165  void useForegroundColor() override
166  {
167  }
168  void useBackgroundColor() override
169  {
170  }
171 
172  int altersGeometry() const override { return 0; }
173  int altersColor() const override { return 0; }
175  { return evalFloat(SOP_COMB_RAD_IDX, 0, t); }
177  { return evalFloat(SOP_COMB_UVRAD_IDX, 0, t); }
179  { return evalFloat(SOP_COMB_RADPRESSURE_IDX, 0, t); }
181  {return evalFloat(SOP_COMB_OPAC_IDX, 0, t); }
183  {return evalFloat(SOP_COMB_OPACPRESSURE_IDX, 0, t) ; }
184 
185  SOP_BrushOp OP() override
186  {
187  switch (evalInt(SOP_COMB_OP_IDX, 0, 0))
188  {
189  default:
190  case 0: return SOP_BRUSHOP_COMB;
191  case 1: return SOP_BRUSHOP_SMOOTHNORMAL;
192  case 2: return SOP_BRUSHOP_ERASE;
193  case 3: return SOP_BRUSHOP_LIFT;
194  case 4: return SOP_BRUSHOP_ROTATE;
195  }
196  }
197  int ACCUMSTENCIL() override { return 0; }
198  int PROJECTIONTYPE() override
199  { return evalInt(SOP_COMB_PROJTYPE_IDX, 0, 0); }
200  int REALTIME() override
201  { return evalInt(SOP_COMB_REALTIME_IDX, 0, 0); }
202  int SHAPE(fpreal t) override
203  { return evalInt(SOP_COMB_SHAPE_IDX, 0, t); }
204  int OVERRIDENML() override
205  { return evalInt(SOP_COMB_OVRNML_IDX, 0, 0); }
206  void NMLNAME(UT_String &str, fpreal t) override
207  { evalString(str, SOP_COMB_NMLNAME_IDX, 0, t); }
208 
209 protected:
210  const char *inputLabel(unsigned idx) const override;
211  void doErase() override;
212 
213 
214  int MERGEMODE() override { return 0; }
215  void SCRIPT(UT_String &, fpreal ) override {}
216  int AXIS() override { return 0 ; }
217  fpreal USERX(fpreal) override { return 0.0; }
218  fpreal USERY(fpreal) override { return 0.0; }
219  fpreal USERZ(fpreal) override { return 0.0; }
220 
222  { return evalFloat(SOP_COMB_RAY_ORIENT_IDX, 0, t); }
224  { return evalFloat(SOP_COMB_RAY_ORIENT_IDX, 1, t); }
226  { return evalFloat(SOP_COMB_RAY_ORIENT_IDX, 2, t); }
227  fpreal RAYHITX(fpreal t) override
228  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 0, t); }
229  fpreal RAYHITY(fpreal t) override
230  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 1, t); }
231  fpreal RAYHITZ(fpreal t) override
232  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 2, t); }
233  fpreal RAYHITU(fpreal t) override
234  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 0, t); }
235  fpreal RAYHITV(fpreal t) override
236  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 1, t); }
237  fpreal RAYHITW(fpreal t) override
238  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 2, t); }
240  { return evalFloat(SOP_COMB_RAY_HITPRESSURE_IDX, 0, t); }
241  int PRIMHIT(fpreal t) override
242  { return evalInt(SOP_COMB_RAY_HITPRIM_IDX,0, t); }
243  int PTHIT(fpreal t) override
244  { return evalInt(SOP_COMB_RAY_HITPT_IDX, 0, t); }
245  int EVENT() override
246  { return evalInt(SOP_COMB_RAY_EVENT_IDX, 0, 0); }
247  bool USE_FOREGROUND() override
248  { return 1; }
249 
250  // We return the lift as our first entry of the foreground colour.
251  fpreal FGR(fpreal t) override
252  { return evalFloat(SOP_COMB_LIFT_IDX, 0, t); }
253  fpreal FGG(fpreal) override { return 0.0; }
254  fpreal FGB(fpreal) override { return 0.0; }
255  fpreal BGR(fpreal) override { return 0.0; }
256  fpreal BGG(fpreal) override { return 0.0; }
257  fpreal BGB(fpreal) override { return 0.0; }
258 
260  { return evalFloat(SOP_COMB_SOFTEDGE_IDX, 0, t); }
261  void KERNEL(UT_String &str, fpreal t) override
262  { evalString(str, SOP_COMB_KERNEL_IDX, 0, t); }
263  int UPTYPE(fpreal t) override
264  { return evalInt(SOP_COMB_UPTYPE_IDX, 0, t); }
265  fpreal UPX(fpreal t) override
266  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 0, t); }
267  fpreal UPY(fpreal t) override
268  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 1, t); }
269  fpreal UPZ(fpreal t) override
270  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 2, t); }
271 
273  { return evalFloat(SOP_COMB_PAPER_IDX, 0, t); }
275  { return evalFloat(SOP_COMB_SPLATTER_IDX, 0, t); }
276  void BITMAP(UT_String &str, fpreal t) override
277  { evalString(str, SOP_COMB_BITMAP_IDX, 0, t); }
278  int BITMAPCHAN(fpreal t) override
279  { return evalInt(SOP_COMB_BITMAPCHAN_IDX, 0, t); }
280  fpreal ANGLE(fpreal t) override
281  { return evalFloat(SOP_COMB_ANGLE_IDX, 0, t); }
282  fpreal SQUASH(fpreal t) override
283  { return evalFloat(SOP_COMB_SQUASH_IDX, 0, t); }
284 
285  int DOSTAMPING() override { return 0; }
286  int WRITEALPHA() override { return 0; }
287  int OVERRIDECD() override { return 0; }
288  void CDNAME(UT_String &, fpreal) override { }
289  int OVERRIDEALPHA() override { return 0; }
290  void ALPHANAME(UT_String &, fpreal) override { }
291  int ADDATTRIB() override { return 1; }
292  int PRESERVENML() override
293  { return evalInt(SOP_COMB_PRESERVENML_IDX, 0, 0); }
295  { return evalFloat(SOP_COMB_SYMAXIS_IDX, 0, t); }
297  { return evalFloat(SOP_COMB_SYMAXIS_IDX, 1, t); }
299  { return evalFloat(SOP_COMB_SYMAXIS_IDX, 2, t); }
301  { return evalFloat(SOP_COMB_SYMORIG_IDX, 0, t); }
303  { return evalFloat(SOP_COMB_SYMORIG_IDX, 1, t); }
305  { return evalFloat(SOP_COMB_SYMORIG_IDX, 2, t); }
306  int DOREFLECTION() override
307  { return evalInt(SOP_COMB_DOREFLECT_IDX,0, 0); }
308  int DOROTATION() override
309  { return evalInt(SOP_COMB_DOROTATION_IDX,0, 0); }
310  int SYMMETRYROT(fpreal t) override
311  { return evalInt(SOP_COMB_SYMROT_IDX,0, t); }
313  { return evalFloat(SOP_COMB_SYMDIST_IDX,0, t); }
314 
315  int DOUVREFLECTION() override
316  { return evalInt(SOP_COMB_DOUVREFLECT_IDX, 0, 0); }
318  { return evalFloat(SOP_COMB_SYMUVORIG_IDX, 0, t); }
320  { return evalFloat(SOP_COMB_SYMUVORIG_IDX, 1, t); }
322  { return evalFloat(SOP_COMB_SYMUVANGLE_IDX, 0, t);}
323 
324  int USECONNECTIVITY() override
325  { return evalInt(SOP_COMB_USECONNECTIVITY_IDX, 0, 0); }
326  int USENORMALS() override
327  { return evalInt(SOP_COMB_USENORMALS_IDX, 0, 0); }
328  int USEDEPTH() override
329  { return evalInt(SOP_COMB_USEDEPTH_IDX, 0, 0); }
330  fpreal DEPTH(fpreal t) override
331  { return evalFloat(SOP_COMB_DEPTH_IDX, 0, t); }
332  fpreal HEIGHT(fpreal t) override
333  { return evalFloat(SOP_COMB_DEPTH_IDX, 1, t); }
334 
335  // Find out if the brush has moved or done anything to cause us to add its
336  // effect to the current gdp.
337  bool hasStrokeChanged(fpreal t) override;
338  bool hasStyleChanged(fpreal t) override;
339 
340  // Find if the nib file has changed:
341  bool hasNibFileChanged(fpreal t) override;
342  bool hasAccumStencilChanged(fpreal t) override;
343  bool hasNibLookChanged(fpreal t) override;
344 
345  // Do we want our cook selection to be updated and displayed?
346  bool wantsCookSelection() const override { return true; }
347 
348 };
349 
350 #endif
void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
Definition: SOP_Comb.h:129
fpreal SYMMETRYDIRZ(fpreal t) override
Definition: SOP_Comb.h:298
fpreal USERY(fpreal) override
Definition: SOP_Comb.h:218
void setHitPrimitive(int primidx, fpreal t) override
Definition: SOP_Comb.h:113
fpreal BGG(fpreal) override
Definition: SOP_Comb.h:256
virtual bool updateParmsFlags()
void useBackgroundColor() override
Definition: SOP_Comb.h:168
fpreal RAWOPACITY(fpreal t) override
Definition: SOP_Comb.h:180
int DOROTATION() override
Definition: SOP_Comb.h:308
fpreal BGB(fpreal) override
Definition: SOP_Comb.h:257
virtual bool hasAccumStencilChanged(fpreal t)=0
fpreal SQUASH(fpreal t) override
Definition: SOP_Comb.h:282
int PTHIT(fpreal t) override
Definition: SOP_Comb.h:243
int USENORMALS() override
Definition: SOP_Comb.h:326
fpreal RAYHITV(fpreal t) override
Definition: SOP_Comb.h:235
fpreal BGR(fpreal) override
Definition: SOP_Comb.h:255
fpreal FGG(fpreal) override
Definition: SOP_Comb.h:253
const GLdouble * v
Definition: glcorearb.h:837
int EVENT() override
Definition: SOP_Comb.h:245
int WRITEALPHA() override
Definition: SOP_Comb.h:286
const char * inputLabel(unsigned idx) const override
fpreal RAWUVRADIUS(fpreal t) override
Definition: SOP_Comb.h:176
fpreal RAYORIENTZ(fpreal t) override
Definition: SOP_Comb.h:225
virtual bool hasStyleChanged(fpreal t)=0
int OVERRIDECD() override
Definition: SOP_Comb.h:287
fpreal SYMMETRYORIGZ(fpreal t) override
Definition: SOP_Comb.h:304
fpreal RAYORIENTX(fpreal t) override
Definition: SOP_Comb.h:221
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int SHAPE(fpreal t) override
Definition: SOP_Comb.h:202
fpreal evalFloat(int pi, int vi, fpreal t) const
int altersGeometry() const override
Definition: SOP_Comb.h:172
int altersColor() const override
Definition: SOP_Comb.h:173
fpreal USERX(fpreal) override
Definition: SOP_Comb.h:217
void setHitPoint(int pt, fpreal t) override
Definition: SOP_Comb.h:125
fpreal SYMMETRYDIRX(fpreal t) override
Definition: SOP_Comb.h:294
void useForegroundColor() override
Definition: SOP_Comb.h:165
void CDNAME(UT_String &, fpreal) override
Definition: SOP_Comb.h:288
int ADDATTRIB() override
Definition: SOP_Comb.h:291
fpreal USERZ(fpreal) override
Definition: SOP_Comb.h:219
int MERGEMODE() override
Definition: SOP_Comb.h:214
void BITMAP(UT_String &str, fpreal t) override
Definition: SOP_Comb.h:276
bool USE_FOREGROUND() override
Definition: SOP_Comb.h:247
struct _cl_event * event
Definition: glcorearb.h:2961
fpreal UPX(fpreal t) override
Definition: SOP_Comb.h:265
void setProjectionType(int projtype) override
Definition: SOP_Comb.h:161
virtual bool hasNibFileChanged(fpreal t)=0
SOP_BrushOp OP() override
Definition: SOP_Comb.h:185
fpreal RAYORIENTY(fpreal t) override
Definition: SOP_Comb.h:223
void SCRIPT(UT_String &, fpreal) override
Definition: SOP_Comb.h:215
int UPTYPE(fpreal t) override
Definition: SOP_Comb.h:263
fpreal SYMMETRYUVORIGV(fpreal t) override
Definition: SOP_Comb.h:319
fpreal SOFTEDGE(fpreal t) override
Definition: SOP_Comb.h:259
void KERNEL(UT_String &str, fpreal t) override
Definition: SOP_Comb.h:261
fpreal UPZ(fpreal t) override
Definition: SOP_Comb.h:269
int ACCUMSTENCIL() override
Definition: SOP_Comb.h:197
fpreal RAYHITPRESSURE(fpreal t) override
Definition: SOP_Comb.h:239
void NMLNAME(UT_String &str, fpreal t) override
Definition: SOP_Comb.h:206
int DOREFLECTION() override
Definition: SOP_Comb.h:306
void evalString(UT_String &val, int pi, int vi, fpreal t) const
fpreal SYMMETRYUVORIGU(fpreal t) override
Definition: SOP_Comb.h:317
fpreal FGB(fpreal) override
Definition: SOP_Comb.h:254
fpreal SYMMETRYUVANGLE(fpreal t) override
Definition: SOP_Comb.h:321
int PROJECTIONTYPE() override
Definition: SOP_Comb.h:198
int BITMAPCHAN(fpreal t) override
Definition: SOP_Comb.h:278
int DOSTAMPING() override
Definition: SOP_Comb.h:285
void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
Definition: SOP_Comb.h:101
fpreal RAYHITU(fpreal t) override
Definition: SOP_Comb.h:233
SOP_BrushOp
Definition: SOP_BrushBase.h:39
int OVERRIDENML() override
Definition: SOP_Comb.h:204
int PRESERVENML() override
Definition: SOP_Comb.h:292
virtual void doErase()=0
void setBrushOp(SOP_BrushOp op) override
Definition: SOP_Comb.h:143
GLuint const GLchar * name
Definition: glcorearb.h:786
fpreal PAPERNOISE(fpreal t) override
Definition: SOP_Comb.h:272
fpreal RAYHITX(fpreal t) override
Definition: SOP_Comb.h:227
int SYMMETRYROT(fpreal t) override
Definition: SOP_Comb.h:310
fpreal SYMMETRYDIRY(fpreal t) override
Definition: SOP_Comb.h:296
void setBrushShape(SOP_BrushShape shape) override
Definition: SOP_Comb.h:157
GA_API const UT_StringHolder orient
int USEDEPTH() override
Definition: SOP_Comb.h:328
GLdouble t
Definition: glad.h:2397
int REALTIME() override
Definition: SOP_Comb.h:200
#define SOP_GDT_GRP_IDX
Definition: SOP_GDT.h:22
fpreal SYMMETRYORIGX(fpreal t) override
Definition: SOP_Comb.h:300
fpreal RAWRADIUS(fpreal t) override
Definition: SOP_Comb.h:174
fpreal OPACITYPRESSURE(fpreal t) override
Definition: SOP_Comb.h:182
void setHitPressure(fpreal p, fpreal t) override
Definition: SOP_Comb.h:135
fpreal HEIGHT(fpreal t) override
Definition: SOP_Comb.h:332
bool wantsCookSelection() const override
Definition: SOP_Comb.h:346
fpreal SYMMETRYORIGY(fpreal t) override
Definition: SOP_Comb.h:302
virtual bool hasStrokeChanged(fpreal t)=0
int AXIS() override
Definition: SOP_Comb.h:216
fpreal FGR(fpreal t) override
Definition: SOP_Comb.h:251
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
fpreal64 fpreal
Definition: SYS_Types.h:277
void setInt(int parmi, int vectori, fpreal t, exint value)
fpreal UPY(fpreal t) override
Definition: SOP_Comb.h:267
fpreal RAYHITW(fpreal t) override
Definition: SOP_Comb.h:237
int PRIMHIT(fpreal t) override
Definition: SOP_Comb.h:241
void ALPHANAME(UT_String &, fpreal) override
Definition: SOP_Comb.h:290
#define SOP_API
Definition: SOP_API.h:10
fpreal ANGLE(fpreal t) override
Definition: SOP_Comb.h:280
int DOUVREFLECTION() override
Definition: SOP_Comb.h:315
fpreal SPLATTER(fpreal t) override
Definition: SOP_Comb.h:274
void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
Definition: SOP_Comb.h:107
void setBrushEvent(SOP_BrushEvent event) override
Definition: SOP_Comb.h:139
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
virtual bool hasNibLookChanged(fpreal t)=0
exint evalInt(int pi, int vi, fpreal t) const
int USECONNECTIVITY() override
Definition: SOP_Comb.h:324
SOP_BrushEvent
Definition: SOP_BrushBase.h:31
GLboolean r
Definition: glcorearb.h:1222
fpreal SYMMETRYDIST(fpreal t) override
Definition: SOP_Comb.h:312
SOP_BrushShape
Definition: SOP_BrushBase.h:65
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
int OVERRIDEALPHA() override
Definition: SOP_Comb.h:289
fpreal DEPTH(fpreal t) override
Definition: SOP_Comb.h:330
fpreal RAYHITZ(fpreal t) override
Definition: SOP_Comb.h:231
fpreal RAYHITY(fpreal t) override
Definition: SOP_Comb.h:229
fpreal RADIUSPRESSURE(fpreal t) override
Definition: SOP_Comb.h:178
void setRadius(fpreal r, fpreal t) override
Definition: SOP_Comb.h:117
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
void setUVRadius(fpreal r, fpreal t) override
Definition: SOP_Comb.h:121
void setAccumulateStencil(bool) override
Definition: SOP_Comb.h:98