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  virtual ~SOP_Comb();
88 
89  virtual bool updateParmsFlags();
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  virtual void setAccumulateStencil(bool)
99  {
100  }
101  virtual void setRayOrigin(const UT_Vector3 &orig, fpreal t)
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  virtual void setRayOrientation(const UT_Vector3 &orient, fpreal t)
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  virtual void setHitPrimitive(int primidx, fpreal t)
114  {
115  setInt(SOP_COMB_RAY_HITPRIM_IDX, 0, t, primidx);
116  }
117  virtual void setRadius(fpreal r, fpreal t)
118  {
119  setFloat(SOP_COMB_RAD_IDX, 0, t, r);
120  }
121  virtual void setUVRadius(fpreal r, fpreal t)
122  {
123  setFloat(SOP_COMB_UVRAD_IDX, 0, t, r);
124  }
125  virtual void setHitPoint(int pt, fpreal t)
126  {
127  setInt(SOP_COMB_RAY_HITPT_IDX, 0, t, pt);
128  }
129  virtual void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t)
130  {
134  }
135  virtual void setHitPressure(fpreal p, fpreal t)
136  {
138  }
140  {
141  setInt(SOP_COMB_RAY_EVENT_IDX, 0, 0, int(event));
142  }
143  virtual void setBrushOp(SOP_BrushOp op)
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  virtual void setBrushShape(SOP_BrushShape shape)
158  {
159  setInt(SOP_COMB_SHAPE_IDX, 0, 0, int(shape));
160  }
161  virtual void setProjectionType(int projtype)
162  {
163  setInt(SOP_COMB_PROJTYPE_IDX, 0, 0, projtype);
164  }
165  virtual void useForegroundColor(void)
166  {
167  }
168  virtual void useBackgroundColor(void)
169  {
170  }
171 
172  virtual int altersGeometry() const { return 0; }
173  virtual int altersColor() const { 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  virtual SOP_BrushOp OP(void)
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  virtual int ACCUMSTENCIL(void) { return 0; }
198  virtual int PROJECTIONTYPE(void)
199  { return evalInt(SOP_COMB_PROJTYPE_IDX, 0, 0); }
200  virtual int REALTIME(void)
201  { return evalInt(SOP_COMB_REALTIME_IDX, 0, 0); }
202  virtual int SHAPE(fpreal t)
203  { return evalInt(SOP_COMB_SHAPE_IDX, 0, t); }
204  virtual int OVERRIDENML()
205  { return evalInt(SOP_COMB_OVRNML_IDX, 0, 0); }
206  virtual void NMLNAME(UT_String &str, fpreal t)
207  { evalString(str, SOP_COMB_NMLNAME_IDX, 0, t); }
208 
209 protected:
210  virtual const char *inputLabel(unsigned idx) const;
211  virtual void doErase();
212 
213 
214  virtual int MERGEMODE() { return 0; }
215  virtual void SCRIPT (UT_String &, fpreal ) {}
216  virtual int AXIS(void) { return 0 ; }
217  virtual fpreal USERX(fpreal) { return 0.0; }
218  virtual fpreal USERY(fpreal) { return 0.0; }
219  virtual fpreal USERZ(fpreal) { 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  virtual fpreal RAYHITX(fpreal t)
228  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 0, t); }
229  virtual fpreal RAYHITY(fpreal t)
230  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 1, t); }
231  virtual fpreal RAYHITZ(fpreal t)
232  { return evalFloat(SOP_COMB_RAY_HITPOS_IDX, 2, t); }
233  virtual fpreal RAYHITU(fpreal t)
234  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 0, t); }
235  virtual fpreal RAYHITV(fpreal t)
236  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 1, t); }
237  virtual fpreal RAYHITW(fpreal t)
238  { return evalFloat(SOP_COMB_RAY_HITUVW_IDX, 2, t); }
240  { return evalFloat(SOP_COMB_RAY_HITPRESSURE_IDX, 0, t); }
241  virtual int PRIMHIT(fpreal t)
242  { return evalInt(SOP_COMB_RAY_HITPRIM_IDX,0, t); }
243  virtual int PTHIT(fpreal t)
244  { return evalInt(SOP_COMB_RAY_HITPT_IDX, 0, t); }
245  virtual int EVENT()
246  { return evalInt(SOP_COMB_RAY_EVENT_IDX, 0, 0); }
247  virtual bool USE_FOREGROUND(void)
248  { return 1; }
249 
250  // We return the lift as our first entry of the foreground colour.
251  virtual fpreal FGR(fpreal t)
252  { return evalFloat(SOP_COMB_LIFT_IDX, 0, t); }
253  virtual fpreal FGG(fpreal) { return 0.0; }
254  virtual fpreal FGB(fpreal) { return 0.0; }
255  virtual fpreal BGR(fpreal) { return 0.0; }
256  virtual fpreal BGG(fpreal) { return 0.0; }
257  virtual fpreal BGB(fpreal) { return 0.0; }
258 
259  virtual fpreal SOFTEDGE(fpreal t)
260  { return evalFloat(SOP_COMB_SOFTEDGE_IDX, 0, t); }
261  virtual void KERNEL(UT_String &str, fpreal t)
262  { evalString(str, SOP_COMB_KERNEL_IDX, 0, t); }
263  virtual int UPTYPE(fpreal t)
264  { return evalInt(SOP_COMB_UPTYPE_IDX, 0, t); }
265  virtual fpreal UPX(fpreal t)
266  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 0, t); }
267  virtual fpreal UPY(fpreal t)
268  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 1, t); }
269  virtual fpreal UPZ(fpreal t)
270  { return evalFloat(SOP_COMB_UPVECTOR_IDX, 2, t); }
271 
273  { return evalFloat(SOP_COMB_PAPER_IDX, 0, t); }
274  virtual fpreal SPLATTER(fpreal t)
275  { return evalFloat(SOP_COMB_SPLATTER_IDX, 0, t); }
276  virtual void BITMAP(UT_String &str, fpreal t)
277  { evalString(str, SOP_COMB_BITMAP_IDX, 0, t); }
278  virtual int BITMAPCHAN(fpreal t)
279  { return evalInt(SOP_COMB_BITMAPCHAN_IDX, 0, t); }
280  virtual fpreal ANGLE(fpreal t)
281  { return evalFloat(SOP_COMB_ANGLE_IDX, 0, t); }
282  virtual fpreal SQUASH(fpreal t)
283  { return evalFloat(SOP_COMB_SQUASH_IDX, 0, t); }
284 
285  virtual int DOSTAMPING() { return 0; }
286  virtual int WRITEALPHA() { return 0; }
287  virtual int OVERRIDECD() { return 0; }
288  virtual void CDNAME(UT_String &, fpreal) { }
289  virtual int OVERRIDEALPHA() { return 0; }
290  virtual void ALPHANAME(UT_String &, fpreal) { }
291  virtual int ADDATTRIB() { return 1; }
292  virtual int PRESERVENML()
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  virtual int DOREFLECTION()
307  { return evalInt(SOP_COMB_DOREFLECT_IDX,0, 0); }
308  virtual int DOROTATION()
309  { return evalInt(SOP_COMB_DOROTATION_IDX,0, 0); }
310  virtual int SYMMETRYROT(fpreal t)
311  { return evalInt(SOP_COMB_SYMROT_IDX,0, t); }
313  { return evalFloat(SOP_COMB_SYMDIST_IDX,0, t); }
314 
315  virtual int DOUVREFLECTION()
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  virtual int USECONNECTIVITY()
325  { return evalInt(SOP_COMB_USECONNECTIVITY_IDX, 0, 0); }
326  virtual int USENORMALS()
327  { return evalInt(SOP_COMB_USENORMALS_IDX, 0, 0); }
328  virtual int USEDEPTH()
329  { return evalInt(SOP_COMB_USEDEPTH_IDX, 0, 0); }
330  virtual fpreal DEPTH(fpreal t)
331  { return evalFloat(SOP_COMB_DEPTH_IDX, 0, t); }
332  virtual fpreal HEIGHT(fpreal t)
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  virtual bool hasStrokeChanged(fpreal t);
338  virtual bool hasStyleChanged(fpreal t);
339 
340  // Find if the nib file has changed:
341  virtual bool hasNibFileChanged(fpreal t);
342  virtual bool hasAccumStencilChanged(fpreal t);
343  virtual bool hasNibLookChanged(fpreal t);
344 
345  // Do we want our cook selection to be updated and displayed?
346  virtual bool wantsCookSelection(void) const { return true; }
347 
348 };
349 
350 #endif
virtual fpreal SYMMETRYORIGY(fpreal t)
Definition: SOP_Comb.h:302
virtual int EVENT()
Definition: SOP_Comb.h:245
virtual fpreal SYMMETRYUVANGLE(fpreal t)
Definition: SOP_Comb.h:321
virtual bool updateParmsFlags()
virtual int WRITEALPHA()
Definition: SOP_Comb.h:286
virtual SOP_BrushOp OP(void)
Definition: SOP_Comb.h:185
virtual fpreal RAYHITU(fpreal t)
Definition: SOP_Comb.h:233
virtual void ALPHANAME(UT_String &, fpreal)
Definition: SOP_Comb.h:290
virtual void setAccumulateStencil(bool)
Definition: SOP_Comb.h:98
virtual fpreal BGG(fpreal)
Definition: SOP_Comb.h:256
virtual bool hasAccumStencilChanged(fpreal t)=0
virtual fpreal FGR(fpreal t)
Definition: SOP_Comb.h:251
virtual fpreal RAYORIENTY(fpreal t)
Definition: SOP_Comb.h:223
virtual fpreal PAPERNOISE(fpreal t)
Definition: SOP_Comb.h:272
virtual int OVERRIDEALPHA()
Definition: SOP_Comb.h:289
const GLdouble * v
Definition: glcorearb.h:836
virtual int USEDEPTH()
Definition: SOP_Comb.h:328
virtual fpreal SYMMETRYUVORIGU(fpreal t)
Definition: SOP_Comb.h:317
virtual fpreal SYMMETRYORIGZ(fpreal t)
Definition: SOP_Comb.h:304
virtual void BITMAP(UT_String &str, fpreal t)
Definition: SOP_Comb.h:276
virtual fpreal RAYHITY(fpreal t)
Definition: SOP_Comb.h:229
virtual fpreal SPLATTER(fpreal t)
Definition: SOP_Comb.h:274
virtual bool hasStyleChanged(fpreal t)=0
virtual void setRayOrigin(const UT_Vector3 &orig, fpreal t)
Definition: SOP_Comb.h:101
virtual fpreal USERX(fpreal)
Definition: SOP_Comb.h:217
virtual fpreal RAWRADIUS(fpreal t)
Definition: SOP_Comb.h:174
fpreal evalFloat(int pi, int vi, fpreal t) const
virtual void NMLNAME(UT_String &str, fpreal t)
Definition: SOP_Comb.h:206
virtual fpreal RAYHITW(fpreal t)
Definition: SOP_Comb.h:237
virtual void setBrushShape(SOP_BrushShape shape)
Definition: SOP_Comb.h:157
virtual int OVERRIDECD()
Definition: SOP_Comb.h:287
virtual void useBackgroundColor(void)
Definition: SOP_Comb.h:168
virtual fpreal SYMMETRYDIST(fpreal t)
Definition: SOP_Comb.h:312
virtual fpreal BGR(fpreal)
Definition: SOP_Comb.h:255
virtual void KERNEL(UT_String &str, fpreal t)
Definition: SOP_Comb.h:261
virtual const char * inputLabel(unsigned idx) const override
virtual int SYMMETRYROT(fpreal t)
Definition: SOP_Comb.h:310
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
virtual void setUVRadius(fpreal r, fpreal t)
Definition: SOP_Comb.h:121
virtual void setProjectionType(int projtype)
Definition: SOP_Comb.h:161
virtual fpreal UPZ(fpreal t)
Definition: SOP_Comb.h:269
virtual fpreal RAYORIENTZ(fpreal t)
Definition: SOP_Comb.h:225
virtual fpreal RAYHITX(fpreal t)
Definition: SOP_Comb.h:227
virtual int ACCUMSTENCIL(void)
Definition: SOP_Comb.h:197
virtual fpreal SYMMETRYUVORIGV(fpreal t)
Definition: SOP_Comb.h:319
struct _cl_event * event
Definition: glcorearb.h:2960
virtual int PROJECTIONTYPE(void)
Definition: SOP_Comb.h:198
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:502
virtual bool hasNibFileChanged(fpreal t)=0
virtual fpreal RAYORIENTX(fpreal t)
Definition: SOP_Comb.h:221
virtual int BITMAPCHAN(fpreal t)
Definition: SOP_Comb.h:278
virtual int PTHIT(fpreal t)
Definition: SOP_Comb.h:243
virtual int REALTIME(void)
Definition: SOP_Comb.h:200
virtual void useForegroundColor(void)
Definition: SOP_Comb.h:165
virtual fpreal RADIUSPRESSURE(fpreal t)
Definition: SOP_Comb.h:178
virtual int OVERRIDENML()
Definition: SOP_Comb.h:204
virtual fpreal RAYHITV(fpreal t)
Definition: SOP_Comb.h:235
virtual void SCRIPT(UT_String &, fpreal)
Definition: SOP_Comb.h:215
virtual fpreal USERY(fpreal)
Definition: SOP_Comb.h:218
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual int MERGEMODE()
Definition: SOP_Comb.h:214
virtual int USECONNECTIVITY()
Definition: SOP_Comb.h:324
virtual void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t)
Definition: SOP_Comb.h:129
virtual void setHitPrimitive(int primidx, fpreal t)
Definition: SOP_Comb.h:113
virtual fpreal ANGLE(fpreal t)
Definition: SOP_Comb.h:280
SOP_BrushOp
Definition: SOP_BrushBase.h:38
virtual void doErase()=0
virtual int DOROTATION()
Definition: SOP_Comb.h:308
virtual int DOREFLECTION()
Definition: SOP_Comb.h:306
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int AXIS(void)
Definition: SOP_Comb.h:216
virtual fpreal SYMMETRYORIGX(fpreal t)
Definition: SOP_Comb.h:300
virtual int altersGeometry() const
Definition: SOP_Comb.h:172
GA_API const UT_StringHolder orient
virtual fpreal SOFTEDGE(fpreal t)
Definition: SOP_Comb.h:259
virtual void setBrushOp(SOP_BrushOp op)
Definition: SOP_Comb.h:143
#define SOP_GDT_GRP_IDX
Definition: SOP_GDT.h:22
virtual int UPTYPE(fpreal t)
Definition: SOP_Comb.h:263
virtual void CDNAME(UT_String &, fpreal)
Definition: SOP_Comb.h:288
virtual fpreal UPY(fpreal t)
Definition: SOP_Comb.h:267
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
virtual fpreal FGB(fpreal)
Definition: SOP_Comb.h:254
double fpreal
Definition: SYS_Types.h:270
virtual void setBrushEvent(SOP_BrushEvent event)
Definition: SOP_Comb.h:139
virtual bool hasStrokeChanged(fpreal t)=0
virtual fpreal RAWUVRADIUS(fpreal t)
Definition: SOP_Comb.h:176
virtual int USENORMALS()
Definition: SOP_Comb.h:326
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
virtual fpreal RAYHITZ(fpreal t)
Definition: SOP_Comb.h:231
void setInt(int parmi, int vectori, fpreal t, exint value)
virtual int DOSTAMPING()
Definition: SOP_Comb.h:285
virtual fpreal SYMMETRYDIRZ(fpreal t)
Definition: SOP_Comb.h:298
virtual bool USE_FOREGROUND(void)
Definition: SOP_Comb.h:247
virtual void setHitPoint(int pt, fpreal t)
Definition: SOP_Comb.h:125
#define SOP_API
Definition: SOP_API.h:10
virtual int DOUVREFLECTION()
Definition: SOP_Comb.h:315
virtual fpreal RAWOPACITY(fpreal t)
Definition: SOP_Comb.h:180
virtual fpreal BGB(fpreal)
Definition: SOP_Comb.h:257
virtual fpreal SQUASH(fpreal t)
Definition: SOP_Comb.h:282
virtual int PRIMHIT(fpreal t)
Definition: SOP_Comb.h:241
virtual int SHAPE(fpreal t)
Definition: SOP_Comb.h:202
virtual int PRESERVENML()
Definition: SOP_Comb.h:292
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual bool hasNibLookChanged(fpreal t)=0
exint evalInt(int pi, int vi, fpreal t) const
virtual fpreal HEIGHT(fpreal t)
Definition: SOP_Comb.h:332
SOP_BrushEvent
Definition: SOP_BrushBase.h:30
GLboolean r
Definition: glcorearb.h:1221
virtual fpreal RAYHITPRESSURE(fpreal t)
Definition: SOP_Comb.h:239
virtual void setHitPressure(fpreal p, fpreal t)
Definition: SOP_Comb.h:135
virtual fpreal SYMMETRYDIRY(fpreal t)
Definition: SOP_Comb.h:296
SOP_BrushShape
Definition: SOP_BrushBase.h:62
virtual void setRadius(fpreal r, fpreal t)
Definition: SOP_Comb.h:117
virtual int ADDATTRIB()
Definition: SOP_Comb.h:291
virtual fpreal USERZ(fpreal)
Definition: SOP_Comb.h:219
virtual bool wantsCookSelection(void) const
Definition: SOP_Comb.h:346
virtual fpreal UPX(fpreal t)
Definition: SOP_Comb.h:265
virtual void setRayOrientation(const UT_Vector3 &orient, fpreal t)
Definition: SOP_Comb.h:107
virtual fpreal DEPTH(fpreal t)
Definition: SOP_Comb.h:330
virtual int altersColor() const
Definition: SOP_Comb.h:173
virtual fpreal OPACITYPRESSURE(fpreal t)
Definition: SOP_Comb.h:182
virtual fpreal SYMMETRYDIRX(fpreal t)
Definition: SOP_Comb.h:294
virtual fpreal FGG(fpreal)
Definition: SOP_Comb.h:253