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