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@pandora.be>2011-11-07 19:23:08 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-07 19:23:08 +0400
commit5ef9039b7e2ea16bd4b651aab21d5aa690485569 (patch)
treee67247fa43d89748900b697eb9bdf0341fe53afc /source/blender/editors/sculpt_paint
parentfb56dbc2afc7c8b6ffc24406ed82cbcbff090da3 (diff)
parent5ebee683bd736ef80df939552bbe0d8e104b56df (diff)
Cycles: svn merge -r41531:41613 ^/trunk/blender
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c105
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
3 files changed, 68 insertions, 48 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c8c1f083046..e283927b76f 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -65,6 +65,7 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
+#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
@@ -106,12 +107,30 @@
#define IMAPAINT_CHAR_TO_FLOAT(c) ((c)/255.0f)
-#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); }
-#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); (c)[3]=FTOCHAR((f)[3]); }
+#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { \
+ (c)[0]= FTOCHAR((f)[0]); \
+ (c)[1]= FTOCHAR((f)[1]); \
+ (c)[2]= FTOCHAR((f)[2]); \
+}
+#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { \
+ (c)[0]= FTOCHAR((f)[0]); \
+ (c)[1]= FTOCHAR((f)[1]); \
+ (c)[2]= FTOCHAR((f)[2]); \
+ (c)[3]= FTOCHAR((f)[3]); \
+}
+#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \
+ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+}
+#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \
+ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+ (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]); \
+}
-#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); }
-#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); (f)[3]=IMAPAINT_CHAR_TO_FLOAT((c)[3]); }
-#define IMAPAINT_FLOAT_RGB_COPY(a, b) VECCOPY(a, b)
+#define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b)
#define IMAPAINT_TILE_BITS 6
#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
@@ -642,7 +661,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
best_face_index = face_index;
best_side = 0;
z_depth_best = z_depth;
- VECCOPY(w, w_tmp);
+ copy_v3_v3(w, w_tmp);
}
}
else if (mf->v4) {
@@ -656,7 +675,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
best_face_index = face_index;
best_side= 1;
z_depth_best = z_depth;
- VECCOPY(w, w_tmp);
+ copy_v3_v3(w, w_tmp);
}
}
}
@@ -759,7 +778,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
if (rgba_fp) {
if (ibuf->rect_float) {
- QUATCOPY(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
+ copy_v4_v4(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
}
else {
char *tmp_ch= ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4);
@@ -1472,7 +1491,7 @@ static ProjPixel *project_paint_uvpixel_init(
}
/* screenspace unclamped, we could keep its z and w values but dont need them at the moment */
- VECCOPY2D(projPixel->projCoSS, pixelScreenCo);
+ copy_v2_v2(projPixel->projCoSS, pixelScreenCo);
projPixel->x_px = x_px;
projPixel->y_px = y_px;
@@ -1572,8 +1591,8 @@ static int line_clip_rect2f(
if (fabsf(l1[0]-l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
return 1;
}
else {
@@ -1581,8 +1600,8 @@ static int line_clip_rect2f(
}
}
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
CLAMP(l1_clip[0], rect->xmin, rect->xmax);
CLAMP(l2_clip[0], rect->xmin, rect->xmax);
return 1;
@@ -1600,8 +1619,8 @@ static int line_clip_rect2f(
if (fabsf(l1[1]-l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
return 1;
}
else {
@@ -1609,8 +1628,8 @@ static int line_clip_rect2f(
}
}
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
CLAMP(l1_clip[1], rect->ymin, rect->ymax);
CLAMP(l2_clip[1], rect->ymin, rect->ymax);
return 1;
@@ -1624,12 +1643,12 @@ static int line_clip_rect2f(
/* are either of the points inside the rectangle ? */
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
+ copy_v2_v2(l1_clip, l1);
ok1 = 1;
}
if (BLI_in_rctf(rect, l2[0], l2[1])) {
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
@@ -1954,14 +1973,14 @@ static void project_bucket_clip_face(
if (inside_bucket_flag == ISECT_ALL3) {
/* all screenspace points are inside the bucket bounding box, this means we dont need to clip and can simply return the UVs */
if (flip) { /* facing the back? */
- VECCOPY2D(bucket_bounds_uv[0], uv3co);
- VECCOPY2D(bucket_bounds_uv[1], uv2co);
- VECCOPY2D(bucket_bounds_uv[2], uv1co);
+ copy_v2_v2(bucket_bounds_uv[0], uv3co);
+ copy_v2_v2(bucket_bounds_uv[1], uv2co);
+ copy_v2_v2(bucket_bounds_uv[2], uv1co);
}
else {
- VECCOPY2D(bucket_bounds_uv[0], uv1co);
- VECCOPY2D(bucket_bounds_uv[1], uv2co);
- VECCOPY2D(bucket_bounds_uv[2], uv3co);
+ copy_v2_v2(bucket_bounds_uv[0], uv1co);
+ copy_v2_v2(bucket_bounds_uv[1], uv2co);
+ copy_v2_v2(bucket_bounds_uv[2], uv3co);
}
*tot = 3;
@@ -2025,33 +2044,33 @@ static void project_bucket_clip_face(
(*tot) = 0;
- if (inside_face_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
- if (inside_face_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
- if (inside_face_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
- if (inside_face_flag & ISECT_4) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
+ if (inside_face_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
+ if (inside_face_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
+ if (inside_face_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
+ if (inside_face_flag & ISECT_4) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
- if (inside_bucket_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], v1coSS); (*tot)++; }
- if (inside_bucket_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], v2coSS); (*tot)++; }
- if (inside_bucket_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], v3coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], v1coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], v2coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], v3coSS); (*tot)++; }
if ((inside_bucket_flag & (ISECT_1|ISECT_2)) != (ISECT_1|ISECT_2)) {
if (line_clip_rect2f(bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
if ((inside_bucket_flag & (ISECT_2|ISECT_3)) != (ISECT_2|ISECT_3)) {
if (line_clip_rect2f(bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
if ((inside_bucket_flag & (ISECT_3|ISECT_1)) != (ISECT_3|ISECT_1)) {
if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
@@ -2580,8 +2599,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]);
- if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
- else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
+ if (fac < 0.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[0]); }
+ else if (fac > 1.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[1]); }
else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
if (!is_ortho) {
@@ -3074,7 +3093,7 @@ static void project_paint_begin(ProjPaintState *ps)
normalize_v3(ps->viewDir);
/* viewPos - object relative */
- VECCOPY(ps->viewPos, viewinv[3]);
+ copy_v3_v3(ps->viewPos, viewinv[3]);
copy_m3_m4(mat, ps->ob->imat);
mul_m3_v3(mat, ps->viewPos);
add_v3_v3(ps->viewPos, ps->ob->imat[3]);
@@ -3434,7 +3453,7 @@ static void project_paint_end(ProjPaintState *ps)
if (is_float) {
float *rgba_fp = (float *)tilerect + (((projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE)) * 4;
- QUATCOPY(rgba_fp, projPixel->origColor.f);
+ copy_v4_v4(rgba_fp, projPixel->origColor.f);
}
else {
((unsigned int *)tilerect)[ (projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE ] = projPixel->origColor.uint;
@@ -3769,7 +3788,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb);
}
else {
- VECCOPY(rgba, ps->brush->rgb);
+ copy_v3_v3(rgba, ps->brush->rgb);
}
rgba[3] = 1.0;
}
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index b1c0b571d49..ed2956ff054 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -124,7 +124,7 @@ float paint_get_tex_pixel(Brush* br, float u, float v)
static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
{
- VECCOPY(pco, co);
+ copy_v3_v3(pco, co);
pco[3]= 1.0f;
mul_m4_v3(ob->obmat, pco);
@@ -166,7 +166,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
invert_m3_m3(invwmat, wmat);
mul_m3_v3(invwmat, h);
- VECCOPY(w, h);
+ copy_v3_v3(w, h);
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c26a4d52a9e..ac2efcb2ec2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2297,8 +2297,9 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
ofs= key_to_vertcos(ob, kb);
/* calculate key coord offsets (from previous location) */
- for (a= 0; a < me->totvert; a++)
- VECSUB(ofs[a], vertCos[a], ofs[a]);
+ for (a= 0; a < me->totvert; a++) {
+ sub_v3_v3v3(ofs[a], vertCos[a], ofs[a]);
+ }
/* apply offsets on other keys */
currkey = me->key->block.first;
@@ -2319,7 +2320,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
MVert *mvert= me->mvert;
for (a= 0; a < me->totvert; a++, mvert++)
- VECCOPY(mvert->co, vertCos[a]);
+ copy_v3_v3(mvert->co, vertCos[a]);
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
}