[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42331] branches/bmesh/blender/source/ blender/blenkernel: file rename, will do the same in trunk to make merges less of a hassle
Campbell Barton
ideasman42 at gmail.com
Fri Dec 2 03:18:34 CET 2011
Revision: 42331
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42331
Author: campbellbarton
Date: 2011-12-02 02:18:29 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
file rename, will do the same in trunk to make merges less of a hassle
Modified Paths:
--------------
branches/bmesh/blender/source/blender/blenkernel/CMakeLists.txt
Added Paths:
-----------
branches/bmesh/blender/source/blender/blenkernel/intern/editderivedmesh.c
Removed Paths:
-------------
branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
Modified: branches/bmesh/blender/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/CMakeLists.txt 2011-12-02 01:01:07 UTC (rev 42330)
+++ branches/bmesh/blender/source/blender/blenkernel/CMakeLists.txt 2011-12-02 02:18:29 UTC (rev 42331)
@@ -92,7 +92,7 @@
intern/displist.c
intern/dynamicpaint.c
intern/effect.c
- intern/editderivedbmesh.c
+ intern/editderivedmesh.c
intern/fcurve.c
intern/fluidsim.c
intern/fmodifier.c
Deleted: branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2011-12-02 01:01:07 UTC (rev 42330)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c 2011-12-02 02:18:29 UTC (rev 42331)
@@ -1,1729 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Tbmple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "PIL_time.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_effect_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_key_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_object_fluidsim.h" // N_T
-#include "DNA_scene_types.h" // N_T
-#include "DNA_texture_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-#include "DNA_particle_types.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-#include "BLI_linklist.h"
-#include "BLI_memarena.h"
-#include "BLI_scanfill.h"
-#include "BLI_ghash.h"
-#include "BLI_array.h"
-
-#include "BKE_cdderivedmesh.h"
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_deform.h"
-#include "BKE_displist.h"
-#include "BKE_effect.h"
-#include "BKE_fluidsim.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_material.h"
-#include "BKE_modifier.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_subsurf.h"
-#include "BKE_texture.h"
-#include "BKE_particle.h"
-#include "BKE_tessmesh.h"
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-#include "GL/glew.h"
-
-#include "GPU_draw.h"
-#include "GPU_extensions.h"
-#include "GPU_material.h"
-
-#include "bmesh.h"
-
-extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
-
-
-BMEditMesh *BMEdit_Create(BMesh *bm)
-{
- BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
-
- tm->bm = bm;
-
- BMEdit_RecalcTesselation(tm);
-
- return tm;
-}
-
-BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
-{
- BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), __func__);
- *tm2 = *tm;
-
- tm2->derivedCage = tm2->derivedFinal = NULL;
-
- tm2->bm = BM_Copy_Mesh(tm->bm);
-
- /*The tesselation is NOT calculated on the copy here,
- because currently all the callers of this function use
- it to make a backup copy of the BMEditMesh to restore
- it in the case of errors in an operation. For perf
- reasons, in that case it makes more sense to do the
- tesselation only when/if that copy ends up getting
- used.*/
- tm2->looptris = NULL;
-
- tm2->vert_index = NULL;
- tm2->edge_index = NULL;
- tm2->face_index = NULL;
-
- return tm2;
-}
-
-static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm)
-{
- /* use this to avoid locking pthread for _every_ polygon
- * and calling the fill function */
-#define USE_TESSFACE_SPEEDUP
-
- BMesh *bm = tm->bm;
- BMLoop *(*looptris)[3]= NULL;
- BLI_array_declare(looptris);
- BMIter iter, liter;
- BMFace *f;
- BMLoop *l;
- int i = 0, j;
-
- if (tm->looptris) MEM_freeN(tm->looptris);
-
- f = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
- for ( ; f; f=BMIter_Step(&iter)) {
- /*don't consider two-edged faces*/
- if (f->len < 3) {
- /* do nothing */
- }
-
-#ifdef USE_TESSFACE_SPEEDUP
-
- /* no need to ensure the loop order, we know its ok */
-
- else if (f->len == 3) {
- BLI_array_growone(looptris);
- l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
- for (j=0; l; l=BMIter_Step(&liter), j++) {
- looptris[i][j] = l;
- }
- i += 1;
- }
- else if (f->len == 4) {
- BMLoop *ltmp[4];
- BLI_array_growitems(looptris, 2);
-
- l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
- for (j=0; l; l=BMIter_Step(&liter), j++) {
- ltmp[j] = l;
- }
-
- looptris[i][0] = ltmp[0];
- looptris[i][1] = ltmp[1];
- looptris[i][2] = ltmp[2];
- i += 1;
-
- looptris[i][0] = ltmp[0];
- looptris[i][1] = ltmp[2];
- looptris[i][2] = ltmp[3];
- i += 1;
- }
-
-#endif /* USE_TESSFACE_SPEEDUP */
-
- else {
- EditVert *v, *lastv=NULL, *firstv=NULL;
- EditEdge *e;
- EditFace *efa;
-
- BLI_begin_edgefill();
- /*scanfill time*/
- l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
- for (j=0; l; l=BMIter_Step(&liter), j++) {
- /*mark order*/
- l->_index = j;
-
- v = BLI_addfillvert(l->v->co);
- v->tmp.p = l;
-
- if (lastv) {
- e = BLI_addfilledge(lastv, v);
- }
-
- lastv = v;
- if (firstv==NULL) firstv = v;
- }
-
- /*complete the loop*/
- BLI_addfilledge(firstv, v);
-
- BLI_edgefill(2);
-
- for (efa = fillfacebase.first; efa; efa=efa->next) {
- BMLoop *l1= efa->v1->tmp.p;
- BMLoop *l2= efa->v2->tmp.p;
- BMLoop *l3= efa->v3->tmp.p;
-
- BLI_array_growone(looptris);
-
- if (l1->_index > l2->_index) { SWAP(BMLoop*, l1, l2); }
- if (l2->_index > l3->_index) { SWAP(BMLoop*, l2, l3); }
- if (l1->_index > l2->_index) { SWAP(BMLoop*, l1, l2); }
-
- looptris[i][0] = l1;
- looptris[i][1] = l2;
- looptris[i][2] = l3;
- i += 1;
- }
-
- BLI_end_edgefill();
- }
- }
-
- tm->tottri = i;
- tm->looptris = looptris;
-
-#undef USE_TESSFACE_SPEEDUP
-
-}
-
-void BMEdit_RecalcTesselation(BMEditMesh *em)
-{
- BMEdit_RecalcTesselation_intern(em);
-
- if (em->derivedFinal && em->derivedFinal == em->derivedCage) {
- if (em->derivedFinal->recalcTesselation)
- em->derivedFinal->recalcTesselation(em->derivedFinal);
- } else if (em->derivedFinal) {
- if (em->derivedCage->recalcTesselation)
- em->derivedCage->recalcTesselation(em->derivedCage);
- if (em->derivedFinal->recalcTesselation)
- em->derivedFinal->recalcTesselation(em->derivedFinal);
- }
-}
-
-void BMEdit_UpdateLinkedCustomData(BMEditMesh *em)
-{
- BMesh *bm = em->bm;
- int act;
-
- if (CustomData_has_layer(&bm->pdata, CD_MTEXPOLY)) {
- act = CustomData_get_active_layer(&bm->pdata, CD_MTEXPOLY);
- CustomData_set_layer_active(&bm->ldata, CD_MLOOPUV, act);
-
- act = CustomData_get_render_layer(&bm->pdata, CD_MTEXPOLY);
- CustomData_set_layer_render(&bm->ldata, CD_MLOOPUV, act);
-
- act = CustomData_get_clone_layer(&bm->pdata, CD_MTEXPOLY);
- CustomData_set_layer_clone(&bm->ldata, CD_MLOOPUV, act);
-
- act = CustomData_get_stencil_layer(&bm->pdata, CD_MTEXPOLY);
- CustomData_set_layer_stencil(&bm->ldata, CD_MLOOPUV, act);
- }
-}
-
-/*does not free the BMEditMesh struct itself*/
-void BMEdit_Free(BMEditMesh *em)
-{
- if(em->derivedFinal) {
- if (em->derivedFinal!=em->derivedCage) {
- em->derivedFinal->needsFree= 1;
- em->derivedFinal->release(em->derivedFinal);
- }
- em->derivedFinal= NULL;
- }
- if(em->derivedCage) {
- em->derivedCage->needsFree= 1;
- em->derivedCage->release(em->derivedCage);
- em->derivedCage= NULL;
- }
-
- em->retopo_paint_data= NULL;
-
- if (em->looptris) MEM_freeN(em->looptris);
-
- if (em->vert_index) MEM_freeN(em->vert_index);
- if (em->edge_index) MEM_freeN(em->edge_index);
- if (em->face_index) MEM_freeN(em->face_index);
-
- if (em->bm)
- BM_Free_Mesh(em->bm);
-}
-
-/*
-ok, basic design:
-
-the bmesh derivedmesh exposes the mesh as triangles. it stores pointers
-to three loops per triangle. the derivedmesh stores a cache of tesselations
-for each face. this cache will smartly update as needed (though at first
-it'll simply be more brute force). keeping track of face/edge counts may
-be a small problbm.
-
-this won't be the most efficient thing, considering that internal edges and
-faces of tesselations are exposed. looking up an edge by index in particular
-is likely to be a little slow.
-*/
-
-typedef struct EditDerivedBMesh {
- DerivedMesh dm;
-
- Object *ob;
- BMEditMesh *tc;
-
- float (*vertexCos)[3];
- float (*vertexNos)[3];
- float (*faceNos)[3];
-
- /*lookup caches; these are rebuilt on dm->RecalcTesselation()
- (or when the derivedmesh is created, of course)*/
- GHash *vhash, *ehash, *fhash;
- BMVert **vtable;
- BMEdge **etable;
- BMFace **ftable;
-
- /*private variables, for number of verts/edges/faces
- within the above hash/table members*/
- int tv, te, tf;
-} EditDerivedBMesh;
-
-static void bmdm_recalc_lookups(EditDerivedBMesh *bmdm)
-{
- BMIter iter;
- BMHeader *h;
- int a, i, iters[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, BM_FACES_OF_MESH};
-
- bmdm->tv = bmdm->tc->bm->totvert;
- bmdm->te = bmdm->tc->bm->totedge;
- bmdm->tf = bmdm->tc->bm->totface;
-
- if (bmdm->vhash) BLI_ghash_free(bmdm->vhash, NULL, NULL);
- if (bmdm->ehash) BLI_ghash_free(bmdm->ehash, NULL, NULL);
- if (bmdm->fhash) BLI_ghash_free(bmdm->fhash, NULL, NULL);
-
- bmdm->vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh derived");
- bmdm->ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh derived");
- bmdm->fhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh derived");
-
- if (bmdm->vtable) MEM_freeN(bmdm->vtable);
- if (bmdm->etable) MEM_freeN(bmdm->etable);
- if (bmdm->ftable) MEM_freeN(bmdm->ftable);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list