HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_Generator.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: COP2_Generator.h
7  *
8  * COMMENTS:
9  * Base class for generator COPs.
10  */
11 #ifndef _COP2_GENERATOR_H_
12 #define _COP2_GENERATOR_H_
13 
14 #include "COP2_API.h"
15 #include <TIL/TIL_Defines.h>
16 #include "COP2_MaskOp.h"
17 
18 
19 // generated planes
20 #define CREATE_PLANE_RGBA 0
21 #define CREATE_PLANE_RGBA3 1
22 #define CREATE_PLANE_RGB 2
23 #define CREATE_PLANE_A 3
24 #define CREATE_PLANE_A3 4
25 #define CREATE_PLANE_M 5
26 #define CREATE_PLANE_M3 6
27 #define CREATE_PLANE_Z 7
28 #define CREATE_PLANE_L 8
29 #define CREATE_PLANE_B 9
30 #define CREATE_PLANE_P 10
31 #define CREATE_PLANE_N 11
32 #define CREATE_PLANE_V 12
33 #define CREATE_PLANE_TERRAIN_H 13
34 #define CREATE_PLANE_NONE 14
35 
36 #define ADD_REPLACE 0
37 #define ADD_RENAME 1
38 #define ADD_ADD 2
39 #define ADD_SCREEN 3
40 #define ADD_SUB 4
41 #define ADD_MULT 5
42 #define ADD_MIN 6
43 #define ADD_MAX 7
44 #define ADD_AVERAGE 8
45 
47 {
48 public:
50 
51  static int setResCallback(void *,int,float, const PRM_Template *);
52  static int setRateCallback(void *,int,float,const PRM_Template *);
53  static int setDepthCallback(void *,int,float,const PRM_Template*);
54 
55  bool isGenerator() const override { return true; }
56 
59  static PRM_Template myTemplateList[];
60  static CH_LocalVariable myVariableList[];
61  static PRM_Template myObsoleteParms[];
62  static const char * myInputLabels[];
63 
64  bool isTimeModifier() const override { return true; }
65 
66  virtual void SET_ADD_PLANES(int planes)
67  {
68  if( canAccess(PRM_WRITE_OK) )
69  setInt("addplanes",0,0, planes);
70  }
71 
72  virtual void SET_PLANES(int planes)
73  {
74  if( canAccess(PRM_WRITE_OK) )
75  setInt("planes", 0, 0, planes);
76  }
77 
79  {
80  if( canAccess(PRM_WRITE_OK) )
81  setInt("depth", 0, 0, (int) format);
82  }
83 
84  virtual void SET_ADD_OP(int op)
85  {
86  if( canAccess(PRM_WRITE_OK) )
87  setInt("addplaneop", 0, 0, op);
88  }
89 
90  virtual void SET_CUSTOM_PLANES(const UT_String &st)
91  {
92  if( canAccess(PRM_WRITE_OK) )
94  "customplanes",0,0);
95  }
96 
97  static int depthChanged(void *, int, float, const PRM_Template *);
98  static int overrideSizeChanged(void *, int, float, const PRM_Template *);
99  static int overrideAspectChanged(void *,int, float, const PRM_Template *);
100  static int overrideRangeChanged(void *,int, float, const PRM_Template *);
101  static int overrideRateChanged(void *, int, float, const PRM_Template *);
102 
103  // For the output area (an area of a plane belonging to this node)
104  // and a set of input areas, determine which input areas and which
105  // parts of these areas are needed to cook the output area.
107  COP2_CookAreaInfo &output_area,
108  const COP2_CookAreaList &input_areas,
109  COP2_CookAreaList &needed_areas) override;
110 
111  int getOpInput() const override { return 0; }
112  int getMaskInput() const override { return 1; }
113  bool isFrameEffectHandled() override { return false; }
114 
115  int scope(UT_String &) override { return 0; }
116  int frameScope(UT_String &) override { return 0; }
117  bool isPixelBased() const override { return false; }
118 
119  void inputConnectChanged(int which) override;
120 
121 protected:
122  COP2_Generator(OP_Network *parent, const char *name,
123  OP_Operator *entry);
124  ~COP2_Generator() override;
125 
126  bool updateParmsFlags() override;
127 
128  void computeImageBounds(COP2_Context &context) override;
129 
131  { return COP2_THREAD_MULTI; }
132 
134  TIL_TileList *tilelist) override;
135  virtual OP_ERROR generateTile(COP2_Context &context,
136  TIL_TileList *tilelist) = 0;
137 
138  const char * uniqueName(const char *name);
139 
140  virtual void getGeneratedBounds(COP2_Context &context,
141  int &bx1, int &by1,
142  int &bx2, int &by2);
143 
144  void applyMaskBounds(const TIL_Plane *plane, int array,
145  float t, int xres,int yres, int thread,
146  int &bx1,int &by1, int &bx2,int &by2);
147 
148  void getBounds(const TIL_Plane *plane, int aindex,
149  float t, int xres, int yres, int thread,
150  int x1,int y1, int x2, int y2,
151  int &bx1, int &by1, int &bx2, int &by2);
152 
154  { return evalInt("overridesize",0,0); }
155 
156  virtual void IMAGE_SIZE(int &x, int &y)
157  { x = evalInt("size",0,0.0f);
158  y = evalInt("size",1,0.0f); }
159 
160  virtual void SET_XRES(int x)
161  {
162  if( canAccess(PRM_WRITE_OK) )
163  setInt("size", 0, 0.0f, x);
164  }
165 
166  virtual void SET_YRES(int x)
167  {
168  if( canAccess(PRM_WRITE_OK) )
169  setInt("size", 1, 0.0f, x);
170  }
171 
173  { return evalInt("overrideaspect",0,0); }
174 
175  virtual float ASPECT()
176  { return evalFloat("aspect",0,0.0f); }
177 
178  virtual int USEPLANES()
179  { return evalInt("planes", 0, 0.0f); }
180 
181  virtual int ADD_PLANES()
182  { return evalInt("addplanes",0,0.0f); }
183 
184  virtual int ADD_OP()
185  { return evalInt("addplaneop", 0, 0.0f); }
186 
187 
188  virtual void CUSTOM_PLANES(UT_String &st)
189  { evalString(st, "customplanes",0,0.0f); }
190 
191  virtual TIL_DataFormat DEPTH();
192 
193  virtual int USE_POINTS()
194  { return evalInt("usebwpoints",0,0.0f); }
195 
196  virtual void BW_POINTS(unsigned int &b, unsigned int &w);
197 
198  virtual int INTERLACE()
199  { return evalInt("interlace", 0,0.0f); }
200 
201  virtual int IDOMINANCE()
202  { return evalInt("idominance", 0,0.0f); }
203 
204  virtual int SINGLE_IMAGE()
205  { return evalInt("singleimage",0,0.0f); }
206 
207  virtual int START()
208  { return evalInt("start", 0, 0.0f); }
209 
210  virtual int LENGTH()
211  { return evalInt("length",0,0.0f); }
212 
213  virtual void SET_START(int start)
214  {
215  if( canAccess(PRM_WRITE_OK) )
216  {
217  deAnimate("start");
218  setInt("start",0,0.0f,start);
219  }
220  }
221 
222  virtual void SET_LENGTH(int len)
223  {
224  if( canAccess(PRM_WRITE_OK) )
225  {
226  deAnimate("length");
227  setInt("length", 0, 0.0f,len);
228  }
229  }
230 
231  virtual float RATE();
232 
234  { return (TIL_Extend)evalInt("preextend", 0, 0.0f); }
235 
236  virtual int PRE_HOLD()
237  { return evalInt("prehold", 0, 0.0f); }
238 
240  { return (TIL_Extend)evalInt("postextend",0,0.0f); }
241 
242  virtual int POST_HOLD()
243  { return evalInt("posthold",0,0.0f); }
244 
245  float AMOUNT(float t) override
246  { return evalFloat("effectamount", 0, t); }
247  int MASK_INPUT() override { return 1; }
248 
249  bool preferredViewPlane(UT_WorkBuffer &) override;
250 
251  int myAddOp;
253 };
254 
255 
256 #endif
void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas) override
virtual void CUSTOM_PLANES(UT_String &st)
virtual void SET_ADD_OP(int op)
int MASK_INPUT() override
virtual void SET_START(int start)
virtual void IMAGE_SIZE(int &x, int &y)
int getMaskInput() const override
bool isPixelBased() const override
int frameScope(UT_String &) override
float AMOUNT(float t) override
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles)=0
void computeImageBounds(COP2_Context &context) override
bool isGenerator() const override
GLuint start
Definition: glcorearb.h:475
int scope(UT_String &) override
virtual int START()
virtual bool preferredViewPlane(UT_WorkBuffer &)
Definition: COP2_Node.h:575
int getOpInput() const override
fpreal evalFloat(int pi, int vi, fpreal t) const
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual float ASPECT()
virtual int USEPLANES()
GLint y
Definition: glcorearb.h:103
virtual int SINGLE_IMAGE()
void setString(const UT_StringRef &val, CH_StringMeaning meaning, int parmi, int vectori, fpreal t)
virtual void SET_FORMAT(TIL_DataFormat format)
bool isFrameEffectHandled() override
GLdouble GLdouble x2
Definition: glad.h:2349
COP2_ThreadPref
Definition: COP2_Common.h:249
< returns > If no error
Definition: snippets.dox:2
bool updateParmsFlags() override
virtual void SET_ADD_PLANES(int planes)
GLfloat f
Definition: glcorearb.h:1926
virtual int USE_POINTS()
#define TIL_DataFormat
Definition: TIL_Defines.h:65
virtual int PRE_HOLD()
TIL_Sequence myConnectedSequence
void evalString(UT_String &val, int pi, int vi, fpreal t) const
void deAnimate(unsigned idx)
virtual void SET_PLANES(int planes)
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
GLdouble y1
Definition: glad.h:2349
COP2_ThreadPref getThreadPreference() const override
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual TIL_Extend POST_EXTEND()
virtual int IDOMINANCE()
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLint GLenum GLint x
Definition: glcorearb.h:409
bool isTimeModifier() const override
static OP_VariablePair myVariablePair
virtual int ADD_OP()
GLdouble t
Definition: glad.h:2397
virtual void SET_YRES(int x)
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
int canAccess(unsigned mask) const
#define COP2_API
Definition: COP2_API.h:10
GT_API const UT_StringHolder st
virtual TIL_Extend PRE_EXTEND()
void setInt(int parmi, int vectori, fpreal t, exint value)
static OP_TemplatePair myTemplatePair
virtual int POST_HOLD()
virtual void SET_CUSTOM_PLANES(const UT_String &st)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
virtual void SET_XRES(int x)
exint evalInt(int pi, int vi, fpreal t) const
void inputConnectChanged(int which) override
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
virtual void SET_LENGTH(int len)
virtual int LENGTH()
virtual int ADD_PLANES()
TIL_Extend
Definition: TIL_Defines.h:103
virtual int INTERLACE()
TIL_Sequence * cookSequenceInfo(OP_ERROR &error) override