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:
49  virtual TIL_Sequence *cookSequenceInfo(OP_ERROR &error);
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  virtual bool isGenerator() const { 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  virtual bool isTimeModifier() const { 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);
110 
111  virtual int getOpInput() const { return 0; }
112  virtual int getMaskInput() const { return 1; }
113  virtual bool isFrameEffectHandled() { return false; }
114 
115  virtual int scope(UT_String &) { return 0; }
116  virtual int frameScope(UT_String &) { return 0; }
117  virtual bool isPixelBased() const { return false; }
118 
119  virtual void inputConnectChanged(int which);
120 
121 protected:
122  COP2_Generator(OP_Network *parent, const char *name,
123  OP_Operator *entry);
124  virtual ~COP2_Generator();
125 
126  virtual bool updateParmsFlags();
127 
128  virtual void computeImageBounds(COP2_Context &context);
129 
131  { return COP2_THREAD_MULTI; }
132 
133  virtual OP_ERROR doCookMyTile(COP2_Context &context,
134  TIL_TileList *tilelist);
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  virtual float AMOUNT(float t) { return evalFloat("effectamount", 0, t); }
246  virtual int MASK_INPUT() { return 1; }
247 
248  virtual bool preferredViewPlane(UT_WorkBuffer &);
249 
250  int myAddOp;
252 };
253 
254 
255 #endif
virtual void CUSTOM_PLANES(UT_String &st)
virtual void SET_ADD_OP(int op)
virtual void SET_START(int start)
virtual void IMAGE_SIZE(int &x, int &y)
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles)=0
virtual void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas)
GLuint start
Definition: glcorearb.h:474
virtual int START()
virtual bool preferredViewPlane(UT_WorkBuffer &)
Definition: COP2_Node.h:589
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:102
virtual int frameScope(UT_String &)
virtual int SINGLE_IMAGE()
virtual int getOpInput() const
void setString(const UT_StringRef &val, CH_StringMeaning meaning, int parmi, int vectori, fpreal t)
virtual bool isFrameEffectHandled()
virtual bool isPixelBased() const
virtual void SET_FORMAT(TIL_DataFormat format)
COP2_ThreadPref
Definition: COP2_Common.h:249
virtual void computeImageBounds(COP2_Context &context)
virtual void SET_ADD_PLANES(int planes)
GLfloat f
Definition: glcorearb.h:1925
virtual int USE_POINTS()
#define TIL_DataFormat
Definition: TIL_Defines.h:64
virtual int PRE_HOLD()
TIL_Sequence myConnectedSequence
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual bool isTimeModifier() const
void deAnimate(unsigned idx)
virtual void SET_PLANES(int planes)
virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error)
virtual float AMOUNT(float t)
virtual COP2_ThreadPref getThreadPreference() const
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int getMaskInput() const
virtual TIL_Extend POST_EXTEND()
virtual int IDOMINANCE()
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
static OP_VariablePair myVariablePair
virtual bool isGenerator() const
virtual int ADD_OP()
virtual bool updateParmsFlags()
virtual void SET_YRES(int x)
virtual void inputConnectChanged(int which)
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
int canAccess(unsigned mask) const
#define COP2_API
Definition: COP2_API.h:10
virtual TIL_Extend PRE_EXTEND()
void setInt(int parmi, int vectori, fpreal t, exint value)
static OP_TemplatePair myTemplatePair
virtual int POST_HOLD()
GLint GLenum GLint x
Definition: glcorearb.h:408
virtual void SET_CUSTOM_PLANES(const UT_String &st)
virtual int MASK_INPUT()
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual void SET_XRES(int x)
exint evalInt(int pi, int vi, fpreal t) const
virtual void SET_LENGTH(int len)
virtual int LENGTH()
virtual int ADD_PLANES()
virtual int scope(UT_String &)
TIL_Extend
Definition: TIL_Defines.h:92
virtual int INTERLACE()