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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-10-20 17:01:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-20 17:01:07 +0400
commitce741bc223940654a13b3d6b723fc42328c3b832 (patch)
tree726e3c6908dceaca95696dff73f2fc79cb742e14 /source/blender/blenkernel/intern/texture.c
parente9d5e9813c5cce45f14bb25bb82f2e88f5688351 (diff)
Code cleanup: de-duplicate implementation of get_texture_value
Expect to be no functional changes :)
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r--source/blender/blenkernel/intern/texture.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 22b0fe7bc24..ccbccac85cf 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -68,6 +68,9 @@
#include "BKE_node.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
+#include "BKE_scene.h"
+
+#include "RE_shader_ext.h"
/* ****************** Mapping ******************* */
@@ -1436,3 +1439,27 @@ bool BKE_texture_dependsOnTime(const struct Tex *texture)
}
/* ------------------------------------------------------------------------- */
+
+void BKE_texture_get_value(Scene *scene, Tex *texture, float *tex_co, TexResult *texres, bool use_color_management)
+{
+ int result_type;
+ bool do_color_manage = false;
+
+ if (scene && use_color_management) {
+ do_color_manage = BKE_scene_check_color_management_enabled(scene);
+ }
+
+ /* no node textures for now */
+ result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage);
+
+ /* if the texture gave an RGB value, we assume it didn't give a valid
+ * intensity, since this is in the context of modifiers don't use perceptual color conversion.
+ * if the texture didn't give an RGB value, copy the intensity across
+ */
+ if (result_type & TEX_RGB) {
+ texres->tin = (1.0f / 3.0f) * (texres->tr + texres->tg + texres->tb);
+ }
+ else {
+ copy_v3_fl(&texres->tr, texres->tin);
+ }
+}