diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-26 04:15:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-26 04:15:21 +0400 |
commit | a7242c3162fd8ac28754b92c3bab8f003f912251 (patch) | |
tree | 00d9123f9c398738446caea9644515e13ac81774 /source | |
parent | bd65fc176d39f8b083e0dbb7c6fda98de896257d (diff) |
Code cleanup: add _v2 suffix to resolve_tri/quad functions
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 18 | ||||
-rw-r--r-- | source/blender/render/intern/source/multires_bake.c | 14 |
3 files changed, 23 insertions, 17 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 633887e3ef8..6889e4f2651 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -218,10 +218,10 @@ void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const flo bool barycentric_coords_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); int barycentric_inside_triangle_v2(const float w[3]); -void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); -void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); -void resolve_quad_uv_deriv(float r_uv[2], float r_deriv[2][2], - const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); +void resolve_tri_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); +void resolve_quad_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); +void resolve_quad_uv_v2_deriv(float r_uv[2], float r_deriv[2][2], + const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); /* use to find the point of a UV on a face */ void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index b1fd0fe5663..66fdaafa32d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2683,8 +2683,13 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3 #define IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0) -/* Barycentric reverse */ -void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]) +/** + * Barycentric reverse + * + * Compute coordinates (u, v) for point \a st with respect to triangle (\a st0, \a st1, \a st2)" + */ +void resolve_tri_uv_v2(float r_uv[2], const float st[2], + const float st0[2], const float st1[2], const float st2[2]) { /* find UV such that * t = u * t0 + v * t1 + (1 - u - v) * t2 @@ -2705,14 +2710,15 @@ void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const } /* bilinear reverse */ -void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) +void resolve_quad_uv_v2(float r_uv[2], const float st[2], + const float st0[2], const float st1[2], const float st2[2], const float st3[2]) { - resolve_quad_uv_deriv(r_uv, NULL, st, st0, st1, st2, st3); + resolve_quad_uv_v2_deriv(r_uv, NULL, st, st0, st1, st2, st3); } /* bilinear reverse with derivatives */ -void resolve_quad_uv_deriv(float r_uv[2], float r_deriv[2][2], - const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) +void resolve_quad_uv_v2_deriv(float r_uv[2], float r_deriv[2][2], + const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]) { const double signed_area = (st0[0] * st1[1] - st0[1] * st1[0]) + (st1[0] * st2[1] - st1[1] * st2[0]) + (st2[0] * st3[1] - st2[1] * st3[0]) + (st3[0] * st0[1] - st3[1] * st0[0]); diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index be6d0111819..be11df4e1a6 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -200,7 +200,7 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y) multiresbake_get_normal(data, no1, data->face_index, i1); multiresbake_get_normal(data, no2, data->face_index, i2); - resolve_tri_uv(fUV, st, st0, st1, st2); + resolve_tri_uv_v2(fUV, st, st0, st1, st2); u = fUV[0]; v = fUV[1]; @@ -772,10 +772,10 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, if (mface.v4) { st3 = mtface[face_index].uv[3]; - resolve_quad_uv(uv, st, st0, st1, st2, st3); + resolve_quad_uv_v2(uv, st, st0, st1, st2, st3); } else - resolve_tri_uv(uv, st, st0, st1, st2); + resolve_tri_uv_v2(uv, st, st0, st1, st2); CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); @@ -868,10 +868,10 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, if (mface.v4) { st3 = mtface[face_index].uv[3]; - resolve_quad_uv(uv, st, st0, st1, st2, st3); + resolve_quad_uv_v2(uv, st, st0, st1, st2, st3); } else - resolve_tri_uv(uv, st, st0, st1, st2); + resolve_tri_uv_v2(uv, st, st0, st1, st2); CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); @@ -1112,10 +1112,10 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void if (mface.v4) { st3 = mtface[face_index].uv[3]; - resolve_quad_uv(uv, st, st0, st1, st2, st3); + resolve_quad_uv_v2(uv, st, st0, st1, st2, st3); } else - resolve_tri_uv(uv, st, st0, st1, st2); + resolve_tri_uv_v2(uv, st, st0, st1, st2); CLAMP(uv[0], 0.0f, 1.0f); CLAMP(uv[1], 0.0f, 1.0f); |