Merge branch 'master' into blender2.8
[blender.git] / intern / cycles / blender / blender_util.h
index cefc01bfa91dd833527736a1daba80eff39e7503..89a53a1deca75f6b54962f843456710fc59401d7 100644 (file)
@@ -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];
        }
 }
 
@@ -93,11 +98,12 @@ static inline void curvemapping_minmax(/*const*/ BL::CurveMapping& cumap,
 }
 
 static inline void curvemapping_to_array(BL::CurveMapping& cumap,
-                                         float *data,
+                                         array<float>& data,
                                          int size)
 {
        cumap.update();
        BL::CurveMap curve = cumap.curves[0];
+       data.resize(size);
        for(int i = 0; i < size; i++) {
                float t = (float)i/(float)(size-1);
                data[i] = curve.evaluate(t);
@@ -105,7 +111,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 +138,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];
 
@@ -268,7 +276,6 @@ static inline uint get_layer(const BL::Array<int, 20>& array)
 
 static inline uint get_layer(const BL::Array<int, 20>& array,
                              const BL::Array<int, 8>& local_array,
-                             bool use_local,
                              bool is_light = false,
                              uint scene_layers = (1 << 20) - 1)
 {
@@ -293,13 +300,6 @@ static inline uint get_layer(const BL::Array<int, 20>& array,
                                layer |= (1 << (20+i));
        }
 
-       /* we don't have spare bits for localview (normally 20-28) because
-        * PATH_RAY_LAYER_SHIFT uses 20-32. So - check if we have localview and if
-        * so, shift local view bits down to 1-8, since this is done for the view
-        * port only - it should be OK and not conflict with render layers. */
-       if(use_local)
-               layer >>= 20;
-
        return layer;
 }
 
@@ -688,33 +688,6 @@ struct ObjectKey {
        }
 };
 
-/* Particle System Key */
-
-struct ParticleSystemKey {
-       void *ob;
-       int id[OBJECT_PERSISTENT_ID_SIZE];
-
-       ParticleSystemKey(void *ob_, int id_[OBJECT_PERSISTENT_ID_SIZE])
-       : ob(ob_)
-       {
-               if(id_)
-                       memcpy(id, id_, sizeof(id));
-               else
-                       memset(id, 0, sizeof(id));
-       }
-
-       bool operator<(const ParticleSystemKey& k) const
-       {
-               /* first id is particle index, we don't compare that */
-               if(ob < k.ob)
-                       return true;
-               else if(ob == k.ob)
-                       return memcmp(id+1, k.id+1, sizeof(int)*(OBJECT_PERSISTENT_ID_SIZE-1)) < 0;
-
-               return false;
-       }
-};
-
 CCL_NAMESPACE_END
 
 #endif /* __BLENDER_UTIL_H__ */