Page MenuHome

Cleanup: Replace 'resolve_tri_uv_v2' with 'barycentric_weights_v2'
Needs ReviewPublic

Authored by Germano Cavalcante (mano-wii) on Feb 4 2021, 9:04 PM.

Details

Summary

Both functions have the same purpose, so theoretically there is no need to have both.

But they have some differences:

resolve_tri_uv_v2:
Advantages:

  • Much more precise because it works with double precision.
  • The name is consistent with the existing ones: resolve_tri_uv_v3, resolve_quad_uv_v2, resolve_quad_uv_v2_deriv, resolve_quad_u_v2.

Differences:

  • Returns a vector with 2 dimensions (uv[2]).
  • If the triangle has zero area the returned vector is {0.0f, 0.0f}.

barycentric_weights_v2:
Advantages:

  • Intensively used throughout the code.
  • 30% more efficient.

Differences:

  • Returns a vector with 3 dimensions (w[3]).
  • If the triangle has zero area the returned vector is {0.333f, 0.333f, 0.333f}.

Proposed change:

  • make barycentric_weights_v2 work with double precision (even losing performance).
  • Replace 'resolve_tri_uv_v2' with it.

(The multires bake code has been tested with the patch).

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 12638
Build 12638: arc lint + arc unit

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Feb 4 2021, 9:04 PM
Germano Cavalcante (mano-wii) created this revision.