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>2005-12-04 02:22:31 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2005-12-04 02:22:31 +0300
commitc2cff1cbcf71634de3aca184c70cc4bd23fe35a8 (patch)
treef5b507efeffa60eb028dc0887226a28cf8182e86 /source/blender/src/unwrapper.c
parent8cb14867b0ad104ebe1f6fd086656dd12ada5758 (diff)
More work on the new unwrapper code (orange branch):
- There is now a (temporary) dropdown box in the image window header for switching between the old an new unwrapper code. So to test the changes described below you need to enable the new unwrapper code. - Pinning is now more predictable, if one uv is pinned, the others belonging to the same vertex are pinned also. - Live LSCM is much faster, since the LU factorization, the most expensive part of the computation, is now stored and reused (was Jens' idea). - Packing multiple uv charts is slightly improved, by doing a binary search over the texture width. This fixes the case where all the charts are packed at the bottom of the image. - LSCM now uses an angle based formulation, and the results seem somewhat different (maybe slightly better?), didn't find out why yet.
Diffstat (limited to 'source/blender/src/unwrapper.c')
-rw-r--r--source/blender/src/unwrapper.c77
1 files changed, 68 insertions, 9 deletions
diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c
index b74181cb385..52f3fcc77f1 100644
--- a/source/blender/src/unwrapper.c
+++ b/source/blender/src/unwrapper.c
@@ -67,6 +67,8 @@
#include "parametrizer.h"
+short CurrentUnwrapper = 0;
+
/* Implementation Least Squares Conformal Maps parameterization, based on
* chapter 2 of:
* Bruno Levy, Sylvain Petitjean, Nicolas Ray, Jerome Maillot. Least Squares
@@ -1140,6 +1142,11 @@ void unwrap_lscm(void)
int res;
Mesh *me;
int totgroup, *groups=NULL, a;
+
+ if (CurrentUnwrapper == 1) {
+ unwrap_lscm_new();
+ return;
+ }
me= get_mesh(OBACT);
if(me==0 || me->tface==0) return;
@@ -1385,9 +1392,9 @@ ParamHandle *construct_param_handle(Mesh *me, short implicit, short fill)
uv[1] = tf->uv[1];
uv[2] = tf->uv[2];
- pin[0] = ((tf->flag & TF_PIN1) != 0);
- pin[1] = ((tf->flag & TF_PIN2) != 0);
- pin[2] = ((tf->flag & TF_PIN3) != 0);
+ pin[0] = ((tf->unwrap & TF_PIN1) != 0);
+ pin[1] = ((tf->unwrap & TF_PIN2) != 0);
+ pin[2] = ((tf->unwrap & TF_PIN3) != 0);
select[0] = ((tf->flag & TF_SEL1) != 0);
select[1] = ((tf->flag & TF_SEL2) != 0);
@@ -1397,7 +1404,7 @@ ParamHandle *construct_param_handle(Mesh *me, short implicit, short fill)
vkeys[3] = (ParamKey)mf->v4;
co[3] = (mv+mf->v4)->co;
uv[3] = tf->uv[3];
- pin[3] = ((tf->flag & TF_PIN4) != 0);
+ pin[3] = ((tf->unwrap & TF_PIN4) != 0);
select[3] = ((tf->flag & TF_SEL4) != 0);
nverts = 4;
}
@@ -1424,8 +1431,7 @@ ParamHandle *construct_param_handle(Mesh *me, short implicit, short fill)
return handle;
}
-#if 0
-void unwrap_lscm(void)
+void unwrap_lscm_new(void)
{
Mesh *me;
ParamHandle *handle;
@@ -1435,11 +1441,12 @@ void unwrap_lscm(void)
handle = construct_param_handle(me, 0, 1);
- param_lscm_begin(handle);
+ param_lscm_begin(handle, PARAM_FALSE);
param_lscm_solve(handle);
param_lscm_end(handle);
param_pack(handle);
+ param_flush(handle);
param_delete(handle);
@@ -1450,7 +1457,6 @@ void unwrap_lscm(void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIMAGE, 0);
}
-#endif
void minimize_stretch_tface_uv(void)
{
@@ -1488,6 +1494,7 @@ void minimize_stretch_tface_uv(void)
if (blend < 10) {
blend++;
param_stretch_blend(handle, blend*0.1f);
+ param_flush(handle);
lasttime = 0.0f;
}
break;
@@ -1496,6 +1503,7 @@ void minimize_stretch_tface_uv(void)
if (blend > 0) {
blend--;
param_stretch_blend(handle, blend*0.1f);
+ param_flush(handle);
lasttime = 0.0f;
}
break;
@@ -1513,6 +1521,8 @@ void minimize_stretch_tface_uv(void)
if (PIL_check_seconds_timer() - lasttime > 0.5) {
char str[100];
+ param_flush(handle);
+
sprintf(str, "Stretch minimize. Blend %.2f.", blend*0.1f);
headerprint(str);
@@ -1522,7 +1532,12 @@ void minimize_stretch_tface_uv(void)
}
}
- param_stretch_end(handle, escape);
+ if (escape)
+ param_flush_restore(handle);
+ else
+ param_flush(handle);
+
+ param_stretch_end(handle);
param_delete(handle);
@@ -1534,3 +1549,47 @@ void minimize_stretch_tface_uv(void)
allqueue(REDRAWIMAGE, 0);
}
+/* LSCM live mode */
+
+static ParamHandle *liveHandle = NULL;
+
+void unwrap_lscm_live_begin(void)
+{
+ Mesh *me;
+
+ if (CurrentUnwrapper == 0)
+ return;
+
+ me= get_mesh(OBACT);
+ if(me==0 || me->tface==0) return;
+
+ liveHandle = construct_param_handle(me, 0, 0);
+
+ param_lscm_begin(liveHandle, PARAM_TRUE);
+}
+
+void unwrap_lscm_live_re_solve(void)
+{
+ if (CurrentUnwrapper == 0) {
+ unwrap_lscm();
+ return;
+ }
+
+ if (liveHandle) {
+ param_lscm_solve(liveHandle);
+ param_flush(liveHandle);
+ }
+}
+
+void unwrap_lscm_live_end(void)
+{
+ if (CurrentUnwrapper == 0)
+ return;
+
+ if (liveHandle) {
+ param_lscm_end(liveHandle);
+ param_delete(liveHandle);
+ liveHandle = NULL;
+ }
+}
+