00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COP2_RAMP_H__
00021 #define __COP2_RAMP_H__
00022
00023 #include "COP2_API.h"
00024 class cop2_RampData;
00025 struct cop2_RampPoint;
00026
00027 #include <UT/UT_PtrArray.h>
00028 #include "COP2_Generator.h"
00029
00030 #define ARG_RAMP_TYPE (myParmBase + 0)
00031 #define ARG_RAMP_INTERPOLATION (myParmBase + 1)
00032 #define ARG_RAMP_CYCLES (myParmBase + 2)
00033 #define ARG_RAMP_PHASE (myParmBase + 3)
00034 #define ARG_RAMP_ROTATION (myParmBase + 4)
00035 #define ARG_RAMP_CENTER (myParmBase + 5)
00036 #define ARG_RAMP_WRAP (myParmBase + 6)
00037 #define ARG_RAMP_REPEAT (myParmBase + 7)
00038 #define ARG_RAMP_NUM_POINTS (myParmBase + 8)
00039
00040 class COP2_API COP2_Ramp : public COP2_Generator
00041 {
00042 public:
00043
00044 virtual unsigned disableParms();
00045
00046 static OP_Node *myConstructor(OP_Network*, const char *,
00047 OP_Operator *);
00048 static OP_TemplatePair myTemplatePair;
00049 static OP_VariablePair myVariablePair;
00050 static PRM_Template myTemplateList[];
00051 static CH_LocalVariable myVariableList[];
00052 static PRM_Template myObsoleteList[];
00053
00054 void getRampColor(float col[4],float pos,float t);
00055
00056 protected:
00057 virtual OP_ERROR generateTile(COP2_Context &context,
00058 TIL_TileList *tilelist);
00059
00060 virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
00061 float t, int xres, int yres,
00062 int thread,
00063 int max_threads);
00064
00065 virtual ~COP2_Ramp();
00066
00067 private:
00068 COP2_Ramp(OP_Network *parent, const char *name,
00069 OP_Operator *entry);
00070
00071 void evaluatePointParameters(UT_PtrArray<cop2_RampPoint *>&points,
00072 float scale, float t);
00073
00074 void makeHorizontal(cop2_RampData *rdata,
00075 float *d1, float *d2, float *d3, float *d4,
00076 int x1, int y1, int x2, int y2);
00077
00078 void makeVertical(cop2_RampData *rdata,
00079 float *d1, float *d2, float *d3, float *d4,
00080 int x1, int y1, int x2, int y2);
00081
00082 void makeRadial(cop2_RampData *rdata,
00083 float *d1, float *d2, float *d3, float *d4,
00084 int x1, int y1, int x2, int y2, float cx, float cy);
00085
00086 void makeConcentric(cop2_RampData *rdata,
00087 float *d1, float *d2, float *d3, float *d4,
00088 int x1, int y1, int x2, int y2,
00089 float cx, float cy);
00090
00091 void makeRotated(cop2_RampData *rdata,
00092 float *d1, float *d2, float *d3, float *d4,
00093 int x1, int y1, int x2, int y2,
00094 float rot, float cx, float cy);
00095
00096 void fillData(TIL_TileList *,
00097 TIL_Tile *, TIL_Tile *, TIL_Tile *, TIL_Tile *,
00098 float *, float *, float *, float *);
00099
00100 int RAMP_TYPE()
00101 { return evalInt(ARG_RAMP_TYPE, 0, 0); }
00102
00103 bool WRAP_FIRST_LAST()
00104 { return evalInt(ARG_RAMP_WRAP, 0, 0); }
00105
00106 bool REPEAT()
00107 { return evalInt(ARG_RAMP_REPEAT, 0, 0); }
00108
00109 float NUM_CYCLES(float t)
00110 { return evalFloat(ARG_RAMP_CYCLES, 0, t); }
00111
00112 float PHASE(float t)
00113 { return evalFloat(ARG_RAMP_PHASE, 0, t); }
00114
00115 float ROTATION(float t)
00116 { return evalFloat(ARG_RAMP_ROTATION, 0, t); }
00117
00118 void CENTER(float &x, float &y, float t)
00119 { x = evalFloat(ARG_RAMP_CENTER, 0, t);
00120 y = evalFloat(ARG_RAMP_CENTER, 1, t); }
00121
00122 int GLOBAL_INTERP()
00123 { return evalInt(ARG_RAMP_INTERPOLATION, 0, 0); }
00124
00125 int NUM_POINTS() { return evalInt(ARG_RAMP_NUM_POINTS, 0, 0.0f); }
00126
00127
00128 bool POINT_ENABLE(int index);
00129 float POINT_POS(int index, float t);
00130 void POINT_COLOR(int index, float color[4], float t);
00131 int INTERPOLATION(int index);
00132
00133 virtual const char *getOperationInfo();
00134
00135 int myParmBase;
00136 };
00137
00138 class COP2_API cop2_RampData : public COP2_ContextData
00139 {
00140 public:
00141 cop2_RampData()
00142 { myRamp[0] = myRamp[1] = myRamp[2] = myRamp[3] = 0; }
00143
00144 virtual ~cop2_RampData()
00145 { delete [] myRamp[0]; delete [] myRamp[1];
00146 delete [] myRamp[2]; delete [] myRamp[3]; }
00147
00148 void blendRamp(int index, cop2_RampPoint *p1, cop2_RampPoint *p2,
00149 float blend);
00150
00151 int mySize;
00152 int myRampType;
00153 float *myRamp[4];
00154 float myRotation;
00155 float myCenterX, myCenterY;
00156 bool myRepeat;
00157
00158 };
00159 #endif