00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _COP2_LUMAKEY_H_
00021 #define _COP2_LUMAKEY_H_
00022
00023 #include "COP2_API.h"
00024 #define ARG_LUMAKEY_MIN_LUM (myParmBase + 0)
00025 #define ARG_LUMAKEY_MIN_VALUE (myParmBase + 1)
00026 #define ARG_LUMAKEY_MAX_LUM (myParmBase + 2)
00027 #define ARG_LUMAKEY_MAX_VALUE (myParmBase + 3)
00028 #define ARG_LUMAKEY_DISCARD (myParmBase + 4)
00029 #define ARG_LUMAKEY_ROLLOFF (myParmBase + 5)
00030 #define ARG_LUMAKEY_ROLL_FUNC (myParmBase + 6)
00031 #define ARG_LUMAKEY_FUNCTION (myParmBase + 7)
00032 #define ARG_LUMAKEY_SUPER_SAMPLE (myParmBase +8)
00033 #define ARG_LUMAKEY_KEY_PLANE (myParmBase + 9)
00034
00035 #include "COP2_KeyBase.h"
00036
00037 class cop2_LumaContext;
00038
00039 class COP2_API COP2_LumaKey : public COP2_KeyBase
00040 {
00041 public:
00042 static OP_Node *myConstructor(OP_Network*, const char *,
00043 OP_Operator *);
00044 static OP_TemplatePair myTemplatePair;
00045 static OP_VariablePair myVariablePair;
00046 static PRM_Template myTemplateList[];
00047 static CH_LocalVariable myVariableList[];
00048 static const char *myInputLabels[];
00049
00050 unsigned disableParms();
00051
00052 virtual void setColorParms(float hmin, float hmax,
00053 float smin, float smax,
00054 float lmin, float lmax,
00055 bool add, float t);
00056 protected:
00057 virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
00058 float t, int xres, int yres,
00059 int thread,
00060 int max_threads);
00061
00062 virtual const char *getKeyPlane(COP2_Context &context);
00063
00064 virtual int getSuperSample(COP2_Context &context);
00065
00066 virtual bool convertToColorSpace(COP2_Context &context,
00067 const float *c1, const float *c2,
00068 const float *c3, const float *c4,
00069 float *&d1, float *&d2,
00070 float *&d3, float *&d4,
00071 int size);
00072
00073 virtual COP2_KeyFunction getKeyFunction(COP2_Context &context,
00074 void *&data);
00075
00076 virtual bool isFrameEffectHandled() { return false; }
00077 private:
00078 COP2_LumaKey(OP_Network *parent, const char *name,
00079 OP_Operator *entry);
00080 virtual ~COP2_LumaKey();
00081
00082 virtual void getShaderAndConstants(COP2_Context &context,
00083 UT_String &shader_funcs,
00084 RE_OGLComputeGPU &engine);
00085
00086 bool MIN_LUMINANCE()
00087 { return (bool) evalInt(ARG_LUMAKEY_MIN_LUM, 0,0); }
00088 float MIN_VALUE(float t)
00089 { return evalFloat(ARG_LUMAKEY_MIN_VALUE, 0,t); }
00090
00091 bool MAX_LUMINANCE()
00092 { return (bool) evalInt(ARG_LUMAKEY_MAX_LUM, 0,0); }
00093 float MAX_VALUE(float t)
00094 { return evalFloat(ARG_LUMAKEY_MAX_VALUE, 0,t); }
00095
00096 float ROLLOFF(float t)
00097 { return evalFloat(ARG_LUMAKEY_ROLLOFF, 0,t); }
00098
00099 int ROLLOFF_FUNCTION()
00100 { return evalInt(ARG_LUMAKEY_ROLL_FUNC,0,0); }
00101
00102 int DISCARD()
00103 { return evalInt(ARG_LUMAKEY_DISCARD,0,0); }
00104
00105 int FUNCTION()
00106 { return evalInt(ARG_LUMAKEY_FUNCTION,0,0); }
00107
00108 int SUPER_SAMPLE(float t)
00109 { return evalInt(ARG_LUMAKEY_SUPER_SAMPLE,0,t); }
00110
00111 void KEY_PLANE(UT_String &st)
00112 { evalString(st, ARG_LUMAKEY_KEY_PLANE, 0, 0); }
00113
00114 int myParmBase;
00115 };
00116
00117 class COP2_API cop2_LumaContext : public COP2_ContextData
00118 {
00119 public:
00120 cop2_LumaContext() {}
00121 virtual ~cop2_LumaContext() {}
00122
00123 virtual bool createPerRes() const { return false; }
00124
00125 int myMinLum;
00126 float myMinVal;
00127 int myMaxLum;
00128 float myMaxVal;
00129
00130 float myRolloff;
00131 int myRollFunc;
00132 int myDiscard;
00133 int myFunction;
00134 int mySuperSample;
00135 UT_String myKeyPlane;
00136 float (*myInterpFunc)(float );
00137 float myInvRoll;
00138 };
00139 #endif