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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-11-01 17:20:31 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-11-01 17:20:50 +0300
commit623574ffa23badf767d8a445f1c18aabdbd10e26 (patch)
tree0a200bb397590031fb658eeaccb6b139a5876f6b /source/blender/blenkernel/intern/multires_reshape.c
parentd710cb91b9281e94851bddc8b49b570dc6326b5f (diff)
Subdiv: Cleanup, de-duplicate some code
Diffstat (limited to 'source/blender/blenkernel/intern/multires_reshape.c')
-rw-r--r--source/blender/blenkernel/intern/multires_reshape.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c
index 22605eb510a..3544fc33816 100644
--- a/source/blender/blenkernel/intern/multires_reshape.c
+++ b/source/blender/blenkernel/intern/multires_reshape.c
@@ -51,41 +51,6 @@
#include "DEG_depsgraph_query.h"
-/* TODO(sergey): De-duplicate with subdiv_displacement_multires.c. */
-
-/* Simplified version of mdisp_rot_face_to_crn, only handles quad and
- * works in normalized coordinates.
- *
- * NOTE: Output coordinates are in ptex coordinates.
- */
-BLI_INLINE int rotate_quad_to_corner(const float u, const float v,
- float *r_u, float *r_v)
-{
- int corner;
- if (u <= 0.5f && v <= 0.5f) {
- corner = 0;
- *r_u = 2.0f * u;
- *r_v = 2.0f * v;
- }
- else if (u > 0.5f && v <= 0.5f) {
- corner = 1;
- *r_u = 2.0f * v;
- *r_v = 2.0f * (1.0f - u);
- }
- else if (u > 0.5f && v > 0.5f) {
- corner = 2;
- *r_u = 2.0f * (1.0f - u);
- *r_v = 2.0f * (1.0f - v);
- }
- else {
- BLI_assert(u <= 0.5f && v >= 0.5f);
- corner = 3;
- *r_u = 2.0f * (1.0f - v);
- *r_v = 2.0f * u;
- }
- return corner;
-}
-
static void multires_reshape_init_mmd(
MultiresModifierData *reshape_mmd,
const MultiresModifierData *mmd)
@@ -314,7 +279,8 @@ static void multires_reshape_vertex_from_final_data(
int grid_index;
if (coarse_poly->totloop == 4) {
float corner_u, corner_v;
- face_corner = rotate_quad_to_corner(u, v, &corner_u, &corner_v);
+ face_corner = BKE_subdiv_rotate_quad_to_corner(
+ u, v, &corner_u, &corner_v);
grid_corner = face_corner;
grid_index = loop_index + face_corner;
BKE_subdiv_ptex_face_uv_to_grid_uv(
@@ -948,7 +914,7 @@ static void reshape_from_ccg_regular_face(ReshapeFromCCGTaskData *data,
const float u = x * resolution_1_inv;
float corner_u, corner_v;
float grid_u, grid_v;
- const int face_corner = rotate_quad_to_corner(
+ const int face_corner = BKE_subdiv_rotate_quad_to_corner(
u, v, &corner_u, &corner_v);
BKE_subdiv_ptex_face_uv_to_grid_uv(
corner_u, corner_v, &grid_u, &grid_v);