HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_Ramp.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_Ramp.h
7  *
8  * COMMENTS:
9  * Constant Ramp COP
10  */
11 #ifndef __COP2_RAMP_H__
12 #define __COP2_RAMP_H__
13 
14 #include "COP2_API.h"
15 class cop2_RampData;
16 struct cop2_RampPoint;
17 
18 #include <UT/UT_ValArray.h>
19 #include "COP2_Generator.h"
20 
21 #define ARG_RAMP_TYPE (myParmBase + 0)
22 #define ARG_RAMP_INTERPOLATION (myParmBase + 1)
23 #define ARG_RAMP_CYCLES (myParmBase + 2)
24 #define ARG_RAMP_PHASE (myParmBase + 3)
25 #define ARG_RAMP_ROTATION (myParmBase + 4)
26 #define ARG_RAMP_CENTER (myParmBase + 5)
27 #define ARG_RAMP_WRAP (myParmBase + 6)
28 #define ARG_RAMP_REPEAT (myParmBase + 7)
29 #define ARG_RAMP_NUM_POINTS (myParmBase + 8)
30 
32 {
33 public:
34  static OP_Node *myConstructor(OP_Network*, const char *,
35  OP_Operator *);
38  static PRM_Template myTemplateList[];
39  static CH_LocalVariable myVariableList[];
40  static PRM_Template myObsoleteList[];
41 
42  void getRampColor(float col[4],float pos,float t);
43 
44 protected:
45  bool updateParmsFlags() override;
46 
48  TIL_TileList *tilelist) override;
49 
51  float t, int xres, int yres,
52  int thread,
53  int max_threads) override;
54 
55  ~COP2_Ramp() override;
56 
57 private:
58  COP2_Ramp(OP_Network *parent, const char *name,
59  OP_Operator *entry);
60 
61  void evaluatePointParameters(UT_ValArray<cop2_RampPoint *>&points,
62  float scale, float t);
63 
64  void makeHorizontal(cop2_RampData *rdata,
65  float *d1, float *d2, float *d3, float *d4,
66  int x1, int y1, int x2, int y2);
67 
68  void makeVertical(cop2_RampData *rdata,
69  float *d1, float *d2, float *d3, float *d4,
70  int x1, int y1, int x2, int y2);
71 
72  void makeRadial(cop2_RampData *rdata,
73  float *d1, float *d2, float *d3, float *d4,
74  int x1, int y1, int x2, int y2, float cx, float cy);
75 
76  void makeConcentric(cop2_RampData *rdata,
77  float *d1, float *d2, float *d3, float *d4,
78  int x1, int y1, int x2, int y2,
79  float cx, float cy);
80 
81  void makeRotated(cop2_RampData *rdata,
82  float *d1, float *d2, float *d3, float *d4,
83  int x1, int y1, int x2, int y2,
84  float rot, float cx, float cy);
85 
86  void fillData(TIL_TileList *,
88  float *, float *, float *, float *);
89 
90  int RAMP_TYPE()
91  { return evalInt(ARG_RAMP_TYPE, 0, 0); }
92 
93  bool WRAP_FIRST_LAST()
94  { return evalInt(ARG_RAMP_WRAP, 0, 0); }
95 
96  bool REPEAT()
97  { return evalInt(ARG_RAMP_REPEAT, 0, 0); }
98 
99  float NUM_CYCLES(float t)
100  { return evalFloat(ARG_RAMP_CYCLES, 0, t); }
101 
102  float PHASE(float t)
103  { return evalFloat(ARG_RAMP_PHASE, 0, t); }
104 
105  float ROTATION(float t)
106  { return evalFloat(ARG_RAMP_ROTATION, 0, t); }
107 
108  void CENTER(float &x, float &y, float t)
109  { x = evalFloat(ARG_RAMP_CENTER, 0, t);
110  y = evalFloat(ARG_RAMP_CENTER, 1, t); }
111 
112  int GLOBAL_INTERP()
113  { return evalInt(ARG_RAMP_INTERPOLATION, 0, 0); }
114 
115  int NUM_POINTS() { return evalInt(ARG_RAMP_NUM_POINTS, 0, 0.0f); }
116 
117  // Ramp points.
118  bool POINT_ENABLE(int index);
119  float POINT_POS(int index, float t);
120  void POINT_COLOR(int index, float color[4], float t);
121  int INTERPOLATION(int index);
122 
123  const char *getOperationInfo() override;
124 
125  int myParmBase;
126 };
127 
129 {
130 public:
132  { myRamp[0] = myRamp[1] = myRamp[2] = myRamp[3] = 0; }
133 
134  ~cop2_RampData() override
135  { delete [] myRamp[0]; delete [] myRamp[1];
136  delete [] myRamp[2]; delete [] myRamp[3]; }
137 
138  void blendRamp(int index, cop2_RampPoint *p1, cop2_RampPoint *p2,
139  float blend);
140 
141  int mySize;
143  float *myRamp[4];
144  float myRotation;
145  float myCenterX, myCenterY;
146  bool myRepeat;
147 
148 };
149 #endif
static OP_TemplatePair myTemplatePair
Definition: COP2_Ramp.h:36
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
virtual OP_ERROR generateTile(COP2_Context &context, TIL_TileList *tilelist)=0
#define ARG_RAMP_NUM_POINTS
Definition: COP2_Ramp.h:29
GA_API const UT_StringHolder rot
fpreal evalFloat(int pi, int vi, fpreal t) const
UT_ErrorSeverity
Definition: UT_Error.h:25
#define ARG_RAMP_REPEAT
Definition: COP2_Ramp.h:28
GLint y
Definition: glcorearb.h:103
bool updateParmsFlags() override
virtual const char * getOperationInfo()
GLdouble GLdouble x2
Definition: glad.h:2349
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4784
GA_API const UT_StringHolder scale
GLfloat f
Definition: glcorearb.h:1926
float myCenterY
Definition: COP2_Ramp.h:145
GLdouble y1
Definition: glad.h:2349
#define ARG_RAMP_TYPE
Definition: COP2_Ramp.h:21
virtual COP2_ContextData * newContextData(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, int max_threads)
GLuint const GLchar * name
Definition: glcorearb.h:786
GLint GLenum GLint x
Definition: glcorearb.h:409
float myRotation
Definition: COP2_Ramp.h:144
static OP_VariablePair myVariablePair
Definition: COP2_Ramp.h:37
#define ARG_RAMP_CENTER
Definition: COP2_Ramp.h:26
GLdouble t
Definition: glad.h:2397
#define ARG_RAMP_WRAP
Definition: COP2_Ramp.h:27
**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
#define COP2_API
Definition: COP2_API.h:10
GLuint color
Definition: glcorearb.h:1261
GLuint index
Definition: glcorearb.h:786
#define ARG_RAMP_PHASE
Definition: COP2_Ramp.h:24
#define ARG_RAMP_INTERPOLATION
Definition: COP2_Ramp.h:22
#define ARG_RAMP_ROTATION
Definition: COP2_Ramp.h:25
~cop2_RampData() override
Definition: COP2_Ramp.h:134
exint evalInt(int pi, int vi, fpreal t) const
#define ARG_RAMP_CYCLES
Definition: COP2_Ramp.h:23
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349