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:
authorAntony Riakiotakis <kalast@gmail.com>2013-03-31 04:38:50 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-03-31 04:38:50 +0400
commit1fea6220a2418b07bec8bbf49da00cc77094076f (patch)
treee674dbe323e533ec54c7d7f6937bcfdf09247a29 /source/blender/editors/sculpt_paint/paint_utils.c
parent68ac08681a084ae719fdfb3c3063593970d2d7b3 (diff)
Woot woot commit.
Stencil style texture mapping. Ready for field testing and user feedback. This commit adds stencil like brushes, like those that existed on old ptex branch. (with the exception of clip colour) To control the position of the stencil, you use Q: translation Shift - Q: scaling Ctrl - Q: rotation There's extra work that has been done to make this work: * Support for coloured overlay in vertex/texture painting * Also made A button do stroke mode selection like in sculpt mode, when mask painting is inactive. There are some TODOs to work on during bcon3: * Support tiled and stencil mode in 2D painting. Support alpha textures also. * Tidy up overlay code. There's some confusion there due to the way we use the primary brush texture sometimes for alpha, other times for colour control. WIP design docs will be in http://wiki.blender.org/index.php/User:Psy-Fi/New_Brush_Tool_Design
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_utils.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 1dadef1e0a4..47e20bcc5fb 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -59,6 +59,7 @@
#include "BIF_glutil.h"
#include "RE_shader_ext.h"
+#include "RE_render_ext.h"
#include "ED_view3d.h"
#include "ED_screen.h"
@@ -176,13 +177,13 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
return len_v3(delta) / scale;
}
-float paint_get_tex_pixel(Brush *br, float u, float v, struct ImagePool *pool)
+float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool)
{
TexResult texres = {0};
float co[3] = {u, v, 0.0f};
int hasrgb;
- hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres, pool);
+ hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, pool);
if (hasrgb & TEX_RGB)
texres.tin = rgb_to_grayscale(&texres.tr) * texres.ta;
@@ -190,6 +191,23 @@ float paint_get_tex_pixel(Brush *br, float u, float v, struct ImagePool *pool)
return texres.tin;
}
+void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool)
+{
+ float co[3] = {u, v, 0.0f};
+ int hasrgb;
+ float intensity;
+
+ hasrgb = externtex(mtex, co, &intensity,
+ rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool);
+
+ if (!hasrgb) {
+ rgba[0] = intensity;
+ rgba[1] = intensity;
+ rgba[2] = intensity;
+ rgba[3] = 1.0f;
+ }
+}
+
/* 3D Paint */
static void imapaint_project(Object *ob, float model[4][4], float proj[4][4], const float co[3], float pco[4])