HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RU_ColorCurve.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: RU_ColorCurve.h
7  *
8  * COMMENTS:
9  * A simple 2D curve for quick evaluation (for color curves).
10  */
11 #ifndef RU_SMOOTHCURVE_H
12 #define RU_SMOOTHCURVE_H
13 
14 #include "RU_API.h"
15 #include <UT/UT_FloatArray.h>
16 #include <UT/UT_Singleton.h>
17 #include <UT/UT_Vector2Array.h>
18 #include <TIL/TIL_Defines.h>
19 
20 #include "RU_PixelFunction.h"
21 
22 class GU_Detail;
23 
25 {
26 public:
27  RU_ColorCurve();
28  ~RU_ColorCurve();
29 
30  void reset();
31  void addPoint(float pos, float val, float sharpness);
32  void create(bool extend_slopes = true);
33 
34  float evaluate(float pos) const;
35 
36 // data
41  float myPreSlope, myPostSlope;
45 };
46 
47 
49 {
50 public:
52  RU_ColorCurveFunc(RU_ColorCurve **curves, int num);
53 
54  ~RU_ColorCurveFunc() override;
55 
56 protected:
57  bool eachComponentDifferent() const override
58  { return myNumCurves > 1; }
59 
60  static float curve(RU_PixelFunction *pf, float val, int);
61  RUPixelFunc getPixelFunction() const override { return curve; }
62  void getPixelShader(UT_String &frag_shader) override;
63 
64  RU_ColorCurve *myCurves[4];
66  float *myCurveData;
67 };
68 
70 {
71 public:
72  // mode = 0, adjust sat. mode = 1, adjust lum.
73  RU_HueCurveFunc(RU_ColorCurve *curve, int mode);
74 
75  ~RU_HueCurveFunc() override;
76 
77 protected:
78  bool needAllComponents() const override { return true; }
79 
80  static void hueSat(RU_PixelFunction *f, float **vals,
81  const bool *scope);
82  static void hueLum(RU_PixelFunction *f, float **vals,
83  const bool *scope);
85  { return myMode ? hueLum:hueSat; }
86  void getPixelShader(UT_String &frag_shader) override;
87 
88  struct CurveData
89  {
91  ~CurveData();
92 
93  float *myScales;
94  float myAvgScale;
95  };
96 
98  int myMode;
100 };
101 
102 
103 #endif
RUPixelFunc getPixelFunction() const override
Definition: RU_ColorCurve.h:61
RUVectorFunc getVectorFunction() const override
Definition: RU_ColorCurve.h:84
#define RU_API
Definition: RU_API.h:10
UT_FloatArray myDivs
Definition: RU_ColorCurve.h:37
UT_FloatArray mySharp
Definition: RU_ColorCurve.h:39
GLfloat f
Definition: glcorearb.h:1926
GLboolean reset
Definition: glad.h:5138
RU_ColorCurve * myCurve
Definition: RU_ColorCurve.h:97
GLenum mode
Definition: glcorearb.h:99
bool needAllComponents() const override
Definition: RU_ColorCurve.h:78
GLuint GLfloat * val
Definition: glcorearb.h:1608
UT_Vector2Array myPoints
Definition: RU_ColorCurve.h:40
void(* RUVectorFunc)(RU_PixelFunction *, float **, const bool *)
UT_SingletonWithLock< CurveData, true > myCurveData
Definition: RU_ColorCurve.h:99
virtual void getPixelShader(UT_String &frag_shader)
float(* RUPixelFunc)(RU_PixelFunction *, float, int)
UT_FloatArray myValues
Definition: RU_ColorCurve.h:38
bool eachComponentDifferent() const override
Definition: RU_ColorCurve.h:57