diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-26 16:45:14 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-26 16:45:14 +0400 |
commit | bbc3d820f44ca62810c1800cf7caa3905b6116a6 (patch) | |
tree | 3cb45928cc5e8e758b3cabd18ebe79a763f162d5 /intern/cycles/blender/blender_util.h | |
parent | 56baed13da0e3cf1206afd17f65bba00ec4a287c (diff) |
Cycles: add ColorRamp node.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index ff6d55c6f3e..67f3a3ab7d9 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -50,6 +50,7 @@ void engine_tag_redraw(void *engine); void engine_tag_update(void *engine); int rna_Object_is_modified(void *ob, void *scene, int settings); void BLI_timestr(double _time, char *str); +void rna_ColorRamp_eval(void *coba, float position, float color[4]); } @@ -63,6 +64,16 @@ static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool app return BL::Mesh(ptr); } +static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size) +{ + for(int i = 0; i < size; i++) { + float color[4]; + + rna_ColorRamp_eval(ramp.ptr.data, i/(float)(size-1), color); + data[i] = make_float4(color[0], color[1], color[2], color[3]); + } +} + static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh) { rna_Main_meshes_remove(data.ptr.data, NULL, mesh.ptr.data); |