Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-11 18:39:37 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-11 18:39:37 +0400
commit43c04eefe32773b708d85ea0db95564e71f4870e (patch)
treeadcbc13cd57ce4f48f7fc26e123e3ca11c71cb2c /intern/cycles/blender/blender_util.h
parent7c81952179f0ff08cfdd8f571eb1c0f06e224070 (diff)
Cycles: RGB and Vector Curves nodes now supported, with the limitation that the
range must be left to the default (0..1 and -1..1).
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r--intern/cycles/blender/blender_util.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 0a9f2dd06aa..fbcbe15ec5a 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -52,6 +52,36 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
}
}
+static inline void curvemapping_color_to_array(BL::CurveMapping cumap, float4 *data, int size, bool rgb_curve)
+{
+ cumap.update();
+
+ BL::CurveMap mapR = cumap.curves[0];
+ BL::CurveMap mapG = cumap.curves[1];
+ BL::CurveMap mapB = cumap.curves[2];
+
+ if(rgb_curve) {
+ BL::CurveMap mapI = cumap.curves[3];
+
+ for(int i = 0; i < size; i++) {
+ float t = i/(float)(size-1);
+
+ data[i][0] = mapR.evaluate(mapI.evaluate(t));
+ data[i][1] = mapG.evaluate(mapI.evaluate(t));
+ data[i][2] = mapB.evaluate(mapI.evaluate(t));
+ }
+ }
+ else {
+ for(int i = 0; i < size; i++) {
+ float t = i/(float)(size-1);
+
+ data[i][0] = mapR.evaluate(t);
+ data[i][1] = mapG.evaluate(t);
+ data[i][2] = mapB.evaluate(t);
+ }
+ }
+}
+
static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
{
return self.is_modified(scene, (preview)? (1<<0): (1<<1))? true: false;