[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28713] trunk/blender/source/blender/ blenkernel/intern/multires.c: Recommit fix that I seem to have uncommitted accidentally, had the fix
Brecht Van Lommel
brecht at blender.org
Mon May 10 17:02:38 CEST 2010
Revision: 28713
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28713
Author: blendix
Date: 2010-05-10 17:02:37 +0200 (Mon, 10 May 2010)
Log Message:
-----------
Recommit fix that I seem to have uncommitted accidentally, had the fix
still in my source tree but svn wasn't showing any diffs.. weird.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/multires.c
Modified: trunk/blender/source/blender/blenkernel/intern/multires.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/multires.c 2010-05-10 14:07:20 UTC (rev 28712)
+++ trunk/blender/source/blender/blenkernel/intern/multires.c 2010-05-10 15:02:37 UTC (rev 28713)
@@ -264,7 +264,39 @@
return result;
}
+static void multires_set_tot_mdisps(Mesh *me, int lvl)
+{
+ MDisps *mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
+ int i;
+ if(mdisps) {
+ for(i = 0; i < me->totface; i++) {
+ if(mdisps[i].totdisp == 0) {
+ int nvert = (me->mface[i].v4)? 4: 3;
+ mdisps[i].totdisp = multires_grid_tot[lvl]*nvert;
+ }
+ }
+ }
+}
+
+static void multires_reallocate_mdisps(Mesh *me, MDisps *mdisps, int lvl)
+{
+ int i;
+
+ /* reallocate displacements to be filled in */
+ for(i = 0; i < me->totface; ++i) {
+ int nvert = (me->mface[i].v4)? 4: 3;
+ int totdisp = multires_grid_tot[lvl]*nvert;
+ float (*disps)[3] = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
+
+ if(mdisps[i].disps)
+ MEM_freeN(mdisps[i].disps);
+
+ mdisps[i].disps = disps;
+ mdisps[i].totdisp = totdisp;
+ }
+}
+
static void column_vectors_to_mat3(float mat[][3], float v1[3], float v2[3], float v3[3])
{
copy_v3_v3(mat[0], v1);
@@ -320,6 +352,7 @@
int levels = mmd->totlvl - lvl;
MDisps *mdisps;
+ multires_set_tot_mdisps(me, mmd->totlvl);
CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
@@ -393,24 +426,6 @@
return subsurf_make_derived_from_derived(dm, &smd, 0, NULL, 0, 0);
}
-static void multires_reallocate_mdisps(Mesh *me, MDisps *mdisps, int lvl)
-{
- int i;
-
- /* reallocate displacements to be filled in */
- for(i = 0; i < me->totface; ++i) {
- int nvert = (me->mface[i].v4)? 4: 3;
- int totdisp = multires_grid_tot[lvl]*nvert;
- float (*disps)[3] = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
-
- if(mdisps[i].disps)
- MEM_freeN(mdisps[i].disps);
-
- mdisps[i].disps = disps;
- mdisps[i].totdisp = totdisp;
- }
-}
-
void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int updateblock, int simple)
{
Mesh *me = ob->data;
@@ -615,6 +630,7 @@
ob = ccgdm->multires.ob;
me = ccgdm->multires.ob->data;
mmd = ccgdm->multires.mmd;
+ multires_set_tot_mdisps(me, mmd->totlvl);
CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
@@ -750,6 +766,7 @@
memcpy(subGridData[i], gridData[i], sizeof(DMGridData)*gridSize*gridSize);
}
+ multires_set_tot_mdisps(me, mmd->totlvl);
CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
multiresModifier_disp_run(result, ob->data, 0, 0, subGridData, mmd->totlvl);
More information about the Bf-blender-cvs
mailing list