[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48962] branches/soc-2011-tomato: Merging r48954 through r48961 from trunk into soc-2011-tomato
Sergey Sharybin
sergey.vfx at gmail.com
Mon Jul 16 13:06:26 CEST 2012
Revision: 48962
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48962
Author: nazgul
Date: 2012-07-16 11:06:26 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
Merging r48954 through r48961 from trunk into soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48954
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48961
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h
branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.cpp
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_mask.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48953
+ /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48961
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h 2012-07-16 10:51:14 UTC (rev 48961)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h 2012-07-16 11:06:26 UTC (rev 48962)
@@ -213,13 +213,13 @@
struct MaskRasterHandle;
typedef struct MaskRasterHandle MaskRasterHandle;
-MaskRasterHandle *BLI_maskrasterize_handle_new(void);
-void BLI_maskrasterize_handle_free(MaskRasterHandle *mr_handle);
-void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+MaskRasterHandle *BKE_maskrasterize_handle_new(void);
+void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle);
+void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
const int width, const int height,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather);
-float BLI_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
+float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
#endif /* USE_RASKTER */
#endif /* __BKE_MASK_H__ */
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c 2012-07-16 10:51:14 UTC (rev 48961)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c 2012-07-16 11:06:26 UTC (rev 48962)
@@ -119,7 +119,7 @@
/* alloc / free functions */
/* --------------------------------------------------------------------- */
-MaskRasterHandle *BLI_maskrasterize_handle_new(void)
+MaskRasterHandle *BKE_maskrasterize_handle_new(void)
{
MaskRasterHandle *mr_handle;
@@ -128,7 +128,7 @@
return mr_handle;
}
-void BLI_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
+void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
{
const unsigned int layers_tot = mr_handle->layers_tot;
unsigned int i;
@@ -452,7 +452,7 @@
BLI_memarena_free(arena);
}
-void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
const int width, const int height,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather)
@@ -963,7 +963,7 @@
}
}
-float BLI_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
+float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
{
/* can't do this because some layers may invert */
/* if (BLI_in_rctf_v(&mr_handle->bounds, xy)) */
Modified: branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h 2012-07-16 10:51:14 UTC (rev 48961)
+++ branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h 2012-07-16 11:06:26 UTC (rev 48962)
@@ -191,7 +191,8 @@
/* tri or quad, d can be NULL */
void interp_weights_face_v3(float w[4],
const float a[3], const float b[3], const float c[3], const float d[3], const float p[3]);
-void interp_weights_poly_v3(float w[], float v[][3], const int n, const float p[3]);
+void interp_weights_poly_v3(float w[], float v[][3], const int n, const float co[3]);
+void interp_weights_poly_v2(float w[], float v[][2], const int n, const float co[2]);
void interp_cubic_v3(float x[3], float v[3],
const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t);
Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c 2012-07-16 10:51:14 UTC (rev 48961)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c 2012-07-16 11:06:26 UTC (rev 48962)
@@ -2148,7 +2148,7 @@
/* Mean value weights - smooth interpolation weights for polygons with
* more than 3 vertices */
-static float mean_value_half_tan(const float v1[3], const float v2[3], const float v3[3])
+static float mean_value_half_tan_v3(const float v1[3], const float v2[3], const float v3[3])
{
float d2[3], d3[3], cross[3], area, dot, len;
@@ -2160,10 +2160,32 @@
dot = dot_v3v3(d2, d3);
len = len_v3(d2) * len_v3(d3);
- if (area == 0.0f)
+ if (LIKELY(area != 0.0f)) {
+ return (len - dot) / area;
+ }
+ else {
return 0.0f;
- else
+ }
+}
+static float mean_value_half_tan_v2(const float v1[2], const float v2[2], const float v3[2])
+{
+ float d2[2], d3[2], area, dot, len;
+
+ sub_v2_v2v2(d2, v2, v1);
+ sub_v2_v2v2(d3, v3, v1);
+
+ /* different from the 3d version but still correct */
+ area = cross_v2v2(d2, d3);
+
+ dot = dot_v2v2(d2, d3);
+ len = len_v2(d2) * len_v2(d3);
+
+ if (LIKELY(area != 0.0f)) {
return (len - dot) / area;
+ }
+ else {
+ return 0.0f;
+ }
}
void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3])
@@ -2178,19 +2200,48 @@
vprev = (i == 0) ? v[n - 1] : v[i - 1];
vnext = (i == n - 1) ? v[0] : v[i + 1];
- t1 = mean_value_half_tan(co, vprev, vmid);
- t2 = mean_value_half_tan(co, vmid, vnext);
+ t1 = mean_value_half_tan_v3(co, vprev, vmid);
+ t2 = mean_value_half_tan_v3(co, vmid, vnext);
len = len_v3v3(co, vmid);
w[i] = (t1 + t2) / len;
totweight += w[i];
}
- if (totweight != 0.0f)
- for (i = 0; i < n; i++)
+ if (totweight != 0.0f) {
+ for (i = 0; i < n; i++) {
w[i] /= totweight;
+ }
+ }
}
+void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[2])
+{
+ float totweight, t1, t2, len, *vmid, *vprev, *vnext;
+ int i;
+
+ totweight = 0.0f;
+
+ for (i = 0; i < n; i++) {
+ vmid = v[i];
+ vprev = (i == 0) ? v[n - 1] : v[i - 1];
+ vnext = (i == n - 1) ? v[0] : v[i + 1];
+
+ t1 = mean_value_half_tan_v2(co, vprev, vmid);
+ t2 = mean_value_half_tan_v2(co, vmid, vnext);
+
+ len = len_v2v2(co, vmid);
+ w[i] = (t1 + t2) / len;
+ totweight += w[i];
+ }
+
+ if (totweight != 0.0f) {
+ for (i = 0; i < n; i++) {
+ w[i] /= totweight;
+ }
+ }
+}
+
/* (x1,v1)(t1=0)------(x2,v2)(t2=1), 0<t<1 --> (x,v)(t) */
void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t)
{
Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.cpp 2012-07-16 10:51:14 UTC (rev 48961)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.cpp 2012-07-16 11:06:26 UTC (rev 48962)
@@ -152,9 +152,9 @@
const int width = this->getWidth();
const int height = this->getHeight();
- this->m_rasterMaskHandle = BLI_maskrasterize_handle_new();
+ this->m_rasterMaskHandle = BKE_maskrasterize_handle_new();
- BLI_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather);
+ BKE_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather);
}
}
}
@@ -162,7 +162,7 @@
void MaskOperation::deinitExecution()
{
if (this->m_rasterMaskHandle) {
- BLI_maskrasterize_handle_free(this->m_rasterMaskHandle);
+ BKE_maskrasterize_handle_free(this->m_rasterMaskHandle);
this->m_rasterMaskHandle = NULL;
}
@@ -197,7 +197,7 @@
{
const float xy[2] = {x / (float)this->m_maskWidth, y / (float)this->m_maskHeight};
if (this->m_rasterMaskHandle) {
- color[0] = BLI_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy);
+ color[0] = BKE_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy);
}
else {
color[0] = 0.0f;
Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-48953
+ /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list