OK, My turn to break things ...

The maximum vertex count for a mesh has been raised from 65000 to
2000000000L (yep, 2 billion!).

Please test!

Chris
This commit is contained in:
Chris Want
2003-12-16 01:27:37 +00:00
parent e4d63d5764
commit 356cf79534
5 changed files with 21 additions and 22 deletions

View File

@@ -140,7 +140,7 @@ static void read_videoscape_mesh(char *str)
float *vertdata, *vd, min[3], max[3], cent[3], ftemp;
unsigned int color[32], col;
int totcol, a, b, verts, tottria=0, totquad=0, totedge=0, poly, nr0, nr, first;
short end;
int end;
char s[50];
fp= fopen(str, "rb");
@@ -158,7 +158,7 @@ static void read_videoscape_mesh(char *str)
return;
}
if(verts>65000) {
if(verts>2000000000L) {
error("too many vertices");
fclose(fp);
return;
@@ -202,7 +202,7 @@ static void read_videoscape_mesh(char *str)
}
}
if(totedge+tottria+totquad>65000) {
if(totedge+tottria+totquad>2000000000L) {
printf(" var1: %d, var2: %d, var3: %d \n", totedge, tottria, totquad);
error("too many faces");
MEM_freeN(vertdata);
@@ -357,7 +357,7 @@ static void read_radiogour(char *str)
float *vertdata, *vd, min[3], max[3], cent[3], ftemp;
unsigned int *colv, *colf, *colvertdata;
int itemp, a, b, verts, tottria=0, totquad=0, totedge=0, poly, nr0, nr, first;
short end;
int end;
char s[50];
fp= fopen(str, "rb");
@@ -375,7 +375,7 @@ static void read_radiogour(char *str)
return;
}
if(verts>65000) {
if(verts>2000000000L) {
error("too many vertices");
fclose(fp);
return;
@@ -410,7 +410,7 @@ static void read_radiogour(char *str)
}
if(totedge+tottria+totquad>65000) {
if(totedge+tottria+totquad>2000000000L) {
printf(" var1: %d, var2: %d, var3: %d \n", totedge, tottria, totquad);
error("too many faces");
MEM_freeN(vertdata);
@@ -683,7 +683,7 @@ static void read_videoscape_nurbs(char *str)
static void read_videoscape(char *str)
{
int file, type;
unsigned short val, numlen;
unsigned int val, numlen;
char name[FILE_MAXDIR+FILE_MAXFILE], head[FILE_MAXFILE], tail[FILE_MAXFILE];
strcpy(name, str);
@@ -1672,8 +1672,8 @@ static void displist_to_mesh(DispList *dlfirst)
if(totvert==0) {
return;
}
if(totvert>=65000 || tottria>=65000) {
if (totvert>=65000) {
if(totvert>=2000000000L || tottria>=2000000000L) {
if (totvert>=2000000000L) {
error("Too many vertices (%d)", totvert);
} else {
error("Too many faces (%d)", tottria);
@@ -2234,7 +2234,7 @@ void write_videoscape(char *str)
{
Base *base;
int file, val, lampdone=0;
unsigned short numlen;
unsigned int numlen;
char head[FILE_MAXFILE], tail[FILE_MAXFILE];
if(BLI_testextensie(str,".trace")) str[ strlen(str)-6]= 0;
@@ -3284,7 +3284,7 @@ static void dxf_read_line(int noob) {
/* Check to see if we need to make a new object */
if(!lwasline || strcmp(layname, oldllay)!=0) dxf_close_line();
if(linemhold != NULL && linemhold->totvert>65000) dxf_close_line();
if(linemhold != NULL && linemhold->totvert>2000000000L) dxf_close_line();
if (linemhold==NULL) {
if (noob) {
@@ -3432,7 +3432,7 @@ static void dxf_read_polyline(int noob) {
if (flag&1) {
if(!lwasp2d || strcmp(layname, oldplay)!=0) dxf_close_2dpoly();
if(p2dmhold != NULL && p2dmhold->totvert>65000) dxf_close_2dpoly();
if(p2dmhold != NULL && p2dmhold->totvert>2000000000L) dxf_close_2dpoly();
if (p2dmhold==NULL) {
if (noob) {
@@ -3592,7 +3592,8 @@ static void dxf_read_polyline(int noob) {
me->totvert++;
/* If we are nearing the limit scan to the next entry */
if(me->totvert > 65000) while(group_isnt(0, "SEQEND")) read_group(id, val);
if(me->totvert > 2000000000L)
while(group_isnt(0, "SEQEND")) read_group(id, val);
vtmp= MEM_callocN(me->totvert*sizeof(MVert), "mverts");
@@ -3771,7 +3772,7 @@ static void dxf_read_3dface(int noob)
/* Check to see if we need to make a new object */
if(!lwasf3d || strcmp(layname, oldflay)!=0) dxf_close_3dface();
if(f3dmhold != NULL && f3dmhold->totvert>65000) dxf_close_3dface();
if(f3dmhold != NULL && f3dmhold->totvert>2000000000L) dxf_close_3dface();
if(nverts<3) {
error("(3DF) Error parsing dxf, not enough vertices near line %d", dxf_line);

View File

@@ -53,11 +53,8 @@ struct bDeformGroup;
* the other hand, it also interferes with sys/types.h, so we get rid
* of it asap. */
#define ushort unsigned short
typedef struct MFace {
/* unsigned short v1, v2, v3, v4; */
ushort v1, v2, v3, v4;
unsigned int v1, v2, v3, v4;
char puno, mat_nr;
char edcode, flag;
} MFace;

View File

@@ -1041,7 +1041,7 @@ int make_structDNA(FILE *file)
void make_bad_file(char *file)
{
FILE *fp= fopen(file, "w");
fprintf(fp, "ERROR! Cannot make correct DNA.c file\n");
fprintf(fp, "ERROR! Cannot make correct DNA.c file, STUPID!\n");
fclose(fp);
}

View File

@@ -6412,7 +6412,7 @@ void join_mesh(void)
/* that way the active object is always selected */
if(ok==0) return;
if(totvert==0 || totvert>65000) return;
if(totvert==0 || totvert>2000000000L) return;
if(okee("Join selected Meshes")==0) return;

View File

@@ -1062,7 +1062,8 @@ void exit_editmode(int freedata) /* freedata==0 at render */
/* temporal */
countall();
if(G.totvert>65000) {
if(G.totvert>2000000000L) {
error("too many vertices");
return;
}