diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-08 02:54:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-17 22:39:16 +0300 |
commit | 08670d3b8117cda608c178688f261e1204794a0d (patch) | |
tree | 4a82f0e7d2212bfc956619880d6b7cc168a2e7df /intern/cycles/blender/blender_util.h | |
parent | 93e4ae84ad31dc6a56fd249592b24007ea286ddc (diff) |
Code refactor: use dynamic shader node array lengths now that OSL supports them.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index cefc01bfa91..d856982fddb 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -58,14 +58,19 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data, } static inline void colorramp_to_array(BL::ColorRamp& ramp, - float4 *data, + array<float3>& ramp_color, + array<float>& ramp_alpha, int size) { + ramp_color.resize(size); + ramp_alpha.resize(size); + for(int i = 0; i < size; i++) { float color[4]; ramp.evaluate((float)i/(float)(size-1), color); - data[i] = make_float4(color[0], color[1], color[2], color[3]); + ramp_color[i] = make_float3(color[0], color[1], color[2]); + ramp_alpha[i] = color[3]; } } @@ -105,7 +110,7 @@ static inline void curvemapping_to_array(BL::CurveMapping& cumap, } static inline void curvemapping_color_to_array(BL::CurveMapping& cumap, - float4 *data, + array<float3>& data, int size, bool rgb_curve) { @@ -132,6 +137,8 @@ static inline void curvemapping_color_to_array(BL::CurveMapping& cumap, BL::CurveMap mapG = cumap.curves[1]; BL::CurveMap mapB = cumap.curves[2]; + data.resize(size); + if(rgb_curve) { BL::CurveMap mapI = cumap.curves[3]; |