9 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version. The Blender
15 * Foundation also sells licenses for use in proprietary software under
16 * the Blender License. See http://www.blender.org/BL/ for information
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
29 * All rights reserved.
31 * The Original Code is: all of this file.
33 * Contributor(s): none yet.
35 * ***** END GPL/BL DUAL LICENSE BLOCK *****
39 #include "BLI_winstuff.h"
47 #include "MEM_guardedalloc.h"
50 #include "DNA_curve_types.h"
51 #include "DNA_material_types.h"
52 #include "DNA_object_types.h"
53 #include "DNA_image_types.h"
54 #include "DNA_key_types.h"
55 #include "DNA_mesh_types.h"
58 #include "BKE_global.h"
60 #include "BKE_subsurf.h"
61 #include "BKE_displist.h"
62 #include "BKE_library.h"
63 #include "BKE_material.h"
65 /* these 2 are only used by conversion functions */
66 #include "BKE_curve.h"
68 #include "BKE_object.h"
69 #include "BKE_utildefines.h"
70 #include "BKE_bad_level_calls.h"
72 #include "BLI_blenlib.h"
73 #include "BLI_editVert.h"
74 #include "BLI_arithb.h"
78 int update_realtime_texture(TFace *tface, double time)
90 if (ima->lastupdate<0)
93 if (ima->lastupdate>time)
94 ima->lastupdate=(float)time;
96 if(ima->tpageflag & IMA_TWINANIM) {
97 if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
99 /* check: zit de bindcode niet het array? Vrijgeven. (nog doen) */
101 diff = (float)(time-ima->lastupdate);
103 inc = (int)(diff*(float)ima->animspeed);
105 ima->lastupdate+=((float)inc/(float)ima->animspeed);
107 newframe = ima->lastframe+inc;
109 if (newframe > (int)ima->twend)
110 newframe = (int)ima->twsta-1 + (newframe-ima->twend)%(ima->twend-ima->twsta);
112 ima->lastframe = newframe;
117 float get_mvert_weight (Object *ob, int vert, int defgroup)
130 for (i=0; i<me->dvert[vert].totweight; i++){
131 if (me->dvert[vert].dw[i].def_nr==defgroup)
132 result+=me->dvert[vert].dw[i].weight;
138 void unlink_mesh(Mesh *me)
144 for(a=0; a<me->totcol; a++) {
145 if(me->mat[a]) me->mat[a]->id.us--;
148 if(me->key) me->key->id.us--;
151 if(me->texcomesh) me->texcomesh= 0;
155 /* niet mesh zelf vrijgeven */
156 void free_mesh(Mesh *me)
161 if(me->mat) MEM_freeN(me->mat);
162 if(me->orco) MEM_freeN(me->orco);
163 if(me->mface) MEM_freeN(me->mface);
164 if(me->tface) MEM_freeN(me->tface);
165 if(me->mvert) MEM_freeN(me->mvert);
166 if(me->dvert) free_dverts(me->dvert, me->totvert);
167 if(me->mcol) MEM_freeN(me->mcol);
168 if(me->msticky) MEM_freeN(me->msticky);
169 if(me->bb) MEM_freeN(me->bb);
170 if(me->disp.first) freedisplist(&me->disp);
173 void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount)
175 /* Assumes dst is already set up */
181 memcpy (dst, src, copycount * sizeof(MDeformVert));
183 for (i=0; i<copycount; i++){
185 dst[i].dw = MEM_callocN (sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight");
186 memcpy (dst[i].dw, src[i].dw, sizeof (MDeformWeight)*src[i].totweight);
191 void free_dverts(MDeformVert *dvert, int totvert)
193 /* Instead of freeing the verts directly,
194 call this function to delete any special
201 /* Free any special data from the verts */
202 for (i=0; i<totvert; i++){
203 if (dvert[i].dw) MEM_freeN (dvert[i].dw);
212 me= alloc_libblock(&G.main->mesh, ID_ME, "Mesh");
214 me->size[0]= me->size[1]= me->size[2]= 1.0;
216 me->texflag= AUTOSPACE;
217 me->flag= ME_TWOSIDED;
220 me->bb= unit_boundbox();
225 Mesh *copy_mesh(Mesh *me)
230 men= copy_libblock(me);
232 men->mat= MEM_dupallocN(me->mat);
233 for(a=0; a<men->totcol; a++) {
234 id_us_plus((ID *)men->mat[a]);
236 id_us_plus((ID *)men->texcomesh);
237 men->mface= MEM_dupallocN(me->mface);
239 men->tface= MEM_dupallocN(me->tface);
242 men->mvert= MEM_dupallocN(me->mvert);
243 memcpy (men->mvert, me->mvert, sizeof (MVert)*me->totvert);
245 men->dvert = MEM_mallocN (sizeof (MDeformVert)*me->totvert, "MDeformVert");
246 copy_dverts(men->dvert, me->dvert, me->totvert);
249 men->mcol= MEM_dupallocN(me->mcol);
250 men->msticky= MEM_dupallocN(me->msticky);
253 men->bb= MEM_dupallocN(men->bb);
255 copy_displist(&men->disp, &me->disp);
257 men->key= copy_key(me->key);
258 if(men->key) men->key->from= (ID *)men;
263 void make_local_tface(Mesh *me)
269 if(me->tface==0) return;
275 /* speciaal geval: ima altijd meteen lokaal */
280 ima->id.flag= LIB_LOCAL;
281 new_id(0, (ID *)ima, 0);
289 void make_local_mesh(Mesh *me)
295 /* - zijn er alleen lib users: niet doen
296 * - zijn er alleen locale users: flag zetten
300 if(me->id.lib==0) return;
303 me->id.flag= LIB_LOCAL;
304 new_id(0, (ID *)me, 0);
306 if(me->tface) make_local_tface(me);
311 ob= G.main->object.first;
313 if( me==get_mesh(ob) ) {
314 if(ob->id.lib) lib= 1;
320 if(local && lib==0) {
322 me->id.flag= LIB_LOCAL;
323 new_id(0, (ID *)me, 0);
325 if(me->tface) make_local_tface(me);
328 else if(local && lib) {
332 ob= G.main->object.first;
334 if( me==get_mesh(ob) ) {
344 void boundbox_mesh(Mesh *me, float *loc, float *size)
348 float min[3], max[3];
349 float mloc[3], msize[3];
352 if(me->bb==0) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
355 INIT_MINMAX(min, max);
358 if (!size) size= msize;
361 for(a=0; a<me->totvert; a++, mvert++) {
362 DO_MINMAX(mvert->co, min, max);
366 loc[0]= (min[0]+max[0])/2.0f;
367 loc[1]= (min[1]+max[1])/2.0f;
368 loc[2]= (min[2]+max[2])/2.0f;
370 size[0]= (max[0]-min[0])/2.0f;
371 size[1]= (max[1]-min[1])/2.0f;
372 size[2]= (max[2]-min[2])/2.0f;
375 loc[0]= loc[1]= loc[2]= 0.0;
376 size[0]= size[1]= size[2]= 0.0;
379 bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= loc[0]-size[0];
380 bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= loc[0]+size[0];
382 bb->vec[0][1]=bb->vec[1][1]=bb->vec[4][1]=bb->vec[5][1]= loc[1]-size[1];
383 bb->vec[2][1]=bb->vec[3][1]=bb->vec[6][1]=bb->vec[7][1]= loc[1]+size[1];
385 bb->vec[0][2]=bb->vec[3][2]=bb->vec[4][2]=bb->vec[7][2]= loc[2]-size[2];
386 bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= loc[2]+size[2];
389 void tex_space_mesh(Mesh *me)
392 float *fp, loc[3], size[3], min[3], max[3];
395 boundbox_mesh(me, loc, size);
397 if(me->texflag & AUTOSPACE) {
402 INIT_MINMAX(min, max);
405 for(a=0; a<kb->totelem; a++, fp+=3) {
406 DO_MINMAX(fp, min, max);
409 loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f;
410 size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f;
413 loc[0]= loc[1]= loc[2]= 0.0;
414 size[0]= size[1]= size[2]= 0.0;
420 VECCOPY(me->loc, loc);
421 VECCOPY(me->size, size);
422 me->rot[0]= me->rot[1]= me->rot[2]= 0.0;
424 if(me->size[0]==0.0) me->size[0]= 1.0;
425 else if(me->size[0]>0.0 && me->size[0]<0.00001) me->size[0]= 0.00001;
426 else if(me->size[0]<0.0 && me->size[0]> -0.00001) me->size[0]= -0.00001;
428 if(me->size[1]==0.0) me->size[1]= 1.0;
429 else if(me->size[1]>0.0 && me->size[1]<0.00001) me->size[1]= 0.00001;
430 else if(me->size[1]<0.0 && me->size[1]> -0.00001) me->size[1]= -0.00001;
432 if(me->size[2]==0.0) me->size[2]= 1.0;
433 else if(me->size[2]>0.0 && me->size[2]<0.00001) me->size[2]= 0.00001;
434 else if(me->size[2]<0.0 && me->size[2]> -0.00001) me->size[2]= -0.00001;
439 void make_orco_displist_mesh(Object *ob, int subdivlvl)
448 /* if there's a key, set the first one */
449 if(me->key && me->texcomesh==0) {
450 cp_key(0, me->totvert, me->totvert, (char*) me->mvert->co, me->key, me->key->refkey, 0);
453 /* Rebuild the displist */
454 dl= subsurf_mesh_to_displist(me, NULL, (short)subdivlvl);
456 /* Restore correct key */
459 /* XXX Assume dl is a DL_MESH (it is),
460 * should be explicit -zr
464 me->orco= MEM_mallocN(dlm->totvert*3*sizeof(float), "mesh displist orco");
466 for (i=0; i<dlm->totvert; i++) {
467 float *fp= &me->orco[i*3];
468 VECCOPY(fp, dlm->mvert[i].co);
471 for(i=0; i<dlm->totvert; i++) {
472 float *fp= &me->orco[i*3];
473 fp[0]= (fp[0]-me->loc[0])/me->size[0];
474 fp[1]= (fp[1]-me->loc[1])/me->size[1];
475 fp[2]= (fp[2]-me->loc[2])/me->size[2];
481 void make_orco_mesh(Mesh *me)
488 totvert= me->totvert;
489 if(totvert==0) return;
490 orco= me->orco= MEM_mallocN(sizeof(float)*3*totvert, "orco mesh");
492 if(me->key && me->texcomesh==0) {
494 if (kb) { /***** BUG *****/
497 for(a=0; a<totvert; a++, orco+=3) {
498 orco[0]= (fp[0]-me->loc[0])/me->size[0];
499 orco[1]= (fp[1]-me->loc[1])/me->size[1];
500 orco[2]= (fp[2]-me->loc[2])/me->size[2];
502 /* mvert alleen ophogen als totvert <= kb->totelem */
503 if(a<kb->totelem) fp+=3;
513 for(a=0; a<totvert; a++, orco+=3) {
514 orco[0]= (mvert->co[0]-me->loc[0])/me->size[0];
515 orco[1]= (mvert->co[1]-me->loc[1])/me->size[1];
516 orco[2]= (mvert->co[2]-me->loc[2])/me->size[2];
518 /* mvert alleen ophogen als totvert <= me->totvert */
519 if(a<me->totvert) mvert++;
524 /** rotates the vertices of a face in case v[2] or v[3] (vertex index)
526 * Helaas, the MFace structure has no pointer to its
527 * texture face, therefore, texture can not be fixed inside
530 * see also blender/src/editmesh.c, fix_faceindices()
532 * THIS FUNCTION WILL BE DINOSOURCE. For the moment, another hack
533 is added to fix texture coordinates / vertex colors:
535 void test_index_face(MFace *mface, TFace *tface, int nr)
538 void test_index_mface(MFace *mface, int nr)
543 /* first test if the face is legal */
545 if(mface->v3 && mface->v3==mface->v4) {
549 if(mface->v2 && mface->v2==mface->v3) {
550 mface->v3= mface->v4;
554 if(mface->v1==mface->v2) {
555 mface->v2= mface->v3;
556 mface->v3= mface->v4;
561 /* voorkom dat een nul op de verkeerde plek staat */
563 if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
567 SWAP(int, mface->v1, mface->v2);
568 SWAP(int, mface->v2, mface->v3);
572 if(a & ME_V1V2) mface->edcode |= ME_V3V1;
573 if(a & ME_V2V3) mface->edcode |= ME_V1V2;
574 if(a & ME_V3V1) mface->edcode |= ME_V2V3;
578 if(a & ME_FLIPV1) mface->puno |= ME_FLIPV2;
579 if(a & ME_FLIPV2) mface->puno |= ME_FLIPV3;
580 if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
584 if(mface->v3==0 || mface->v4==0) {
585 SWAP(int, mface->v1, mface->v3);
586 SWAP(int, mface->v2, mface->v4);
589 if(a & ME_V1V2) mface->edcode |= ME_V3V4;
590 if(a & ME_V2V3) mface->edcode |= ME_V2V3;
591 if(a & ME_V3V4) mface->edcode |= ME_V1V2;
592 if(a & ME_V4V1) mface->edcode |= ME_V4V1;
596 if(a & ME_FLIPV1) mface->puno |= ME_FLIPV3;
597 if(a & ME_FLIPV2) mface->puno |= ME_FLIPV4;
598 if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
599 if(a & ME_FLIPV4) mface->puno |= ME_FLIPV2;
604 /** This function should die as soon as there is another mesh
605 structure. Functionality is the same as
607 void test_index_mface()
609 but it fixes texture coordinates as well.
612 #define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
613 void test_index_face(MFace *mface, TFace *tface, int nr)
620 /* first test if the face is legal */
622 if(mface->v3 && mface->v3==mface->v4) {
626 if(mface->v2 && mface->v2==mface->v3) {
627 mface->v3= mface->v4;
631 if(mface->v1==mface->v2) {
632 mface->v2= mface->v3;
633 mface->v3= mface->v4;
638 /* voorkom dat een nul op de verkeerde plek staat */
640 if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
644 SWAP(int, mface->v1, mface->v2);
645 SWAP(int, mface->v2, mface->v3);
646 /* rotate face UV coordinates, too */
647 UVCOPY(tmpuv, tface->uv[0]);
648 UVCOPY(tface->uv[0], tface->uv[1]);
649 UVCOPY(tface->uv[1], tface->uv[2]);
650 UVCOPY(tface->uv[2], tmpuv);
651 /* same with vertex colours */
652 tmpcol = tface->col[0];
653 tface->col[0] = tface->col[1];
654 tface->col[1] = tface->col[2];
655 tface->col[2] = tmpcol;
660 if(a & ME_V1V2) mface->edcode |= ME_V3V1;
661 if(a & ME_V2V3) mface->edcode |= ME_V1V2;
662 if(a & ME_V3V1) mface->edcode |= ME_V2V3;
666 if(a & ME_FLIPV1) mface->puno |= ME_FLIPV2;
667 if(a & ME_FLIPV2) mface->puno |= ME_FLIPV3;
668 if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
672 if(mface->v3==0 || mface->v4==0) {
673 SWAP(int, mface->v1, mface->v3);
674 SWAP(int, mface->v2, mface->v4);
675 /* swap UV coordinates */
676 UVCOPY(tmpuv, tface->uv[0]);
677 UVCOPY(tface->uv[0], tface->uv[2]);
678 UVCOPY(tface->uv[2], tmpuv);
679 UVCOPY(tmpuv, tface->uv[1]);
680 UVCOPY(tface->uv[1], tface->uv[3]);
681 UVCOPY(tface->uv[3], tmpuv);
682 /* swap vertex colours */
683 tmpcol = tface->col[0];
684 tface->col[0] = tface->col[2];
685 tface->col[2] = tmpcol;
686 tmpcol = tface->col[1];
687 tface->col[1] = tface->col[3];
688 tface->col[3] = tmpcol;
692 if(a & ME_V1V2) mface->edcode |= ME_V3V4;
693 if(a & ME_V2V3) mface->edcode |= ME_V2V3;
694 if(a & ME_V3V4) mface->edcode |= ME_V1V2;
695 if(a & ME_V4V1) mface->edcode |= ME_V4V1;
699 if(a & ME_FLIPV1) mface->puno |= ME_FLIPV3;
700 if(a & ME_FLIPV2) mface->puno |= ME_FLIPV4;
701 if(a & ME_FLIPV3) mface->puno |= ME_FLIPV1;
702 if(a & ME_FLIPV4) mface->puno |= ME_FLIPV2;
707 void flipnorm_mesh(Mesh *me)
718 mvert->no[0]= -mvert->no[0];
719 mvert->no[1]= -mvert->no[1];
720 mvert->no[2]= -mvert->no[2];
729 SWAP(int, mface->v4, mface->v1);
730 SWAP(int, mface->v3, mface->v2);
731 test_index_mface(mface, 4);
734 if(temp & ME_FLIPV1) mface->puno |= ME_FLIPV4;
735 if(temp & ME_FLIPV2) mface->puno |= ME_FLIPV3;
736 if(temp & ME_FLIPV3) mface->puno |= ME_FLIPV2;
737 if(temp & ME_FLIPV4) mface->puno |= ME_FLIPV1;
740 SWAP(int, mface->v3, mface->v1);
741 test_index_mface(mface, 3);
744 if(temp & ME_FLIPV1) mface->puno |= ME_FLIPV3;
745 if(temp & ME_FLIPV2) mface->puno |= ME_FLIPV2;
746 if(temp & ME_FLIPV3) mface->puno |= ME_FLIPV1;
767 Mesh *get_mesh(Object *ob)
771 if(ob->type==OB_MESH) return ob->data;
775 void set_mesh(Object *ob, Mesh *me)
781 if(ob->type==OB_MESH) {
785 id_us_plus((ID *)me);
788 test_object_materials((ID *)me);
791 void mball_to_mesh(ListBase *lb, Mesh *me)
802 if(dl->type==DL_INDEX4) {
803 me->flag= ME_NOPUNOFLIP;
805 me->totface= dl->parts;
807 me->mvert=mvert= MEM_callocN(dl->nr*sizeof(MVert), "mverts");
812 VECCOPY(mvert->co, verts);
813 mvert->no[0]= (short int)(nors[0]*32767.0);
814 mvert->no[1]= (short int)(nors[1]*32767.0);
815 mvert->no[2]= (short int)(nors[2]*32767.0);
821 me->mface=mface= MEM_callocN(dl->parts*sizeof(MFace), "mface");
831 mface->edcode= ME_V1V2+ME_V2V3;
832 mface->flag = ME_SMOOTH;
840 void nurbs_to_mesh(Object *ob)
849 int a, b, ofs, vertcount, startvert, totvert=0, totvlak=0;
850 int p1, p2, p3, p4, *index;
854 if(ob->type==OB_CURVE) {
855 /* regel: dl->type INDEX3 altijd vooraan in lijst */
857 if(dl->type!=DL_INDEX3) {
858 curve_to_filledpoly(ob->data, &cu->disp);
865 if(dl->type==DL_SEGM) {
866 totvert+= dl->parts*dl->nr;
867 totvlak+= dl->parts*(dl->nr-1);
869 else if(dl->type==DL_POLY) {
870 /* cyclic polys are filled. except when 3D */
871 if(cu->flag & CU_3D) {
872 totvert+= dl->parts*dl->nr;
873 totvlak+= dl->parts*dl->nr;
876 else if(dl->type==DL_SURF) {
877 totvert+= dl->parts*dl->nr;
878 totvlak+= (dl->parts-1+((dl->flag & 2)==2))*(dl->nr-1+(dl->flag & 1));
880 else if(dl->type==DL_INDEX3) {
887 error("can't convert");
893 me->totvert= totvert;
894 me->totface= totvlak;
896 me->totcol= cu->totcol;
901 mvert=me->mvert= MEM_callocN(me->totvert*sizeof(MVert), "cumesh1");
902 mface=me->mface= MEM_callocN(me->totface*sizeof(MFace), "cumesh2");
904 /* verts en vlakken */
909 if(dl->type==DL_SEGM) {
910 startvert= vertcount;
914 VECCOPY(mvert->co, data);
920 for(a=0; a<dl->parts; a++) {
922 for(b=1; b<dl->nr; b++) {
923 mface->v1= startvert+ofs+b-1;
924 mface->v2= startvert+ofs+b;
925 mface->edcode= ME_V1V2;
926 test_index_mface(mface, 2);
932 else if(dl->type==DL_POLY) {
933 /* cyclic polys are filled */
934 /* startvert= vertcount;
938 VECCOPY(mvert->co, data);
944 for(a=0; a<dl->parts; a++) {
946 for(b=0; b<dl->nr; b++) {
947 mface->v1= startvert+ofs+b;
948 if(b==dl->nr-1) mface->v2= startvert+ofs;
949 else mface->v2= startvert+ofs+b+1;
950 mface->edcode= ME_V1V2;
951 test_index_mface(mface, 2);
957 else if(dl->type==DL_INDEX3) {
958 startvert= vertcount;
962 VECCOPY(mvert->co, data);
971 mface->v1= startvert+index[0];
972 mface->v2= startvert+index[1];
973 mface->v3= startvert+index[2];
977 mface->edcode= ME_V1V2+ME_V2V3;
978 test_index_mface(mface, 3);
986 else if(dl->type==DL_SURF) {
987 startvert= vertcount;
991 VECCOPY(mvert->co, data);
997 for(a=0; a<dl->parts; a++) {
999 if( (dl->flag & 2)==0 && a==dl->parts-1) break;
1001 if(dl->flag & 1) { /* p2 -> p1 -> */
1002 p1= startvert+ dl->nr*a; /* p4 -> p3 -> */
1003 p2= p1+ dl->nr-1; /* -----> volgende rij */
1009 p2= startvert+ dl->nr*a;
1015 if( (dl->flag & 2) && a==dl->parts-1) {
1016 p3-= dl->parts*dl->nr;
1017 p4-= dl->parts*dl->nr;
1020 for(; b<dl->nr; b++) {
1025 mface->mat_nr= (unsigned char)dl->col;
1026 mface->edcode= ME_V1V2+ME_V2V3;
1027 test_index_mface(mface, 4);
1043 free_libblock(&G.main->curve, ob->data);
1051 ob1= G.main->object.first;
1056 ob1->data= ob->data;
1057 id_us_plus((ID *)ob->data);
1064 void edge_drawflags_mesh(Mesh *me)
1070 for(a=0; a<me->totface; a++, mface++) {
1071 mface->edcode= ME_V1V2|ME_V2V3|ME_V3V4|ME_V4V1;
1075 void tface_to_mcol(Mesh *me)
1081 me->mcol= MEM_mallocN(4*sizeof(int)*me->totface, "nepmcol");
1082 mcol= (unsigned int *)me->mcol;
1087 memcpy(mcol, tface->col, 16);
1093 void mcol_to_tface(Mesh *me, int freedata)
1101 mcol= (unsigned int *)me->mcol;
1103 memcpy(tface->col, mcol, 16);
1109 MEM_freeN(me->mcol);
1114 int mesh_uses_displist(Mesh *me) {
1115 return (me->flag&ME_SUBSURF && (me->subdiv>0));
1118 int rendermesh_uses_displist(Mesh *me) {
1119 return (me->flag&ME_SUBSURF);