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@gmail.com>2016-05-08 02:54:35 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2016-06-08 22:45:40 +0300
commit40453dbca1ee07dc1ecc4a8ad148b8c20e622270 (patch)
tree4130ae665529a5abc2a9e339d869d06fe34230a4 /intern/cycles/blender/blender_util.h
parentdfe7a7ccbf5d61bb43e58f70b1d24f79a371480a (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.h13
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];