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:
authorMartin Poirier <theeth@yahoo.com>2007-11-09 01:03:04 +0300
committerMartin Poirier <theeth@yahoo.com>2007-11-09 01:03:04 +0300
commiteeb9e1486d6babb9c64bcaa0b29236def05d9f95 (patch)
tree0fa603b8e80c0f2e6a40e918fd69dcbfdbd412ca /source/blender/src/reeb.c
parente7c4bad8e929fd690aed9c652157eb3c8688c850 (diff)
Still nothing to see here <shifty eyes>
This fixes up angle based subdivisions, adds embedding post processing methods (before, only average was there, added smooth and sharpen). More parameters are controllable through the UI.
Diffstat (limited to 'source/blender/src/reeb.c')
-rw-r--r--source/blender/src/reeb.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/src/reeb.c b/source/blender/src/reeb.c
index efe12a5db21..4f40c51191f 100644
--- a/source/blender/src/reeb.c
+++ b/source/blender/src/reeb.c
@@ -382,9 +382,28 @@ void buildAdjacencyList(ReebGraph *rg)
}
/****************************************** SMOOTHING **************************************************/
-void smoothGraph(ReebGraph *rg)
+void postprocessGraph(ReebGraph *rg, char mode)
{
ReebArc *arc;
+ float fac1, fac2, fac3;
+
+ switch(mode)
+ {
+ case SKGEN_AVERAGE:
+ fac1 = fac2 = fac3 = 1.0f / 3.0f;
+ break;
+ case SKGEN_SMOOTH:
+ fac1 = fac3 = 0.25f;
+ fac2 = 0.5f;
+ break;
+ case SKGEN_SHARPEN:
+ fac1 = fac2 = -0.5f;
+ fac2 = 2.0f;
+ break;
+ default:
+ error("Unknown post processing mode");
+ return;
+ }
for(arc = rg->arcs.first; arc; arc = arc->next)
{
@@ -394,8 +413,8 @@ void smoothGraph(ReebGraph *rg)
for(index = 1; index < bcount - 1; index++)
{
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index - 1].p, 0.5f);
- VecLerpf(buckets[index].p, buckets[index].p, buckets[index + 1].p, 1.0f/3.0f);
+ VecLerpf(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
+ VecLerpf(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
}
}
}
@@ -1806,9 +1825,9 @@ void generateSkeleton(void)
verifyBuckets(rg);
- if (G.scene->toolsettings->skgen_options & SKGEN_SMOOTH)
+ if (G.scene->toolsettings->skgen_postpro != SKGEN_NONE)
{
- smoothGraph(rg);
+ postprocessGraph(rg, G.scene->toolsettings->skgen_postpro);
}
buildAdjacencyList(rg);